[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:
Lirusaito
2013-04-19 11:49:29 -04:00
parent 4cb28f1dea
commit c79487d3da
4 changed files with 86 additions and 145 deletions

View File

@@ -3,10 +3,9 @@
* @brief Message popup preferences panel
*
* $LicenseInfo:firstyear=2003&license=viewergpl$
*
* Second Life Viewer Source Code
* 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
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
@@ -34,36 +33,30 @@
#include "llpanelmsgs.h"
#include "llnotificationsutil.h"
#include "llscrolllistctrl.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"
#include "lluictrlfactory.h"
#include "llfirstuse.h"
#include "llnotificationtemplate.h"
//-----------------------------------------------------------------------------
LLPanelMsgs::LLPanelMsgs() :
LLPanel("Messages Panel")
LLPanelMsgs::LLPanelMsgs()
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml");
}
LLPanelMsgs::~LLPanelMsgs()
{ }
{
}
//-----------------------------------------------------------------------------
// postBuild()
//-----------------------------------------------------------------------------
BOOL LLPanelMsgs::postBuild()
{
childSetAction("enable_popup", onClickEnablePopup, this);
childSetAction("reset_dialogs_btn", onClickResetDialogs, this);
childSetAction("skip_dialogs_btn", onClickSkipDialogs, this);
childSetAction("skip_frst_btn", onClickSkipFirstTime, this);
getChild<LLUICtrl>("enable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickEnablePopup, this));
getChild<LLUICtrl>("disable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickDisablePopup, this));
getChild<LLUICtrl>("reset_dialogs_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickResetDialogs, 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("show_new_inventory", gSavedSettings.getBOOL("ShowNewInventory"));
@@ -72,8 +65,18 @@ BOOL LLPanelMsgs::postBuild()
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 =
getChildRef<LLScrollListCtrl>("disabled_popups");
@@ -103,7 +106,7 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in
LLStringUtil::format(ignore_msg,notification->getSubstitutions());
row["columns"][0]["value"] = ignore_msg;
row["columns"][0]["font"] = "SANSSERIF_SMALL";
row["columns"][0]["width"] = 300;
row["columns"][0]["width"] = 500;
LLScrollListItem* item = NULL;
@@ -129,13 +132,11 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in
row["columns"][1]["font"] = "SANSSERIF_SMALL";
row["columns"][1]["width"] = 160;
}
item = disabled_popups.addElement(row,
ADD_SORTED);
item = disabled_popups.addElement(row, ADD_SORTED);
}
else
{
item = enabled_popups.addElement(row,
ADD_SORTED);
item = enabled_popups.addElement(row, ADD_SORTED);
}
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()
{
@@ -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()
{
for (LLNotificationTemplates::TemplateMap::const_iterator iter = LLNotificationTemplates::instance().templatesBegin();
@@ -199,70 +214,22 @@ void LLPanelMsgs::setAllIgnored()
}
}
//static
void LLPanelMsgs::onClickEnablePopup(void* user_data)
void LLPanelMsgs::onClickResetDialogs()
{
LLPanelMsgs* panelp = (LLPanelMsgs*)user_data;
LLScrollListCtrl& disabled_popups = panelp->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);
}
panelp->buildLists();
resetAllIgnored();
LLFirstUse::resetFirstUse();
buildPopupLists();
}
bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp)
void LLPanelMsgs::onClickSkipDialogs()
{
S32 option = LLNotification::getSelectedOption(notification, response);
if (0 == option)
{
if ( panelp )
{
panelp->resetAllIgnored();
LLFirstUse::resetFirstUse();
panelp->buildLists();
}
}
return false;
setAllIgnored();
LLFirstUse::disableFirstUse();
buildPopupLists();
}
// static
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)
void LLPanelMsgs::onClickSkipFirstTime()
{
LLFirstUse::disableFirstUse();
LLPanelMsgs* panelp = (LLPanelMsgs*)user_data;
if(panelp) panelp->buildLists();
buildPopupLists();
}

