Skip to content
Snippets Groups Projects
Commit dcc6dca9 authored by ¡Cinder! ㊝'s avatar ¡Cinder! ㊝ :speech_balloon:
Browse files

Legacy notification well for normal folks who don't like checking their...

Legacy notification well for normal folks who don't like checking their mailboxes or categorizing spaghettios. Simple folk who just want to love and be loved.

UNPLUMBED AT THE MOMENT IT IS PART OF *A THING*
parent 01de4c27
No related branches found
No related tags found
No related merge requests found
......@@ -446,6 +446,7 @@ set(viewer_SOURCE_FILES
lllandmarkactions.cpp
lllandmarklist.cpp
lllegacyatmospherics.cpp
lllegacynotificationwellwindow.cpp
lllistbrowser.cpp
lllistcontextmenu.cpp
lllistview.cpp
......@@ -1155,6 +1156,7 @@ set(viewer_HEADER_FILES
llkeyconflict.h
lllandmarkactions.h
lllandmarklist.h
lllegacynotificationwellwindow.h
lllightconstants.h
lllistbrowser.h
lllistcontextmenu.h
......
/**
* @file lllegacynotificationwellwindow.cpp
* @brief Notification well intended for managing notifications
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "lllegacynotificationwellwindow.h"
#include "llchiclet.h"
#include "llflatlistview.h"
#include "llfloaterreg.h"
#include "llnotificationhandler.h"
#include "lltoastpanel.h"
LLNotificationWellWindow::WellNotificationChannel::WellNotificationChannel(LLNotificationWellWindow* well_window)
: LLNotificationChannel(LLNotificationChannel::Params().name(well_window->getPathname()))
, mWellWindow(well_window)
{
connectToChannel("Notifications");
connectToChannel("Group Notifications");
connectToChannel("Offer");
}
LLNotificationWellWindow::LLNotificationWellWindow(const LLSD& key)
: LLSysWellWindow(key)
{
mNotificationUpdates.reset(new WellNotificationChannel(this));
}
// static
LLNotificationWellWindow* LLNotificationWellWindow::getInstance(const LLSD& key /*= LLSD()*/)
{
return LLFloaterReg::getTypedInstance<LLNotificationWellWindow>("legacy_notification_well_window", key);
}
// virtual
BOOL LLNotificationWellWindow::postBuild()
{
BOOL rv = LLSysWellWindow::postBuild();
setTitle(getString("title_notification_well_window"));
return rv;
}
// virtual
void LLNotificationWellWindow::setVisible(BOOL visible)
{
if (visible)
{
// when Notification channel is cleared, storable toasts will be added into the list.
clearScreenChannels();
}
LLSysWellWindow::setVisible(visible);
}
void LLNotificationWellWindow::addItem(const LLSysWellItem::Params& p)
{
LLSD value = p.notification_id;
// do not add clones
if( mMessageList->getItemByValue(value))
return;
LLSysWellItem* new_item = new LLSysWellItem(p);
if (mMessageList->addItem(new_item, value, ADD_TOP))
{
mSysWellChiclet->updateWidget(isWindowEmpty());
reshapeWindow();
new_item->setOnItemCloseCallback(boost::bind(&LLNotificationWellWindow::onItemClose, this, _1));
new_item->setOnItemClickCallback(boost::bind(&LLNotificationWellWindow::onItemClick, this, _1));
}
else
{
LL_WARNS() << "Unable to add Notification into the list, notification ID: " << p.notification_id
<< ", title: " << p.title
<< LL_ENDL;
new_item->die();
}
}
void LLNotificationWellWindow::closeAll()
{
// Need to clear notification channel, to add storable toasts into the list.
clearScreenChannels();
std::vector<LLPanel*> items;
mMessageList->getItems(items);
for (std::vector<LLPanel*>::iterator
iter = items.begin(),
iter_end = items.end();
iter != iter_end; ++iter)
{
LLSysWellItem* sys_well_item = dynamic_cast<LLSysWellItem*>(*iter);
if (sys_well_item)
onItemClose(sys_well_item);
}
}
void LLNotificationWellWindow::initChannel()
{
LLSysWellWindow::initChannel();
if(mChannel)
{
mChannel->addOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2));
}
}
void LLNotificationWellWindow::clearScreenChannels()
{
// 1 - remove StartUp toast and channel if present
if(!LLNotificationsUI::LLScreenChannel::getStartUpToastShown())
{
LLNotificationsUI::LLChannelManager::getInstance()->onStartUpToastClose();
}
// 2 - remove toasts in Notification channel
if(mChannel)
{
mChannel->removeAndStoreAllStorableToasts();
}
}
void LLNotificationWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id)
{
LLSysWellItem::Params p;
p.notification_id = id;
p.title = static_cast<LLToastPanel*>(info_panel)->getTitle();
addItem(p);
}
void LLNotificationWellWindow::onItemClick(LLSysWellItem* item)
{
LLUUID id = item->getID();
LLFloaterReg::showInstance("inspect_toast", id);
}
void LLNotificationWellWindow::onItemClose(LLSysWellItem* item)
{
LLUUID id = item->getID();
if(mChannel)
{
// removeItemByID() is invoked from killToastByNotificationID() and item will removed;
mChannel->killToastByNotificationID(id);
}
else
{
// removeItemByID() should be called one time for each item to remove it from notification well
removeItemByID(id);
}
}
void LLNotificationWellWindow::onAdd( LLNotificationPtr notify )
{
removeItemByID(notify->getID());
}
/**
* @file lllegacynotificationwellwindow.h
* @brief Notification well intended for managing notifications
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_NOTIFICATIONWELLWINDOW_H
#define LL_NOTIFICATIONWELLWINDOW_H
#include "llnotificationptr.h"
#include "llnotifications.h"
#include "llsyswellwindow.h"
class LLPanel;
class LLNotificationWellWindow : public LLSysWellWindow
{
public:
LLNotificationWellWindow(const LLSD& key);
static LLNotificationWellWindow* getInstance(const LLSD& key = LLSD());
BOOL postBuild() override;
void setVisible(BOOL visible) override;
void onAdd(LLNotificationPtr notify);
// Operating with items
void addItem(const LLSysWellItem::Params& p);
// Closes all notifications and removes them from the Notification Well
void closeAll();
protected:
struct WellNotificationChannel : public LLNotificationChannel
{
WellNotificationChannel(LLNotificationWellWindow*);
void onDelete(LLNotificationPtr notify)
{
mWellWindow->removeItemByID(notify->getID());
}
LLNotificationWellWindow* mWellWindow;
};
LLNotificationChannelPtr mNotificationUpdates;
const std::string& getAnchorViewName() override { return NOTIFICATION_WELL_ANCHOR_NAME; }
private:
// init Window's channel
void initChannel() override;
void clearScreenChannels();
void onStoreToast(LLPanel* info_panel, LLUUID id);
// Handlers
void onItemClick(LLSysWellItem* item);
void onItemClose(LLSysWellItem* item);
// ID of a toast loaded by user (by clicking notification well item)
LLUUID mLoadedToastId;
};
#endif // LL_NOTIFICATIONWELLWINDOW_H
......@@ -178,6 +178,7 @@
#include "llinspectobject.h"
#include "llinspectremoteobject.h"
#include "llinspecttoast.h"
#include "lllegacynotificationwellwindow.h"
#include "llmoveview.h"
#include "llfloaterimnearbychat.h"
#include "llpanelblockedlist.h"
......@@ -442,6 +443,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("delete_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteQueue>);
LLFloaterReg::add("generic_text", "floater_generic_text.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGenericText>);
LLFloaterReg::add("legacy_profile", "floater_profile_legacy.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<LLFloaterProfileLegacy>);
LLFloaterReg::add("legacy_notification_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNotificationWellWindow>);
LLFloaterReg::add("lightbox", "floater_lightbox_settings.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<ALFloaterLightBox>);
LLFloaterReg::add("message_builder", "floater_message_builder.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMessageBuilder>);
LLFloaterReg::add("message_log", "floater_message_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMessageLog>);
......
......@@ -23,6 +23,10 @@
name="title_im_well_window">
CONVERSATIONS
</string>
<string
name="title_notification_well_window">
NOTIFICATIONS
</string>
<flat_list_view
color="FloaterDefaultBackgroundColor"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment