Skip to content
Permalink
Browse files

Issue #140: add "Files" tab to preferences dialog, move "Prompt for f…

…ile save" checkbox there, and introduce two new checkboxes for restoring opened and unsaved query tab contents (both new yet without functionality in their back)
  • Loading branch information...
ansgarbecker committed Mar 17, 2019
1 parent 3975db0 commit 0fb341bb88f3c07899584d43b65dd99561b10d49
Showing with 91 additions and 40 deletions.
  1. +7 −1 out/locale/en/LC_MESSAGES/default.po
  2. +3 −1 source/apphelpers.pas
  3. +2 −0 source/const.inc
  4. +62 −35 source/options.dfm
  5. +17 −3 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: 2019-03-14 21:10+0100\n"
"PO-Revision-Date: 2019-03-17 11:54+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"
@@ -2743,6 +2743,12 @@ msgstr "Tabs to spaces"
msgid "Prompt to save modified files on tab close"
msgstr "Prompt to save modified files on tab close"

msgid "Reopen previously used SQL files in tabs"
msgstr "Reopen previously used SQL files in tabs"

msgid "Automatically backup and restore unsaved content (up to %s per file)"
msgstr "Automatically backup and restore unsaved content (up to %s per file)"

msgid "Show query warnings dialog"
msgstr "Show query warnings dialog"

@@ -168,7 +168,7 @@ TQueryThread = class(TThread)
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asMySQLBinaries, asCustomSnippetsDirectory,
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage,
asPromptSaveFileOnTabClose, asReopenFiles, asBackupRestoreFiles, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack,
@@ -3615,6 +3615,8 @@ constructor TAppSettings.Create;
DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\';
InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
InitSetting(asReopenFiles, 'ReopenFiles', 0, True);
InitSetting(asBackupRestoreFiles, 'BackupRestoreFiles', 0, True);
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
@@ -82,6 +82,8 @@ const
// Data grid: How many bytes to fetch from data fields that are potentially large.
GRIDMAXDATA: Integer = 256;

BACKUP_MAXFILESIZE: Integer = 10 * SIZE_MB;

