Notify about saved screenshot

Show message about saved screenshot via schedule message box. Since screenshot
saving happens not in the main thread calling messageBox directly is unsafe.
WindowManager::scheduleMessageBox delays message box showing until next update
in the main thread.
This commit is contained in:
elsid 2021-05-25 01:49:27 +02:00
parent f7a6be053d
commit 5103120eef
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
6 changed files with 71 additions and 12 deletions

View file

@ -218,6 +218,14 @@ namespace
if (Settings::Manager::getInt("async num threads", "Physics") == 0)
profiler.removeUserStatsLine(" -Async");
}
struct ScheduleNonDialogMessageBox
{
void operator()(std::string message) const
{
MWBase::Environment::get().getWindowManager()->scheduleMessageBox(std::move(message), MWGui::ShowInDialogueMode_Never);
}
};
}
void OMW::Engine::executeLocalScripts()
@ -676,7 +684,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mWorkQueue,
new SceneUtil::WriteScreenshotToFileOperation(
mCfgMgr.getScreenshotPath().string(),
Settings::Manager::getString("screenshot format", "General")
Settings::Manager::getString("screenshot format", "General"),
ScheduleNonDialogMessageBox {}
)
);