From 6a03ca713cf6fee640d511b389eec6eb19dee80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 12 Nov 2014 10:33:20 +0100 Subject: [PATCH] Issue #713 Installer downloading of parts like SWC file can be skipped moving auto update check to separate thread for faster loading --- installer.nsi | 33 ++++++++++---------- nsis_plugins/Flash_Inetc.nsh | 7 +++-- nsis_plugins/JREDyna_Inetc.nsh | 7 +++-- src/com/jpexs/decompiler/flash/gui/Main.java | 10 +++++- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/installer.nsi b/installer.nsi index b53e28388..d5c90029f 100644 --- a/installer.nsi +++ b/installer.nsi @@ -433,19 +433,17 @@ Function HelpUsClick FunctionEnd -!define StrRep "!insertmacro StrRep" -!macro StrRep output string old new +!define un.StrRep "!insertmacro un.StrRep" +!macro un.StrRep output string old new Push `${string}` Push `${old}` Push `${new}` - !ifdef __UNINSTALL__ - Call un.StrRep - !else - Call StrRep - !endif + Call un.StrRep + Pop ${output} !macroend + !macro Func_StrRep un Function ${un}StrRep Exch $R2 ;new @@ -497,7 +495,7 @@ FunctionEnd Exch $R1 FunctionEnd !macroend -!insertmacro Func_StrRep "" +;!insertmacro Func_StrRep "" !insertmacro Func_StrRep "un." ;var AddToContextMenu @@ -600,7 +598,7 @@ Function un.RemoveExtContextMenu StrCpy $2 $MRUList 1 $R1 ;Copy one character ReadRegStr $3 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $2 ${If} $3 == ${APP_EXENAME} - ${StrRep} $MRUList $MRUList $2 "" + ${un.StrRep} $MRUList $MRUList $2 "" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" "MRUList" $MRUList DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$ext\OpenWithList" $2 ${Break} @@ -753,20 +751,20 @@ var pgfound var f var pgname -Section "PlayerGlobal.swc" SecPlayerGlobal - +Section "Download PlayerGlobal.swc" SecPlayerGlobal +checkadobe: DetailPrint "Checking Adobe site for newest PlayerGlobal.swc file" !tempfile PGHTML -inetc::get /SILENT /USERAGENT "${APP_NAME} Setup" https://www.adobe.com/support/flashplayer/downloads.html ${PGHTML} +inetc::get /SILENT /USERAGENT "${APP_NAME} Setup" "https://www.adobe.com/support/flashplayer/downloads.html" "${PGHTML}" Pop $0 StrCmp $0 "OK" dlok -MessageBox MB_OK|MB_ICONEXCLAMATION "PlayerGlobal.SWC was not found on Adobe webpages. Click OK to abort installation" /SD IDOK +MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "PlayerGlobal.SWC was not found on Adobe webpages. You can download it later manually." /SD IDIGNORE IDRETRY checkadobe IDIGNORE exit Abort dlok: StrCpy $pgfound 0 -FileOpen $f ${PGHTML} r +FileOpen $f "${PGHTML}" r loop: FileRead $f $txt IfErrors done @@ -787,8 +785,9 @@ loop: done: FileClose $f StrCmp $pgfound 2 +3 - MessageBox MB_OK|MB_ICONEXCLAMATION "PlayerGlobal.SWC not found on Adobe Webpages, click OK to abort installation" /SD IDOK - Abort + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "PlayerGlobal.SWC was not found on Adobe webpages. You can download it later manually." /SD IDIGNORE IDRETRY checkadobe IDIGNORE exit +Abort + ${StrRPos} $pos $txt "/" IntOp $pos $pos + 1 @@ -801,7 +800,7 @@ done: inetc::get /USERAGENT "${APP_NAME} Setup" $txt "$APPDATA\JPEXS\FFDec\flashlib\$pgname" Pop $0 StrCmp $0 "OK" saved - MessageBox MB_OK|MB_ICONEXCLAMATION "Failed to download PlayerGlobal.SWC. Click OK to abort installation" /SD IDOK + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "Failed to download PlayerGlobal.SWC from Adobe webpages. You can download it later manually." /SD IDIGNORE IDRETRY checkadobe IDIGNORE exit Abort saved: DetailPrint "PlayerGlobal.swc saved to $APPDATA\JPEXS\FFDec\flashlib\$pgname" diff --git a/nsis_plugins/Flash_Inetc.nsh b/nsis_plugins/Flash_Inetc.nsh index 984f60b06..f48ae0bb5 100644 --- a/nsis_plugins/Flash_Inetc.nsh +++ b/nsis_plugins/Flash_Inetc.nsh @@ -65,8 +65,9 @@ downloadFlash: DetailPrint "Download result = $0" strcmp $0 "OK" downloadsuccessful - MessageBox MB_OK "There was a problem downloading required component - Error: $0" - abort + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "Cannot download Flash ActiveX. You can download it later manually or use our own flash viewer." /SD IDIGNORE IDRETRY downloadFlash IDIGNORE End + Abort + downloadsuccessful: @@ -97,7 +98,7 @@ InstallVerif: ExitInstallFlash: Pop $1 - MessageBox MB_OK "Unable to install Flash ActiveX - Setup will be aborted$\n$\n$1" + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "Unable to install Flash ActiveX. You can download it later manually or use our own flash viewer.\n$\n$1" /SD IDIGNORE IDRETRY downloadFlash IDIGNORE End Pop $1 ; Restore $1 Pop $0 ; Restore $0 Abort diff --git a/nsis_plugins/JREDyna_Inetc.nsh b/nsis_plugins/JREDyna_Inetc.nsh index ac70e743c..5043aa615 100644 --- a/nsis_plugins/JREDyna_Inetc.nsh +++ b/nsis_plugins/JREDyna_Inetc.nsh @@ -101,8 +101,9 @@ downloadJRE: DetailPrint "Download result = $0" strcmp $0 "OK" downloadsuccessful - MessageBox MB_OK "There was a problem downloading required component - Error: $0" - abort + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "Cannot download Java. You can download it later manually." /SD IDIGNORE IDRETRY downloadJRE IDIGNORE End + Abort + downloadsuccessful: @@ -142,7 +143,7 @@ JREPathStorage: ExitInstallJRE: Pop $1 - MessageBox MB_OK "Unable to install Java - Setup will be aborted$\n$\n$1" + MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP "Unable to install Java. You can installl it later manually.\n$\n$1" /SD IDIGNORE IDRETRY downloadJRE IDIGNORE End Pop $1 ; Restore $1 Pop $0 ; Restore $0 Abort diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index 46faa0ade..c1c95ba5b 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1250,7 +1250,15 @@ public class Main { if (Configuration.checkForUpdatesAuto.get()) { Calendar lastUpdatesCheckDate = Configuration.lastUpdatesCheckDate.get(); if ((lastUpdatesCheckDate == null) || (lastUpdatesCheckDate.getTime().getTime() < Calendar.getInstance().getTime().getTime() - Configuration.checkForUpdatesDelay.get())) { - checkForUpdates(); + new SwingWorker(){ + @Override + protected Object doInBackground() throws Exception { + checkForUpdates(); + return null; + } + }.execute(); + System.out.println("finished"); + } } }