Skip to content

Commit 9ccabb5

Browse files
committed
🔔 New in-app notifications
Changes: - A lot of MessageBoxes replaced by in-app notifications - Settings -> Startup: Checkbox-based options list Added: - Icons for in-app notifications - Settings -> Startup: Maximize window
1 parent a5ba0f0 commit 9ccabb5

File tree

59 files changed

+1762
-1764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1762
-1764
lines changed

.vs/quick-picture-viewer/v16/.suo

-28 KB
Binary file not shown.
0 Bytes
Binary file not shown.
32 KB
Binary file not shown.
4.01 MB
Binary file not shown.

docs/index.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ header .navbar .link:hover {
108108
flex-wrap: wrap;
109109
}
110110

111+
.hero a {
112+
margin: 8px;
113+
}
114+
111115
.hero .button {
112116
padding: 12px 24px;
113117
border: 2px solid rgba(255, 255, 255, 0.5);
114118
border-radius: 8px;
115-
margin: 8px;
116119
transition: 0.25s transform, 0.25s filter;;
117120
}
118121

@@ -122,11 +125,11 @@ header .navbar .link:hover {
122125
border-color: rgba(0, 0, 0, 0.25);
123126
}
124127

125-
.hero .button:hover {
128+
.hero a:hover .button {
126129
transform: translateY(-8px);
127130
}
128131

129-
.hero .button.dark:hover {
132+
.hero a:hover .button.dark {
130133
filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
131134
}
132135

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h3>Lightweight, versatile desktop image viewer for Windows</h3>
3838
<span>Download</span>
3939
<span class="version"></span>
4040
</div>
41-
<div class="size">3.8 MB</div>
41+
<div class="size"></div>
4242
</a>
4343
<a href="https://github.com/ModuleArt/quick-picture-viewer">
4444
<div class="button">

quick-picture-viewer/AboutForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private void InitLanguage()
105105
{
106106
this.Text = owner.resMan.GetString("about");
107107
infoTooltip.SetToolTip(closeBtn, owner.resMan.GetString("close") + " | Alt+F4");
108-
updatesLink.Text = owner.resMan.GetString("check-for-updates");
108+
updatesLink.Text = owner.resMan.GetString("check-for-app-updates");
109109
descTextBox.Text = owner.resMan.GetString("app-description");
110110
makeDefaultBtn.Text = owner.resMan.GetString("set-as-default-image-viewer");
111111
infoTooltip.SetToolTip(makeDefaultBtn, owner.resMan.GetString("open-windows-settings"));

quick-picture-viewer/App.config

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
<setting name="ShowCursorInFullscreen" serializeAs="String">
2626
<value>False</value>
2727
</setting>
28-
<setting name="StartupAction" serializeAs="String">
29-
<value>0</value>
28+
<setting name="StartupPaste" serializeAs="String">
29+
<value>False</value>
3030
</setting>
3131
<setting name="FavoriteExternalApp" serializeAs="String">
3232
<value>C:\Windows\System32\mspaint.exe</value>
@@ -49,6 +49,9 @@
4949
<setting name="MouseWheelScrollAction" serializeAs="String">
5050
<value>0</value>
5151
</setting>
52+
<setting name="StartupMaximize" serializeAs="String">
53+
<value>False</value>
54+
</setting>
5255
</quick_picture_viewer.Properties.Settings>
5356
</userSettings>
5457
</configuration>

quick-picture-viewer/MainForm.Designer.cs

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

quick-picture-viewer/MainForm.cs

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ public MainForm(string openPath, bool darkMode)
7777
InitLanguage();
7878

7979
closeFile();
80+
81+
if (Properties.Settings.Default.StartupMaximize)
82+
{
83+
this.WindowState = FormWindowState.Maximized;
84+
}
8085
}
8186

8287
protected override void WndProc(ref Message m)
@@ -195,11 +200,11 @@ private void slideshowTimer_Event(Object source, ElapsedEventArgs e)
195200
{
196201
if ((Properties.Settings.Default.SlideshowTime - slideshowCounter) <= 1)
197202
{
198-
showSuggestion(resMan.GetString("next-image-in-1-second"));
203+
showSuggestion(resMan.GetString("next-image-in-1-second"), SuggestionIcon.Info);
199204
}
200205
else
201206
{
202-
showSuggestion(string.Format(resMan.GetString("next-image-in-x-seconds"), (Properties.Settings.Default.SlideshowTime - slideshowCounter)));
207+
showSuggestion(string.Format(resMan.GetString("next-image-in-x-seconds"), Properties.Settings.Default.SlideshowTime - slideshowCounter), SuggestionIcon.Info);
203208
}
204209
}
205210
}
@@ -223,10 +228,10 @@ private void MainForm_Load(object sender, EventArgs e)
223228
{
224229
if (string.IsNullOrEmpty(openPath))
225230
{
226-
if (Properties.Settings.Default.StartupAction == 1 && Clipboard.ContainsImage())
231+
if (Properties.Settings.Default.StartupPaste && Clipboard.ContainsImage())
227232
{
228233
pasteButton.PerformClick();
229-
showSuggestion(resMan.GetString("image-pasted-from-clipboard"));
234+
showSuggestion(resMan.GetString("image-pasted-from-clipboard"), SuggestionIcon.Info);
230235
}
231236
}
232237
else
@@ -244,7 +249,7 @@ private void MainForm_Load(object sender, EventArgs e)
244249
}
245250
catch
246251
{
247-
MessageBox.Show(resMan.GetString("unable-to-open-file"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
252+
showSuggestion(resMan.GetString("unable-to-open-file"), SuggestionIcon.Warning);
248253
}
249254

250255
if (Properties.Settings.Default.CheckForUpdates)
@@ -273,7 +278,7 @@ public async void checkForUpdates(bool showUpToDateDialog)
273278
{
274279
if (showUpToDateDialog)
275280
{
276-
MessageBox.Show(resMan.GetString("app-is-up-to-date"), resMan.GetString("updator"), MessageBoxButtons.OK, MessageBoxIcon.Information);
281+
showSuggestion(resMan.GetString("app-is-up-to-date"), SuggestionIcon.Check);
277282
}
278283
}
279284
else
@@ -300,7 +305,7 @@ public async void checkForUpdates(bool showUpToDateDialog)
300305
{
301306
if (showUpToDateDialog)
302307
{
303-
MessageBox.Show(resMan.GetString("update-failed"), resMan.GetString("updator"), MessageBoxButtons.OK, MessageBoxIcon.Information);
308+
showSuggestion(resMan.GetString("update-failed"), SuggestionIcon.Warning);
304309
Console.WriteLine(ex);
305310
}
306311
}
@@ -382,7 +387,7 @@ private void openFile(string path)
382387
}
383388
catch (Exception ex)
384389
{
385-
MessageBox.Show(resMan.GetString("unable-to-open-file"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
390+
showSuggestion(resMan.GetString("unable-to-open-file"), SuggestionIcon.Warning);
386391
Console.WriteLine(ex);
387392
}
388393
}
@@ -427,14 +432,14 @@ public void openDdsOrTga(string path)
427432
}
428433
catch (Exception ex)
429434
{
430-
MessageBox.Show(resMan.GetString("dds-memory-error"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
435+
showSuggestion(resMan.GetString("dds-memory-error"), SuggestionIcon.Warning);
431436
Console.WriteLine(ex);
432437
}
433438
}
434439
}
435440
catch (Exception ex)
436441
{
437-
MessageBox.Show(resMan.GetString("unable-open-dds"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
442+
showSuggestion(resMan.GetString("unable-open-dds"), SuggestionIcon.Warning);
438443
Console.WriteLine(ex);
439444
}
440445
}
@@ -462,7 +467,7 @@ public void openSvg(string path, int width, int height)
462467
}
463468
catch (Exception ex)
464469
{
465-
MessageBox.Show(resMan.GetString("unable-open-svg"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
470+
showSuggestion(resMan.GetString("unable-open-svg"), SuggestionIcon.Warning);
466471
Console.WriteLine(ex);
467472
}
468473
}
@@ -933,7 +938,7 @@ private void saveAsButton_Click(object sender, EventArgs e)
933938
private void copyButton_Click(object sender, EventArgs e)
934939
{
935940
Clipboard.SetImage(originalImage);
936-
showSuggestion(resMan.GetString("image-copied-to-clipboard"));
941+
showSuggestion(resMan.GetString("image-copied-to-clipboard"), SuggestionIcon.Check);
937942
}
938943

939944
private void pasteButton_Click(object sender, EventArgs e)
@@ -1119,7 +1124,7 @@ private void setFullscreen(bool b)
11191124

11201125
setAlwaysOnTop(false, true);
11211126

1122-
showSuggestion(string.Format(resMan.GetString("press-to-exit-fullscreen"), "Esc"));
1127+
showSuggestion(string.Format(resMan.GetString("press-to-exit-fullscreen"), "Esc"), SuggestionIcon.Info);
11231128
}
11241129
else
11251130
{
@@ -1423,7 +1428,7 @@ private int nextFile()
14231428
if (currentIndex == -1)
14241429
{
14251430
setSlideshow(false);
1426-
MessageBox.Show(resMan.GetString("cur-file-not-found"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
1431+
showSuggestion(resMan.GetString("cur-file-not-found"), SuggestionIcon.Warning);
14271432
return 0;
14281433
}
14291434
else
@@ -1462,7 +1467,7 @@ private void prevFile()
14621467

14631468
if (currentIndex == -1)
14641469
{
1465-
MessageBox.Show(resMan.GetString("cur-file-not-found"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
1470+
showSuggestion(resMan.GetString("cur-file-not-found"), SuggestionIcon.Warning);
14661471
}
14671472
else
14681473
{
@@ -1510,7 +1515,7 @@ private void openFirstFileInFolder()
15101515
}
15111516
else
15121517
{
1513-
MessageBox.Show(resMan.GetString("no-files-to-open"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
1518+
showSuggestion(resMan.GetString("no-files-to-open"), SuggestionIcon.Warning);
15141519
}
15151520
}
15161521

@@ -1549,7 +1554,7 @@ private void deleteButton_Click(object sender, EventArgs e)
15491554
}
15501555
else
15511556
{
1552-
MessageBox.Show(resMan.GetString("cur-file-not-found"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
1557+
showSuggestion(resMan.GetString("cur-file-not-found"), SuggestionIcon.Warning);
15531558
}
15541559
}
15551560
}
@@ -1826,7 +1831,7 @@ private void showFileButton_Click(object sender, EventArgs e)
18261831
}
18271832
else
18281833
{
1829-
MessageBox.Show(resMan.GetString("cur-file-not-found"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
1834+
showSuggestion(resMan.GetString("cur-file-not-found"), SuggestionIcon.Warning);
18301835
}
18311836
}
18321837

@@ -1845,11 +1850,31 @@ private void zoomOutButton_MouseDown(object sender, MouseEventArgs e)
18451850
zoomOutTimer.Start();
18461851
}
18471852

1848-
private void showSuggestion(string text)
1853+
private enum SuggestionIcon
1854+
{
1855+
Info = 0,
1856+
Check = 1,
1857+
Warning = 2
1858+
}
1859+
1860+
private void showSuggestion(string text, SuggestionIcon icon)
18491861
{
18501862
suggestionLabel.Invoke((MethodInvoker)(() => {
18511863
suggestionLabel.Text = text;
18521864
suggestionLabel.Visible = true;
1865+
if (icon == SuggestionIcon.Info)
1866+
{
1867+
suggestionIcon.Image = Properties.Resources.white_info;
1868+
}
1869+
else if (icon == SuggestionIcon.Check)
1870+
{
1871+
suggestionIcon.Image = Properties.Resources.white_check;
1872+
}
1873+
else
1874+
{
1875+
suggestionIcon.Image = Properties.Resources.white_warning;
1876+
}
1877+
suggestionIcon.Visible = true;
18531878
}));
18541879

18551880
if (suggestionTimer != null)
@@ -1869,6 +1894,8 @@ private void hideSuggestion()
18691894
suggestionLabel.Invoke((MethodInvoker)(() => {
18701895
suggestionLabel.Text = string.Empty;
18711896
suggestionLabel.Visible = false;
1897+
suggestionIcon.Image.Dispose();
1898+
suggestionIcon.Visible = false;
18721899
}));
18731900
}
18741901

@@ -1899,7 +1926,7 @@ private void typeOpsButton_Click(object sender, EventArgs e)
18991926
private void reloadButton_Click(object sender, EventArgs e)
19001927
{
19011928
openFile(Path.Combine(currentFolder, currentFile));
1902-
showSuggestion(resMan.GetString("file-reloaded"));
1929+
showSuggestion(resMan.GetString("file-reloaded"), SuggestionIcon.Check);
19031930
}
19041931

19051932
private void newWindowButton_Click(object sender, EventArgs e)
@@ -2013,11 +2040,11 @@ private void copyFileBtn_Click(object sender, EventArgs e)
20132040
string[] filesToCopy = { Path.Combine(currentFolder, currentFile) };
20142041
Clipboard.Clear();
20152042
Clipboard.SetData(DataFormats.FileDrop, filesToCopy);
2016-
showSuggestion(resMan.GetString("file-copied-to-clipboard"));
2043+
showSuggestion(resMan.GetString("file-copied-to-clipboard"), SuggestionIcon.Check);
20172044
}
20182045
catch
20192046
{
2020-
MessageBox.Show(resMan.GetString("cur-file-not-found"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
2047+
showSuggestion(resMan.GetString("cur-file-not-found"), SuggestionIcon.Warning);
20212048
}
20222049
}
20232050

@@ -2057,7 +2084,7 @@ private void externalRunBtn_Click(object sender, EventArgs e)
20572084
}
20582085
catch
20592086
{
2060-
MessageBox.Show(resMan.GetString("unable-to-run-external-app"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
2087+
showSuggestion(resMan.GetString("unable-to-run-external-app"), SuggestionIcon.Warning);
20612088
}
20622089
}
20632090

@@ -2069,7 +2096,7 @@ private void externalFavoriteBtn_Click(object sender, EventArgs e)
20692096
}
20702097
catch
20712098
{
2072-
MessageBox.Show(resMan.GetString("unable-to-run-external-app"), resMan.GetString("error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
2099+
showSuggestion(resMan.GetString("unable-to-run-external-app"), SuggestionIcon.Warning);
20732100
}
20742101
}
20752102

0 commit comments

Comments
 (0)