installer:

* use SuppressibleMsgBox
* internal cleanup (please confirm that everything works fine i.e. the .NET detection etc)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@682 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
XhmikosR 2011-10-02 09:20:53 +00:00
parent 29cd0863c8
commit 084c10107f

View File

@ -26,7 +26,7 @@
#error Update your Inno Setup version #error Update your Inno Setup version
#endif #endif
#define installer_build_number "19" #define installer_build_number "20"
#define app_copyright "Copyright © 2001-2011, Nikse" #define app_copyright "Copyright © 2001-2011, Nikse"
#define VerMajor #define VerMajor
@ -403,7 +403,7 @@ begin
// based on whether these files exist only // based on whether these files exist only
if CurUninstallStep = usUninstall then begin if CurUninstallStep = usUninstall then begin
if SettingsExistCheck OR DictionariesExistCheck then begin if SettingsExistCheck OR DictionariesExistCheck then begin
if MsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO OR MB_DEFBUTTON2) = IDYES then begin if SuppressibleMsgBox(ExpandConstant('{cm:msg_DeleteSettings}'), mbConfirmation, MB_YESNO OR MB_DEFBUTTON2, IDNO) = IDYES then begin
CleanUpDictionaries; CleanUpDictionaries;
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml')); DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Settings.xml'));
end; end;
@ -432,37 +432,33 @@ var
begin begin
// Create a mutex for the installer and if it's already running then expose a message and stop installation // Create a mutex for the installer and if it's already running then expose a message and stop installation
if CheckForMutexes(installer_mutex_name) AND NOT WizardSilent() then begin if CheckForMutexes(installer_mutex_name) AND NOT WizardSilent() then begin
MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK); SuppressibleMsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK, MB_OK);
exit;
end;
CreateMutex(installer_mutex_name);
if IsModuleLoaded('SubtitleEdit.exe') then begin
MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK );
Result := False; Result := False;
Abort; end else begin
end else
Result := True; Result := True;
CreateMutex(installer_mutex_name);
// Check if .NET Framework 2.0 is installed and if not offer to download it if IsModuleLoaded('SubtitleEdit.exe') then begin
try SuppressibleMsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK, MB_OK);
ExpandConstant('{dotnet20}'); Result := False;
Result := True; end else
except // Check if .NET Framework 2.0 is installed and if not offer to download it
begin try
if NOT WizardSilent() then ExpandConstant('{dotnet20}');
if MsgBox(ExpandConstant('{cm:msg_AskToDownNET}'), mbCriticalError, MB_YESNO OR MB_DEFBUTTON1) = IDYES then begin except
Result := False; begin
ShellExec('open','http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe','','',SW_SHOWNORMAL,ewNoWait,ErrorCode); if NOT WizardSilent() then
end if SuppressibleMsgBox(ExpandConstant('{cm:msg_AskToDownNET}'), mbCriticalError, MB_YESNO OR MB_DEFBUTTON1, IDYES) = IDYES then begin
else begin ShellExec('open','http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
Result := False; Result := False;
end
else begin
Result := False;
end;
end; end;
end; end;
end; end;
is_update := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1');
is_update := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SubtitleEdit_is1');
end; end;
@ -471,20 +467,17 @@ function InitializeUninstall(): Boolean;
begin begin
// Check if app is running during uninstallation // Check if app is running during uninstallation
if IsModuleLoadedU('SubtitleEdit.exe') then begin if IsModuleLoadedU('SubtitleEdit.exe') then begin
MsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK ); SuppressibleMsgBox(ExpandConstant('{cm:msg_AppIsRunning}'), mbError, MB_OK, MB_OK);
Result := False; Result := False;
end else end else
Result := True; Result := True;
if NOT IsModuleLoadedU('SubtitleEdit.exe') AND CheckForMutexes(installer_mutex_name) then begin if NOT IsModuleLoadedU('SubtitleEdit.exe') AND CheckForMutexes(installer_mutex_name) then begin
MsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK); SuppressibleMsgBox(ExpandConstant('{cm:msg_SetupIsRunningWarning}'), mbError, MB_OK, MB_OK);
Result := False; Result := False;
end end else
else begin CreateMutex(installer_mutex_name);
CreateMutex(installer_mutex_name);
Result := True;
end;
// Unload the psvince.dll in order to be uninstalled // Unload the psvince.dll in order to be uninstalled
UnloadDLL(ExpandConstant('{app}\psvince.dll')); UnloadDLL(ExpandConstant('{app}\psvince.dll'));
end; end;