installer: added a separate task to reset dictionaries on install

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@102 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
XhmikosR 2010-10-27 12:58:11 +00:00
parent 8243a3606a
commit 9458f428c8
2 changed files with 54 additions and 20 deletions

View File

@ -33,6 +33,7 @@ en.sm_com_ReadmeFile=Subtitle Edit's ReadMe
en.tsk_AllUsers=For all users
en.tsk_CurrentUser=For the current user only
en.tsk_Other=Other:
en.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
en.tsk_ResetSettings=Reset Subtitle Edit's settings
@ -46,6 +47,7 @@ dk.sm_com_ReadmeFile=Subtitle Edit's ReadMe
dk.tsk_AllUsers=For alle brugere
dk.tsk_CurrentUser=Kun for aktulle bruger
dk.tsk_Other=Andre:
dk.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
dk.tsk_ResetSettings=Nulstil Subtitle Edit indstillinger
@ -59,6 +61,7 @@ dk.tsk_ResetSettings=Nulstil Subtitle Edit indstillinger
;es.tsk_AllUsers=For all users
;es.tsk_CurrentUser=For the current user only
;es.tsk_Other=Other:
;es.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
;es.tsk_ResetSettings=Reset Subtitle Edit's settings
@ -72,6 +75,7 @@ fr.sm_com_ReadmeFile=Subtitle Edit's ReadMe
fr.tsk_AllUsers=For all users
fr.tsk_CurrentUser=For the current user only
fr.tsk_Other=Other:
fr.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
fr.tsk_ResetSettings=Reset Subtitle Edit's settings
@ -85,6 +89,7 @@ fr.tsk_ResetSettings=Reset Subtitle Edit's settings
;it.tsk_AllUsers=For all users
;it.tsk_CurrentUser=For the current user only
;it.tsk_Other=Other:
;it.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
;it.tsk_ResetSettings=Reset Subtitle Edit's settings
@ -98,6 +103,7 @@ nl.sm_com_ReadmeFile=Subtitle Edit's ReadMe
nl.tsk_AllUsers=For all users
nl.tsk_CurrentUser=For the current user only
nl.tsk_Other=Other:
nl.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
nl.tsk_ResetSettings=Reset Subtitle Edit's settings
@ -111,6 +117,7 @@ pl.sm_com_ReadmeFile=Subtitle Edit's ReadMe
pl.tsk_AllUsers=For all users
pl.tsk_CurrentUser=For the current user only
pl.tsk_Other=Other:
pl.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
pl.tsk_ResetSettings=Reset Subtitle Edit's settings
ro.msg_SetupIsRunningWarning=Instalarea programului Subtitle Edit se efectuează deja!
@ -123,4 +130,5 @@ ro.sm_com_ReadmeFile=Citeşte-mă
ro.tsk_AllUsers=Pentru toţi utilizatorii
ro.tsk_CurrentUser=Pentru utilizatorul curent
ro.tsk_Other=Altele:
ro.tsk_ResetDictionaries=Reset Dictionaries and delete any custom names
ro.tsk_ResetSettings=Resetaţi setările programului Subtitle Edit

View File

@ -21,7 +21,7 @@
; Inno Setup QuickStart Pack Unicode v5.3.11(+): http://www.jrsoftware.org/isdl.php#qsp
#define installer_build_number "07"
#define installer_build_number "08"
#define VerMajor
#define VerMinor
@ -109,6 +109,7 @@ Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:Ad
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
Name: reset_dictionaries; Description: {cm:tsk_ResetDictionaries}; GroupDescription: {cm:tsk_Other}; Check: DictionariesExistCheck(); Flags: checkedonce unchecked
Name: reset_settings; Description: {cm:tsk_ResetSettings}; GroupDescription: {cm:tsk_Other}; Check: SettingsExistCheck(); Flags: checkedonce unchecked
@ -165,17 +166,7 @@ Type: files; Name: {commondesktop}\Subtitle Edit.lnk; Check: NOT IsTaskSelected(
Type: files; Name: {userappdata}\Subtitle Edit\Settings.xml; Tasks: reset_settings
Type: dirifempty; Name: {userappdata}\Subtitle Edit; Tasks: reset_settings
;remove old Tesseract files, Dictionaries and settings file
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
;remove old files from the {app} dir
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
@ -186,6 +177,17 @@ 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
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
Type: files; Name: {app}\Settings.xml
@ -196,6 +198,7 @@ Filename: {#= app_web_site}; Description: {cm:run_VisitWebsite}; Flags: nowait p
[UninstallDelete]
Type: dirifempty; Name: {app}\WaveForms
Type: dirifempty; Name: {userappdata}\Subtitle Edit\WaveForms
Type: dirifempty; Name: {app}
@ -224,9 +227,17 @@ begin
end;
Procedure CleanUpFiles();
// Check if Dictionaries exist
function DictionariesExistCheck(): Boolean;
begin
Result := False;
if DirExists(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries')) then
Result := True;
end;
procedure CleanUpDictionaries();
begin
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
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'));
@ -237,7 +248,6 @@ begin
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'));
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit'));
end;
@ -271,16 +281,32 @@ begin
end;
Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
procedure CurStepChanged(CurStep: TSetupStep);
begin
// When uninstalling ask user to delete Subtitle Edit's logs and settings
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);
begin
// When uninstalling ask user to delete Subtitle Edit's dictionaries and settings
// based on whether these files exist only
if CurUninstallStep = usUninstall then begin
if SettingsExistCheck then begin
if SettingsExistCheck or DictionariesExistCheck then begin
if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then begin
CleanUpFiles;
CleanUpDictionaries;
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
end;
RemoveDir(ExpandConstant('{app}'));
RemoveDir(ExpandConstant('{userappdata}\Subtitle Edit'));
end;
end;
end;