mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Code cosmetic:
* Sanitize main unit from unused variables * Move global variables to public scope * Bring public vars into some reasonable order * Move constants to const.inc, unless dependent from some used VCL unit
This commit is contained in:
@ -70,8 +70,8 @@ begin
|
|||||||
// Assign text
|
// Assign text
|
||||||
Caption := 'About '+AppName;
|
Caption := 'About '+AppName;
|
||||||
lblAppName.Caption := AppName;
|
lblAppName.Caption := AppName;
|
||||||
lblAppDescription.Caption := AppDescription;
|
lblAppDescription.Caption := Mainform.AppDescription;
|
||||||
lblAppVersion.Caption := 'Version '+AppVersion;
|
lblAppVersion.Caption := 'Version '+Mainform.AppVersion;
|
||||||
FileAge(ParamStr(0), Compiled);
|
FileAge(ParamStr(0), Compiled);
|
||||||
lblAppCompiled.Caption := 'Compiled on: ' + DateTimeToStr(Compiled);
|
lblAppCompiled.Caption := 'Compiled on: ' + DateTimeToStr(Compiled);
|
||||||
lblAppWebpage.Caption := AppDomain;
|
lblAppWebpage.Caption := AppDomain;
|
||||||
|
@ -269,9 +269,15 @@ const
|
|||||||
|
|
||||||
// Data grid: How many bytes to fetch from data fields that are potentially large.
|
// Data grid: How many bytes to fetch from data fields that are potentially large.
|
||||||
GRIDMAXDATA: Integer = 256;
|
GRIDMAXDATA: Integer = 256;
|
||||||
|
|
||||||
// Data grid: How many rows to fetch at a time.
|
// Data grid: How many rows to fetch at a time.
|
||||||
GRIDMAXROWS: Cardinal = 1000;
|
GRIDMAXROWS: Cardinal = 1000;
|
||||||
|
// The InnoDB folks are raging over the lack of count(*) support
|
||||||
|
// in the storage engine. To avoid count(*), the first of these
|
||||||
|
// constants decide how many rows the data area should estimate
|
||||||
|
// in any table. The second value decides how many percent above the
|
||||||
|
// number of seen (or simulated) rows the scrollbar should project.
|
||||||
|
SIMULATE_INITIAL_ROWS = 10000;
|
||||||
|
SIMULATE_MORE_ROWS = 20;
|
||||||
|
|
||||||
VTREE_NOTLOADED = 0;
|
VTREE_NOTLOADED = 0;
|
||||||
VTREE_LOADED = 1;
|
VTREE_LOADED = 1;
|
||||||
|
@ -846,7 +846,7 @@ begin
|
|||||||
else
|
else
|
||||||
NodeCount := Grid.RootNodeCount;
|
NodeCount := Grid.RootNodeCount;
|
||||||
EnableProgressBar(NodeCount);
|
EnableProgressBar(NodeCount);
|
||||||
Generator := APPNAME+' '+AppVersion;
|
Generator := APPNAME+' '+Mainform.AppVersion;
|
||||||
tmp :=
|
tmp :=
|
||||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' + CRLF +
|
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' + CRLF +
|
||||||
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF + CRLF +
|
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF + CRLF +
|
||||||
|
171
source/main.pas
171
source/main.pas
@ -714,29 +714,22 @@ type
|
|||||||
procedure actDataResetSortingExecute(Sender: TObject);
|
procedure actDataResetSortingExecute(Sender: TObject);
|
||||||
procedure actReformatSQLExecute(Sender: TObject);
|
procedure actReformatSQLExecute(Sender: TObject);
|
||||||
private
|
private
|
||||||
ReachedEOT : Boolean;
|
ReachedEOT: Boolean;
|
||||||
FDelimiter: String;
|
FDelimiter: String;
|
||||||
viewingdata : Boolean;
|
FileNameSessionLog: String;
|
||||||
EditVariableForm : TfrmEditVariable;
|
FileHandleSessionLog: Textfile;
|
||||||
FileNameSessionLog : String;
|
FLastMouseUpOnPageControl: Cardinal;
|
||||||
FileHandleSessionLog : Textfile;
|
FLastTabNumberOnMouseUp: Integer;
|
||||||
SelectedTableColumns : TTableColumnList;
|
FLastMouseDownCloseButton: TObject;
|
||||||
SelectedTableKeys : TTableKeyList;
|
|
||||||
SelectedTableForeignKeys : TForeignKeyList;
|
|
||||||
FilterPanelManuallyOpened : Boolean;
|
|
||||||
DataGridDB, DataGridTable : String;
|
|
||||||
PrevTableColWidths : TWideStringList;
|
|
||||||
DataGridHasChanges : Boolean;
|
|
||||||
FLastMouseUpOnPageControl : Cardinal;
|
|
||||||
FLastTabNumberOnMouseUp : Integer;
|
|
||||||
FLastMouseDownCloseButton : TObject;
|
|
||||||
DataGridResult : TGridResult;
|
|
||||||
// Filter text per tab for filter panel
|
// Filter text per tab for filter panel
|
||||||
FilterTextVariables, FilterTextStatus, FilterTextProcessList, FilterTextCommandStats,
|
FilterTextVariables: String;
|
||||||
FilterTextDatabase, FilterTextData: String;
|
FilterTextStatus: String;
|
||||||
|
FilterTextProcessList: String;
|
||||||
|
FilterTextCommandStats: String;
|
||||||
|
FilterTextDatabase: String;
|
||||||
|
FilterTextData: String;
|
||||||
PreviousFocusedNode: PVirtualNode;
|
PreviousFocusedNode: PVirtualNode;
|
||||||
function GetParamValue(const paramChar: Char; const paramName:
|
function GetParamValue(const paramChar: Char; const paramName: string; var curIdx: Byte; out paramValue: string): Boolean;
|
||||||
string; var curIdx: Byte; out paramValue: string): Boolean;
|
|
||||||
procedure SetDelimiter(Value: String);
|
procedure SetDelimiter(Value: String);
|
||||||
procedure DisplayRowCountStats(MatchingRows: Int64 = -1);
|
procedure DisplayRowCountStats(MatchingRows: Int64 = -1);
|
||||||
procedure insertFunction(Sender: TObject);
|
procedure insertFunction(Sender: TObject);
|
||||||
@ -754,8 +747,14 @@ type
|
|||||||
procedure DatabaseChanged(Database: String);
|
procedure DatabaseChanged(Database: String);
|
||||||
public
|
public
|
||||||
Connection: TMySQLConnection;
|
Connection: TMySQLConnection;
|
||||||
cancelling: Boolean;
|
SessionName: String;
|
||||||
virtualDesktopName: string;
|
virtualDesktopName: string;
|
||||||
|
AllDatabases: TWideStringList;
|
||||||
|
Databases: TWideStringList;
|
||||||
|
btnAddTab: TPngSpeedButton;
|
||||||
|
QueryTabs: TObjectList;
|
||||||
|
|
||||||
|
// Cached forms
|
||||||
TableToolsDialog: TfrmTableTools;
|
TableToolsDialog: TfrmTableTools;
|
||||||
ViewEditor: TfrmView;
|
ViewEditor: TfrmView;
|
||||||
UserManagerForm: TUserManagerForm;
|
UserManagerForm: TUserManagerForm;
|
||||||
@ -765,50 +764,71 @@ type
|
|||||||
TriggerEditor: TfrmTriggerEditor;
|
TriggerEditor: TfrmTriggerEditor;
|
||||||
OptionsForm: Toptionsform;
|
OptionsForm: Toptionsform;
|
||||||
SessionManager: TConnForm;
|
SessionManager: TConnForm;
|
||||||
AllDatabases, Databases: TWideStringList;
|
CreateDatabaseForm: TCreateDatabaseForm;
|
||||||
TemporaryDatabase : String;
|
TableEditor: TfrmTableEditor;
|
||||||
dataselected : Boolean;
|
InsertFiles: TfrmInsertFiles;
|
||||||
editing : Boolean;
|
EditVariableForm: TfrmEditVariable;
|
||||||
WindowNumber : Integer;
|
|
||||||
SessionName : String;
|
// Virtual Tree data arrays
|
||||||
VTRowDataListVariables,
|
VTRowDataListVariables,
|
||||||
VTRowDataListStatus,
|
VTRowDataListStatus,
|
||||||
VTRowDataListProcesses,
|
VTRowDataListProcesses,
|
||||||
VTRowDataListCommandStats,
|
VTRowDataListCommandStats,
|
||||||
VTRowDataListTables : TVTreeDataArray;
|
VTRowDataListTables: TVTreeDataArray;
|
||||||
|
|
||||||
// Variables set by preferences dialog
|
// Variables set by preferences dialog
|
||||||
prefRememberFilters : Boolean;
|
prefRememberFilters: Boolean;
|
||||||
prefLogsqlnum,
|
prefLogsqlnum: Integer;
|
||||||
prefLogSqlWidth,
|
prefLogSqlWidth: Integer;
|
||||||
prefMaxColWidth,
|
prefMaxColWidth: Integer;
|
||||||
prefMaxTotalRows : Integer;
|
prefMaxTotalRows: Integer;
|
||||||
prefCSVSeparator,
|
prefCSVSeparator: String;
|
||||||
prefCSVEncloser,
|
prefCSVEncloser: String;
|
||||||
prefCSVTerminator : String;
|
prefCSVTerminator: String;
|
||||||
prefLogToFile,
|
prefLogToFile: Boolean;
|
||||||
prefEnableBinaryEditor,
|
prefEnableBinaryEditor: Boolean;
|
||||||
prefEnableDatetimeEditor,
|
prefEnableDatetimeEditor: Boolean;
|
||||||
prefEnableEnumEditor,
|
prefEnableEnumEditor: Boolean;
|
||||||
prefEnableSetEditor,
|
prefEnableSetEditor: Boolean;
|
||||||
prefEnableNullBG,
|
prefEnableNullBG: Boolean;
|
||||||
prefExportLocaleNumbers : Boolean;
|
prefExportLocaleNumbers: Boolean;
|
||||||
prefNullColorDefault,
|
prefNullColorDefault: TColor;
|
||||||
prefNullBG : TColor;
|
prefNullBG: TColor;
|
||||||
CreateDatabaseForm : TCreateDatabaseForm;
|
|
||||||
TableEditor : TfrmTableEditor;
|
// Data grid related stuff
|
||||||
InsertFiles : TfrmInsertFiles;
|
FDataGridSelect: TWideStringList;
|
||||||
FDataGridSelect : TWideStringList;
|
FDataGridSort: TOrderColArray;
|
||||||
FDataGridSort : TOrderColArray;
|
FDataGridFocusedNodeIndex: Cardinal;
|
||||||
FDataGridFocusedNodeIndex : Cardinal;
|
|
||||||
FDataGridFocusedColumnIndex: TColumnIndex;
|
FDataGridFocusedColumnIndex: TColumnIndex;
|
||||||
DataGridCurrentSelect,
|
DataGridCurrentSelect: String;
|
||||||
DataGridCurrentFullSelect,
|
DataGridCurrentFullSelect: String;
|
||||||
DataGridCurrentFrom,
|
DataGridCurrentFrom: String;
|
||||||
DataGridCurrentFilter,
|
DataGridCurrentFilter: String;
|
||||||
DataGridCurrentSort : String;
|
DataGridCurrentSort: String;
|
||||||
btnAddTab : TPngSpeedButton;
|
DataGridDB: String;
|
||||||
QueryTabs : TObjectList;
|
DataGridTable: String;
|
||||||
|
DataGridHasChanges: Boolean;
|
||||||
|
DataGridResult: TGridResult;
|
||||||
SelectedTableCreateStatement: String;
|
SelectedTableCreateStatement: String;
|
||||||
|
SelectedTableColumns: TTableColumnList;
|
||||||
|
SelectedTableKeys: TTableKeyList;
|
||||||
|
SelectedTableForeignKeys: TForeignKeyList;
|
||||||
|
FilterPanelManuallyOpened: Boolean;
|
||||||
|
PrevTableColWidths: TWideStringList;
|
||||||
|
|
||||||
|
// Executable file details
|
||||||
|
AppVerMajor: Integer;
|
||||||
|
AppVerMinor: Integer;
|
||||||
|
AppVerRelease: Integer;
|
||||||
|
AppVerRevision: Integer;
|
||||||
|
AppVersion: String;
|
||||||
|
AppDescription: String;
|
||||||
|
|
||||||
|
// Common directories
|
||||||
|
DirnameCommonAppData: String;
|
||||||
|
DirnameUserAppData: String;
|
||||||
|
DirnameSnippets: String;
|
||||||
|
DirnameSessionLogs: String;
|
||||||
|
|
||||||
property Delimiter: String read FDelimiter write SetDelimiter;
|
property Delimiter: String read FDelimiter write SetDelimiter;
|
||||||
procedure CallSQLHelpWithKeyword( keyword: String );
|
procedure CallSQLHelpWithKeyword( keyword: String );
|
||||||
@ -819,14 +839,11 @@ type
|
|||||||
procedure PopupQueryLoadRemoveAbsentFiles( sender: TObject );
|
procedure PopupQueryLoadRemoveAbsentFiles( sender: TObject );
|
||||||
procedure SessionConnect(Sender: TObject);
|
procedure SessionConnect(Sender: TObject);
|
||||||
function InitConnection(parHost, parSocketname, parPort, parUser, parPass, parCompress, parSession: String): Boolean;
|
function InitConnection(parHost, parSocketname, parPort, parUser, parPass, parCompress, parSession: String): Boolean;
|
||||||
|
|
||||||
function ActiveGrid: TVirtualStringTree;
|
function ActiveGrid: TVirtualStringTree;
|
||||||
function GridResult(Grid: TBaseVirtualTree): TGridResult; overload;
|
function GridResult(Grid: TBaseVirtualTree): TGridResult; overload;
|
||||||
function GridResult(PageIndex: Integer): TGridResult; overload;
|
function GridResult(PageIndex: Integer): TGridResult; overload;
|
||||||
|
|
||||||
property ActiveDatabase : String read GetActiveDatabase write SetSelectedDatabase;
|
property ActiveDatabase : String read GetActiveDatabase write SetSelectedDatabase;
|
||||||
property SelectedTable : TDBObject read GetSelectedTable;
|
property SelectedTable : TDBObject read GetSelectedTable;
|
||||||
|
|
||||||
procedure TestVTreeDataArray( P: PVTreeDataArray );
|
procedure TestVTreeDataArray( P: PVTreeDataArray );
|
||||||
function GetVTreeDataArray( VT: TBaseVirtualTree ): PVTreeDataArray;
|
function GetVTreeDataArray( VT: TBaseVirtualTree ): PVTreeDataArray;
|
||||||
procedure ActivateFileLogging;
|
procedure ActivateFileLogging;
|
||||||
@ -863,27 +880,10 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
MainForm : TMainForm;
|
MainForm: TMainForm;
|
||||||
AppVerMajor, AppVerMinor, AppVerRelease, AppVerRevision: Integer;
|
|
||||||
AppVersion, AppDescription: String;
|
|
||||||
DirnameCommonAppData,
|
|
||||||
DirnameUserAppData,
|
|
||||||
DirnameSnippets,
|
|
||||||
DirnameSessionLogs : String;
|
|
||||||
|
|
||||||
const
|
const
|
||||||
discname = 'not connected';
|
// Customized messages
|
||||||
ICON_MYSELF_CONNECTED = 38;
|
|
||||||
ICON_MYSELF_DISCONNECTED = -1;
|
|
||||||
ICON_OTHER_CONNECTED = 36;
|
|
||||||
ICON_OTHER_DISCONNECTED = -1;
|
|
||||||
// The InnoDB folks are raging over the lack of count(*) support
|
|
||||||
// in the storage engine. To avoid count(*), the first of these
|
|
||||||
// constants decide how many rows the data area should estimate
|
|
||||||
// in any table. The second value decides how many percent above the
|
|
||||||
// number of seen (or simulated) rows the scrollbar should project.
|
|
||||||
SIMULATE_INITIAL_ROWS = 10000;
|
|
||||||
SIMULATE_MORE_ROWS = 20;
|
|
||||||
MSG_UPDATECHECK = WM_USER + 1;
|
MSG_UPDATECHECK = WM_USER + 1;
|
||||||
MSG_ABOUT = WM_USER + 2;
|
MSG_ABOUT = WM_USER + 2;
|
||||||
|
|
||||||
@ -1194,8 +1194,6 @@ begin
|
|||||||
// Folder for session logfiles
|
// Folder for session logfiles
|
||||||
DirnameSessionLogs := DirnameUserAppData + 'Sessionlogs\';
|
DirnameSessionLogs := DirnameUserAppData + 'Sessionlogs\';
|
||||||
|
|
||||||
TemporaryDatabase := '';
|
|
||||||
|
|
||||||
// SQLFiles-History
|
// SQLFiles-History
|
||||||
FillPopupQueryLoad;
|
FillPopupQueryLoad;
|
||||||
|
|
||||||
@ -2554,7 +2552,6 @@ var
|
|||||||
begin
|
begin
|
||||||
// Refresh
|
// Refresh
|
||||||
// Force data tab update when appropriate.
|
// Force data tab update when appropriate.
|
||||||
dataselected := false;
|
|
||||||
tab1 := PageControlMain.ActivePage;
|
tab1 := PageControlMain.ActivePage;
|
||||||
if ActiveControl = DBtree then
|
if ActiveControl = DBtree then
|
||||||
RefreshTree(True)
|
RefreshTree(True)
|
||||||
@ -3272,7 +3269,6 @@ begin
|
|||||||
if (SelectedTable.Name = '') or (ActiveDatabase = '') then
|
if (SelectedTable.Name = '') or (ActiveDatabase = '') then
|
||||||
Exit;
|
Exit;
|
||||||
Screen.Cursor := crHourglass;
|
Screen.Cursor := crHourglass;
|
||||||
viewingdata := true;
|
|
||||||
sl_query := TWideStringList.Create();
|
sl_query := TWideStringList.Create();
|
||||||
|
|
||||||
// Ensure grid has left editing mode so DataGrid.OnNewText applies its changes
|
// Ensure grid has left editing mode so DataGrid.OnNewText applies its changes
|
||||||
@ -3399,8 +3395,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
debug('mem: browse row initialization complete.');
|
debug('mem: browse row initialization complete.');
|
||||||
|
|
||||||
dataselected := true;
|
|
||||||
|
|
||||||
PageControlMainChange(Self);
|
PageControlMainChange(Self);
|
||||||
finally
|
finally
|
||||||
DataGrid.Header.Columns.EndUpdate;
|
DataGrid.Header.Columns.EndUpdate;
|
||||||
@ -3418,7 +3412,6 @@ begin
|
|||||||
SelectNode(DataGrid, FDataGridFocusedNodeIndex);
|
SelectNode(DataGrid, FDataGridFocusedNodeIndex);
|
||||||
if DataGrid.Header.Columns.Count > FDataGridFocusedColumnIndex then
|
if DataGrid.Header.Columns.Count > FDataGridFocusedColumnIndex then
|
||||||
DataGrid.FocusedColumn := FDataGridFocusedColumnIndex;
|
DataGrid.FocusedColumn := FDataGridFocusedColumnIndex;
|
||||||
viewingdata := false;
|
|
||||||
EnumerateRecentFilters;
|
EnumerateRecentFilters;
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
end;
|
end;
|
||||||
@ -3828,7 +3821,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// Avoid excessive GridHighlightChanged() when flicking controls.
|
// Avoid excessive GridHighlightChanged() when flicking controls.
|
||||||
viewingdata := true;
|
|
||||||
ProgressBarStatus.Hide;
|
ProgressBarStatus.Hide;
|
||||||
|
|
||||||
if Assigned(Results) and Results.HasResult then begin
|
if Assigned(Results) and Results.HasResult then begin
|
||||||
@ -3883,7 +3875,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
// Ensure controls are in a valid state
|
// Ensure controls are in a valid state
|
||||||
ValidateControls(Sender);
|
ValidateControls(Sender);
|
||||||
viewingdata := false;
|
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
ShowStatus( STATUS_MSG_READY );
|
ShowStatus( STATUS_MSG_READY );
|
||||||
end;
|
end;
|
||||||
@ -8499,8 +8490,6 @@ var
|
|||||||
begin
|
begin
|
||||||
// Set window caption and taskbar text
|
// Set window caption and taskbar text
|
||||||
Cap := SessionName;
|
Cap := SessionName;
|
||||||
if WindowNumber <> 0 then
|
|
||||||
Cap := Cap + Format( ' (%d)', [WindowNumber] );
|
|
||||||
if ActiveDatabase <> '' then
|
if ActiveDatabase <> '' then
|
||||||
Cap := Cap + ' /' + ActiveDatabase;
|
Cap := Cap + ' /' + ActiveDatabase;
|
||||||
if SelectedTable.Name <> '' then
|
if SelectedTable.Name <> '' then
|
||||||
|
@ -293,7 +293,7 @@ begin
|
|||||||
Mainform.ActivateFileLogging
|
Mainform.ActivateFileLogging
|
||||||
else if Mainform.prefLogToFile then
|
else if Mainform.prefLogToFile then
|
||||||
Mainform.DeactivateFileLogging;
|
Mainform.DeactivateFileLogging;
|
||||||
btnOpenLogFolder.Enabled := DirectoryExists(DirnameSessionLogs);
|
btnOpenLogFolder.Enabled := DirectoryExists(Mainform.DirnameSessionLogs);
|
||||||
Mainform.prefMaxColWidth := updownMaxColWidth.Position;
|
Mainform.prefMaxColWidth := updownMaxColWidth.Position;
|
||||||
Mainform.prefMaxTotalRows := maxrows;
|
Mainform.prefMaxTotalRows := maxrows;
|
||||||
Mainform.prefCSVSeparator := editCSVSeparator.Text;
|
Mainform.prefCSVSeparator := editCSVSeparator.Text;
|
||||||
@ -392,7 +392,7 @@ begin
|
|||||||
|
|
||||||
// Log to file
|
// Log to file
|
||||||
chkLogToFile.Checked := GetRegValue(REGNAME_LOGTOFILE, DEFAULT_LOGTOFILE);
|
chkLogToFile.Checked := GetRegValue(REGNAME_LOGTOFILE, DEFAULT_LOGTOFILE);
|
||||||
btnOpenLogFolder.Enabled := DirectoryExists(DirnameSessionLogs);
|
btnOpenLogFolder.Enabled := DirectoryExists(Mainform.DirnameSessionLogs);
|
||||||
|
|
||||||
// SQL:
|
// SQL:
|
||||||
Mainform.SetupSynEditors;
|
Mainform.SetupSynEditors;
|
||||||
@ -475,7 +475,7 @@ end;
|
|||||||
}
|
}
|
||||||
procedure Toptionsform.btnOpenLogFolderClick(Sender: TObject);
|
procedure Toptionsform.btnOpenLogFolderClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ShellExec( '', DirnameSessionLogs );
|
ShellExec( '', Mainform.DirnameSessionLogs );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{**
|
{**
|
||||||
|
@ -961,7 +961,7 @@ begin
|
|||||||
WideFormat('# %-30s%s', ['Database:', DBObj.Database]) + CRLF +
|
WideFormat('# %-30s%s', ['Database:', DBObj.Database]) + CRLF +
|
||||||
WideFormat('# %-30s%s', ['Server version:', Mainform.Connection.ServerVersionUntouched]) + CRLF +
|
WideFormat('# %-30s%s', ['Server version:', Mainform.Connection.ServerVersionUntouched]) + CRLF +
|
||||||
WideFormat('# %-30s%s', ['Server OS:', Mainform.Connection.GetVar('SHOW VARIABLES LIKE ' + esc('version_compile_os'), 1)]) + CRLF +
|
WideFormat('# %-30s%s', ['Server OS:', Mainform.Connection.GetVar('SHOW VARIABLES LIKE ' + esc('version_compile_os'), 1)]) + CRLF +
|
||||||
WideFormat('# %-30s%s', [APPNAME + ' version:', AppVersion]) + CRLF +
|
WideFormat('# %-30s%s', [APPNAME + ' version:', Mainform.AppVersion]) + CRLF +
|
||||||
WideFormat('# %-30s%s', ['Date/time:', DateTimeToStr(Now)]) + CRLF +
|
WideFormat('# %-30s%s', ['Date/time:', DateTimeToStr(Now)]) + CRLF +
|
||||||
'# --------------------------------------------------------' + CRLF + CRLF +
|
'# --------------------------------------------------------' + CRLF + CRLF +
|
||||||
'/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' + CRLF +
|
'/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;' + CRLF +
|
||||||
|
@ -104,8 +104,8 @@ begin
|
|||||||
|
|
||||||
// Prepare download
|
// Prepare download
|
||||||
CheckfileDownload := TDownLoadURL2.Create(Self);
|
CheckfileDownload := TDownLoadURL2.Create(Self);
|
||||||
CheckfileDownload.SetUserAgent(APPNAME + ' ' + AppVersion + ' update checker tool');
|
CheckfileDownload.SetUserAgent(APPNAME + ' ' + Mainform.AppVersion + ' update checker tool');
|
||||||
CheckfileDownload.URL := APPDOMAIN + 'updatecheck.php?r='+IntToStr(AppVerRevision);
|
CheckfileDownload.URL := APPDOMAIN + 'updatecheck.php?r='+IntToStr(Mainform.AppVerRevision);
|
||||||
CheckfileDownload.Filename := GetTempDir + APPNAME + '_updatecheck.ini';
|
CheckfileDownload.Filename := GetTempDir + APPNAME + '_updatecheck.ini';
|
||||||
|
|
||||||
// Download the check file
|
// Download the check file
|
||||||
@ -117,9 +117,9 @@ begin
|
|||||||
ReadCheckFile;
|
ReadCheckFile;
|
||||||
// Developer versions probably have "unknown" (0) as revision,
|
// Developer versions probably have "unknown" (0) as revision,
|
||||||
// which makes it impossible to compare the revisions.
|
// which makes it impossible to compare the revisions.
|
||||||
if AppVerRevision = 0 then
|
if Mainform.AppVerRevision = 0 then
|
||||||
Status('Error: Cannot determine current revision. Using a developer version?')
|
Status('Error: Cannot determine current revision. Using a developer version?')
|
||||||
else if AppVerRevision = BuildRevision then
|
else if Mainform.AppVerRevision = BuildRevision then
|
||||||
Status('Your '+APPNAME+' is up-to-date (no update available).')
|
Status('Your '+APPNAME+' is up-to-date (no update available).')
|
||||||
else if groupRelease.Enabled or btnBuild.Enabled then
|
else if groupRelease.Enabled or btnBuild.Enabled then
|
||||||
Status('Updates available.');
|
Status('Updates available.');
|
||||||
@ -166,14 +166,14 @@ begin
|
|||||||
ReleaseVersion := Ini.ReadString(INISECT_RELEASE, 'Version', 'unknown');
|
ReleaseVersion := Ini.ReadString(INISECT_RELEASE, 'Version', 'unknown');
|
||||||
ReleaseRevision := Ini.ReadInteger(INISECT_RELEASE, 'Revision', 0);
|
ReleaseRevision := Ini.ReadInteger(INISECT_RELEASE, 'Revision', 0);
|
||||||
ReleaseURL := Ini.ReadString(INISECT_RELEASE, 'URL', '');
|
ReleaseURL := Ini.ReadString(INISECT_RELEASE, 'URL', '');
|
||||||
memoRelease.Lines.Add( 'Version ' + ReleaseVersion + ' (yours: '+AppVersion+')' );
|
memoRelease.Lines.Add( 'Version ' + ReleaseVersion + ' (yours: '+Mainform.AppVersion+')' );
|
||||||
memoRelease.Lines.Add( 'Released: ' + Ini.ReadString(INISECT_RELEASE, 'Date', '') );
|
memoRelease.Lines.Add( 'Released: ' + Ini.ReadString(INISECT_RELEASE, 'Date', '') );
|
||||||
Note := Ini.ReadString(INISECT_RELEASE, 'Note', '');
|
Note := Ini.ReadString(INISECT_RELEASE, 'Note', '');
|
||||||
if Note <> '' then
|
if Note <> '' then
|
||||||
memoRelease.Lines.Add( 'Note: ' + Note );
|
memoRelease.Lines.Add( 'Note: ' + Note );
|
||||||
btnRelease.Caption := 'Download version ' + ReleaseVersion;
|
btnRelease.Caption := 'Download version ' + ReleaseVersion;
|
||||||
// Enable the download button if the current version is outdated
|
// Enable the download button if the current version is outdated
|
||||||
groupRelease.Enabled := ReleaseRevision > AppVerRevision;
|
groupRelease.Enabled := ReleaseRevision > Mainform.AppVerRevision;
|
||||||
btnRelease.Enabled := groupRelease.Enabled;
|
btnRelease.Enabled := groupRelease.Enabled;
|
||||||
memoRelease.Enabled := groupRelease.Enabled;
|
memoRelease.Enabled := groupRelease.Enabled;
|
||||||
if not memoRelease.Enabled then
|
if not memoRelease.Enabled then
|
||||||
@ -187,7 +187,7 @@ begin
|
|||||||
BuildRevision := Ini.ReadInteger(INISECT_BUILD, 'Revision', 0);
|
BuildRevision := Ini.ReadInteger(INISECT_BUILD, 'Revision', 0);
|
||||||
BuildURL := Ini.ReadString(INISECT_BUILD, 'URL', '');
|
BuildURL := Ini.ReadString(INISECT_BUILD, 'URL', '');
|
||||||
BuildSize := Ini.ReadInteger(INISECT_BUILD, 'Size', 0);
|
BuildSize := Ini.ReadInteger(INISECT_BUILD, 'Size', 0);
|
||||||
memoBuild.Lines.Add( 'Revision ' + IntToStr(BuildRevision) + ' (yours: '+IntToStr(AppVerRevision)+')' );
|
memoBuild.Lines.Add( 'Revision ' + IntToStr(BuildRevision) + ' (yours: '+IntToStr(Mainform.AppVerRevision)+')' );
|
||||||
FileAge(ParamStr(0), Compiled);
|
FileAge(ParamStr(0), Compiled);
|
||||||
memoBuild.Lines.Add( 'Compiled: ' + Ini.ReadString(INISECT_BUILD, 'Date', '') + ' (yours: '+DateToStr(Compiled)+')' );
|
memoBuild.Lines.Add( 'Compiled: ' + Ini.ReadString(INISECT_BUILD, 'Date', '') + ' (yours: '+DateToStr(Compiled)+')' );
|
||||||
Note := Ini.ReadString(INISECT_BUILD, 'Note', '');
|
Note := Ini.ReadString(INISECT_BUILD, 'Note', '');
|
||||||
@ -197,7 +197,7 @@ begin
|
|||||||
// A new release should have priority over a new nightly build.
|
// A new release should have priority over a new nightly build.
|
||||||
// So the user should not be able to download a newer build here
|
// So the user should not be able to download a newer build here
|
||||||
// before having installed the new release.
|
// before having installed the new release.
|
||||||
btnBuild.Enabled := (AppVerRevision = 0) or ((BuildRevision > AppVerRevision) and (not btnRelease.Enabled));
|
btnBuild.Enabled := (Mainform.AppVerRevision = 0) or ((BuildRevision > Mainform.AppVerRevision) and (not btnRelease.Enabled));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user