VTREE_NOTLOADED = 0;
VTREE_NOTLOADED_PURGECACHE = 1;
VTREE_LOADED = 2;
@@ -568,28 +568,28 @@ object optionsform: Toptionsform
end
object lblSQLColElement: TLabel
Left = 8
Top = 220
Top = 186
Width = 42
Height = 13
Caption = 'Element:'
end
object lblSQLColBackground: TLabel
Left = 180
Top = 314
Top = 280
Width = 60
Height = 13
Caption = 'Background:'
end
object lblSQLColForeground: TLabel
Left = 180
Top = 267
Top = 233
Width = 60
Height = 13
Caption = 'Foreground:'
end
object lblEditorColorsPreset: TLabel
Left = 8
Top = 193
Top = 159
Width = 68
Height = 13
Caption = 'Colors preset:'
@@ -659,18 +659,6 @@ object optionsform: Toptionsform
TabOrder = 4
OnClick = updownSQLFontSizeClick
end
object chkAskFileSave: TCheckBox
Left = 180
Top = 111
Width = 506
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt to save modified files on tab close'
Checked = True
State = cbChecked
TabOrder = 9
OnClick = Modified
end
object editMaxQueryResults: TEdit
Left = 180
Top = 61
@@ -693,55 +681,55 @@ object optionsform: Toptionsform
end
object comboSQLColElement: TComboBox
Left = 180
Top = 217
Top = 183
Width = 145
Height = 21
Style = csDropDownList
TabOrder = 13
TabOrder = 12
OnChange = comboSQLColElementChange
end
object chkSQLBold: TCheckBox
Left = 180
Top = 244
Top = 210
Width = 61
Height = 17
Caption = 'Bold'
TabOrder = 14
TabOrder = 13
OnClick = SQLFontChange
end
object chkSQLItalic: TCheckBox
Left = 254
Top = 244
Top = 210
Width = 50
Height = 17
Caption = 'Italic'
TabOrder = 15
TabOrder = 14
OnClick = SQLFontChange
end
object cboxSQLColForeground: TColorBox
Left = 180
Top = 286
Top = 252
Width = 145
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
TabOrder = 16
TabOrder = 15
OnChange = SQLFontChange
end
object cboxSQLColBackground: TColorBox
Left = 180
Top = 333
Top = 299
Width = 145
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
TabOrder = 17
TabOrder = 16
OnChange = SQLFontChange
end
object SynMemoSQLSample: TSynMemo
AlignWithMargins = True
Left = 331
Top = 190
Top = 156
Width = 364
Height = 191
Height = 229
Cursor = crHandPoint
SingleLineMode = False
Anchors = [akLeft, akTop, akRight, akBottom]
@@ -750,7 +738,7 @@ object optionsform: Toptionsform
Font.Height = -13
Font.Name = 'Courier New'
Font.Style = []
TabOrder = 18
TabOrder = 17
OnClick = SynMemoSQLSampleClick
CodeFolding.GutterShapeSize = 11
CodeFolding.CollapsedLineColor = clGrayText
@@ -780,32 +768,32 @@ object optionsform: Toptionsform
end
object chkQueryWarningsMessage: TCheckBox
Left = 180
Top = 134
Top = 110
Width = 508
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Show query warnings dialog'
TabOrder = 10
TabOrder = 9
OnClick = Modified
end
object chkAutoUppercase: TCheckBox
Left = 180
Top = 159
Top = 133
Width = 508
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Auto uppercase reserved words and functions'
TabOrder = 11
TabOrder = 10
OnClick = Modified
end
object comboEditorColorsPreset: TComboBox
Left = 180
Top = 190
Top = 156
Width = 145
Height = 21
Style = csDropDownList
ItemIndex = 0
TabOrder = 12
TabOrder = 11
Text = 'Current custom settings'
OnChange = comboEditorColorsPresetChange
Items.Strings = (
@@ -1250,6 +1238,45 @@ object optionsform: Toptionsform
end
end
end
object tabFiles: TTabSheet
Caption = 'Files'
ImageIndex = 10
DesignSize = (
700
388)
object chkReopenFiles: TCheckBox
Left = 190
Top = 31
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Reopen previously used SQL files in tabs'
TabOrder = 0
end
object chkAskFileSave: TCheckBox
Left = 190
Top = 8
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Prompt to save modified files on tab close'
Checked = True
State = cbChecked
TabOrder = 1
OnClick = Modified
end
object chkBackupRestoreFiles: TCheckBox
Left = 190
Top = 54
Width = 496
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption =
'Automatically backup and restore unsaved content (up to %s per f' +
'ile)'
TabOrder = 2
end
end
end
object btnCancel: TButton
Left = 561
@@ -98,7 +98,6 @@ Toptionsform = class(TFormWithSizeGrip)
editSQLTabWidth: TEdit;
updownSQLTabWidth: TUpDown;
Label1: TLabel;
chkAskFileSave: TCheckBox;
lblMaxQueryResults: TLabel;
editMaxQueryResults: TEdit;
updownMaxQueryResults: TUpDown;
@@ -169,6 +168,10 @@ Toptionsform = class(TFormWithSizeGrip)
comboGridTextColorsPreset: TComboBox;
lblIconPack: TLabel;
comboIconPack: TComboBox;
tabFiles: TTabSheet;
chkReopenFiles: TCheckBox;
chkAskFileSave: TCheckBox;
chkBackupRestoreFiles: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@@ -279,7 +282,6 @@ procedure Toptionsform.Apply(Sender: TObject);
AppSettings.WriteBool(asAutoReconnect, chkAutoReconnect.Checked);
AppSettings.WriteBool(asAllowMultipleInstances, chkAllowMultiInstances.Checked);
AppSettings.WriteBool(asRestoreLastUsedDB, chkRestoreLastDB.Checked);
AppSettings.WriteBool(asPromptSaveFileOnTabClose, chkAskFileSave.Checked);
AppSettings.WriteBool(asQueryWarningsMessage, chkQueryWarningsMessage.Checked);
AppSettings.WriteString(asFontName, comboSQLFontName.Text);
AppSettings.WriteInt(asFontSize, updownSQLFontSize.Position);
@@ -398,6 +400,11 @@ procedure Toptionsform.Apply(Sender: TObject);
// Populate SynMemo settings to all instances
Mainform.SetupSynEditors;

// Files
AppSettings.WriteBool(asPromptSaveFileOnTabClose, chkAskFileSave.Checked);
AppSettings.WriteBool(asReopenFiles, chkReopenFiles.Checked);
AppSettings.WriteBool(asBackupRestoreFiles, chkBackupRestoreFiles.Checked);

// Set relevant properties in mainform
MainForm.ApplyFontToGrids;
MainForm.PrepareImageList;
@@ -591,6 +598,9 @@ procedure Toptionsform.FormCreate(Sender: TObject);
FShortcutCategories.Add(_('SQL editing'));
TreeShortcutItems.RootNodeCount := FShortcutCategories.Count;
comboLineBreakStyle.Items := Explode(',', _('Windows linebreaks')+','+_('UNIX linebreaks')+','+_('Mac OS linebreaks'));

// Files
chkBackupRestoreFiles.Caption := f_('Automatically backup and restore unsaved content (up to %s per file)', [FormatByteNumber(BACKUP_MAXFILESIZE,0)]);
end;


@@ -644,7 +654,6 @@ procedure Toptionsform.FormShow(Sender: TObject);
comboGUIFont.OnChange(comboGUIFont);
comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.ReadString(asTheme));
comboIconPack.ItemIndex := comboIconPack.Items.IndexOf(AppSettings.ReadString(asIconPack));
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage);

// Logging
@@ -718,6 +727,11 @@ procedure Toptionsform.FormShow(Sender: TObject);
TreeShortcutItems.ReinitChildren(nil, True);
SelectNode(TreeShortcutItems, nil);

// Files
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkReopenFiles.Checked := AppSettings.ReadBool(asReopenFiles);
chkBackupRestoreFiles.Checked := AppSettings.ReadBool(asBackupRestoreFiles);

FRestartOptionTouched := False;
btnApply.Enabled := False;
screen.Cursor := crdefault;

0 comments on commit 0fb341b

Please sign in to comment.
You can’t perform that action at this time.