summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAlexei Arabadji <aarabadji@productengine.com>2010-04-19 17:21:16 +0300
committerAlexei Arabadji <aarabadji@productengine.com>2010-04-19 17:21:16 +0300
commitd57e8ecc7e119ca6930499ee270f438fc5ec415a (patch)
tree16e50c507e0adac9b046309d3241b3f87510f740 /indra/newview
parenteddb964e701d43e6d5135fd82e8c065a43e4a0e5 (diff)
fixed EXT-6848 Avoid creation of dummy objects in LLOnlineStatusToast and LLPanelGenericTip classes.
* decoupled tip toast panel related logic from class LLTast; * moved documentation comment of LLPanelGenericTip constructor from .cpp to .h file; * corrected name attribute in panel_generic_tip.xml; reviewed by Mike Antipov and Vadim Savchuk at https://codereview.productengine.com/secondlife/r/230/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt6
-rw-r--r--indra/newview/llnotificationtiphandler.cpp5
-rw-r--r--indra/newview/llpanelgenerictip.cpp9
-rw-r--r--indra/newview/llpanelgenerictip.h14
-rw-r--r--indra/newview/llpaneltiptoast.cpp69
-rw-r--r--indra/newview/llpaneltiptoast.h57
-rw-r--r--indra/newview/lltoast.cpp29
-rw-r--r--indra/newview/lltoast.h5
-rw-r--r--indra/newview/skins/default/xui/en/panel_generic_tip.xml2
9 files changed, 159 insertions, 37 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 4158899446..efb16d1e42 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -303,6 +303,7 @@ set(viewer_SOURCE_FILES
llpanelcontents.cpp
llpaneleditwearable.cpp
llpanelface.cpp
+ llpanelgenerictip.cpp
llpanelgroup.cpp
llpanelgroupgeneral.cpp
llpanelgroupinvite.cpp
@@ -342,6 +343,7 @@ set(viewer_SOURCE_FILES
llpanelprofile.cpp
llpanelprofileview.cpp
llpanelteleporthistory.cpp
+ llpaneltiptoast.cpp
llpanelvolume.cpp
llpanelvolumepulldown.cpp
llparcelselection.cpp
@@ -437,7 +439,6 @@ set(viewer_SOURCE_FILES
lltracker.cpp
lltransientdockablefloater.cpp
lltransientfloatermgr.cpp
- llpanelgenerictip.cpp
lluilistener.cpp
lluploaddialog.cpp
llurl.cpp
@@ -802,6 +803,7 @@ set(viewer_HEADER_FILES
llpanelcontents.h
llpaneleditwearable.h
llpanelface.h
+ llpanelgenerictip.h
llpanelgroup.h
llpanelgroupgeneral.h
llpanelgroupinvite.h
@@ -841,6 +843,7 @@ set(viewer_HEADER_FILES
llpanelprofile.h
llpanelprofileview.h
llpanelteleporthistory.h
+ llpaneltiptoast.h
llpanelvolume.h
llpanelvolumepulldown.h
llparcelselection.h
@@ -939,7 +942,6 @@ set(viewer_HEADER_FILES
lltracker.h
lltransientdockablefloater.h
lltransientfloatermgr.h
- llpanelgenerictip.h
lluiconstants.h
lluilistener.h
lluploaddialog.h
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 407de79c89..e528f871af 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -41,10 +41,11 @@
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "llnotificationmanager.h"
+#include "llpaneltiptoast.h"
using namespace LLNotificationsUI;
-class LLOnlineStatusToast : public LLToastPanel
+class LLOnlineStatusToast : public LLPanelTipToast
{
public:
@@ -57,7 +58,7 @@ public:
Params() {}
};
- LLOnlineStatusToast(Params& p) : LLToastPanel(p.notification)
+ LLOnlineStatusToast(Params& p) : LLPanelTipToast(p.notification)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_online_status_toast.xml");
diff --git a/indra/newview/llpanelgenerictip.cpp b/indra/newview/llpanelgenerictip.cpp
index 2e977faf09..e0658554a4 100644
--- a/indra/newview/llpanelgenerictip.cpp
+++ b/indra/newview/llpanelgenerictip.cpp
@@ -36,15 +36,10 @@
#include "llpanelgenerictip.h"
#include "llnotifications.h"
-/**
- * Generic toast tip panel.
- * This is particular case of toast panel that decoupled from LLToastNotifyPanel.
- * From now LLToastNotifyPanel is deprecated and will be removed after all panel
- * types are represented in separate classes.
- */
+
LLPanelGenericTip::LLPanelGenericTip(
const LLNotificationPtr& notification) :
- LLToastPanel(notification)
+ LLPanelTipToast(notification)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_generic_tip.xml");
diff --git a/indra/newview/llpanelgenerictip.h b/indra/newview/llpanelgenerictip.h
index 0eb502498a..defa069727 100644
--- a/indra/newview/llpanelgenerictip.h
+++ b/indra/newview/llpanelgenerictip.h
@@ -34,14 +34,24 @@
#ifndef LL_PANELGENERICTIP_H
#define LL_PANELGENERICTIP_H
-#include "lltoastpanel.h"
+#include "llpaneltiptoast.h"
-class LLPanelGenericTip: public LLToastPanel
+/**
+ * Represents tip toast panel that contains only one child element - message text.
+ * This panel can be used for different cases of tip notifications.
+ */
+class LLPanelGenericTip: public LLPanelTipToast
{
// disallow instantiation of this class
private:
// grant privileges to instantiate this class to LLToastPanel
friend class LLToastPanel;
+ /**
+ * Generic toast tip panel.
+ * This is particular case of toast panel that decoupled from LLToastNotifyPanel.
+ * From now LLToastNotifyPanel is deprecated and will be removed after all panel
+ * types are represented in separate classes.
+ */
LLPanelGenericTip(const LLNotificationPtr& notification);
};
#endif /* LL_PANELGENERICTIP_H */
diff --git a/indra/newview/llpaneltiptoast.cpp b/indra/newview/llpaneltiptoast.cpp
new file mode 100644
index 0000000000..23367df41a
--- /dev/null
+++ b/indra/newview/llpaneltiptoast.cpp
@@ -0,0 +1,69 @@
+/**
+ * @file llpaneltiptoast.cpp
+ * @brief Represents a base class of tip toast panels.
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, 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
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llpaneltiptoast.h"
+
+BOOL LLPanelTipToast::postBuild()
+{
+ mMessageText= findChild<LLUICtrl>("message");
+
+ if (mMessageText != NULL)
+ {
+ mMessageText->setMouseUpCallback(boost::bind(&LLPanelTipToast::onMessageTextClick,this));
+ setMouseUpCallback(boost::bind(&LLPanelTipToast::onPanelClick, this, _2, _3, _4));
+ }
+ else
+ {
+ llassert(!"Can't find child 'message' text box.");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void LLPanelTipToast::onMessageTextClick()
+{
+ // notify parent toast about need hide
+ LLSD info;
+ info["action"] = "hide_toast";
+ notifyParent(info);
+}
+
+void LLPanelTipToast::onPanelClick(S32 x, S32 y, MASK mask)
+{
+ if (!mMessageText->getRect().pointInRect(x, y))
+ {
+ onMessageTextClick();
+ }
+}
diff --git a/indra/newview/llpaneltiptoast.h b/indra/newview/llpaneltiptoast.h
new file mode 100644
index 0000000000..e8678aa1d3
--- /dev/null
+++ b/indra/newview/llpaneltiptoast.h
@@ -0,0 +1,57 @@
+/**
+ * @file llpaneltiptoast.h
+ * @brief Represents a base class of tip toast panels.
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, 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
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "lltoastpanel.h"
+
+#ifndef LL_PANELTOASTTIP_H
+#define LL_PANELTOASTTIP_H
+
+/**
+ * Base class for tip toast panels.
+ *
+ * Tip toast panels are required to have text message box named as 'message'.
+ */
+class LLPanelTipToast : public LLToastPanel
+{
+ LOG_CLASS(LLPanelTipToast);
+public:
+ LLPanelTipToast(const LLNotificationPtr& notification): LLToastPanel(notification) {}
+ virtual BOOL postBuild();
+private:
+ void onMessageTextClick();
+ void onPanelClick(S32 x, S32 y, MASK mask);
+
+ LLUICtrl* mMessageText;
+};
+
+#endif /* LL_PANELTOASTTIP_H */
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 911ed6ade7..22b12ee132 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -119,30 +119,10 @@ BOOL LLToast::postBuild()
mTimer->stop();
}
- if (mIsTip)
- {
- mTextEditor = mPanel->getChild<LLTextEditor>("text_editor_box");
-
- if (mTextEditor)
- {
- mTextEditor->setMouseUpCallback(boost::bind(&LLToast::hide,this));
- mPanel->setMouseUpCallback(boost::bind(&LLToast::handleTipToastClick, this, _2, _3, _4));
- }
- }
-
return TRUE;
}
//--------------------------------------------------------------------------
-void LLToast::handleTipToastClick(S32 x, S32 y, MASK mask)
-{
- if (!mTextEditor->getRect().pointInRect(x, y))
- {
- hide();
- }
-}
-
-//--------------------------------------------------------------------------
void LLToast::setHideButtonEnabled(bool enabled)
{
if(mHideBtn)
@@ -421,4 +401,13 @@ bool LLToast::isNotificationValid()
//--------------------------------------------------------------------------
+S32 LLToast::notifyParent(const LLSD& info)
+{
+ if (info.has("action") && "hide_toast" == info["action"].asString())
+ {
+ hide();
+ return 1;
+ }
+ return LLModalDialog::notifyParent(info);
+}
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index bd07ff9fb1..4a213580da 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -190,14 +190,14 @@ public:
boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
+ virtual S32 notifyParent(const LLSD& info);
+
private:
void onToastMouseEnter();
void onToastMouseLeave();
- void handleTipToastClick(S32 x, S32 y, MASK mask);
-
void expire();
LLUUID mNotificationID;
@@ -213,7 +213,6 @@ private:
LLPanel* mPanel;
LLButton* mHideBtn;
- LLTextEditor* mTextEditor;
LLColor4 mBgColor;
bool mCanFade;
diff --git a/indra/newview/skins/default/xui/en/panel_generic_tip.xml b/indra/newview/skins/default/xui/en/panel_generic_tip.xml
index 453ed7c7a6..eea92895f5 100644
--- a/indra/newview/skins/default/xui/en/panel_generic_tip.xml
+++ b/indra/newview/skins/default/xui/en/panel_generic_tip.xml
@@ -3,7 +3,7 @@
height="40"
layout="topleft"
left="0"
- name="panel_system_tip"
+ name="panel_generic_tip"
top="0"
width="305">
<text