⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pidgin-installer.nsi

📁 Linux下的多协议即时通讯程序源代码
💻 NSI
📖 第 1 页 / 共 4 页
字号:
  instdir_done:;LogSet on  Pop $R0FunctionEndFunction un.onInit  Call un.RunCheck  StrCpy $name "Pidgin ${PIDGIN_VERSION}"  ; Get stored language preference  !insertmacro MUI_UNGETLANGUAGEFunctionEnd; This is a modified StartRadioButtons (from Sections.nsh); The only difference is that it allows for nothing in the group to be selected; In that case, the default variable should be set to ""!macro StartRadioButtonsUnselectable var  !define StartRadioButtons_Var "${var}"  Push $R0  Push $R1   ;If we have no selection, don't try to unselect it   StrCmp "${StartRadioButtons_Var}" "" +4   SectionGetFlags "${StartRadioButtons_Var}" $R0   IntOp $R1 $R0 & ${SF_SELECTED}   IntOp $R0 $R0 & ${SECTION_OFF}   SectionSetFlags "${StartRadioButtons_Var}" $R0   ; If the previous value isn't currently selected,   ; we don't want to select it at the end   IntCmp $R1 ${SF_SELECTED} +2   StrCpy "${StartRadioButtons_Var}" ""   StrCpy $R1 "${StartRadioButtons_Var}"!macroendFunction .onSelChange  Push $0  Push $1  Push $2  ; Check that at most one of the non-readonly spelling dictionaries are selected  ; We can't use $R0 or $R1 in this block since they're used in the macros  !insertmacro StartRadioButtonsUnselectable $SPELLCHECK_SEL    ; Start with the first language dictionary    IntOp $2 ${SecSpellCheck} + 1    start_spellcheck_radio:    SectionGetFlags $2 $0    IntOp $1 $0 & ${SF_SECGRPEND}    ; If it is the end of the section group, stop    IntCmp $1 ${SF_SECGRPEND} end_spellcheck_radio    IntOp $0 $0 & ${SF_RO}    IntCmp $0 ${SF_RO} after_button_insert    ; If !readonly, then it is part of the radiobutton group    !insertmacro RadioButton $2    after_button_insert:    IntOp $2 $2 + 1 ;Advance to the next section    Goto start_spellcheck_radio    end_spellcheck_radio:  !insertmacro EndRadioButtons  Pop $2  Pop $1  Pop $0FunctionEnd; Page enter and exit functions..Function preWelcomePage  Push $R0!ifndef WITH_GTK  ; If this installer dosn't have GTK, check whether we need it.  ; We do this here an not in .onInit because language change in  ; .onInit doesn't take effect until it is finished.  Call DoWeNeedGtk  Pop $R0  Pop $GTK_FOLDER  IntCmp $R0 1 done done  MessageBox MB_OK $(GTK_INSTALLER_NEEDED) /SD IDOK  Quit  done:!else  Push $R1  Push $R2  ; Make the GTK+ Section RO if it is required.  Call DoWeNeedGtk  Pop $R0  Pop $R2  IntCmp $R0 1 gtk_not_mandatory gtk_not_mandatory    !insertmacro SetSectionFlag ${SecGtk} ${SF_RO}  gtk_not_mandatory:  ; If on Win95/98/ME warn them that the GTK+ version wont work  ${Unless} ${IsNT}    !insertmacro UnselectSection ${SecGtk}    !insertmacro SetSectionFlag ${SecGtk} ${SF_RO}    MessageBox MB_OK $(GTK_WINDOWS_INCOMPATIBLE) /SD IDOK    IntCmp $R0 1 done done ; Upgrade isn't optional - abort if we don't have a suitable version    Quit  ${EndIf}  done:  Pop $R2  Pop $R1!endif  Pop $R0FunctionEnd!ifdef WITH_GTKFunction preGtkDirPage  Push $R0  Push $R1  Call DoWeNeedGtk  Pop $R0  Pop $R1  IntCmp $R0 2 +2 +2 no_gtk  StrCmp $R0 "3" no_gtk no_gtk  ; Don't show dir selector.. Upgrades are done to existing path..  Pop $R1  Pop $R0  Abort  no_gtk:    StrCmp $R1 "NONE" 0 no_gtk_cont      ; Got no install rights..      Pop $R1      Pop $R0      Abort    no_gtk_cont:      ; Suggest path..      StrCmp $R1 "HKCU" 0 hklm1        ${GetParent} $SMPROGRAMS $R0        ${GetParent} $R0 $R0        StrCpy $R0 "$R0\GTK\2.0"        Goto got_path      hklm1:        StrCpy $R0 "${GTK_DEFAULT_INSTALL_PATH}"   got_path:     StrCpy $name "GTK+ ${GTK_INSTALL_VERSION}"     StrCpy $GTK_FOLDER $R0     Pop $R1     Pop $R0FunctionEndFunction postGtkDirPage  Push $R0  StrCpy $name "Pidgin ${PIDGIN_VERSION}"  Push $GTK_FOLDER  Call VerifyDir  Pop $R0  StrCmp $R0 "0" 0 done    MessageBox MB_OK $(GTK_BAD_INSTALL_PATH) /SD IDOK    Pop $R0    Abort  done:  Pop $R0FunctionEnd!endif; SpellChecker Related Functions;-------------------------------; Convert the a Section index to the language code; Push the section index onto the stack and pop off the language code after the call; This will set the error code, if no match is foundFunction GetLangCodeForSection  ClearErrors  Push $R0  Exch  Pop $R0 ;This is the section index  IntCmp $R0 ${SecSpellCheckBreton} 0 +3 +3  StrCpy $R0 "br"  Goto done  IntCmp $R0 ${SecSpellCheckCatalan} 0 +3 +3  StrCpy $R0 "ca"  Goto done  IntCmp $R0 ${SecSpellCheckCzech} 0 +3 +3  StrCpy $R0 "cs"  Goto done  IntCmp $R0 ${SecSpellCheckWelsh} 0 +3 +3  StrCpy $R0 "cy"  Goto done  IntCmp $R0 ${SecSpellCheckDanish} 0 +3 +3  StrCpy $R0 "da"  Goto done  IntCmp $R0 ${SecSpellCheckGerman} 0 +3 +3  StrCpy $R0 "de"  Goto done  IntCmp $R0 ${SecSpellCheckGreek} 0 +3 +3  StrCpy $R0 "el"  Goto done  IntCmp $R0 ${SecSpellCheckEnglish} 0 +3 +3  StrCpy $R0 "en"  Goto done  IntCmp $R0 ${SecSpellCheckEsperanto} 0 +3 +3  StrCpy $R0 "eo"  Goto done  IntCmp $R0 ${SecSpellCheckSpanish} 0 +3 +3  StrCpy $R0 "es"  Goto done  IntCmp $R0 ${SecSpellCheckFaroese} 0 +3 +3  StrCpy $R0 "fo"  Goto done  IntCmp $R0 ${SecSpellCheckFrench} 0 +3 +3  StrCpy $R0 "fr"  Goto done  IntCmp $R0 ${SecSpellCheckItalian} 0 +3 +3  StrCpy $R0 "it"  Goto done  IntCmp $R0 ${SecSpellCheckDutch} 0 +3 +3  StrCpy $R0 "nl"  Goto done  IntCmp $R0 ${SecSpellCheckNorwegian} 0 +3 +3  StrCpy $R0 "no"  Goto done  IntCmp $R0 ${SecSpellCheckPolish} 0 +3 +3  StrCpy $R0 "pl"  Goto done  IntCmp $R0 ${SecSpellCheckPortuguese} 0 +3 +3  StrCpy $R0 "pt"  Goto done  IntCmp $R0 ${SecSpellCheckRomanian} 0 +3 +3  StrCpy $R0 "ro"  Goto done  IntCmp $R0 ${SecSpellCheckRussian} 0 +3 +3  StrCpy $R0 "ru"  Goto done  IntCmp $R0 ${SecSpellCheckSlovak} 0 +3 +3  StrCpy $R0 "sk"  Goto done  IntCmp $R0 ${SecSpellCheckSwedish} 0 +3 +3  StrCpy $R0 "sv"  Goto done  IntCmp $R0 ${SecSpellCheckUkrainian} 0 +3 +3  StrCpy $R0 "uk"  Goto done  SetErrors  done:  Exch $R0FunctionEnd ;GetLangCodeForSection; Select and Disable any Sections that have currently installed dictionariesFunction SelectAndDisableInstalledDictionaries  Push $R0  Push $R1  Push $R2  ; Start with the first language dictionary  IntOp $R0 ${SecSpellCheck} + 1  start:  ; If it is the end of the section group, stop  SectionGetFlags $R0 $R1  IntOp $R2 $R1 & ${SF_SECGRPEND}  IntCmp $R2 ${SF_SECGRPEND} done  Push $R0  Call GetLangCodeForSection  Pop $R2  IfErrors end_loop  ReadRegStr $R2 HKLM "${ASPELL_REG_KEY}-$R2" "" ; Check that the dictionary is installed  StrCmp $R2 "" end_loop ; If it isn't installed, skip to the next item  IntOp $R1 $R1 | ${SF_RO} ; Mark Readonly  IntOp $R1 $R1 | ${SF_SELECTED} ; Select  SectionSetFlags $R0 $R1  end_loop:  IntOp $R0 $R0 + 1 ;Advance to the next section  Goto start  done:  Pop $R2  Pop $R1  Pop $R0FunctionEndFunction InstallAspellAndDict  Push $R0  Exch  Call GetLangCodeForSection  Pop $R0 ;This is the language code  Push $R1  IfErrors done ; We weren't able to convert the section to lang code  retry:    Call InstallAspell    Pop $R1    StrCmp $R1 "" +3    StrCmp $R1 "cancel" done    MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_ERROR) : $R1" /SD IDCANCEL IDRETRY retry IDCANCEL done  retry_dict:    Push $R0    Call InstallAspellDictionary    Pop $R1    StrCmp $R1 "" +3    StrCmp $R1 "cancel" done    MessageBox MB_RETRYCANCEL "$(PIDGIN_SPELLCHECK_DICT_ERROR) : $R1" /SD IDCANCEL IDRETRY retry_dict  done:  Pop $R1  Pop $R0FunctionEndFunction InstallAspell  Push $R0  Push $R1  Push $R2  check:  ClearErrors  ReadRegDWORD $R0 HKLM ${ASPELL_REG_KEY} "AspellVersion"  IntCmp $R0 15 installed  ; If this is the check after installation, don't infinite loop on failure  StrCmp $R1 "$TEMP\aspell_installer.exe" 0 +3    StrCpy $R0 $(ASPELL_INSTALL_FAILED)    Goto done  ; We need to download and install aspell  StrCpy $R1 "$TEMP\aspell_installer.exe"  StrCpy $R2 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=aspell_core"  DetailPrint "Downloading Aspell... ($R2)"  NSISdl::download /TIMEOUT=10000 $R2 $R1  Pop $R0  StrCmp $R0 "success" +2    Goto done  ExecWait '"$R1"'  Delete $R1  Goto check ; Check that it is now installed correctly  installed: ;Aspell is currently installed, no error message    DetailPrint "Aspell is installed"    StrCpy $R0 ''  done:  Pop $R2  Pop $R1  Exch $R0FunctionEndFunction InstallAspellDictionary  Push $R0  Exch  Pop $R0 ;This is the language code  Push $R1  Push $R2  Push $R3  check:  ClearErrors  ReadRegStr $R2 HKLM "${ASPELL_REG_KEY}-$R0" ""  StrCmp $R2 "" 0 installed  ; If this is the check after installation, don't infinite loop on failure  StrCmp $R1 "$TEMP\aspell_dict-$R0.exe" 0 +3    StrCpy $R0 $(ASPELL_INSTALL_FAILED)    Goto done  ; We need to download and install aspell  StrCpy $R1 "$TEMP\aspell_dict-$R0.exe"  StrCpy $R3 "${DOWNLOADER_URL}?version=${PIDGIN_VERSION}&dl_pkg=lang_$R0"  DetailPrint "Downloading the Aspell $R0 Dictionary... ($R3)"  NSISdl::download /TIMEOUT=10000 $R3 $R1  Pop $R3  StrCmp $R3 "success" +3    StrCpy $R0 $R3    Goto done  ExecWait '"$R1"'  Delete $R1  Goto check ; Check that it is now installed correctly  installed: ;The dictionary is currently installed, no error message    DetailPrint "Aspell $R0 Dictionary is installed"    StrCpy $R0 ''  done:  Pop $R3  Pop $R2  Pop $R1  Exch $R0FunctionEnd

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -