tools/installer/nsis/includes/instdir.nsh
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
     2 ;;
       
     3 ;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ;; All rights reserved.
       
     5 ;; Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 ;;
       
     7 ;; This file is part of the tools applications of the Qt Toolkit.
       
     8 ;;
       
     9 ;; $QT_BEGIN_LICENSE:LGPL$
       
    10 ;; No Commercial Usage
       
    11 ;; This file contains pre-release code and may not be distributed.
       
    12 ;; You may use this file in accordance with the terms and conditions
       
    13 ;; contained in the Technology Preview License Agreement accompanying
       
    14 ;; this package.
       
    15 ;;
       
    16 ;; GNU Lesser General Public License Usage
       
    17 ;; Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ;; General Public License version 2.1 as published by the Free Software
       
    19 ;; Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ;; packaging of this file.  Please review the following information to
       
    21 ;; ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 ;;
       
    24 ;; In addition, as a special exception, Nokia gives you certain additional
       
    25 ;; rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ;; version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 ;;
       
    28 ;; If you have questions regarding the use of this file, please contact
       
    29 ;; Nokia at qt-info@nokia.com.
       
    30 ;;
       
    31 ;;
       
    32 ;;
       
    33 ;;
       
    34 ;;
       
    35 ;;
       
    36 ;;
       
    37 ;;
       
    38 ;; $QT_END_LICENSE$
       
    39 ;;
       
    40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
    41 !ifndef INSTDIR_1
       
    42   !macro INSTDIR_INITIALIZE
       
    43     !define MUI_DIRECTORYPAGE_VARIABLE $${INSTDIR_0}_INSTDIR
       
    44     !ifdef ${INSTDIR_0}_ValidateDirectory
       
    45       !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "${INSTDIR_0}_ValidateDirectoryFunc"
       
    46     !endif
       
    47     !insertmacro MUI_PAGE_DIRECTORY
       
    48   !macroend
       
    49   !macro INSTDIR_FUNCTIONS
       
    50   !macroend
       
    51   !macro INSTDIR_STARTUP
       
    52   !macroend
       
    53 !else
       
    54 !macro INSTDIR_INITIALIZE
       
    55   !define INSTDIR_INI_FILE "instdir.ini"
       
    56   !define INSTDIR_0_DIRFIELD "Field 10"
       
    57   !define INSTDIR_0_TEXTFIELD "Field 13"
       
    58   !define INSTDIR_1_DIRFIELD "Field 7"
       
    59   !define INSTDIR_1_TEXTFIELD "Field 11"
       
    60   !define INSTDIR_2_DIRFIELD "Field 5"
       
    61   !define INSTDIR_2_TEXTFIELD "Field 8"
       
    62   !define INSTDIR_3_DIRFIELD "Field 3"
       
    63   !define INSTDIR_3_TEXTFIELD "Field 6"
       
    64   !define INSTDIR_4_DIRFIELD "Field 2"
       
    65   !define INSTDIR_4_TEXTFIELD "Field 4"
       
    66   !define INSTDIR_5_DIRFIELD "Field 9"
       
    67   !define INSTDIR_5_TEXTFIELD "Field 12"
       
    68   !define INSTDIR_DIRHEIGHT 18
       
    69 
       
    70   Page custom InitInstDirs UpdateInstDirs
       
    71   
       
    72   LangString InstDirLicenseTitle ${LANG_ENGLISH} "Installation Directories"
       
    73   LangString InstDirLicenseTitleDescription ${LANG_ENGLISH} "Select the directories where you want the software installed."
       
    74 !macroend
       
    75 
       
    76 !macro INSTDIR_FUNCTIONS
       
    77   Function InitInstDirs
       
    78     push $0
       
    79     push $1
       
    80     push $2
       
    81     push $3
       
    82     
       
    83     !insertmacro MUI_HEADER_TEXT "$(InstDirLicenseTitle)" "$(InstDirLicenseTitleDescription)"
       
    84     strcpy $0 "129"
       
    85 
       
    86 !ifdef INSTDIR_0
       
    87     SectionGetFlags ${${INSTDIR_0}_SEC01} $1
       
    88 !ifdef ${INSTDIR_0}_SEC02
       
    89     SectionGetFlags ${${INSTDIR_0}_SEC02} $3
       
    90     IntOp $1 $1 | $3
       
    91 !endif
       
    92     IntOp $2 $1 & 1 ;just care about the first flag
       
    93     StrCpy $1 "READONLY"
       
    94     StrCmp "$2" "1" +2
       
    95       StrCpy $1 "DISABLED"
       
    96     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Flags" "$1"
       
    97     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Flags" "$1"
       
    98     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Text" "${INSTDIR_0_TEXT}"
       
    99     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State" $${INSTDIR_0}_INSTDIR
       
   100 !else
       
   101     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "Type" "Unknown"
       
   102     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_0_TEXTFIELD}" "Type" "Unknown"
       
   103     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   104 !endif
       
   105 !ifdef INSTDIR_1
       
   106     SectionGetFlags ${${INSTDIR_1}_SEC01} $1
       
   107 !ifdef ${INSTDIR_1}_SEC02
       
   108     SectionGetFlags ${${INSTDIR_1}_SEC02} $3
       
   109     IntOp $1 $1 | $3
       
   110 !endif
       
   111     IntOp $2 $1 & 1 ;just care about the first flag
       
   112     StrCpy $1 "READONLY"
       
   113     StrCmp "$2" "1" +2
       
   114       StrCpy $1 "DISABLED"
       
   115     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Flags" "$1"
       
   116     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Flags" "$1"
       
   117     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Text" "${INSTDIR_1_TEXT}"
       
   118     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State" $${INSTDIR_1}_INSTDIR
       
   119 !else
       
   120     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "Type" "Unknown"
       
   121     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_1_TEXTFIELD}" "Type" "Unknown"
       
   122     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   123 !endif
       
   124 !ifdef INSTDIR_2
       
   125     SectionGetFlags ${${INSTDIR_2}_SEC01} $1
       
   126 !ifdef ${INSTDIR_2}_SEC02
       
   127     SectionGetFlags ${${INSTDIR_2}_SEC02} $3
       
   128     IntOp $1 $1 | $3
       
   129 !endif
       
   130     IntOp $2 $1 & 1 ;just care about the first flag
       
   131     StrCpy $1 "READONLY"
       
   132     StrCmp "$2" "1" +2
       
   133       StrCpy $1 "DISABLED"
       
   134     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Flags" "$1"
       
   135     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Flags" "$1"
       
   136     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Text" "${INSTDIR_2_TEXT}"
       
   137     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State" $${INSTDIR_2}_INSTDIR
       
   138 !else
       
   139     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "Type" "Unknown"
       
   140     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_2_TEXTFIELD}" "Type" "Unknown"
       
   141     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   142 !endif
       
   143 !ifdef INSTDIR_3
       
   144     SectionGetFlags ${${INSTDIR_3}_SEC01} $1
       
   145 !ifdef ${INSTDIR_3}_SEC02
       
   146     SectionGetFlags ${${INSTDIR_3}_SEC02} $3
       
   147     IntOp $1 $1 | $3
       
   148 !endif
       
   149     IntOp $2 $1 & 1 ;just care about the first flag
       
   150     StrCpy $1 "READONLY"
       
   151     StrCmp "$2" "1" +2
       
   152       StrCpy $1 "DISABLED"
       
   153     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Flags" "$1"
       
   154     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Flags" "$1"
       
   155     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Text" "${INSTDIR_3_TEXT}"
       
   156     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State" $${INSTDIR_3}_INSTDIR
       
   157 !else
       
   158     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "Type" "Unknown"
       
   159     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_3_TEXTFIELD}" "Type" "Unknown"
       
   160     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   161 !endif
       
   162 !ifdef INSTDIR_4
       
   163     SectionGetFlags ${${INSTDIR_4}_SEC01} $1
       
   164 !ifdef ${INSTDIR_4}_SEC02
       
   165     SectionGetFlags ${${INSTDIR_4}_SEC02} $3
       
   166     IntOp $1 $1 | $3
       
   167 !endif
       
   168     IntOp $2 $1 & 1 ;just care about the first flag
       
   169     StrCpy $1 "READONLY"
       
   170     StrCmp "$2" "1" +2
       
   171       StrCpy $1 "DISABLED"
       
   172     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Flags" "$1"
       
   173     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Flags" "$1"
       
   174     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Text" "${INSTDIR_4_TEXT}"
       
   175     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State" $${INSTDIR_4}_INSTDIR
       
   176 !else
       
   177     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "Type" "Unknown"
       
   178     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_4_TEXTFIELD}" "Type" "Unknown"
       
   179     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   180 !endif
       
   181 !ifdef INSTDIR_5
       
   182     SectionGetFlags ${${INSTDIR_5}_SEC01} $1
       
   183 !ifdef ${INSTDIR_5}_SEC02
       
   184     SectionGetFlags ${${INSTDIR_5}_SEC02} $3
       
   185     IntOp $1 $1 | $3
       
   186 !endif
       
   187     IntOp $2 $1 & 1 ;just care about the first flag
       
   188     StrCpy $1 "READONLY"
       
   189     StrCmp "$2" "1" +2
       
   190       StrCpy $1 "DISABLED"
       
   191     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Flags" "$1"
       
   192     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Flags" "$1"
       
   193     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Text" "${INSTDIR_5_TEXT}"
       
   194     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State" $${INSTDIR_5}_INSTDIR
       
   195 !else
       
   196     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "Type" "Unknown"
       
   197     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "${INSTDIR_5_TEXTFIELD}" "Type" "Unknown"
       
   198     intop $0 $0 - ${INSTDIR_DIRHEIGHT}
       
   199 !endif
       
   200 
       
   201     !insertmacro MUI_INSTALLOPTIONS_WRITE "${INSTDIR_INI_FILE}" "Field 1" "Bottom" "$0"
       
   202     !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${INSTDIR_INI_FILE}"
       
   203 
       
   204     pop $3
       
   205     pop $2
       
   206     pop $1
       
   207     pop $0
       
   208   FunctionEnd
       
   209 
       
   210   Function UpdateInstDirs
       
   211 !ifdef INSTDIR_0
       
   212     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_0}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_0_DIRFIELD}" "State"
       
   213     !ifdef ${INSTDIR_0}_ValidateDirectory
       
   214       call ${INSTDIR_0}_ValidateDirectoryFunc
       
   215     !endif
       
   216 !endif
       
   217 !ifdef INSTDIR_1
       
   218     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_1}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_1_DIRFIELD}" "State"
       
   219     !ifdef ${INSTDIR_1}_ValidateDirectory
       
   220       call ${INSTDIR_1}_ValidateDirectoryFunc
       
   221     !endif
       
   222 !endif
       
   223 !ifdef INSTDIR_2
       
   224     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_2}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_2_DIRFIELD}" "State"
       
   225     !ifdef ${INSTDIR_2}_ValidateDirectory
       
   226       call ${INSTDIR_2}_ValidateDirectoryFunc
       
   227     !endif
       
   228 !endif
       
   229 !ifdef INSTDIR_3
       
   230     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_3}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_3_DIRFIELD}" "State"
       
   231     !ifdef ${INSTDIR_3}_ValidateDirectory
       
   232       call ${INSTDIR_3}_ValidateDirectoryFunc
       
   233     !endif
       
   234 !endif
       
   235 !ifdef INSTDIR_4
       
   236     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_4}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_4_DIRFIELD}" "State"
       
   237     !ifdef ${INSTDIR_4}_ValidateDirectory
       
   238       call ${INSTDIR_4}_ValidateDirectoryFunc
       
   239     !endif
       
   240 !endif
       
   241 !ifdef INSTDIR_5
       
   242     !insertmacro MUI_INSTALLOPTIONS_READ $${INSTDIR_5}_INSTDIR "${INSTDIR_INI_FILE}" "${INSTDIR_5_DIRFIELD}" "State"
       
   243     !ifdef ${INSTDIR_5}_ValidateDirectory
       
   244       call ${INSTDIR_5}_ValidateDirectoryFunc
       
   245     !endif
       
   246 !endif
       
   247   FunctionEnd
       
   248 !macroend
       
   249 
       
   250 !macro INSTDIR_STARTUP
       
   251   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${INSTDIR_INI_FILE}"
       
   252 !macroend
       
   253 
       
   254 !endif ;ifndef INSTDIR_1