From: <sv...@op...> - 2024-04-07 19:10:00
|
Author: sagamusix Date: Sun Apr 7 21:09:48 2024 New Revision: 20519 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20519 Log: Merged revision(s) 20518 from trunk/OpenMPT: [Imp] When autos-saving, display the to-be-saved module's filename in the status bar. ........ Modified: branches/OpenMPT-1.31/ (props changed) branches/OpenMPT-1.31/mptrack/AutoSaver.cpp Modified: branches/OpenMPT-1.31/mptrack/AutoSaver.cpp ============================================================================== --- branches/OpenMPT-1.31/mptrack/AutoSaver.cpp Sun Apr 7 21:07:59 2024 (r20518) +++ branches/OpenMPT-1.31/mptrack/AutoSaver.cpp Sun Apr 7 21:09:48 2024 (r20519) @@ -9,15 +9,18 @@ #include "stdafx.h" -#include "Mptrack.h" -#include "Mainfrm.h" -#include "Moddoc.h" #include "AutoSaver.h" #include "FileDialog.h" #include "FolderScanner.h" +#include "Mainfrm.h" +#include "Moddoc.h" +#include "Mptrack.h" +#include "Reporting.h" #include "resource.h" -#include "mpt/fs/fs.hpp" +#include "TrackerSettings.h" #include "../soundlib/mod_specifications.h" +#include "mpt/fs/fs.hpp" + #include <algorithm> @@ -58,35 +61,39 @@ bool CAutoSaver::DoSave(DWORD curTime) { - bool success = true; - - //If time to save and not already having save in progress. - if (CheckTimer(curTime) && !m_saveInProgress) - { - m_saveInProgress = true; - - theApp.BeginWaitCursor(); //display hour glass - - for(auto &modDoc : theApp.GetOpenDocuments()) + // Do nothing if we are already saving, or if time to save has not been reached yet. + if(m_saveInProgress || !CheckTimer(curTime)) + return true; + + bool success = true, clearStatus = false; + m_saveInProgress = true; + + theApp.BeginWaitCursor(); // Display hour glass + + for(auto &modDoc : theApp.GetOpenDocuments()) + { + if(modDoc->ModifiedSinceLastAutosave()) { - if(modDoc->ModifiedSinceLastAutosave()) + clearStatus = true; + static_cast<CMainFrame *>(theApp.GetMainWnd())->SetHelpText(MPT_CFORMAT("Auto-saving {}...")(modDoc->GetPathNameMpt().GetFilename())); + if(SaveSingleFile(*modDoc)) { - if(SaveSingleFile(*modDoc)) - { - CleanUpBackups(*modDoc); - } else - { - TrackerSettings::Instance().AutosaveEnabled = false; - Reporting::Warning("Warning: Auto Save failed and has been disabled. Please:\n- Review your Auto Save paths\n- Check available disk space and filesystem access rights"); - success = false; - } + CleanUpBackups(*modDoc); + } else + { + TrackerSettings::Instance().AutosaveEnabled = false; + Reporting::Warning("Warning: Auto Save failed and has been disabled. Please:\n- Review your Auto Save paths\n- Check available disk space and filesystem access rights"); + success = false; } } - - m_lastSave = timeGetTime(); - theApp.EndWaitCursor(); // End display hour glass - m_saveInProgress = false; } + + m_lastSave = timeGetTime(); + theApp.EndWaitCursor(); // End display hour glass + m_saveInProgress = false; + + if(clearStatus) + static_cast<CMainFrame *>(theApp.GetMainWnd())->SetHelpText(_T("")); return success; } |