Files
VoiletCStudio/installer/voiletcstudio.nsi
虾哥 2ea81633f9 v1.2: .VSC 文件格式 & 跨平台安装程序
【文件格式】
- 工程文件扩展名从 .json 改为 .VSC(内容仍为 JSON)
- 文件对话框过滤、保存/打开全部适配 .VSC
- 双击 .VSC 文件可直接打开工程(命令行传参)

【安装程序】
- Windows: NSIS 安装脚本 (installer/voiletcstudio.nsi)
  支持注册 .VSC 文件关联、开始菜单/桌面快捷方式、卸载
- Linux: install.sh/uninstall.sh 一键安装/卸载
  自动注册 MIME 类型、.desktop 文件、命令行软链接
- 内置 --register/--unregister 命令行参数用于文件关联

【代码清理】
- 移除所有拖拽功能(dragEnter/Move/DropEvent)
- 新增 MainWindow::openProjectFile() 用于命令行打开
- main.cpp 完整重写,加入命令行解析器

【其他】
- .gitignore 排除 NSIS 输出 (.exe)
2026-04-28 19:14:54 +08:00

86 lines
3.1 KiB
NSIS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; =====================================================
; VoiletCStudio Windows 安装脚本 (NSIS)
; 用法: makensis installer/voiletcstudio.nsi
; =====================================================
!define PRODUCT_NAME "VoiletCStudio"
!define PRODUCT_VERSION "1.2"
!define PRODUCT_PUBLISHER "LinuxAcme"
!define PRODUCT_EXE "VoiletCStudio.exe"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "VoiletCStudio-Setup-${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
RequestExecutionLevel admin
; ----- 安装页面 -----
Page directory
Page instfiles
; ----- 默认安装路径 -----
Section "Install"
SetOutPath "$INSTDIR"
; 复制主程序
File "VoiletCStudio.exe"
; 复制 Qt 运行时 DLL需要提前准备好
; File /r "Qt5Core.dll"
; File /r "Qt5Gui.dll"
; File /r "Qt5Widgets.dll"
; 复制 MinGW 运行时
; File /r "libgcc_s_seh-1.dll"
; File /r "libstdc++-6.dll"
; File /r "libwinpthread-1.dll"
; 创建卸载程序
WriteUninstaller "$INSTDIR\uninstall.exe"
; 注册 .VSC 文件关联
WriteRegStr HKCR ".VSC" "" "VoiletCStudio.VSC"
WriteRegStr HKCR "VoiletCStudio.VSC" "" "VoiletCStudio 工程文件"
WriteRegStr HKCR "VoiletCStudio.VSC\DefaultIcon" "" "$INSTDIR\${PRODUCT_EXE},0"
WriteRegStr HKCR "VoiletCStudio.VSC\shell\open\command" "" '"$INSTDIR\${PRODUCT_EXE}" "%1"'
; 注册表卸载信息
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "${PRODUCT_PUBLISHER}"
; 开始菜单快捷方式
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\VoiletCStudio.lnk" "$INSTDIR\${PRODUCT_EXE}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\卸载.lnk" "$INSTDIR\uninstall.exe"
; 桌面快捷方式
CreateShortCut "$DESKTOP\VoiletCStudio.lnk" "$INSTDIR\${PRODUCT_EXE}"
; 通知系统刷新文件关联
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd
; ----- 卸载 -----
Section "Uninstall"
; 删除程序
Delete "$INSTDIR\${PRODUCT_EXE}"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
; 删除文件关联
DeleteRegKey HKCR ".VSC"
DeleteRegKey HKCR "VoiletCStudio.VSC"
; 删除注册表
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
; 删除快捷方式
Delete "$SMPROGRAMS\${PRODUCT_NAME}\VoiletCStudio.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\卸载.lnk"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
Delete "$DESKTOP\VoiletCStudio.lnk"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd