[Frosting] Modernize llpanelmsgs.* and the Popups Preferences
Makes the scrolllists multiselect, adds a disable button, rearranges the buttons, and maximizes vertical and horizontal use of real estate for scroll lists. Finally notifications can easily be passed back and forth between the two lists Removes the pointless alerts for explaining what "en/dis-able all" does. If some language needs larger explanation, there's always tooltips, but it should be obvious enough without notifications. As for code changes, this swaps a whole bunch of static functions over to boost::bind and removes includes. Translators will need to update panel_preferences_popups.xml (and notifications.xml)
This commit is contained in:
@@ -3,10 +3,9 @@
|
|||||||
* @brief Message popup preferences panel
|
* @brief Message popup preferences panel
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
||||||
*
|
* Second Life Viewer Source Code
|
||||||
* Copyright (c) 2003-2009, Linden Research, Inc.
|
* Copyright (c) 2003-2009, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
* to you under the terms of the GNU General Public License, version 2.0
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
@@ -34,36 +33,30 @@
|
|||||||
|
|
||||||
#include "llpanelmsgs.h"
|
#include "llpanelmsgs.h"
|
||||||
|
|
||||||
#include "llnotificationsutil.h"
|
|
||||||
#include "llscrolllistctrl.h"
|
#include "llscrolllistctrl.h"
|
||||||
#include "llviewerwindow.h"
|
|
||||||
#include "llviewercontrol.h"
|
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
#include "llfirstuse.h"
|
#include "llfirstuse.h"
|
||||||
#include "llnotificationtemplate.h"
|
#include "llnotificationtemplate.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
LLPanelMsgs::LLPanelMsgs()
|
||||||
LLPanelMsgs::LLPanelMsgs() :
|
|
||||||
LLPanel("Messages Panel")
|
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml");
|
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LLPanelMsgs::~LLPanelMsgs()
|
LLPanelMsgs::~LLPanelMsgs()
|
||||||
{ }
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// postBuild()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
BOOL LLPanelMsgs::postBuild()
|
BOOL LLPanelMsgs::postBuild()
|
||||||
{
|
{
|
||||||
childSetAction("enable_popup", onClickEnablePopup, this);
|
getChild<LLUICtrl>("enable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickEnablePopup, this));
|
||||||
childSetAction("reset_dialogs_btn", onClickResetDialogs, this);
|
getChild<LLUICtrl>("disable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickDisablePopup, this));
|
||||||
childSetAction("skip_dialogs_btn", onClickSkipDialogs, this);
|
getChild<LLUICtrl>("reset_dialogs_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickResetDialogs, this));
|
||||||
childSetAction("skip_frst_btn", onClickSkipFirstTime, this);
|
getChild<LLUICtrl>("skip_dialogs_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickSkipDialogs, this));
|
||||||
|
getChild<LLUICtrl>("skip_frst_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickSkipFirstTime, this));
|
||||||
|
|
||||||
buildLists();
|
buildPopupLists();
|
||||||
|
|
||||||
childSetValue("accept_new_inventory", gSavedSettings.getBOOL("AutoAcceptNewInventory"));
|
childSetValue("accept_new_inventory", gSavedSettings.getBOOL("AutoAcceptNewInventory"));
|
||||||
childSetValue("show_new_inventory", gSavedSettings.getBOOL("ShowNewInventory"));
|
childSetValue("show_new_inventory", gSavedSettings.getBOOL("ShowNewInventory"));
|
||||||
@@ -72,8 +65,18 @@ BOOL LLPanelMsgs::postBuild()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPanelMsgs::draw()
|
||||||
|
{
|
||||||
|
BOOL has_first_selected = (getChildRef<LLScrollListCtrl>("disabled_popups").getFirstSelected()!=NULL);
|
||||||
|
childSetEnabled("enable_popup", has_first_selected);
|
||||||
|
|
||||||
void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in v3
|
has_first_selected = (getChildRef<LLScrollListCtrl>("enabled_popups").getFirstSelected()!=NULL);
|
||||||
|
childSetEnabled("disable_popup", has_first_selected);
|
||||||
|
|
||||||
|
LLPanel::draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPanelMsgs::buildPopupLists() //void LLFloaterPreference::buildPopupLists() in v3
|
||||||
{
|
{
|
||||||
LLScrollListCtrl& disabled_popups =
|
LLScrollListCtrl& disabled_popups =
|
||||||
getChildRef<LLScrollListCtrl>("disabled_popups");
|
getChildRef<LLScrollListCtrl>("disabled_popups");
|
||||||
@@ -103,7 +106,7 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in
|
|||||||
LLStringUtil::format(ignore_msg,notification->getSubstitutions());
|
LLStringUtil::format(ignore_msg,notification->getSubstitutions());
|
||||||
row["columns"][0]["value"] = ignore_msg;
|
row["columns"][0]["value"] = ignore_msg;
|
||||||
row["columns"][0]["font"] = "SANSSERIF_SMALL";
|
row["columns"][0]["font"] = "SANSSERIF_SMALL";
|
||||||
row["columns"][0]["width"] = 300;
|
row["columns"][0]["width"] = 500;
|
||||||
|
|
||||||
LLScrollListItem* item = NULL;
|
LLScrollListItem* item = NULL;
|
||||||
|
|
||||||
@@ -129,13 +132,11 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in
|
|||||||
row["columns"][1]["font"] = "SANSSERIF_SMALL";
|
row["columns"][1]["font"] = "SANSSERIF_SMALL";
|
||||||
row["columns"][1]["width"] = 160;
|
row["columns"][1]["width"] = 160;
|
||||||
}
|
}
|
||||||
item = disabled_popups.addElement(row,
|
item = disabled_popups.addElement(row, ADD_SORTED);
|
||||||
ADD_SORTED);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item = enabled_popups.addElement(row,
|
item = enabled_popups.addElement(row, ADD_SORTED);
|
||||||
ADD_SORTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
@@ -145,22 +146,6 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelMsgs::draw()
|
|
||||||
{
|
|
||||||
LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
|
|
||||||
|
|
||||||
if (disabled_popups.getFirstSelected())
|
|
||||||
{
|
|
||||||
childEnable("enable_popup");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
childDisable("enable_popup");
|
|
||||||
}
|
|
||||||
|
|
||||||
LLPanel::draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LLPanelMsgs::apply()
|
void LLPanelMsgs::apply()
|
||||||
{
|
{
|
||||||
@@ -173,6 +158,36 @@ void LLPanelMsgs::cancel()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPanelMsgs::onClickEnablePopup()
|
||||||
|
{
|
||||||
|
LLScrollListCtrl& disabled_popups = getChildRef<LLScrollListCtrl>("disabled_popups");
|
||||||
|
|
||||||
|
std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
|
||||||
|
std::vector<LLScrollListItem*>::iterator itor;
|
||||||
|
for (itor = items.begin(); itor != items.end(); ++itor)
|
||||||
|
{
|
||||||
|
LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
|
||||||
|
gSavedSettings.setWarning(templatep->mName, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
buildPopupLists();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLPanelMsgs::onClickDisablePopup()
|
||||||
|
{
|
||||||
|
LLScrollListCtrl& enabled_popups = getChildRef<LLScrollListCtrl>("enabled_popups");
|
||||||
|
|
||||||
|
std::vector<LLScrollListItem*> items = enabled_popups.getAllSelected();
|
||||||
|
std::vector<LLScrollListItem*>::iterator itor;
|
||||||
|
for (itor = items.begin(); itor != items.end(); ++itor)
|
||||||
|
{
|
||||||
|
LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
|
||||||
|
gSavedSettings.setWarning(templatep->mName, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
buildPopupLists();
|
||||||
|
}
|
||||||
|
|
||||||
void LLPanelMsgs::resetAllIgnored()
|
void LLPanelMsgs::resetAllIgnored()
|
||||||
{
|
{
|
||||||
for (LLNotificationTemplates::TemplateMap::const_iterator iter = LLNotificationTemplates::instance().templatesBegin();
|
for (LLNotificationTemplates::TemplateMap::const_iterator iter = LLNotificationTemplates::instance().templatesBegin();
|
||||||
@@ -199,70 +214,22 @@ void LLPanelMsgs::setAllIgnored()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLPanelMsgs::onClickResetDialogs()
|
||||||
void LLPanelMsgs::onClickEnablePopup(void* user_data)
|
|
||||||
{
|
{
|
||||||
LLPanelMsgs* panelp = (LLPanelMsgs*)user_data;
|
resetAllIgnored();
|
||||||
|
LLFirstUse::resetFirstUse();
|
||||||
LLScrollListCtrl& disabled_popups = panelp->getChildRef<LLScrollListCtrl>("disabled_popups");
|
buildPopupLists();
|
||||||
|
|
||||||
std::vector<LLScrollListItem*> items = disabled_popups.getAllSelected();
|
|
||||||
std::vector<LLScrollListItem*>::iterator itor;
|
|
||||||
for (itor = items.begin(); itor != items.end(); ++itor)
|
|
||||||
{
|
|
||||||
LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata()));
|
|
||||||
gSavedSettings.setWarning(templatep->mName, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
panelp->buildLists();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp)
|
void LLPanelMsgs::onClickSkipDialogs()
|
||||||
{
|
{
|
||||||
S32 option = LLNotification::getSelectedOption(notification, response);
|
setAllIgnored();
|
||||||
if (0 == option)
|
LLFirstUse::disableFirstUse();
|
||||||
{
|
buildPopupLists();
|
||||||
if ( panelp )
|
|
||||||
{
|
|
||||||
panelp->resetAllIgnored();
|
|
||||||
LLFirstUse::resetFirstUse();
|
|
||||||
panelp->buildLists();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLPanelMsgs::onClickSkipFirstTime()
|
||||||
void LLPanelMsgs::onClickResetDialogs(void* user_data)
|
|
||||||
{
|
|
||||||
LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, (LLPanelMsgs*)user_data));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp)
|
|
||||||
{
|
|
||||||
S32 option = LLNotification::getSelectedOption(notification, response);
|
|
||||||
if (0 == option)
|
|
||||||
{
|
|
||||||
if ( panelp )
|
|
||||||
{
|
|
||||||
panelp->setAllIgnored();
|
|
||||||
LLFirstUse::disableFirstUse();
|
|
||||||
panelp->buildLists();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void LLPanelMsgs::onClickSkipDialogs(void* user_data)
|
|
||||||
{
|
|
||||||
LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, (LLPanelMsgs*)user_data));
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void LLPanelMsgs::onClickSkipFirstTime(void* user_data)
|
|
||||||
{
|
{
|
||||||
LLFirstUse::disableFirstUse();
|
LLFirstUse::disableFirstUse();
|
||||||
LLPanelMsgs* panelp = (LLPanelMsgs*)user_data;
|
buildPopupLists();
|
||||||
if(panelp) panelp->buildLists();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
* @brief Message popup preferences panel
|
* @brief Message popup preferences panel
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
* $LicenseInfo:firstyear=2003&license=viewergpl$
|
||||||
*
|
* Second Life Viewer Source Code
|
||||||
* Copyright (c) 2003-2009, Linden Research, Inc.
|
* Copyright (c) 2003-2009, Linden Research, Inc.
|
||||||
*
|
*
|
||||||
* Second Life Viewer Source Code
|
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||||
* to you under the terms of the GNU General Public License, version 2.0
|
* to you under the terms of the GNU General Public License, version 2.0
|
||||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||||
@@ -35,29 +34,26 @@
|
|||||||
|
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
|
|
||||||
class LLScrollListCtrl;
|
|
||||||
|
|
||||||
class LLPanelMsgs : public LLPanel
|
class LLPanelMsgs : public LLPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLPanelMsgs();
|
LLPanelMsgs();
|
||||||
/*virtual*/ ~LLPanelMsgs();
|
/*virtual*/ ~LLPanelMsgs();
|
||||||
|
|
||||||
/*virtual*/ BOOL postBuild();
|
|
||||||
/*virtual*/ void draw();
|
|
||||||
|
|
||||||
void apply();
|
void apply();
|
||||||
void cancel();
|
void cancel();
|
||||||
|
/*virtual*/ void draw();
|
||||||
|
/*virtual*/ BOOL postBuild();
|
||||||
|
|
||||||
static void onClickEnablePopup(void* user_data);
|
void onClickEnablePopup();
|
||||||
static void onClickResetDialogs(void* user_data);
|
void onClickDisablePopup();
|
||||||
static void onClickSkipDialogs(void* user_data);
|
|
||||||
static void onClickSkipFirstTime(void* user_data);
|
|
||||||
|
|
||||||
void buildLists();
|
|
||||||
|
|
||||||
void resetAllIgnored();
|
void resetAllIgnored();
|
||||||
void setAllIgnored();
|
void setAllIgnored();
|
||||||
|
void onClickResetDialogs();
|
||||||
|
void onClickSkipDialogs();
|
||||||
|
void onClickSkipFirstTime();
|
||||||
|
|
||||||
|
void buildPopupLists();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_PANEL_MSGS
|
#endif // LL_PANEL_MSGS
|
||||||
|
|||||||
@@ -1141,28 +1141,6 @@ Please select a proposal to view.
|
|||||||
Please select a history item to view.
|
Please select a history item to view.
|
||||||
</notification>
|
</notification>
|
||||||
|
|
||||||
<notification
|
|
||||||
icon="alertmodal.tga"
|
|
||||||
name="ResetShowNextTimeDialogs"
|
|
||||||
type="alertmodal">
|
|
||||||
Would you like to re-enable all these popups, which you previously indicated 'Don't show me again'?
|
|
||||||
<usetemplate
|
|
||||||
name="okcancelbuttons"
|
|
||||||
notext="Cancel"
|
|
||||||
yestext="OK"/>
|
|
||||||
</notification>
|
|
||||||
|
|
||||||
<notification
|
|
||||||
icon="alertmodal.tga"
|
|
||||||
name="SkipShowNextTimeDialogs"
|
|
||||||
type="alertmodal">
|
|
||||||
Would you like to disable all popups which can be skipped?
|
|
||||||
<usetemplate
|
|
||||||
name="okcancelbuttons"
|
|
||||||
notext="Cancel"
|
|
||||||
yestext="OK"/>
|
|
||||||
</notification>
|
|
||||||
|
|
||||||
<notification
|
<notification
|
||||||
icon="notify.tga"
|
icon="notify.tga"
|
||||||
name="CacheWillClear"
|
name="CacheWillClear"
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||||
<panel border="true" bottom="0" height="500" label="Popups" left="0" name="popups" title="Popups" width="400">
|
<panel border="true" bottom="0" height="500" label="Popups" left="0" name="popups" title="Popups" width="400">
|
||||||
<text bottom="-20" follows="top" left="15" name="dont_show_label">Do not show these popups:</text>
|
<check_box bottom="-22" left="16" follows="top" height="16" label="Automatically accept item offers" name="accept_new_inventory"/>
|
||||||
<scroll_list follows="top" height="88" name="disabled_popups" width="480"/>
|
<check_box bottom_delta="0" left_delta="250" follows="top" height="16" label="View previewable items after accepting" name="show_new_inventory"/>
|
||||||
<button follows="top" height="20" label="Enable this popup" name="enable_popup" width="175"/>
|
<check_box bottom_delta="-20" left="16" follows="top" height="16" label="Show newly accepted objects in inventory" name="show_in_inventory"/>
|
||||||
<button follows="top" height="20" label="Enable all popups..." left="200" name="reset_dialogs_btn" tool_tip="Enable all of the optional popups and 'first time use' notifications." width="175" bottom_delta="0"/>
|
<text bottom_delta="-12" follows="top" left="15" name="show_label">Always show:</text>
|
||||||
<text follows="top" left="15" name="show_label" bottom_delta="-24">Show these popups:</text>
|
<scroll_list follows="top" multi_select="true" height="169" name="enabled_popups" width="480"/>
|
||||||
<scroll_list follows="top" height="88" left="15" name="enabled_popups" width="480"/>
|
<button follows="top" height="20" label="Enable all" left="25" name="reset_dialogs_btn" tool_tip="Enable all of the optional popups and 'first time use' notifications." width="100"/>
|
||||||
<button follows="top" height="20" label="Disable first time popups..." name="skip_frst_btn" tool_tip="Disable all of the first time use notifications." width="175"/>
|
<button follows="top" height="20" label="" image_overlay="arrow_up.tga" left_delta="105" name="enable_popup" width="30" bottom_delta="0"/>
|
||||||
<button bottom_delta="0" follows="top" height="20" label="Disable all these popups..." left="200" name="skip_dialogs_btn" tool_tip="Disable all of the optional popups and 'first time use' notifications." width="175"/>
|
<button follows="top" height="20" label="Disable first time popups..." left_delta="35" name="skip_frst_btn" tool_tip="Disable all of the first time use notifications." width="175" bottom_delta="0"/>
|
||||||
<text bottom_delta="-24" follows="top" height="10" left="15" name="text_box2">Offers of notecards, textures and landmarks:</text>
|
<button follows="top" height="20" label="" image_overlay="arrow_down.tga" left_delta="180" name="disable_popup" width="30" bottom_delta="0"/>
|
||||||
<check_box bottom_delta="-25" follows="top" height="16" initial_value="false" label="Automatically accept" left="40" name="accept_new_inventory"/>
|
<button bottom_delta="0" follows="top" height="20" label="Disable all" left_delta="35" name="skip_dialogs_btn" tool_tip="Disable all of the optional popups and 'first time use' notifications." width="100"/>
|
||||||
<check_box bottom_delta="-20" follows="top" height="16" initial_value="true" label="Automatically view after accepting" name="show_new_inventory"/>
|
<text follows="top" left="15" name="dont_show_label" bottom_delta="-12">Never show:</text>
|
||||||
<check_box bottom_delta="-20" follows="top" height="16" initial_value="true" label="Automatically show newly accepted objects in inventory" left="18" name="show_in_inventory"/>
|
<scroll_list follows="top" multi_select="true" height="169" left="15" name="disabled_popups" width="480"/>
|
||||||
</panel>
|
</panel>
|
||||||
|
|||||||
Reference in New Issue
Block a user