Permalink
Browse files

Inform the user via dialog after changing critical settings, or setti…

…ngs which just need a restart to apply. A restart could have a healing effect on #410.
  • Loading branch information...
ansgarbecker committed Dec 4, 2018
1 parent 151862b commit 573055e662fddf512c784b3318d422b017087ee1
Showing with 36 additions and 7 deletions.
  1. +4 −1 out/locale/en/LC_MESSAGES/default.po
  2. +12 −6 source/options.dfm
  3. +20 −0 source/options.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2018-11-29 13:09+0100\n"
"PO-Revision-Date: 2018-12-04 20:04+0100\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -6278,3 +6278,6 @@ msgstr "%0:d out of %1:d matching. %2:d hidden."
msgid "Style Theme:"
msgstr "Style Theme:"
msgid "You should restart %s to apply changed critical settings, and to prevent unexpected behaviour."
msgstr "You should restart %s to apply changed critical settings, and to prevent unexpected behaviour."
@@ -9,6 +9,7 @@ object optionsform: Toptionsform
ParentFont = True
OldCreateOrder = False
Position = poMainFormCenter
OnClose = FormClose
OnCreate = FormCreate
OnShow = FormShow
DesignSize = (
@@ -54,9 +55,9 @@ object optionsform: Toptionsform
object lblLanguage: TLabel
Left = 8
Top = 282
Width = 189
Width = 112
Height = 13
Caption = 'Application language (requires restart):'
Caption = 'Application language: *'
end
object lblCustomSnippetsDirectory: TLabel
Left = 8
@@ -68,9 +69,9 @@ object optionsform: Toptionsform
object lblGUIFont: TLabel
Left = 8
Top = 309
Width = 131
Width = 54
Height = 13
Caption = 'GUI font (requires restart):'
Caption = 'GUI font: *'
end
object lblGUIFontSize: TLabel
Left = 694
@@ -83,9 +84,9 @@ object optionsform: Toptionsform
object lblTheme: TLabel
Left = 8
Top = 336
Width = 63
Width = 72
Height = 13
Caption = 'Style Theme:'
Caption = 'Style Theme: *'
end
object chkAutoReconnect: TCheckBox
Left = 8
@@ -208,6 +209,7 @@ object optionsform: Toptionsform
OnRightButtonClick = editMySQLBinariesRightButtonClick
end
object comboAppLanguage: TComboBox
Tag = 1
Left = 272
Top = 279
Width = 435
@@ -234,6 +236,7 @@ object optionsform: Toptionsform
OnRightButtonClick = editCustomSnippetsDirectoryRightButtonClick
end
object comboGUIFont: TComboBox
Tag = 1
Left = 272
Top = 306
Width = 334
@@ -244,6 +247,7 @@ object optionsform: Toptionsform
OnChange = comboGUIFontChange
end
object editGUIFontSize: TEdit
Tag = 1
Left = 612
Top = 306
Width = 57
@@ -254,6 +258,7 @@ object optionsform: Toptionsform
OnChange = Modified
end
object updownGUIFontSize: TUpDown
Tag = 1
Left = 669
Top = 306
Width = 16
@@ -276,6 +281,7 @@ object optionsform: Toptionsform
OnClick = Modified
end
object comboTheme: TComboBox
Tag = 1
Left = 272
Top = 333
Width = 435
@@ -197,12 +197,15 @@ Toptionsform = class(TForm)
procedure comboGUIFontChange(Sender: TObject);
procedure chkQueryHistoryClick(Sender: TObject);
procedure comboEditorColorsPresetChange(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
FWasModified: Boolean;
FShortcutCategories: TStringList;
FGridTextColors: Array[dtcInteger..dtcOther] of TColor;
FLanguages: TStringList;
FRestartOptionTouched: Boolean;
FRestartOptionApplied: Boolean;
procedure InitLanguages;
procedure SelectDirectory(Sender: TObject; NewFolderButton: Boolean);
public
@@ -222,6 +225,9 @@ procedure Toptionsform.Modified(Sender: TObject);
begin
// Modified
btnApply.Enabled := True;
if (Sender is TComponent) and (TComponent(Sender).Tag <> 0) then begin
FRestartOptionTouched := True;
end;
end;
@@ -399,6 +405,9 @@ procedure Toptionsform.Apply(Sender: TObject);
Mainform.ListProcesses.Invalidate;
Mainform.ListCommandStats.Invalidate;
FRestartOptionApplied := FRestartOptionTouched;
// Settings have been applied, send a signal to the user
btnApply.Enabled := False;
Screen.Cursor := crDefault;
@@ -419,6 +428,16 @@ function EnumFixedProc(
end;
procedure Toptionsform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FRestartOptionApplied then begin
MessageDialog(f_('You should restart %s to apply changed critical settings, and to prevent unexpected behaviour.', [APPNAME]),
mtInformation,
[mbOk]);
end;
end;
procedure Toptionsform.FormCreate(Sender: TObject);
var
i: Integer;
@@ -601,6 +620,7 @@ procedure Toptionsform.FormShow(Sender: TObject);
TreeShortcutItems.ReinitChildren(nil, True);
SelectNode(TreeShortcutItems, nil);
FRestartOptionTouched := False;
btnApply.Enabled := False;
screen.Cursor := crdefault;
end;

0 comments on commit 573055e

Please sign in to comment.