From: Brian S. <xue...@us...> - 2006-02-06 14:19:04
|
Update of /cvsroot/popfile/windows/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1117 Modified Files: Tag: b0_22_2 pfidbstatus.nsi Log Message: Add the size of the SQLite database to the report (use a NSIS plugin to find the size of the file in KB). Change GPL license to remove the option for the person using POPFile to license it under any version of the GPL other than v2 Index: pfidbstatus.nsi =================================================================== RCS file: /cvsroot/popfile/windows/test/pfidbstatus.nsi,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -C2 -d -r1.3.2.2 -r1.3.2.3 *** pfidbstatus.nsi 13 Sep 2005 19:05:32 -0000 1.3.2.2 --- pfidbstatus.nsi 6 Feb 2006 14:18:44 -0000 1.3.2.3 *************** *** 12,23 **** # sqlite.exe version number before trying to execute any SQL. # ! # Copyright (c) 2005 John Graham-Cumming # # This file is part of POPFile # ! # POPFile is free software; you can redistribute it and/or modify ! # it under the terms of the GNU General Public License as published by ! # the Free Software Foundation; either version 2 of the License, or ! # (at your option) any later version. # # POPFile is distributed in the hope that it will be useful, --- 12,22 ---- # sqlite.exe version number before trying to execute any SQL. # ! # Copyright (c) 2005-2006 John Graham-Cumming # # This file is part of POPFile # ! # POPFile is free software; you can redistribute it and/or modify it ! # under the terms of version 2 of the GNU General Public License as ! # published by the Free Software Foundation. # # POPFile is distributed in the hope that it will be useful, *************** *** 31,34 **** --- 30,76 ---- #------------------------------------------------------------------------------------------- + ; This version of the script has been tested with the "NSIS 2.0" compiler (final), + ; released 7 February 2004, with no "official" NSIS patches applied. This compiler + ; can be downloaded from http://prdownloads.sourceforge.net/nsis/nsis20.exe?download + + !define ${NSIS_VERSION}_found + + !ifndef v2.0_found + !warning \ + "$\r$\n\ + $\r$\n*** NSIS COMPILER WARNING:\ + $\r$\n***\ + $\r$\n*** This script has only been tested using the NSIS 2.0 compiler\ + $\r$\n*** and may not work properly with this NSIS ${NSIS_VERSION} compiler\ + $\r$\n***\ + $\r$\n*** The resulting 'installer' program should be tested carefully!\ + $\r$\n$\r$\n" + !endif + + !undef ${NSIS_VERSION}_found + + ;------------------------------------------------ + ; This script requires the 'GetSize' NSIS plugin + ;------------------------------------------------ + + ; This script uses a special NSIS plugin (GetSize) to find the size of the SQLite database. + ; + ; 'GetSize' plugin thread in the "NSIS Discussion" forum: + ; http://forums.winamp.com/showthread.php?threadid=224452 + ; + ; 'GetSize' plugin download link (from the above forum thread): + ; http://forums.winamp.com/attachment.php?postid=1756112 + ; + ; To compile this script, copy the 'getsize.dll' file to the standard NSIS plugins folder + ; (${NSISDIR}\Plugins\). The 'GetSize' source and example files can be unzipped to the + ; ${NSISDIR}\Contrib\GetSize\ folder if you wish, but this step is entirely optional. + ; + ; Tested with version 1.0 of the 'GetSize' plugin. + ; + ; The 'GetSize' plugin has not been added to the NSIS Wiki. The plugin's author decided + ; to include its functions in a much larger general purpose plugin (Locate). This enhanced + ; plugin (it is more than 3 times the size of 'GetSize') has been added to the NSIS Wiki: + ; http://nsis.sourceforge.net/Locate_plugin + #-------------------------------------------------------------------------- # Compile-time command-line switches (used by 'makensis.exe') *************** *** 93,115 **** #------------------------------------------------------------------------------------------- ! ; This version of the script has been tested with the "NSIS 2.0" compiler (final), ! ; released 7 February 2004, with no "official" NSIS patches applied. This compiler ! ; can be downloaded from http://prdownloads.sourceforge.net/nsis/nsis20.exe?download ! ! !define ${NSIS_VERSION}_found ! ! !ifndef v2.0_found ! !warning \ ! "$\r$\n\ ! $\r$\n*** NSIS COMPILER WARNING:\ ! $\r$\n***\ ! $\r$\n*** This script has only been tested using the NSIS 2.0 compiler\ ! $\r$\n*** and may not work properly with this NSIS ${NSIS_VERSION} compiler\ ! $\r$\n***\ ! $\r$\n*** The resulting 'installer' program should be tested carefully!\ ! $\r$\n$\r$\n" ! !endif ! !undef ${NSIS_VERSION}_found ;-------------------------------------------------------------------------- --- 135,143 ---- #------------------------------------------------------------------------------------------- ! ;-------------------------------------------------------------------------- ! ; Select LZMA compression (to generate smallest EXE file) ! ;-------------------------------------------------------------------------- ! SetCompressor lzma ;-------------------------------------------------------------------------- *************** *** 129,133 **** ;-------------------------------------------------------------------------- ! !define C_VERSION "0.0.4" ; see 'VIProductVersion' comment below for format details !define C_OUTFILE "pfidbstatus.exe" --- 157,161 ---- ;-------------------------------------------------------------------------- ! !define C_VERSION "0.0.8" ; see 'VIProductVersion' comment below for format details !define C_OUTFILE "pfidbstatus.exe" *************** *** 178,182 **** VIAddVersionKey "Comments" "POPFile Homepage: http://getpopfile.org/" VIAddVersionKey "CompanyName" "The POPFile Project" ! VIAddVersionKey "LegalCopyright" "Copyright (c) 2005 John Graham-Cumming" VIAddVersionKey "FileDescription" "Check the status of POPFile's SQLite database" VIAddVersionKey "FileVersion" "${C_VERSION}" --- 206,210 ---- VIAddVersionKey "Comments" "POPFile Homepage: http://getpopfile.org/" VIAddVersionKey "CompanyName" "The POPFile Project" ! VIAddVersionKey "LegalCopyright" "Copyright (c) 2006 John Graham-Cumming" VIAddVersionKey "FileDescription" "Check the status of POPFile's SQLite database" VIAddVersionKey "FileVersion" "${C_VERSION}" *************** *** 206,209 **** --- 234,238 ---- Var G_DBFORMAT ; SQLite database format ('2.x', '3.x' or an error string) Var G_DBSCHEMA ; SQLite database schema ( a number like '12' or an error string) + Var G_DBSIZE ; SQLite database file size (in KB) Var G_PLS_FIELD_1 ; used to customize language strings *************** *** 364,368 **** !insertmacro DBS_TEXT DBS_LANG_DBFORMAT "Database is in SQLite $G_DBFORMAT format" ! !insertmacro DBS_TEXT DBS_LANG_DBFORMATSCHEMA "$(DBS_LANG_DBFORMAT) and uses POPFile schema version $G_DBSCHEMA" !insertmacro DBS_TEXT DBS_LANG_DBSCHEMAERROR "SQLite error detected when extracting POPFile schema version:" --- 393,398 ---- !insertmacro DBS_TEXT DBS_LANG_DBFORMAT "Database is in SQLite $G_DBFORMAT format" ! !insertmacro DBS_TEXT DBS_LANG_DBSCHEMA ", uses schema version $G_DBSCHEMA" ! !insertmacro DBS_TEXT DBS_LANG_DBSIZE " and its size is $G_DBSIZE KB" !insertmacro DBS_TEXT DBS_LANG_DBSCHEMAERROR "SQLite error detected when extracting POPFile schema version:" *************** *** 402,405 **** --- 432,437 ---- !define L_TEMP $R9 + Push ${L_TEMP} + SetDetailsPrint textonly DetailPrint "$(DBS_LANG_RIGHTCLICK)" *************** *** 411,418 **** DetailPrint "" ! ClearErrors ! UserInfo::GetName ! IfErrors default_name ! Pop $G_WINUSERNAME StrCmp $G_WINUSERNAME "" 0 check_input --- 443,450 ---- DetailPrint "" ! ClearErrors ! UserInfo::GetName ! IfErrors default_name ! Pop $G_WINUSERNAME StrCmp $G_WINUSERNAME "" 0 check_input *************** *** 591,596 **** --- 623,639 ---- continue: + StrCpy $G_PLS_FIELD_2 $G_DATABASE StrCpy $G_DATABASE "$G_PLS_FIELD_1\$G_DATABASE" IfFileExists "$G_DATABASE\*.*" dir_not_file + Push $0 + Push $1 + Push $2 + getsize::GetSize "$G_PLS_FIELD_1" "/M=$G_PLS_FIELD_2 /G=0 /S=Kb" .r0 .r1 .r2 + Push $0 + Call InsertThousandSeparators + Pop $G_DBSIZE + Pop $2 + Pop $1 + Pop $0 DetailPrint "" DetailPrint "$(DBS_LANG_CHECKTHISONE)" *************** *** 700,704 **** StrCpy $G_DBSCHEMA "($G_DBSCHEMA)" DetailPrint "" ! DetailPrint "$(DBS_LANG_DBFORMAT)" DetailPrint "" DetailPrint "$(DBS_LANG_DBSCHEMAERROR)" --- 743,747 ---- StrCpy $G_DBSCHEMA "($G_DBSCHEMA)" DetailPrint "" ! DetailPrint "$(DBS_LANG_DBFORMAT)$(DBS_LANG_DBSIZE)" DetailPrint "" DetailPrint "$(DBS_LANG_DBSCHEMAERROR)" *************** *** 708,712 **** schema_ok: DetailPrint "" ! DetailPrint "$(DBS_LANG_DBFORMATSCHEMA)" check_integrity: --- 751,755 ---- schema_ok: DetailPrint "" ! DetailPrint "$(DBS_LANG_DBFORMAT)$(DBS_LANG_DBSCHEMA)$(DBS_LANG_DBSIZE)" check_integrity: *************** *** 770,773 **** --- 813,818 ---- Call HideFinalTimestamp + POP ${L_TEMP} + !undef L_TEMP *************** *** 775,778 **** --- 820,926 ---- #-------------------------------------------------------------------------- + # Installer Function: InsertThousandSeparators + # + # When large integers are displayed they can be hard to read (eg 1234567). This function + # inserts one or more "thousand" separators to make large integers easier to read + # (eg 1,234,567). + # + # If the input value isn't an unsigned decimal integer then the output string equals the input. + # + # This function uses the target system's OS setting for the "thousand" separator. This is the + # character (or characters) used to separate groups of digits to the left of the decimal point. + # + # Input: + # (top of stack) - input + # + # Output: + # (top of stack) - input value with separators inserted if appropriate + # + # Usage: + # Push "1234567" + # Call InsertThousandSeparators + # Pop $R0 ; $R0 will be "1,234,567" + # ; (assuming the 'English' setting for the "thousand" separator) + # + # Push "1234.567" + # Call InsertThousandSeparators + # Pop $R0 ; $R0 will be "1234.567" + # ; (no changes made because input contains a decimal point) + #-------------------------------------------------------------------------- + + Function InsertThousandSeparators + + !define L_INPUT $R9 ; the input string + !define L_RESULT $R8 ; the output string + + !define L_TEMP $1 ; temp variable (also used as .r1 in 'system' call) + !define L_COMMA $0 ; target system's "thousand" separator (used as .r0 in 'system' call) + + Exch ${L_INPUT} + Push ${L_RESULT} + Push ${L_TEMP} + Push ${L_COMMA} + + Push ${L_INPUT} + Call PFI_StrCheckDecimal + Pop ${L_TEMP} + StrCmp ${L_TEMP} "" no_commas + + ; Use the target system's "thousand" separator (this is ',' when 'English' locale selected) + + !define LOCALE_SYSTEM_DEFAULT 0x400 + !define LOCALE_STHOUSAND 0xF + !define MAX_PATH 260 ; upper limit for the length of the separator + + StrCpy ${L_COMMA} "" + + System::Call "kernel32::GetLocaleInfoA(i ${LOCALE_SYSTEM_DEFAULT}, i ${LOCALE_STHOUSAND}, t .r0, i ${MAX_PATH}) i r1" + + ; If the 'system' call returns an empty string use the default English separator + ; (or should we just use the empty string in case that is what is really required here?) + + StrCmp ${L_COMMA} "" 0 got_separator + StrCpy ${L_COMMA} "," + + got_separator: + + ; Input is an unsigned decimal integer (i.e. it contains only the characters 0 to 9) + + StrCpy ${L_RESULT} "" + + loop: + StrLen ${L_TEMP} ${L_INPUT} + IntCmp ${L_TEMP} 3 done done + StrCpy ${L_TEMP} ${L_INPUT} 3 -3 + StrCmp ${L_RESULT} "" first_group + StrCpy ${L_RESULT} ${L_TEMP}${L_COMMA}${L_RESULT} + + next_group: + StrCpy ${L_INPUT} ${L_INPUT} -3 + Goto loop + + first_group: + StrCpy ${L_RESULT} ${L_TEMP} + Goto next_group + + done: + StrCmp ${L_RESULT} "" no_commas + StrCpy ${L_INPUT} ${L_INPUT}${L_COMMA}${L_RESULT} + + no_commas: + Pop ${L_COMMA} + Pop ${L_TEMP} + Pop ${L_RESULT} + Exch ${L_INPUT} + + !undef L_INPUT + !undef L_RESULT + + !undef L_TEMP + !undef L_COMMA + + FunctionEnd + + #-------------------------------------------------------------------------- # Functions used to manipulate the contents of the details view #-------------------------------------------------------------------------- |