2010-10-14 00:36:01 +02:00
|
|
|
|
;* Subtitle Edit - Installer script
|
2010-10-12 14:40:07 +02:00
|
|
|
|
;*
|
|
|
|
|
;* Copyright (C) 2010 XhmikosR
|
|
|
|
|
;*
|
|
|
|
|
;* This file is part of Subtitle Edit.
|
|
|
|
|
;*
|
|
|
|
|
;* Subtitle Edit is free software; you can redistribute it and/or modify
|
|
|
|
|
;* it under the terms of the GNU General Public License as published by
|
|
|
|
|
;* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;* (at your option) any later version.
|
|
|
|
|
;*
|
|
|
|
|
;* Subtitle Edit is distributed in the hope that it will be useful,
|
|
|
|
|
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;* GNU General Public License for more details.
|
|
|
|
|
;*
|
|
|
|
|
;* You should have received a copy of the GNU General Public License
|
|
|
|
|
;* along with Subtitle Edit. If not, see <http://www.gnu.org/licenses/>.
|
2010-10-12 23:02:57 +02:00
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
; Requirements:
|
2010-11-03 12:56:15 +01:00
|
|
|
|
; Inno Setup QuickStart Pack Unicode v5.4.0(+): http://www.jrsoftware.org/isdl.php#qsp
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
2010-10-12 19:51:08 +02:00
|
|
|
|
|
2010-11-12 12:58:21 +01:00
|
|
|
|
#define installer_build_number "10"
|
2010-10-12 19:51:08 +02:00
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
#define VerMajor
|
|
|
|
|
#define VerMinor
|
|
|
|
|
#define VerBuild
|
2010-10-12 19:51:08 +02:00
|
|
|
|
#define VerRevision
|
|
|
|
|
|
2010-11-12 12:58:21 +01:00
|
|
|
|
#if VER < 0x05040000
|
|
|
|
|
#error Update your Inno Setup version
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifnexist "..\src\bin\Release\SubtitleEdit.exe"
|
|
|
|
|
#error Compile Subtitle Edit first
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-10-12 19:51:08 +02:00
|
|
|
|
#expr ParseVersion("..\src\bin\Release\SubtitleEdit.exe", VerMajor, VerMinor, VerBuild, VerRevision)
|
|
|
|
|
#define app_version str(VerMajor) + "." + str(VerMinor) + "." + str(VerBuild) + "." + str(VerRevision)
|
|
|
|
|
|
2010-10-12 23:02:57 +02:00
|
|
|
|
;the following simple_app_version is for 3 digit releases, one of the two must be uncommented at a time
|
2010-10-12 19:51:08 +02:00
|
|
|
|
;#define simple_app_version str(VerMajor) + "." + str(VerMinor) + "." + str(VerBuild)
|
|
|
|
|
#define simple_app_version str(VerMajor) + "." + str(VerMinor)
|
|
|
|
|
|
2010-10-16 13:45:22 +02:00
|
|
|
|
#define app_web_site "http://www.nikse.dk/se/"
|
2010-10-12 14:40:07 +02:00
|
|
|
|
#define installer_build_date GetDateTimeString('mmm, d yyyy', '', '')
|
|
|
|
|
|
2010-10-12 19:51:08 +02:00
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
[Setup]
|
|
|
|
|
AppID=SubtitleEdit
|
2010-10-14 00:36:01 +02:00
|
|
|
|
AppCopyright=Copyright <20> 2001-2010, Nikse
|
2010-10-16 13:45:22 +02:00
|
|
|
|
AppContact={#= app_web_site}
|
2010-10-12 14:40:07 +02:00
|
|
|
|
AppName=Subtitle Edit
|
2010-10-26 22:28:19 +02:00
|
|
|
|
AppVerName=Subtitle Edit v{#= simple_app_version}
|
2010-10-12 14:40:07 +02:00
|
|
|
|
AppVersion={#= simple_app_version}
|
|
|
|
|
AppPublisher=Nikse
|
2010-10-16 13:45:22 +02:00
|
|
|
|
AppPublisherURL={#= app_web_site}
|
|
|
|
|
AppSupportURL={#= app_web_site}
|
|
|
|
|
AppUpdatesURL={#= app_web_site}
|
2010-10-26 22:28:19 +02:00
|
|
|
|
UninstallDisplayName=Subtitle Edit v{#= simple_app_version}
|
2010-10-13 01:47:03 +02:00
|
|
|
|
UninstallDisplayIcon={app}\SubtitleEdit.exe
|
2010-10-12 14:40:07 +02:00
|
|
|
|
DefaultDirName={pf}\Subtitle Edit
|
|
|
|
|
DefaultGroupName=Subtitle Edit
|
|
|
|
|
VersionInfoCompany=Nikse
|
2010-10-14 00:36:01 +02:00
|
|
|
|
VersionInfoCopyright=Copyright <20> 2001-2010, Nikse
|
2010-10-26 22:28:19 +02:00
|
|
|
|
VersionInfoDescription=Subtitle Edit v{#= simple_app_version} Setup
|
2010-10-12 14:40:07 +02:00
|
|
|
|
VersionInfoTextVersion={#= simple_app_version}
|
|
|
|
|
VersionInfoVersion={#= simple_app_version}
|
|
|
|
|
VersionInfoProductName=Subtitle Edit
|
|
|
|
|
VersionInfoProductVersion={#= simple_app_version}
|
|
|
|
|
VersionInfoProductTextVersion={#= simple_app_version}
|
|
|
|
|
MinVersion=0,5.0.2195
|
2010-10-12 19:51:08 +02:00
|
|
|
|
;AppReadmeFile={app}\Readme.txt
|
2010-10-12 15:28:10 +02:00
|
|
|
|
LicenseFile=..\src\gpl.txt
|
2010-10-12 23:02:57 +02:00
|
|
|
|
InfoAfterFile=..\src\Changelog.txt
|
2010-10-12 19:51:08 +02:00
|
|
|
|
;InfoBeforeFile=..\Readme.txt
|
|
|
|
|
SetupIconFile=..\src\Icons\SE.ico
|
2010-10-12 14:40:07 +02:00
|
|
|
|
;WizardImageFile=Icons\WizardImageFile.bmp
|
|
|
|
|
WizardSmallImageFile=Icons\WizardSmallImageFile.bmp
|
|
|
|
|
OutputDir=.
|
|
|
|
|
OutputBaseFilename=SubtitleEdit-{#= simple_app_version}-setup
|
2010-10-12 23:02:57 +02:00
|
|
|
|
AllowNoIcons=yes
|
|
|
|
|
Compression=lzma/ultra64
|
|
|
|
|
SolidCompression=yes
|
|
|
|
|
EnableDirDoesntExistWarning=no
|
|
|
|
|
DirExistsWarning=auto
|
|
|
|
|
ShowTasksTreeLines=yes
|
|
|
|
|
DisableReadyPage=yes
|
2010-10-12 14:40:07 +02:00
|
|
|
|
PrivilegesRequired=admin
|
|
|
|
|
ShowLanguageDialog=yes
|
2010-10-12 23:02:57 +02:00
|
|
|
|
DisableDirPage=auto
|
2010-10-12 14:40:07 +02:00
|
|
|
|
DisableProgramGroupPage=auto
|
2010-10-25 16:12:06 +02:00
|
|
|
|
;AppMutex=Subtitle_Edit_Mutex
|
2010-10-12 23:02:57 +02:00
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
[Languages]
|
|
|
|
|
Name: en; MessagesFile: compiler:Default.isl
|
2010-11-12 12:58:21 +01:00
|
|
|
|
Name: de; MessagesFile: compiler:Languages\German.isl
|
2010-10-12 14:40:07 +02:00
|
|
|
|
Name: dk; MessagesFile: compiler:Languages\Danish.isl
|
2010-11-12 15:01:39 +01:00
|
|
|
|
Name: es; MessagesFile: compiler:Languages\Spanish.isl
|
2010-10-12 14:40:07 +02:00
|
|
|
|
Name: fr; MessagesFile: compiler:Languages\French.isl
|
2010-11-03 00:21:17 +01:00
|
|
|
|
Name: hu; MessagesFile: compiler:Languages\Hungarian.isl
|
2010-10-27 12:17:52 +02:00
|
|
|
|
;Name: it; MessagesFile: compiler:Languages\Italian.isl
|
2010-11-03 15:42:25 +01:00
|
|
|
|
;Name: nl; MessagesFile: compiler:Languages\Dutch.isl
|
2010-10-12 14:40:07 +02:00
|
|
|
|
Name: pl; MessagesFile: compiler:Languages\Polish.isl
|
|
|
|
|
Name: ro; MessagesFile: Languages\Romanian.isl
|
2010-11-03 12:56:15 +01:00
|
|
|
|
Name: sv; MessagesFile: Languages\Swedish.isl
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
2010-10-13 01:47:03 +02:00
|
|
|
|
; Include the installer's custom messages
|
2010-10-12 14:40:07 +02:00
|
|
|
|
#include "Custom_Messages.iss"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Messages]
|
2010-10-26 22:28:19 +02:00
|
|
|
|
BeveledLabel=Subtitle Edit v{#= simple_app_version} by Nikse, Setup v{#= installer_build_number} built on {#= installer_build_date}
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
|
2010-10-12 23:02:57 +02:00
|
|
|
|
[Tasks]
|
|
|
|
|
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
|
|
|
|
|
Name: desktopicon\user; Description: {cm:tsk_CurrentUser}; GroupDescription: {cm:AdditionalIcons}; Flags: exclusive
|
|
|
|
|
Name: desktopicon\common; Description: {cm:tsk_AllUsers}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked exclusive
|
|
|
|
|
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; OnlyBelowVersion: 0,6.01; Flags: unchecked
|
2010-10-27 14:58:11 +02:00
|
|
|
|
Name: reset_dictionaries; Description: {cm:tsk_ResetDictionaries}; GroupDescription: {cm:tsk_Other}; Check: DictionariesExistCheck(); Flags: checkedonce unchecked
|
2010-10-12 23:02:57 +02:00
|
|
|
|
Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Check: SettingsExistCheck(); Flags: checkedonce unchecked
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
[Files]
|
2010-10-25 14:37:00 +02:00
|
|
|
|
Source: psvince.dll; DestDir: {app}; Flags: ignoreversion
|
2010-10-12 23:02:57 +02:00
|
|
|
|
Source: ..\src\Changelog.txt; DestDir: {app}; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\gpl.txt; DestDir: {app}; Flags: ignoreversion
|
2010-10-12 15:28:10 +02:00
|
|
|
|
Source: ..\src\Bin\Release\Hunspellx86.dll; DestDir: {app}; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Interop.QuartzTypeLib.dll; DestDir: {app}; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\NHunspell.dll; DestDir: {app}; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\SubtitleEdit.exe; DestDir: {app}; Flags: ignoreversion
|
2010-10-12 23:02:57 +02:00
|
|
|
|
Source: Icons\uninstall.ico; DestDir: {app}; Flags: ignoreversion
|
2010-10-12 15:28:10 +02:00
|
|
|
|
Source: ..\src\Bin\Release\Icons\Find.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\Help.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\New.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\Open.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\Replace.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\Save.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\SaveAs.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\Settings.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\SpellCheck.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\VideoToogle.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\VisualSync.png; DestDir: {app}\Icons; Flags: ignoreversion
|
|
|
|
|
Source: ..\src\Bin\Release\Icons\WaveFormToogle.png; DestDir: {app}\Icons; Flags: ignoreversion
|
2010-10-27 12:17:52 +02:00
|
|
|
|
Source: ..\Dictionaries\da_DK_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\da_DK_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\dan_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\en_US.aff; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion
|
|
|
|
|
Source: ..\Dictionaries\en_US.dic; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion
|
|
|
|
|
Source: ..\Dictionaries\en_US_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\en_US_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\eng_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
|
|
|
|
Source: ..\Dictionaries\names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall
|
2010-10-26 18:18:34 +02:00
|
|
|
|
Source: ..\Tesseract\tessdata\eng.traineddata; DestDir: {app}\Tesseract\tessdata; Flags: ignoreversion
|
|
|
|
|
Source: ..\Tesseract\leptonlib.dll; DestDir: {app}\Tesseract; Flags: ignoreversion
|
|
|
|
|
Source: ..\Tesseract\tesseract.exe; DestDir: {app}\Tesseract; Flags: ignoreversion
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Icons]
|
2010-10-26 22:28:19 +02:00
|
|
|
|
Name: {group}\Subtitle Edit; Filename: {app}\SubtitleEdit.exe; Comment: Subtitle Edit v{#= simple_app_version}; WorkingDir: {app}; AppUserModelID: Nikse.SubtitleEdit; IconFilename: {app}\SubtitleEdit.exe; IconIndex: 0
|
2010-10-12 19:51:08 +02:00
|
|
|
|
Name: {group}\Help and Support\Changelog; Filename: {app}\Changelog.txt; Comment: {cm:sm_com_Changelog}; WorkingDir: {app}
|
|
|
|
|
;Name: {group}\Help and Support\Readme; Filename: {app}\Readme.txt; Comment: {cm:sm_com_ReadmeFile}; WorkingDir: {app}
|
2010-10-16 13:45:22 +02:00
|
|
|
|
Name: {group}\Help and Support\{cm:ProgramOnTheWeb,Subtitle Edit}; Filename: {#= app_web_site}; Comment: {cm:ProgramOnTheWeb,Subtitle Edit}
|
2010-10-12 14:40:07 +02:00
|
|
|
|
Name: {group}\{cm:UninstallProgram,Subtitle Edit}; Filename: {uninstallexe}; IconFilename: {app}\uninstall.ico; Comment: {cm:UninstallProgram,Subtitle Edit}; WorkingDir: {app}
|
2010-10-12 19:51:08 +02:00
|
|
|
|
|
2010-10-26 22:28:19 +02:00
|
|
|
|
Name: {commondesktop}\Subtitle Edit; Filename: {app}\SubtitleEdit.exe; Tasks: desktopicon\common; Comment: Subtitle Edit v{#= simple_app_version}; WorkingDir: {app}; AppUserModelID: Nikse.SubtitleEdit; IconFilename: {app}\SubtitleEdit.exe; IconIndex: 0
|
|
|
|
|
Name: {userdesktop}\Subtitle Edit; Filename: {app}\SubtitleEdit.exe; Tasks: desktopicon\user; Comment: Subtitle Edit v{#= simple_app_version}; WorkingDir: {app}; AppUserModelID: Nikse.SubtitleEdit; IconFilename: {app}\SubtitleEdit.exe; IconIndex: 0
|
|
|
|
|
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Subtitle Edit; Filename: {app}\SubtitleEdit.exe; Tasks: quicklaunchicon; Comment: Subtitle Edit v{#= simple_app_version}; WorkingDir: {app}; IconFilename: {app}\SubtitleEdit.exe; IconIndex: 0
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[InstallDelete]
|
|
|
|
|
Type: files; Name: {userdesktop}\Subtitle Edit.lnk; Check: NOT IsTaskSelected('desktopicon\user') AND IsUpdate()
|
|
|
|
|
Type: files; Name: {commondesktop}\Subtitle Edit.lnk; Check: NOT IsTaskSelected('desktopicon\common') AND IsUpdate()
|
2010-10-12 23:02:57 +02:00
|
|
|
|
Type: files; Name: {userappdata}\Subtitle Edit\Settings.xml; Tasks: reset_settings
|
2010-10-26 22:28:19 +02:00
|
|
|
|
Type: dirifempty; Name: {userappdata}\Subtitle Edit; Tasks: reset_settings
|
|
|
|
|
|
2010-10-27 14:58:11 +02:00
|
|
|
|
;remove old files from the {app} dir
|
2010-10-27 12:17:52 +02:00
|
|
|
|
Type: files; Name: {app}\Dictionaries\da_DK_names_etc.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\da_DK_user.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\dan_OCRFixReplaceList.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\en_US.aff
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\en_US.dic
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\en_US_names_etc.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\en_US_user.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\eng_OCRFixReplaceList.xml
|
|
|
|
|
Type: files; Name: {app}\Dictionaries\names_etc.xml
|
|
|
|
|
Type: dirifempty; Name: {app}\Dictionaries
|
2010-10-27 14:58:11 +02:00
|
|
|
|
Type: files; Name: {app}\tessnet2_32.dll
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.DangAmbigs
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.freq-dawg
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.inttemp
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.normproto
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.pffmtable
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.unicharset
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.user-words
|
|
|
|
|
Type: files; Name: {app}\TessData\eng.word-dawg
|
|
|
|
|
Type: dirifempty; Name: {app}\TessData
|
|
|
|
|
|
2010-10-26 23:36:04 +02:00
|
|
|
|
Type: files; Name: {app}\Settings.xml
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Run]
|
2010-10-12 19:51:08 +02:00
|
|
|
|
Filename: {app}\SubtitleEdit.exe; Description: {cm:LaunchProgram,Subtitle Edit}; WorkingDir: {app}; Flags: nowait postinstall skipifsilent runascurrentuser
|
2010-10-16 13:45:22 +02:00
|
|
|
|
Filename: {#= app_web_site}; Description: {cm:run_VisitWebsite}; Flags: nowait postinstall skipifsilent shellexec runascurrentuser unchecked
|
2010-10-12 14:40:07 +02:00
|
|
|
|
|
|
|
|
|
|
2010-10-12 23:39:27 +02:00
|
|
|
|
[UninstallDelete]
|
|
|
|
|
Type: dirifempty; Name: {app}\WaveForms
|
2010-10-27 14:58:11 +02:00
|
|
|
|
Type: dirifempty; Name: {userappdata}\Subtitle Edit\WaveForms
|
2010-10-12 23:39:27 +02:00
|
|
|
|
Type: dirifempty; Name: {app}
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
[Code]
|
|
|
|
|
// Global variables and constants
|
|
|
|
|
const installer_mutex_name = 'subtitle_edit_setup_mutex';
|
|
|
|
|
var
|
|
|
|
|
is_update: Boolean;
|
|
|
|
|
|
|
|
|
|
|
2010-10-25 14:37:00 +02:00
|
|
|
|
// General functions
|
|
|
|
|
function IsModuleLoaded(modulename: AnsiString ): Boolean;
|
|
|
|
|
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function IsModuleLoadedU(modulename: AnsiString ): Boolean;
|
|
|
|
|
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly';
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
// Check if Subtitle Edit's settings exist
|
|
|
|
|
function SettingsExistCheck(): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
2010-10-26 22:28:19 +02:00
|
|
|
|
if FileExists(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml')) then
|
2010-10-12 14:40:07 +02:00
|
|
|
|
Result := True;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
2010-10-27 14:58:11 +02:00
|
|
|
|
// Check if Dictionaries exist
|
|
|
|
|
function DictionariesExistCheck(): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
if DirExists(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries')) then
|
|
|
|
|
Result := True;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure CleanUpDictionaries();
|
2010-10-12 14:40:07 +02:00
|
|
|
|
begin
|
2010-10-27 12:17:52 +02:00
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_names_etc.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_user.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\dan_OCRFixReplaceList.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_US_names_etc.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_US_user.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\eng_OCRFixReplaceList.xml'));
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\names_etc.xml'));
|
|
|
|
|
DelTree(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.dic'), False, True, False);
|
|
|
|
|
DelTree(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\*.aff'), False, True, False);
|
|
|
|
|
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries'));
|
2010-10-12 14:40:07 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function IsUpdate(): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := is_update;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ShouldSkipPage(PageID: Integer): Boolean;
|
|
|
|
|
begin
|
|
|
|
|
if IsUpdate then begin
|
|
|
|
|
Case PageID of
|
|
|
|
|
// Hide the license page
|
|
|
|
|
wpLicense: Result := True;
|
|
|
|
|
else
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
2010-10-12 23:02:57 +02:00
|
|
|
|
procedure CurPageChanged(CurPageID: Integer);
|
|
|
|
|
begin
|
|
|
|
|
if CurPageID = wpSelectTasks then
|
|
|
|
|
WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall)
|
2010-10-12 23:39:27 +02:00
|
|
|
|
else if CurPageID = wpFinished then
|
|
|
|
|
WizardForm.NextButton.Caption := SetupMessage(msgButtonFinish)
|
2010-10-12 23:02:57 +02:00
|
|
|
|
else
|
|
|
|
|
WizardForm.NextButton.Caption := SetupMessage(msgButtonNext);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
2010-10-27 14:58:11 +02:00
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
|
|
|
begin
|
|
|
|
|
if CurStep = ssInstall then begin
|
|
|
|
|
if IsTaskSelected('reset_settings') then begin
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
|
|
|
|
|
end;
|
|
|
|
|
if IsTaskSelected('reset_dictionaries') then begin
|
|
|
|
|
CleanUpDictionaries;
|
|
|
|
|
end;
|
|
|
|
|
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit'));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
2010-10-12 14:40:07 +02:00
|
|
|
|
begin
|
2010-10-27 14:58:11 +02:00
|
|
|
|
// When uninstalling ask user to delete Subtitle Edit's dictionaries and settings
|
2010-10-12 14:40:07 +02:00
|
|
|
|
// based on whether these files exist only
|
|
|
|
|
if CurUninstallStep = usUninstall then begin
|
2010-10-27 14:58:11 +02:00
|
|
|
|
if SettingsExistCheck or DictionariesExistCheck then begin
|
2010-10-12 14:40:07 +02:00
|
|
|
|
if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin
|
2010-10-27 14:58:11 +02:00
|
|
|
|
CleanUpDictionaries;
|
|
|
|
|
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
|
2010-10-12 14:40:07 +02:00
|
|
|
|
end;
|
|
|
|
|
RemoveDir(ExpandConstant('{app}'));
|
2010-10-27 14:58:11 +02:00
|
|
|
|
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit'));
|
2010-10-12 14:40:07 +02:00
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function InitializeSetup(): Boolean;
|
|
|
|
|
var
|
|
|
|
|
ErrorCode: Integer;
|
|
|
|
|
begin
|
|
|
|
|
// Create a mutex for the installer and if it's already running then expose a message and stop installation
|
|
|
|
|
if CheckForMutexes(installer_mutex_name) then begin
|
|
|
|
|
if not WizardSilent() then
|
2010-10-25 14:37:00 +02:00
|
|
|
|
MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK);
|
2010-10-12 14:40:07 +02:00
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
CreateMutex(installer_mutex_name);
|
|
|
|
|
|
2010-10-25 14:37:00 +02:00
|
|
|
|
if IsModuleLoaded( 'SubtitleEdit.exe' ) then begin
|
|
|
|
|
MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK );
|
|
|
|
|
Result := False;
|
|
|
|
|
Abort;
|
|
|
|
|
end else
|
|
|
|
|
Result := True;
|
|
|
|
|
|
2010-10-12 14:40:07 +02:00
|
|
|
|
// Check if .NET Framework 2.0 is installed and if not offer to download it
|
|
|
|
|
try
|
|
|
|
|
ExpandConstant('{dotnet20}');
|
|
|
|
|
Result := True;
|
|
|
|
|
except
|
|
|
|
|
begin
|
|
|
|
|
if not WizardSilent() then
|
|
|
|
|
if MsgBox(ExpandConstant('{cm:msg_AskToDownNET}'), mbCriticalError, MB_YESNO or MB_DEFBUTTON1) = IDYES then begin
|
|
|
|
|
Result := False;
|
|
|
|
|
ShellExec('open','http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
|
|
|
|
|
end
|
|
|
|
|
else begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
is_update := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1');
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function InitializeUninstall(): Boolean;
|
|
|
|
|
begin
|
2010-10-25 14:37:00 +02:00
|
|
|
|
// Check if app is running during uninstallation
|
|
|
|
|
if IsModuleLoadedU( 'SubtitleEdit.exe' ) then begin
|
|
|
|
|
MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK );
|
|
|
|
|
Result := False;
|
|
|
|
|
end
|
|
|
|
|
else Result := True;
|
|
|
|
|
|
|
|
|
|
if NOT IsModuleLoadedU( 'SubtitleEdit.exe' ) then begin
|
|
|
|
|
Result := True;
|
|
|
|
|
if CheckForMutexes(installer_mutex_name) then begin
|
|
|
|
|
if not WizardSilent() then
|
|
|
|
|
MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK);
|
|
|
|
|
Result := False;
|
|
|
|
|
end
|
|
|
|
|
else begin
|
|
|
|
|
CreateMutex(installer_mutex_name);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
// Unload the psvince.dll in order to be uninstalled
|
|
|
|
|
UnloadDLL(ExpandConstant('{app}\psvince.dll'));
|
2010-10-12 14:40:07 +02:00
|
|
|
|
end;
|