Skip to content

Commit 5aab136

Browse files
committed
🐛 Bug fixes
- Fix: Wrong format of saved images - Fix: Blank screen when trying to save a file with the doubled extension (.png.svg etc) - Fix: Some issues related to the file extension names (lower/upper case) - Fix: Cr2 memory leak
1 parent 7167d4e commit 5aab136

File tree

11 files changed

+363
-345
lines changed

11 files changed

+363
-345
lines changed

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

0 Bytes
Binary file not shown.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Want more? Open a <a href="https://github.com/ModuleArt/quick-picture-viewer/iss
4747
## 🔮 Future plans:
4848

4949
* Enhanced zoom menu
50-
* Image preloader [#57]
51-
* Sort by menu [#62]
52-
* Customizable keyboard shortcuts [#27]
53-
* More wallpaper related options [#65]
50+
* Image preloader [<a href="https://github.com/ModuleArt/quick-picture-viewer/discussions/57">#57</a>]
51+
* Sort by menu [<a href="https://github.com/ModuleArt/quick-picture-viewer/issues/62">#62</a>]
52+
* Customizable keyboard shortcuts [<a href="https://github.com/ModuleArt/quick-picture-viewer/issues/69">#27</a>]
53+
* More wallpaper related options [<a href="https://github.com/ModuleArt/quick-picture-viewer/issues/65">#65</a>]
5454

5555
## 🧩 Built-in plugins:
5656

0 Bytes
Binary file not shown.
2 KB
Binary file not shown.

quick-picture-viewer/forms/MainForm.cs

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ private void showTypeOpsButton(bool show, string type = null)
371371
}));
372372
}
373373

374-
public void OpenFile(string path, bool goPrev = false, bool skipIfError = false, bool cantOpenLastError = false)
374+
public void OpenFile(string path, bool goPrev = false, bool skipIfError = false, bool cantOpenLastError = false, string targetExtension = null)
375375
{
376-
FileTypeMan.OpenResult res = FileTypeMan.Open(path);
376+
FileTypeMan.OpenResult res = FileTypeMan.Open(path, targetExtension);
377377
showTypeOpsButton(res.ShowTypeOps, res.TypeName);
378378
if (string.IsNullOrEmpty(res.ErrorMessage))
379379
{
@@ -769,57 +769,74 @@ private void saveAsButton_Click(object sender, EventArgs e)
769769
{
770770
setSlideshow(false);
771771

772-
string ext = ".png";
773772
if (currentFile != null)
774773
{
775774
saveFileDialog1.FileName = Path.GetFileNameWithoutExtension(currentFile);
776775
saveFileDialog1.InitialDirectory = currentFolder;
777776

778-
ext = Path.GetExtension(currentFile);
779-
switch (ext)
777+
switch (Path.GetExtension(currentFile).ToLower())
780778
{
781779
case ".png":
782780
saveFileDialog1.FilterIndex = 1;
783-
ext = ".png";
784781
break;
785782
case ".jpg":
786783
case ".jpeg":
787784
case ".jpe":
788785
case ".jfif":
789786
case ".exif":
790787
saveFileDialog1.FilterIndex = 2;
791-
ext = ".jpg";
792788
break;
793789
case ".gif":
794790
saveFileDialog1.FilterIndex = 3;
795-
ext = ".gif";
796791
break;
797792
case ".bmp":
798793
case ".dib":
799794
case ".rle":
800795
saveFileDialog1.FilterIndex = 4;
801-
ext = ".bmp";
802796
break;
803797
case ".tiff":
804798
case ".tif":
805799
saveFileDialog1.FilterIndex = 5;
806-
ext = ".tiff";
807800
break;
808801
case ".ico":
809802
saveFileDialog1.FilterIndex = 6;
810-
ext = ".ico";
811803
break;
812804
case ".webp":
813805
saveFileDialog1.FilterIndex = 7;
814-
ext = ".webp";
815806
break;
816807
}
817808
}
818809

819-
if (saveFileDialog1.ShowDialog() == DialogResult.OK) SaveFile(saveFileDialog1.FileName, ext, true);
820-
setImageChanged(false);
821-
CheckRecursiveFolder(saveFileDialog1.FileName);
822-
OpenFile(saveFileDialog1.FileName);
810+
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
811+
{
812+
string ext = ".png";
813+
switch (saveFileDialog1.FilterIndex)
814+
{
815+
case 2:
816+
ext = ".jpg";
817+
break;
818+
case 3:
819+
ext = ".gif";
820+
break;
821+
case 4:
822+
ext = ".bmp";
823+
break;
824+
case 5:
825+
ext = ".tif";
826+
break;
827+
case 6:
828+
ext = ".ico";
829+
break;
830+
case 7:
831+
ext = ".webp";
832+
break;
833+
}
834+
SaveFile(saveFileDialog1.FileName, ext, true);
835+
836+
setImageChanged(false);
837+
CheckRecursiveFolder(saveFileDialog1.FileName);
838+
OpenFile(saveFileDialog1.FileName, targetExtension: ext);
839+
}
823840
saveFileDialog1.Dispose();
824841
}
825842

@@ -2417,7 +2434,7 @@ private void saveBtn_Click(object sender, EventArgs e)
24172434
setSlideshow(false);
24182435

24192436
bool needSaveAs = true;
2420-
string ext = Path.GetExtension(currentFile);
2437+
string ext = Path.GetExtension(currentFile).ToLower();
24212438
switch (ext)
24222439
{
24232440
case ".png":
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
2 KB
Binary file not shown.

0 commit comments

Comments
 (0)