forked from HeidiSQL/HeidiSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheidisql.lpr
More file actions
88 lines (74 loc) · 3.36 KB
/
heidisql.lpr
File metadata and controls
88 lines (74 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
program heidisql;
{$mode delphi}{$H+}
uses
{$IFDEF UNIX} cthreads, {$ENDIF}
{$IFDEF DARWIN} iosxlocale, {$ENDIF}
Interfaces, // this includes the LCL widgetset
{$IFDEF WINDOWS} uMetaDarkStyle, uDarkStyleParams, uDarkStyleSchemes, {$ENDIF}
SysUtils, Dialogs,
Forms, printer4lazarus, datetimectrls, LCLTranslator, Translations,
{ you can add units after this }
main, apphelpers, dbconnection, generic_types;
{$R *.res}
var
AppLanguage: String;
WasDarkMode: Boolean;
begin
PostponedLogItems := TDBLogItems.Create(True);
Application.{%H-}MainFormOnTaskBar := True; // hide warning: Symbol "MainFormOnTaskBar" is not portable
// Use MySQL standard format for date/time variables: YYYY-MM-DD HH:MM:SS
// Be aware that Delphi internally converts the slashes in ShortDateFormat to the DateSeparator
Application.{%H-}UpdateFormatSettings := False;
DefaultFormatSettings.DateSeparator := '-';
DefaultFormatSettings.TimeSeparator := ':';
DefaultFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
DefaultFormatSettings.LongTimeFormat := 'hh:nn:ss';
// Issue #2189 and #2325:
// Auto-replace French and Russian non-breaking white space, broken through the Char type
// DefaultFormatSettings.ThousandSeparator:= #160;
if DefaultFormatSettings.ThousandSeparator in [#226, #160] then
DefaultFormatSettings.ThousandSeparator := ' ';
// Issue #2366:
// https://wiki.freepascal.org/Locale_settings_for_macOS
// On macOS, initializing locale settings through iosxlocale mostly does not work, so we do it hardcoded here:
if DefaultFormatSettings.DecimalSeparator = #0 then
DefaultFormatSettings.DecimalSeparator := '.';
if DefaultFormatSettings.ThousandSeparator = #0 then
DefaultFormatSettings.ThousandSeparator := ' ';
AppSettings := TAppSettings.Create;
AppLanguage := AppSettings.ReadString(asAppLanguage);
// SysLanguage may be zh_CN, while we don't offer such a language, but anyway, this is just the current system language:
SysLanguage := GetLanguageID.LanguageCode;
LCLTranslator.SetDefaultLang(AppLanguage, '', GetApplicationName);
InitMoFile(AppLanguage);
RequireDerivedFormResource:=True;
Application.Scaled:=True;
AppColorSchemes := TAppColorSchemes.Create(True);
{$IFDEF WINDOWS}
PreferredAppMode := pamAllowDark;
case AppSettings.ReadInt(asThemeMode) of
// 0: dark mode based on Windows setting
0: if AppSettings.IsWindowsDarkApps then PreferredAppMode := pamForceDark;
// 1: light, no change required, leave pamAllowDark
2: PreferredAppMode := pamForceDark;
end;
if PreferredAppMode = pamForceDark then
uMetaDarkStyle.ApplyMetaDarkStyle(DefaultDark);
{$ENDIF}
// Switch synedit and grid colors to dark mode and vice versa
WasDarkMode := AppSettings.ReadBool(asCurrentThemeIsDark);
if (not WasDarkMode) and ThemeIsDark then
AppColorSchemes.ApplyDark
else if WasDarkMode and (not ThemeIsDark) then
AppColorSchemes.ApplyLight;
AppSettings.WriteBool(asCurrentThemeIsDark, ThemeIsDark);
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.OnException := MainForm.ApplicationException;
MainForm.AfterFormCreate;
Application.OnDeactivate := MainForm.ApplicationDeActivate;
Application.OnIdle := MainForm.ApplicationIdle;
Application.OnShortcut := MainForm.ApplicationShortCut;
Application.OnShowHint := MainForm.ApplicationShowHint;
Application.Run;
end.