diff --git a/Source/Core/CommonDefs.h b/Source/Core/CommonDefs.h index 2fb06402..d70bb90d 100644 --- a/Source/Core/CommonDefs.h +++ b/Source/Core/CommonDefs.h @@ -4,8 +4,9 @@ #pragma once //#include "Core/Utils/CoreUtils.h" -#define APPNAME _T("Image Uploader") #define APPNAME_ "Image Uploader" +#define APPNAME _T(APPNAME_) + // QString <-> std::string (utf-8) conversion macroses #define Q2U(str) str.toUtf8().data() diff --git a/Source/Func/IuCommonFunctions.cpp b/Source/Func/IuCommonFunctions.cpp index 6b08fd5b..d4ed2a64 100644 --- a/Source/Func/IuCommonFunctions.cpp +++ b/Source/Func/IuCommonFunctions.cpp @@ -11,6 +11,8 @@ namespace IuCommonFunctions { +int screenshotIndex = 1; + CString GetDataFolder() { CString result = U2W(AppParams::instance()->dataDirectory()); diff --git a/Source/Func/IuCommonFunctions.h b/Source/Func/IuCommonFunctions.h index 9ebbbc9a..e627e3ca 100644 --- a/Source/Func/IuCommonFunctions.h +++ b/Source/Func/IuCommonFunctions.h @@ -8,6 +8,7 @@ #include "atlheaders.h" namespace IuCommonFunctions { + extern int screenshotIndex; CString GetDataFolder(); BOOL CreateTempFolder(CString& IUCommonTempFolder, CString& IUTempFolder); @@ -23,4 +24,4 @@ namespace IuCommonFunctions { CString PrepareFileDialogImageFilter(); }; -#endif \ No newline at end of file +#endif diff --git a/Source/Gui/Dialogs/WizardDlg.cpp b/Source/Gui/Dialogs/WizardDlg.cpp index 245bd465..103ff80e 100644 --- a/Source/Gui/Dialogs/WizardDlg.cpp +++ b/Source/Gui/Dialogs/WizardDlg.cpp @@ -168,7 +168,6 @@ CWizardDlg::CWizardDlg(std::shared_ptr logger, CMyEngineList* eng enginelist_(enginelist) { mainThreadId_ = GetCurrentThreadId(); - screenshotIndex = 1; CurPage = -1; PrevPage = -1; NextPage = -1; @@ -2155,7 +2154,7 @@ bool CWizardDlg::CommonScreenshot(ScreenCapture::CaptureMode mode) ImageEditorWindow::DialogResult dialogResult = ImageEditorWindow::drCancel; CString suggestingFileName; if ( result ) { - suggestingFileName = IuCommonFunctions::GenerateFileName(Settings.ScreenshotSettings.FilenameTemplate, screenshotIndex,CPoint(result->GetWidth(),result->GetHeight())); + suggestingFileName = IuCommonFunctions::GenerateFileName(Settings.ScreenshotSettings.FilenameTemplate, IuCommonFunctions::screenshotIndex,CPoint(result->GetWidth(),result->GetHeight())); } if(result && ( (mode == cmRectangles && !Settings.ScreenshotSettings.UseOldRegionScreenshotMethod) || (!fromTray && Settings.ScreenshotSettings.OpenInEditor ) || (fromTray && Settings.TrayIconSettings.TrayScreenshotAction == TRAY_SCREENSHOT_OPENINEDITOR) )) @@ -2201,13 +2200,13 @@ bool CWizardDlg::CommonScreenshot(ScreenCapture::CaptureMode mode) ImageUtils::Gdip_RemoveAlpha(*result, Color(255, 255, 255, 255)); } - CString saveFolder = IuCommonFunctions::GenerateFileName(Settings.ScreenshotSettings.Folder, screenshotIndex,CPoint(result->GetWidth(),result->GetHeight())); + CString saveFolder = IuCommonFunctions::GenerateFileName(Settings.ScreenshotSettings.Folder, IuCommonFunctions::screenshotIndex,CPoint(result->GetWidth(),result->GetHeight())); try { ImageUtils::MySaveImage(result.get(),suggestingFileName,buf,savingFormat, Settings.ScreenshotSettings.Quality,(Settings.ScreenshotSettings.Folder.IsEmpty())?0:(LPCTSTR)saveFolder); } catch (const std::exception& ex) { LOG(ERROR) << ex.what(); } - screenshotIndex++; + IuCommonFunctions::screenshotIndex++; if ( CopyToClipboard ) { CClientDC dc(m_hWnd); diff --git a/Source/Gui/Dialogs/WizardDlg.h b/Source/Gui/Dialogs/WizardDlg.h index 88565f34..b7d85857 100644 --- a/Source/Gui/Dialogs/WizardDlg.h +++ b/Source/Gui/Dialogs/WizardDlg.h @@ -324,7 +324,6 @@ class CWizardDlg : bool DragndropEnabled; CStringList m_Paths; CWizardPage* Pages[5]; - int screenshotIndex; CString m_bCurrentFunc; CMyEngineList* enginelist_; std::unique_ptr serverIconCache_; diff --git a/Source/ImageEditor/Gui/ImageEditorWindow.cpp b/Source/ImageEditor/Gui/ImageEditorWindow.cpp index 7706de5d..795d04e0 100644 --- a/Source/ImageEditor/Gui/ImageEditorWindow.cpp +++ b/Source/ImageEditor/Gui/ImageEditorWindow.cpp @@ -9,6 +9,7 @@ #include "Core/Images/Utils.h" #include "Gui/GuiTools.h" #include "Func/WinUtils.h" +#include "Func/IuCommonFunctions.h" #include "ImageEditor/MovableElements.h" #include "Gui/Dialogs/SearchByImageDlg.h" #include "Gui/Components/MyFileDialog.h" @@ -1443,7 +1444,12 @@ bool ImageEditorWindow::OnSaveAs() } enableToolbarsIfNecessary(true); outFileName_ = dlg->getFile(); - saveDocument(ClipboardFormat::None, true); + + if (saveDocument(ClipboardFormat::None, true)) { + auto* settings = ServiceLocator::instance()->settings(); + setSuggestedFileName(IuCommonFunctions::GenerateFileName(settings->ScreenshotSettings.FilenameTemplate, ++IuCommonFunctions::screenshotIndex, + CPoint(canvas_->currentDocument()->getWidth(), canvas_->currentDocument()->getHeight()))); + } return true; }