Skip to content

Commit 3e21a9f

Browse files
committed
Add ShowFileHint setting and integrate into UI hints
1 parent eeb6c3f commit 3e21a9f

4 files changed

Lines changed: 58 additions & 23 deletions

src/Settings/RipGrepper.Settings.AppSettings.pas

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TAppSettings = class(TPersistableSettings, IIniPersistable)
3737
KEY_LOGFILEPATH = 'LogFilePath';
3838
KEY_LOGFILECREATIONMODE = 'LogFileCreationMode';
3939
KEY_LOGDESTINATIONS = 'LogDestinations';
40+
KEY_SHOW_FILE_HINT = 'ShowFileHint';
4041

4142
private
4243
FColorTheme : IStringSetting;
@@ -54,6 +55,7 @@ TAppSettings = class(TPersistableSettings, IIniPersistable)
5455
FLogFilePath : IStringSetting;
5556
FLogFileCreationMode : IIntegerSetting;
5657
FLogDestinations : IIntegerSetting;
58+
FShowFileHint : IBoolSetting;
5759
function GetColorTheme() : string;
5860
function GetComboHistoryCount() : Integer;
5961
function GetSearchHistoryCount() : Integer;
@@ -66,6 +68,7 @@ TAppSettings = class(TPersistableSettings, IIniPersistable)
6668
function GetLogFilePath() : string;
6769
function GetLogFileCreationMode() : ELogFileCreationMode;
6870
function GetLogDestinations() : TLogDestinations;
71+
function GetShowFileHint() : Boolean;
6972
function GetCheckNewVersionOnStartup : Boolean;
7073
procedure SetColorTheme(const Value : string);
7174
procedure SetComboHistoryCount(const Value : Integer);
@@ -78,6 +81,7 @@ TAppSettings = class(TPersistableSettings, IIniPersistable)
7881
procedure SetLogFilePath(const Value : string);
7982
procedure SetLogFileCreationMode(const Value : ELogFileCreationMode);
8083
procedure SetLogDestinations(const Value : TLogDestinations);
84+
procedure SetShowFileHint(const Value : Boolean);
8185
procedure SetCheckNewVersionOnStartup(const Value : Boolean);
8286

8387
protected
@@ -103,6 +107,7 @@ TAppSettings = class(TPersistableSettings, IIniPersistable)
103107
property LogFilePath : string read GetLogFilePath write SetLogFilePath;
104108
property LogFileCreationMode : ELogFileCreationMode read GetLogFileCreationMode write SetLogFileCreationMode;
105109
property LogDestinations : TLogDestinations read GetLogDestinations write SetLogDestinations;
110+
property ShowFileHint : Boolean read GetShowFileHint write SetShowFileHint;
106111
end;
107112

108113
implementation
@@ -213,6 +218,11 @@ function TAppSettings.GetLogDestinations() : TLogDestinations;
213218
end;
214219
end;
215220

221+
function TAppSettings.GetShowFileHint() : Boolean;
222+
begin
223+
Result := FShowFileHint.Value;
224+
end;
225+
216226
procedure TAppSettings.Init;
217227
begin
218228
var
@@ -233,6 +243,7 @@ procedure TAppSettings.Init;
233243
FLogFilePath := TStringSetting.Create(KEY_LOGFILEPATH, '');
234244
FLogFileCreationMode := TIntegerSetting.Create(KEY_LOGFILECREATIONMODE, Integer(lfcmAppend));
235245
FLogDestinations := TIntegerSetting.Create(KEY_LOGDESTINATIONS, LOG_DEST_FILE);
246+
FShowFileHint := TBoolSetting.Create(KEY_SHOW_FILE_HINT, True);
236247

237248
CreateSetting(FColorTheme);
238249
CreateSetting(FCopyToClipBoardShell);
@@ -248,6 +259,7 @@ procedure TAppSettings.Init;
248259
CreateSetting(FLogFilePath);
249260
CreateSetting(FLogFileCreationMode);
250261
CreateSetting(FLogDestinations);
262+
CreateSetting(FShowFileHint);
251263
end;
252264

253265
function TAppSettings.IsExpertMode(): Boolean;
@@ -326,6 +338,11 @@ procedure TAppSettings.SetLogDestinations(const Value : TLogDestinations);
326338
FLogDestinations.Value := v;
327339
end;
328340

