summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-04-24 17:16:15 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-04-24 17:16:15 +0300
commit869c8728bc22f614e53fbcc70b0e55c71d93a0b6 (patch)
tree8125f2478ee5f952d7d5b42f7efe9a67ed94a5a2
parenteedf3e7f4664e9b0ff60e8e392bb22ea1e7af076 (diff)
MAINT-8427 Make snapshot path consistant over sessions
-rw-r--r--indra/newview/app_settings/settings_per_account.xml22
-rw-r--r--indra/newview/llviewerwindow.cpp36
-rw-r--r--indra/newview/llviewerwindow.h11
3 files changed, 48 insertions, 21 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 92e61d2e86..3d4bd659f1 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -392,5 +392,27 @@
<key>Value</key>
<string></string>
</map>
+ <key>SnapshotBaseDir</key>
+ <map>
+ <key>Comment</key>
+ <string>Path to last snapshot save location</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string></string>
+ </map>
+ <key>SnapshotBaseName</key>
+ <map>
+ <key>Comment</key>
+ <string>Pattern for naming snapshots</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>Snapshot</string>
+ </map>
</map>
</llsd>
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);
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index 38178fa910..c01921641c 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -350,8 +350,8 @@ public:
BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, LLSnapshotModel::ESnapshotLayerType type = LLSnapshotModel::SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE);
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type);
- BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
- void resetSnapshotLoc() const { sSnapshotDir.clear(); }
+ BOOL isSnapshotLocSet() const;
+ void resetSnapshotLoc() const;
BOOL saveImageNumbered(LLImageFormatted *image, BOOL force_picker, BOOL& insufficient_memory);
// Reset the directory where snapshots are saved.
@@ -419,7 +419,7 @@ public:
bool getSystemUIScaleFactorChanged() { return mSystemUIScaleFactorChanged; }
static void showSystemUIScaleFactorChanged();
- static std::string getLastSnapshotDir() { return sSnapshotDir; }
+ static std::string getLastSnapshotDir();
private:
bool shouldShowToolTipFor(LLMouseHandler *mh);
@@ -504,11 +504,6 @@ private:
boost::scoped_ptr<LLWindowListener> mWindowListener;
boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener;
- static std::string sSnapshotBaseName;
- static std::string sSnapshotDir;
-
- static std::string sMovieBaseName;
-
// Object temporarily hovered over while dragging
LLPointer<LLViewerObject> mDragHoveredObject;