diff options
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationtiphandler.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpanelgenerictip.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llpanelgenerictip.h | 47 | ||||
-rw-r--r-- | indra/newview/lltoastnotifypanel.h | 5 | ||||
-rw-r--r-- | indra/newview/lltoastpanel.cpp | 23 | ||||
-rw-r--r-- | indra/newview/lltoastpanel.h | 10 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_generic_tip.xml | 23 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_toast.xml | 2 |
9 files changed, 172 insertions, 5 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 47fde08a9d..b3f7a64efb 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -438,6 +438,7 @@ set(viewer_SOURCE_FILES lltracker.cpp lltransientdockablefloater.cpp lltransientfloatermgr.cpp + llpanelgenerictip.cpp lluilistener.cpp lluploaddialog.cpp llurl.cpp @@ -940,6 +941,7 @@ 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 afc00bf7ef..407de79c89 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -157,6 +157,7 @@ bool LLTipHandler::processNotification(const LLSD& notify) } LLToastPanel* notify_box = NULL; + // TODO: this should be implemented in LLToastPanel::buidPanelFromNotification if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName()) { LLOnlineStatusToast::Params p; @@ -167,6 +168,14 @@ bool LLTipHandler::processNotification(const LLSD& notify) } else { + notify_box = LLToastPanel::buidPanelFromNotification(notification); + } + + // TODO: this if statement should be removed after modification of + // LLToastPanel::buidPanelFromNotification() to allow create generic tip panel + // for all tip notifications except FriendOnline and FriendOffline + if (notify_box == NULL) + { notify_box = new LLToastNotifyPanel(notification); } diff --git a/indra/newview/llpanelgenerictip.cpp b/indra/newview/llpanelgenerictip.cpp new file mode 100644 index 0000000000..2e977faf09 --- /dev/null +++ b/indra/newview/llpanelgenerictip.cpp @@ -0,0 +1,56 @@ +/** + * @file llpanelgenerictip.cpp + * @brief Represents a generic panel for a notifytip notifications. As example: + * "SystemMessageTip", "Cancelled", "UploadWebSnapshotDone". + * + * $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 "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) +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_generic_tip.xml"); + + childSetValue("message", notification->getMessage()); + + // set line max count to 3 in case of a very long name + snapToMessageHeight(getChild<LLTextBox> ("message"), 3); +} + diff --git a/indra/newview/llpanelgenerictip.h b/indra/newview/llpanelgenerictip.h new file mode 100644 index 0000000000..0eb502498a --- /dev/null +++ b/indra/newview/llpanelgenerictip.h @@ -0,0 +1,47 @@ +/** + * @file llpanelgenerictip.h + * @brief Represents a generic panel for a notifytip notifications. As example: + * "SystemMessageTip", "Cancelled", "UploadWebSnapshotDone". + * + * $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$ + */ + +#ifndef LL_PANELGENERICTIP_H +#define LL_PANELGENERICTIP_H + +#include "lltoastpanel.h" + +class LLPanelGenericTip: public LLToastPanel +{ + // disallow instantiation of this class +private: + // grant privileges to instantiate this class to LLToastPanel + friend class LLToastPanel; + LLPanelGenericTip(const LLNotificationPtr& notification); +}; +#endif /* LL_PANELGENERICTIP_H */ diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 1c68e4c6b3..a6644c0a7a 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -49,6 +49,9 @@ class LLNotificationForm; * Notification panel should be used for notifications that require a response from the user. * * Replaces class LLNotifyBox. + * + * @deprecated this class will be removed after all toast panel types are + * implemented in separate classes. */ class LLToastNotifyPanel: public LLToastPanel { @@ -60,6 +63,8 @@ public: * @param rect an initial rectangle of the toast panel. * If it is null then a loaded from xml rectangle will be used. * @see LLNotification + * @deprecated if you intend to instantiate LLToastNotifyPanel - it's point to + * implement right class for desired toast panel. @see LLGenericTipPanel as example. */ LLToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null); virtual ~LLToastNotifyPanel(); diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index 755e647777..d142a0665b 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -32,14 +32,14 @@ #include "llviewerprecompiledheaders.h" -#include "lltoastpanel.h" - +#include "llpanelgenerictip.h" #include "llnotifications.h" +#include "lltoastpanel.h" //static const S32 LLToastPanel::MIN_PANEL_HEIGHT = 40; // VPAD(4)*2 + ICON_HEIGHT(32) -LLToastPanel::LLToastPanel(LLNotificationPtr& notification) +LLToastPanel::LLToastPanel(const LLNotificationPtr& notification) { mNotification = notification; } @@ -91,3 +91,20 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount) } } +// static +LLToastPanel* LLToastPanel::buidPanelFromNotification( + const LLNotificationPtr& notification) +{ + LLToastPanel* res = NULL; + + if (notification->getName() == "SystemMessageTip") + { + res = new LLPanelGenericTip(notification); + } + /* + else if(...) + create all other specific non-public toast panel + */ + + return res; +} diff --git a/indra/newview/lltoastpanel.h b/indra/newview/lltoastpanel.h index f1dd7d7a86..54243e52fa 100644 --- a/indra/newview/lltoastpanel.h +++ b/indra/newview/lltoastpanel.h @@ -53,13 +53,21 @@ public: */ class LLToastPanel: public LLPanel { public: - LLToastPanel(LLNotificationPtr&); + LLToastPanel(const LLNotificationPtr&); virtual ~LLToastPanel() = 0; virtual std::string getTitle(); virtual const LLUUID& getID(); static const S32 MIN_PANEL_HEIGHT; + + /** + * Builder method for constructing notification specific panels. + * Normally type of created panels shouldn't be publicated and should be hidden + * from other functionality. + */ + static LLToastPanel* buidPanelFromNotification( + const LLNotificationPtr& notification); protected: LLNotificationPtr mNotification; void snapToMessageHeight(LLTextBase* message, S32 maxLineCount); diff --git a/indra/newview/skins/default/xui/en/panel_generic_tip.xml b/indra/newview/skins/default/xui/en/panel_generic_tip.xml new file mode 100644 index 0000000000..453ed7c7a6 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_generic_tip.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel + height="40" + layout="topleft" + left="0" + name="panel_system_tip" + top="0" + width="305"> + <text + follows="all" + font="SansSerif" + height="20" + layout="topleft" + left="10" + max_length="350" + name="message" + text_color="white" + top="10" + use_ellipses="true" + value="" + width="285" + wrap="true" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml index e7384fa77f..92b4c17247 100644 --- a/indra/newview/skins/default/xui/en/panel_toast.xml +++ b/indra/newview/skins/default/xui/en/panel_toast.xml @@ -55,7 +55,7 @@ clip_partial="true" visible="false" follows="left|top|right|bottom" - font="SansSerifBold" + font="SansSerif" height="20" layout="topleft" left="20" |