341+
procedure TAppSettings.SetShowFileHint(const Value : Boolean);
342+
begin
343+
FShowFileHint.Value := Value;
344+
end;
345+
329346
procedure TAppSettings.UpdateSettingsFromInternals();
330347
begin
331348
FLoadHistoryMode.Value := FInternalLoadHistoryMode.ToString();

src/UI/RipGrepper.UI.MiddleFrame.pas

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,9 @@ procedure TRipGrepperMiddleFrame.VstResultGetHint(Sender : TBaseVirtualTree; Nod
17691769
end else
17701770
{$ENDIF}
17711771
begin
1772-
HintText := TFileHintBuilder.BuildFileNodeHint(filePath, Settings.NodeLookSettings.ShowRelativePath, Settings.NodeLookSettings.DateFormat);
1772+
if Settings.AppSettings.ShowFileHint then begin
1773+
HintText := TFileHintBuilder.BuildFileNodeHint(filePath, Settings.NodeLookSettings.ShowRelativePath, Settings.NodeLookSettings.DateFormat);
1774+
end;
17731775
end;
17741776
end;
17751777
end;
@@ -1781,7 +1783,9 @@ procedure TRipGrepperMiddleFrame.VstResultGetHint(Sender : TBaseVirtualTree; Nod
17811783
// Match node
17821784
case Column of
17831785
COL_FILE, COL_ROW_NUM, COL_COL_NUM : begin
1784-
HintText := TFileHintBuilder.BuildMatchNodeHint(nodeData);
1786+
if Settings.AppSettings.ShowFileHint then begin
1787+
HintText := TFileHintBuilder.BuildMatchNodeHint(nodeData);
1788+
end;
17851789
end;
17861790
COL_MATCH_TEXT : begin
17871791
HintText := nodeData.MatchData.LineText;

src/UI/RipGrepper.UI.Settings.ColorSettingsForm.dfm

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inherited ColorSettingsForm: TColorSettingsForm
3232
end
3333
object pnlTop: TPanel [2]
3434
Left = 0
35-
Top = 266
35+
Top = 280
3636
Width = 660
37-
Height = 156
37+
Height = 142
3838
Align = alClient
3939
BevelOuter = bvNone
4040
ShowCaption = False
@@ -45,15 +45,15 @@ inherited ColorSettingsForm: TColorSettingsForm
4545
Left = 3
4646
Top = 3
4747
Width = 654
48-
Height = 150
48+
Height = 136
4949
Align = alClient
5050
Caption = 'Fonts && Colors'
5151
TabOrder = 0
5252
object ScrollBox1: TScrollBox
5353
Left = 2
5454
Top = 17
5555
Width = 650
56-
Height = 131
56+
Height = 117
5757
Align = alClient
5858
BevelInner = bvNone
5959
BevelOuter = bvNone
@@ -66,7 +66,7 @@ inherited ColorSettingsForm: TColorSettingsForm
6666
Left = 0
6767
Top = 0
6868
Width = 660
69-
Height = 266
69+
Height = 280
7070
Align = alTop
7171
BevelOuter = bvNone
7272
ShowCaption = False
@@ -89,22 +89,22 @@ inherited ColorSettingsForm: TColorSettingsForm
8989
object grpDateColumns: TGroupBox
9090
AlignWithMargins = True
9191
Left = 3
92-
Top = 152
92+
Top = 167
9393
Width = 654
94-
Height = 109
94+
Height = 110
9595
Align = alTop
96-
Caption = 'Date Columns'
96+
Caption = 'Date'
9797
TabOrder = 1
9898
object lblDateFormat: TLabel
9999
Left = 16
100-
Top = 24
100+
Top = 29
101101
Width = 66
102102
Height = 15
103103
Caption = 'Date format:'
104104
end
105105
object cmbDateFormat: TComboBox
106106
Left = 105
107-
Top = 20
107+
Top = 25
108108
Width = 200
109109
Height = 23
110110
Hint =
@@ -121,7 +121,7 @@ inherited ColorSettingsForm: TColorSettingsForm
121121
end
122122
object cbShowModifiedDateColumn: TCheckBox
123123
Left = 16
124-
Top = 49
124+
Top = 54
125125
Width = 200
126126
Height = 17
127127
Hint = 'Show the "Modified" timestamp column in the result tree'
@@ -132,7 +132,7 @@ inherited ColorSettingsForm: TColorSettingsForm
132132
end
133133
object cbShowCreationDateColumn: TCheckBox
134134
Left = 16
135-
Top = 65
135+
Top = 70
136136
Width = 200
137137
Height = 17
138138
Hint = 'Show the "Created" timestamp column in the result tree'
@@ -141,42 +141,53 @@ inherited ColorSettingsForm: TColorSettingsForm
141141
end
142142
object cbShowLastAccessDateColumn: TCheckBox
143143
Left = 16
144-
Top = 82
144+
Top = 87
145145
Width = 200
146146
Height = 17
147147
Hint = 'Show the "Accessed" timestamp column in the result tree'
148148
Caption = 'Show "Accessed" column'
149149
TabOrder = 3
150150
end
151151
end
152-
object grpFileColors: TGroupBox
152+
object grpFileColumn: TGroupBox
153153
AlignWithMargins = True
154154
Left = 3
155155
Top = 87
156156
Width = 654
157-
Height = 59
157+
Height = 74
158158
Align = alTop
159-
Caption = 'File Colors'
159+
Caption = 'File'
160160
TabOrder = 2
161-
object cbShowFileErrorColor: TCheckBox
161+
object cbShowFileHint: TCheckBox
162162
Left = 16
163163
Top = 19
164164
Width = 280
165165
Height = 17
166+
Hint = 'Show file details (size, dates, attributes) as hint on hover'
167+
Caption = 'Show file hint'
168+
Checked = True
169+
State = cbChecked
170+
TabOrder = 0
171+
end
172+
object cbShowFileErrorColor: TCheckBox
173+
Left = 16
174+
Top = 35
175+
Width = 280
176+
Height = 17
166177
Hint = 'Use error color for files that do not exist'
167178
Caption = 'Error color for missing files'
168-
TabOrder = 0
179+
TabOrder = 1
169180
end
170181
object cbShowFileWarningColor: TCheckBox
171182
Left = 16
172-
Top = 35
183+
Top = 51
173184
Width = 280
174185
Height = 17
175186
Hint =
176187
'Use warning color for files outside the project path (Extension ' +
177188
'only)'
178189
Caption = 'Warning color for files outside project'
179-
TabOrder = 1
190+
TabOrder = 2
180191
end
181192
end
182193
end

src/UI/RipGrepper.UI.Settings.ColorSettingsForm.pas

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ TColorSettingsForm = class(TSettingsBaseForm)
3636
cbShowModifiedDateColumn : TCheckBox;
3737
cbShowCreationDateColumn : TCheckBox;
3838
cbShowLastAccessDateColumn : TCheckBox;
39-
grpFileColors : TGroupBox;
39+
grpFileColumn : TGroupBox;
40+
cbShowFileHint : TCheckBox;
4041
cbShowFileErrorColor : TCheckBox;
4142
cbShowFileWarningColor : TCheckBox;
4243
procedure btnLoadDefaultsClick(Sender : TObject);
@@ -222,6 +223,7 @@ procedure TColorSettingsForm.ReadSettings;
222223
cbShowLastAccessDateColumn.Checked := FNodeLookSettings.ShowLastAccessDateColumn;
223224
cbShowFileErrorColor.Checked := FNodeLookSettings.ShowFileErrorColor;
224225
cbShowFileWarningColor.Checked := FNodeLookSettings.ShowFileWarningColor;
226+
cbShowFileHint.Checked := FAppSettings.ShowFileHint;
225227
end;
226228

227229
procedure TColorSettingsForm.SetFontAttribsForFrames();
@@ -308,6 +310,7 @@ procedure TColorSettingsForm.WriteSettings;
308310
FNodeLookSettings.ShowLastAccessDateColumn := cbShowLastAccessDateColumn.Checked;
309311
FNodeLookSettings.ShowFileErrorColor := cbShowFileErrorColor.Checked;
310312
FNodeLookSettings.ShowFileWarningColor := cbShowFileWarningColor.Checked;
313+
FAppSettings.ShowFileHint := cbShowFileHint.Checked;
311314
end;
312315

313316
end.

0 commit comments

Comments
 (0)