View File

@@ -3,10 +3,9 @@
* @brief Message popup preferences panel
*
* $LicenseInfo:firstyear=2003&license=viewergpl$
*
* Second Life Viewer Source Code
* 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
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
@@ -35,29 +34,26 @@
#include "llpanel.h"
class LLScrollListCtrl;
class LLPanelMsgs : public LLPanel
{
public:
LLPanelMsgs();
/*virtual*/ ~LLPanelMsgs();
/*virtual*/ BOOL postBuild();
/*virtual*/ void draw();
void apply();
void cancel();
/*virtual*/ void draw();
/*virtual*/ BOOL postBuild();
static void onClickEnablePopup(void* user_data);
static void onClickResetDialogs(void* user_data);
static void onClickSkipDialogs(void* user_data);
static void onClickSkipFirstTime(void* user_data);
void buildLists();
void onClickEnablePopup();
void onClickDisablePopup();
void resetAllIgnored();
void setAllIgnored();
void onClickResetDialogs();
void onClickSkipDialogs();
void onClickSkipFirstTime();
void buildPopupLists();
};
#endif // LL_PANEL_MSGS

View File

@@ -1141,28 +1141,6 @@ Please select a proposal to view.
Please select a history item to view.
</notification>
<notification
icon="alertmodal.tga"
name="ResetShowNextTimeDialogs"
type="alertmodal">
Would you like to re-enable all these popups, which you previously indicated &apos;Don&apos;t show me again&apos;?
<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
icon="notify.tga"
name="CacheWillClear"

View File

@@ -1,15 +1,15 @@
<?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">
<text bottom="-20" follows="top" left="15" name="dont_show_label">Do not show these popups:</text>
<scroll_list follows="top" height="88" name="disabled_popups" width="480"/>
<button follows="top" height="20" label="Enable this popup" name="enable_popup" width="175"/>
<button follows="top" height="20" label="Enable all popups..." left="200" name="reset_dialogs_btn" tool_tip="Enable all of the optional popups and &apos;first time use&apos; notifications." width="175" bottom_delta="0"/>
<text follows="top" left="15" name="show_label" bottom_delta="-24">Show these popups:</text>
<scroll_list follows="top" height="88" left="15" name="enabled_popups" width="480"/>
<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 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 &apos;first time use&apos; notifications." width="175"/>
<text bottom_delta="-24" follows="top" height="10" left="15" name="text_box2">Offers of notecards, textures and landmarks:</text>
<check_box bottom_delta="-25" follows="top" height="16" initial_value="false" label="Automatically accept" left="40" name="accept_new_inventory"/>
<check_box bottom_delta="-20" follows="top" height="16" initial_value="true" label="Automatically view after accepting" name="show_new_inventory"/>
<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"/>
<check_box bottom="-22" left="16" follows="top" height="16" label="Automatically accept item offers" name="accept_new_inventory"/>
<check_box bottom_delta="0" left_delta="250" follows="top" height="16" label="View previewable items after accepting" name="show_new_inventory"/>
<check_box bottom_delta="-20" left="16" follows="top" height="16" label="Show newly accepted objects in inventory" name="show_in_inventory"/>
<text bottom_delta="-12" follows="top" left="15" name="show_label">Always show:</text>
<scroll_list follows="top" multi_select="true" height="169" 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="" image_overlay="arrow_up.tga" left_delta="105" name="enable_popup" width="30" bottom_delta="0"/>
<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"/>
<button follows="top" height="20" label="" image_overlay="arrow_down.tga" left_delta="180" name="disable_popup" width="30" bottom_delta="0"/>
<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"/>
<text follows="top" left="15" name="dont_show_label" bottom_delta="-12">Never show:</text>
<scroll_list follows="top" multi_select="true" height="169" left="15" name="disabled_popups" width="480"/>
</panel>