summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2014-12-03 06:35:46 -0500
committerJonathan Yap <jhwelch@gmail.com>2014-12-03 06:35:46 -0500
commitcc22efa4c0d6b06bac6f49b6243df7726f89c7c4 (patch)
tree4ab1120c671cfb5953ee7e4f362df2da0ea319d9 /indra/newview
parentade3953e380d9211ad6d332b9b27fa23e57a7d81 (diff)
STORM-2082 Remove Apply button.
Add new control variable to track which preset is active. Save settings to active preset when clicking on Ok button. Initial work to make pulldown operational. Still to do: add pretty icon for current preset. Notifications do not appear when called from this panel.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/app_settings/settings.xml12
-rw-r--r--indra/newview/llfloaterdeleteprefpreset.cpp9
-rwxr-xr-xindra/newview/llfloaterpreference.cpp39
-rwxr-xr-xindra/newview/llfloaterpreference.h3
-rw-r--r--indra/newview/llfloatersaveprefpreset.cpp2
-rw-r--r--indra/newview/llpanelpresetspulldown.cpp65
-rw-r--r--indra/newview/llpanelpresetspulldown.h4
-rw-r--r--indra/newview/llpresetsmanager.cpp13
-rwxr-xr-xindra/newview/llstatusbar.cpp12
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_preferences_graphics1.xml21
-rw-r--r--indra/newview/skins/default/xui/en/panel_presets_pulldown.xml59
11 files changed, 147 insertions, 92 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 31890ca205..6016839875 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -15551,7 +15551,17 @@
<key>Value</key>
<integer>0</integer>
</map>
-
+ <key>PresetGraphicActive</key>
+ <map>
+ <key>Comment</key>
+ <string>Name of currently selected preference</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string />
+ </map>
</map>
</llsd>
diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp
index 01b25398dd..d92aaa5659 100644
--- a/indra/newview/llfloaterdeleteprefpreset.cpp
+++ b/indra/newview/llfloaterdeleteprefpreset.cpp
@@ -28,11 +28,11 @@
#include "llfloaterdeleteprefpreset.h"
-#include "llpresetsmanager.h"
-
#include "llbutton.h"
#include "llcombobox.h"
#include "llnotificationsutil.h"
+#include "llpresetsmanager.h"
+#include "llviewercontrol.h"
LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key)
: LLFloater(key)
@@ -69,6 +69,11 @@ void LLFloaterDeletePrefPreset::onBtnDelete()
if (LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name))
{
+ if (name == gSavedSettings.getString("PresetGraphicActive"))
+ {
+ LLPresetsManager::getInstance()->savePreset(mSubdirectory, PRESETS_DEFAULT);
+ }
+
LLSD args;
args["NAME"] = name;
LLNotificationsUtil::add("PresetDeleted", args);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index c80ec1a976..7b9c4c3035 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -325,7 +325,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
registered_dialog = true;
}
- mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this));
mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this));
mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this));
@@ -788,6 +787,7 @@ void LLFloaterPreference::setHardwareDefaults()
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
refreshEnabledGraphics();
+
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
child_list_t::const_iterator iter = tabcontainer->getChildList()->begin();
child_list_t::const_iterator end = tabcontainer->getChildList()->end();
@@ -884,24 +884,11 @@ void LLFloaterPreference::onBtnOK()
LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
pPathfindingConsole->onRegionBoundaryCross();
}
-
-}
-// static
-void LLFloaterPreference::onBtnApply( )
-{
- if (hasFocus())
+ if (LLStartUp::getStartupState() == STATE_STARTED)
{
- LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- if (cur_focus && cur_focus->acceptsTextInput())
- {
- cur_focus->onCommit();
- }
+ LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, gSavedSettings.getString("PresetGraphicActive"));
}
- apply();
- saveSettings();
-
- LLPanelLogin::updateLocationSelectorsVisibility();
}
// static
@@ -2115,7 +2102,6 @@ void LLPanelPreference::onChangePreset(const LLSD& user_data)
LLComboBox* combo = getChild<LLComboBox>(subdirectory + "_preset_combo");
std::string name = combo->getSimple();
-
LLPresetsManager::getInstance()->loadPreset(subdirectory, name);
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
@@ -2194,19 +2180,6 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox()
LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option);
}
-void LLPanelPreferenceGraphics::draw()
-{
- LLPanelPreference::draw();
-
- LLButton* button_apply = findChild<LLButton>("Apply");
-
- if (button_apply && button_apply->getVisible())
- {
- bool enable = hasDirtyChilds();
-
- button_apply->setEnabled(enable);
- }
-}
bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
std::list<LLView*> view_stack;
@@ -2256,11 +2229,7 @@ void LLPanelPreferenceGraphics::resetDirtyChilds()
}
}
}
-void LLPanelPreferenceGraphics::apply()
-{
- resetDirtyChilds();
- LLPanelPreference::apply();
-}
+
void LLPanelPreferenceGraphics::cancel()
{
resetDirtyChilds();
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 4a6a2eda71..d43c41272a 100755
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -97,7 +97,6 @@ public:
protected:
void onBtnOK();
void onBtnCancel();
- void onBtnApply();
void onClickClearCache(); // Clear viewer texture cache, vfs, and VO cache on next startup
void onClickBrowserClearCache(); // Clear web history and caches as well as viewer caches above
@@ -248,8 +247,6 @@ class LLPanelPreferenceGraphics : public LLPanelPreference
{
public:
BOOL postBuild();
- void draw();
- void apply();
void cancel();
void saveSettings();
void setHardwareDefaults();
diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp
index 3148978778..a5fc356c36 100644
--- a/indra/newview/llfloatersaveprefpreset.cpp
+++ b/indra/newview/llfloatersaveprefpreset.cpp
@@ -85,6 +85,8 @@ void LLFloaterSavePrefPreset::onBtnSave()
LLSD args;
args["NAME"] = name;
LLNotificationsUtil::add("PresetSaved", args);
+
+ closeFloater();
}
void LLFloaterSavePrefPreset::onPresetsListChange()
diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp
index 977e9ff5e2..cd049712e1 100644
--- a/indra/newview/llpanelpresetspulldown.cpp
+++ b/indra/newview/llpanelpresetspulldown.cpp
@@ -37,6 +37,7 @@
#include "llfloaterpreference.h"
#include "llpresetsmanager.h"
#include "llsliderctrl.h"
+#include "llscrolllistctrl.h"
/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f;
/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f;
@@ -50,19 +51,53 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown()
{
mHoverTimer.stop();
- mCommitCallbackRegistrar.add("Presets.GoMoveViewPrefs", boost::bind(&LLPanelPresetsPulldown::onMoveViewButtonClick, this, _2));
mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2));
+ mCommitCallbackRegistrar.add("Presets.RowClick", boost::bind(&LLPanelPresetsPulldown::onRowClick, this, _2));
+
buildFromFile( "panel_presets_pulldown.xml");
}
BOOL LLPanelPresetsPulldown::postBuild()
{
+ LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this));
// Make sure there is a default preference file
LLPresetsManager::getInstance()->createMissingDefault();
+ populatePanel();
+
return LLPanel::postBuild();
}
+void LLPanelPresetsPulldown::populatePanel()
+{
+ std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC);
+ LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_POSITION_NORMAL);
+
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
+
+ if (scroll && mPresetNames.begin() != mPresetNames.end())
+ {
+ scroll->clearRows();
+
+ for (std::list<std::string>::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it)
+ {
+ const std::string& name = *it;
+
+ LLSD row;
+ row["columns"][0]["column"] = "preset_name";
+ row["columns"][0]["value"] = name;
+
+ if (name == gSavedSettings.getString("PresetGraphicActive"))
+ {
+ row["columns"][1]["column"] = "active_name";
+ row["columns"][1]["value"] = "X";
+ }
+
+ scroll->addElement(row);
+ }
+ }
+}
+
/*virtual*/
void LLPanelPresetsPulldown::onMouseEnter(S32 x, S32 y, MASK mask)
{
@@ -97,22 +132,26 @@ void LLPanelPresetsPulldown::onVisibilityChange ( BOOL new_visibility )
}
}
-void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data)
+void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data)
{
- // close the minicontrol, we're bringing up the big one
- setVisible(FALSE);
+ LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("preset_list");
- // bring up the prefs floater
- LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences");
- if (prefsfloater)
+ if (scroll)
{
- // grab the 'move' panel from the preferences floater and
- // bring it the front!
- LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
- LLPanel* movepanel = prefsfloater->getChild<LLPanel>("move");
- if (tabcontainer && movepanel)
+ LLScrollListItem* item = scroll->getFirstSelected();
+ if (item)
{
- tabcontainer->selectTabPanel(movepanel);
+ std::string name = item->getColumn(1)->getValue().asString();
+
+ LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name);
+ LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
+ if (instance)
+ {
+ instance->refreshEnabledGraphics();
+ }
+ setVisible(FALSE);
+ // This line shouldn't be necessary but it is.
+ populatePanel();
}
}
}
diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h
index 0cabf4aaad..f3e0340247 100644
--- a/indra/newview/llpanelpresetspulldown.h
+++ b/indra/newview/llpanelpresetspulldown.h
@@ -45,9 +45,11 @@ class LLPanelPresetsPulldown : public LLPanel
/*virtual*/ BOOL postBuild();
private:
+ void populatePanel();
void onGraphicsButtonClick(const LLSD& user_data);
- void onMoveViewButtonClick(const LLSD& user_data);
+ void onRowClick(const LLSD& user_data);
+ std::list<std::string> mPresetNames;
LLFrameTimer mHoverTimer;
static const F32 sAutoCloseFadeStartTimeSec;
static const F32 sAutoCloseTotalTimeSec;
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 709181b3ad..ddcd54162c 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -56,6 +56,11 @@ void LLPresetsManager::createMissingDefault()
// when changing languages.
savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT);
}
+
+ if (gSavedSettings.getString("PresetGraphicActive").empty())
+ {
+ gSavedSettings.setString("PresetGraphicActive", PRESETS_DEFAULT);
+ }
}
std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory)
@@ -93,7 +98,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
if (found)
{
std::string path = gDirUtilp->add(dir, file);
- std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
+ std::string name = gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true);
if (PRESETS_DEFAULT != name)
{
mPresetNames.push_back(name);
@@ -131,6 +136,8 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st
// Additions or subtractions to the control variables in the floaters must also be reflected here.
if(PRESETS_GRAPHIC == subdirectory)
{
+ gSavedSettings.setString("PresetGraphicActive", name);
+
name_list = boost::assign::list_of
("RenderQualityPerformance")
("RenderFarClip")
@@ -164,7 +171,9 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st
("RenderVBOEnable")
("RenderCompressTextures")
("TextureMemory")
- ("RenderFogRatio");
+ ("RenderFogRatio")
+
+ ("PresetGraphicActive");
}
if(PRESETS_CAMERA == subdirectory)
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 3c8dcaf4d4..7ca38fad03 100755
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -476,15 +476,17 @@ void LLStatusBar::onClickBuyCurrency()
void LLStatusBar::onMouseEnterPresets()
{
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon" );
- LLRect btn_rect = icon->getRect();
+ LLRect icon_rect = icon->getRect();
LLRect pulldown_rect = mPanelPresetsPulldown->getRect();
- pulldown_rect.setLeftTopAndSize(btn_rect.mLeft -
- (pulldown_rect.getWidth() - btn_rect.getWidth()),
- btn_rect.mBottom,
+ pulldown_rect.setLeftTopAndSize(icon_rect.mLeft -
+ (pulldown_rect.getWidth() - icon_rect.getWidth()),
+ icon_rect.mBottom,
pulldown_rect.getWidth(),
pulldown_rect.getHeight());
+ pulldown_rect.translate(popup_holder->getRect().getWidth() - pulldown_rect.mRight, 0);
mPanelPresetsPulldown->setShape(pulldown_rect);
// show the master presets pull-down
@@ -497,6 +499,7 @@ void LLStatusBar::onMouseEnterPresets()
void LLStatusBar::onMouseEnterVolume()
{
+ LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
LLButton* volbtn = getChild<LLButton>( "volume_btn" );
LLRect vol_btn_rect = volbtn->getRect();
LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect();
@@ -506,6 +509,7 @@ void LLStatusBar::onMouseEnterVolume()
volume_pulldown_rect.getWidth(),
volume_pulldown_rect.getHeight());
+ volume_pulldown_rect.translate(popup_holder->getRect().getWidth() - volume_pulldown_rect.mRight, 0);
mPanelVolumePulldown->setShape(volume_pulldown_rect);
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 837644ed27..6df4a4f2ea 100755
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -37,7 +37,7 @@
<button
follows="top|left"
height="23"
- label="Save..."
+ label="SaveAs..."
layout="topleft"
left_pad="5"
name="PrefSaveButton"
@@ -949,22 +949,9 @@
<button
follows="left|bottom"
height="23"
- label="Apply"
- label_selected="Apply"
- layout="topleft"
- left="10"
- name="Apply"
- top="310"
- width="115">
- <button.commit_callback
- function="Pref.Apply" />
- </button>
- <button
- follows="left|bottom"
- height="23"
label="Undo"
layout="topleft"
- left_pad="5"
+ left="10"
name="Defaults"
top="310"
width="115">
@@ -974,12 +961,12 @@
<button
follows="left|bottom"
height="23"
- label="Recommended"
+ label="Recommended Settings"
layout="topleft"
left_pad="5"
name="Recommended"
top="310"
- width="115">
+ width="190">
<button.commit_callback
function="Pref.Recommended" />
</button>
diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml
index 697bfd58e7..652d85656c 100644
--- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml
+++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml
@@ -12,29 +12,60 @@
layout="topleft"
name="presets_pulldown"
width="225">
- <button
- name="open_prefs_btn"
- image_overlay="Icon_Gear_Foreground"
- hover_glow_amount="0.15"
- tool_tip = "Bring up graphics prefs"
- top="5"
- left="5"
- height="20"
- width="20">
- <button.commit_callback
- function="Presets.GoGraphicsPrefs" />
- </button>
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
- top_delta="4"
- left_delta="25"
+ top="4"
+ left_delta="5"
font.style="BOLD"
name="Graphic Presets"
width="120">
Graphic Presets
</text>
+ <scroll_list
+ follows="left|top"
+ layout="topleft"
+ column_padding="0"
+ height="100"
+ width="215"
+ draw_heading="false"
+ draw_stripes="false"
+ bg_stripe_color="0.25 0.25 0.25 0.25"
+ top_delta="15"
+ left_delta="0"
+ name="preset_list">
+ <scroll_list.columns
+ width="10"
+ label="Active"
+ name="active_name" />
+ <scroll_list.columns
+ width="200"
+ label="Preset Name"
+ name="preset_name" />
+ <scroll_list.commit_callback
+ function="Presets.RowClick" />
+ </scroll_list>
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ left="5"
+ name="horiz_separator"
+ top_delta="105"
+ width="215" />
+ <button
+ name="open_prefs_btn"
+ label="Open Graphics Preferences"
+ tool_tip = "Bring up graphics prefs"
+ top_delta="5"
+ left="15"
+ height="20"
+ width="200">
+ <button.commit_callback
+ function="Presets.GoGraphicsPrefs" />
+ </button>
</panel>