diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-04-24 17:16:15 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-04-24 17:16:15 +0300 |
commit | 869c8728bc22f614e53fbcc70b0e55c71d93a0b6 (patch) | |
tree | 8125f2478ee5f952d7d5b42f7efe9a67ed94a5a2 /indra/newview/llviewerwindow.cpp | |
parent | eedf3e7f4664e9b0ff60e8e392bb22ea1e7af076 (diff) |
MAINT-8427 Make snapshot path consistant over sessions
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index a6a083ec6b..2d92f394dd 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -261,10 +261,8 @@ static const F32 MIN_UI_SCALE = 0.75f; static const F32 MAX_UI_SCALE = 7.0f; static const F32 MIN_DISPLAY_SCALE = 0.75f; -std::string LLViewerWindow::sSnapshotBaseName; -std::string LLViewerWindow::sSnapshotDir; - -std::string LLViewerWindow::sMovieBaseName; +static LLCachedControl<std::string> sSnapshotBaseName(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot")); +static LLCachedControl<std::string> sSnapshotDir(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseDir", "")); LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity"); @@ -1694,11 +1692,6 @@ LLViewerWindow::LLViewerWindow(const Params& p) LL_INFOS() << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << LL_ENDL; } - // Default to application directory. - LLViewerWindow::sSnapshotBaseName = "Snapshot"; - LLViewerWindow::sMovieBaseName = "SLmovie"; - resetSnapshotLoc(); - /* LLWindowCallbacks* callbacks, @@ -1877,6 +1870,11 @@ void LLViewerWindow::showSystemUIScaleFactorChanged() LLNotificationsUtil::add("SystemUIScaleFactorChanged", LLSD(), LLSD(), onSystemUIScaleFactorChanged); } +std::string LLViewerWindow::getLastSnapshotDir() +{ + return sSnapshotDir; +} + //static bool LLViewerWindow::onSystemUIScaleFactorChanged(const LLSD& notification, const LLSD& response) { @@ -4401,11 +4399,12 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picke // Copy the directory + file name std::string filepath = picker.getFirstFile(); - LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filepath, true); - LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath); + gSavedPerAccountSettings.setString("SnapshotBaseName", gDirUtilp->getBaseFileName(filepath, true)); + gSavedPerAccountSettings.setString("SnapshotBaseDir", gDirUtilp->getDirName(filepath)); } - if(LLViewerWindow::sSnapshotDir.empty()) + std::string snapshot_dir = sSnapshotDir; + if(snapshot_dir.empty()) { return FALSE; } @@ -4452,7 +4451,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picke void LLViewerWindow::resetSnapshotLoc() { - sSnapshotDir.clear(); + gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string()); } // static @@ -4506,6 +4505,17 @@ void LLViewerWindow::playSnapshotAnimAndSound() send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f); } +BOOL LLViewerWindow::isSnapshotLocSet() const +{ + std::string snapshot_dir = sSnapshotDir; + return !snapshot_dir.empty(); +} + +void LLViewerWindow::resetSnapshotLoc() const +{ + gSavedPerAccountSettings.setString("SnapshotBaseDir", std::string()); +} + BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type) { return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, do_rebuild, type); |