Skip to content

Commit d35bb92

Browse files
committed
Add quick usage info to config dialog
1 parent b838523 commit d35bb92

File tree

5 files changed

+58
-26
lines changed

5 files changed

+58
-26
lines changed

SmartImage 3/App/Integration.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Diagnostics.CodeAnalysis;
77
using System.Diagnostics;
88
using System.Linq;
9+
using System.Reflection;
910
using System.Text;
1011
using System.Threading.Tasks;
1112
using Kantan.Console.Cli;
@@ -106,11 +107,12 @@ public static string ExeLocation
106107

107108
// Require.NotNull(module);
108109
Trace.Assert(module != null);
109-
110110
return module.FileName;
111111
}
112112
}
113113

114+
public static Version Version => Assembly.GetExecutingAssembly().GetName().Version;
115+
114116
public static string CurrentAppFolder => Path.GetDirectoryName(ExeLocation);
115117

116118
public static bool IsAppFolderInPath => FileSystem.IsFolderInPath(CurrentAppFolder);
@@ -132,7 +134,7 @@ public static void HandlePath(bool option)
132134
.Any(p => p == appFolder);
133135

134136
string cd = Environment.CurrentDirectory;
135-
string exe = Path.Combine(cd, Resources.Name_Exe);
137+
string exe = Path.Combine(cd, ExeLocation);
136138

137139
if (!appFolderInPath) {
138140
string newValue = oldValue + FileSystem.PATH_DELIM + cd;

SmartImage 3/Modes/GuiMode.cs

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ public sealed class GuiMode : BaseProgramMode
168168

169169
private static readonly ProgressBar Pbr_Status = new()
170170
{
171-
X = Pos.Right(Btn_Config) + 1,
172-
Y = Pos.Y(Tf_Input),
173-
Width = 10,
174-
ProgressBarStyle = ProgressBarStyle.Continuous,
171+
X = Pos.Right(Btn_Config) + 1,
172+
Y = Pos.Y(Tf_Input),
173+
Width = 10,
174+
ProgressBarStyle = ProgressBarStyle.Continuous,
175175
BidirectionalMarquee = false,
176-
ProgressBarFormat = ProgressBarFormat.SimplePlusPercentage
176+
ProgressBarFormat = ProgressBarFormat.SimplePlusPercentage
177177
};
178178

179179
private static readonly Label Lbl_Status = new()
@@ -516,7 +516,9 @@ private void AboutDialog()
516516
{
517517
var d = new Dialog()
518518
{
519-
Text = $"{R2.Name}",
519+
Text = $"{R2.Name} {Integration.Version}\n" +
520+
$"Current directory: {Integration.CurrentAppFolder}",
521+
520522
Title = R2.Name,
521523
AutoSize = true,
522524
Width = Dim.Percent(30),
@@ -528,25 +530,40 @@ void RefreshDialog()
528530
d.SetNeedsDisplay();
529531
}
530532

531-
var b1 = new Button() { AutoSize = true, Text = $"Repo", };
533+
var b1 = new Button()
534+
{
535+
AutoSize = true,
536+
Text = $"Repo",
537+
};
532538

533539
b1.Clicked += () =>
534540
{
535541
HttpUtilities.TryOpenUrl(R2.Repo_Url);
536542
RefreshDialog();
537543
};
538544

539-
var b2 = new Button() { AutoSize = true, Text = $"Wiki", };
545+
var b2 = new Button()
546+
{
547+
AutoSize = true,
548+
Text = $"Wiki",
549+
};
540550

541551
b2.Clicked += () =>
542552
{
543553
HttpUtilities.TryOpenUrl(R2.Wiki_Url);
544554
RefreshDialog();
545555
};
546556

547-
var b3 = new Button() { Text = $"Ok", AutoSize = true, };
557+
var b3 = new Button()
558+
{
559+
Text = $"Ok",
560+
AutoSize = true,
561+
};
548562

549-
b3.Clicked += () => { Application.RequestStop(); };
563+
b3.Clicked += () =>
564+
{
565+
Application.RequestStop();
566+
};
550567

551568
d.AddButton(b1);
552569
d.AddButton(b2);
@@ -631,6 +648,16 @@ private void OnConfigDialog()
631648
Height = 1,
632649
};
633650

651+
Label lbHelp = new($"{Values.Line} Arrow keys or mouse :: select option\n" +
652+
$"{Values.Line} Space bar or click :: toggle mark option\n" +
653+
$"{Values.Line} Enter :: save option")
654+
{
655+
AutoSize = true,
656+
657+
X = 0,
658+
Y = Pos.Bottom(cbContextMenu) + 1
659+
};
660+
634661
var cfgInfo = new FileInfo(SearchConfig.Configuration.FilePath);
635662

636663
ustring s = $"Config";
@@ -709,7 +736,8 @@ void ReloadDialog()
709736
};
710737

711738
dlCfg.Add(tvConfig, lvSearchEngines, lvPriorityEngines,
712-
cbContextMenu, cbOnTop, lbConfig, lbSearchEngines, lbPriorityEngines);
739+
cbContextMenu, cbOnTop, lbConfig, lbSearchEngines, lbPriorityEngines,
740+
lbHelp);
713741

714742
dlCfg.AddButton(btnRefresh);
715743
dlCfg.AddButton(btnOk);
@@ -844,7 +872,7 @@ private async void OnRun()
844872
if (!ok) {
845873
return;
846874
}
847-
875+
848876
Pbr_Status.BidirectionalMarquee = false;
849877
Pbr_Status.ProgressBarStyle = ProgressBarStyle.Continuous;
850878
Pbr_Status.Fraction = 0;

SmartImage 3/Resources.Designer.cs

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SmartImage 3/Resources.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
<data name="Name" xml:space="preserve">
121121
<value>SmartImage</value>
122122
</data>
123-
<data name="Name_Exe" xml:space="preserve">
124-
<value>SmartImage.exe</value>
125-
</data>
126123
<data name="Repo_Url" xml:space="preserve">
127124
<value>https://github.com/Decimation/SmartImage</value>
128125
</data>
@@ -138,4 +135,7 @@
138135
<data name="Arg_Input" xml:space="preserve">
139136
<value>-i</value>
140137
</data>
138+
<data name="Author" xml:space="preserve">
139+
<value>Read Stanton</value>
140+
</data>
141141
</root>

SmartImage 3/UI/Values.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ internal static class Values
1212
internal static readonly ustring NA = ustring.Make(Application.Driver.RightDefaultIndicator);
1313
internal static readonly ustring OK = ustring.Make(Application.Driver.Checked);
1414
internal static readonly ustring PRC = ustring.Make(Application.Driver.Diamond);
15+
16+
internal static readonly Rune Line = Application.Driver.HLine;
1517
}

0 commit comments

Comments
 (0)