From 1ea65f0285d7022ce20ef84d4e35e3c94bcb3fbd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Mar 2012 22:56:02 -0700 Subject: CHUI-51 WIP notifications routig code cleanup phase 1, removal of most of llnotificationhandler --- indra/llui/llnotifications.cpp | 50 +++--- indra/llui/llnotifications.h | 21 +-- indra/llui/llnotificationtemplate.h | 10 +- indra/newview/llbrowsernotification.cpp | 5 +- indra/newview/llchiclet.cpp | 9 +- indra/newview/llfloaternotificationsconsole.cpp | 2 +- indra/newview/llfloateroutbox.cpp | 51 +----- indra/newview/llfloateroutbox.h | 2 +- indra/newview/llimhandler.cpp | 82 +++++----- indra/newview/llnearbychathandler.cpp | 8 +- indra/newview/llnearbychathandler.h | 3 +- indra/newview/llnotificationalerthandler.cpp | 99 +++++------- indra/newview/llnotificationgrouphandler.cpp | 50 +++--- indra/newview/llnotificationhandler.h | 143 ++++++----------- indra/newview/llnotificationhandlerutil.cpp | 126 ++------------- indra/newview/llnotificationhinthandler.cpp | 26 +--- indra/newview/llnotificationmanager.cpp | 90 ++--------- indra/newview/llnotificationmanager.h | 11 +- indra/newview/llnotificationofferhandler.cpp | 172 ++++++++++----------- indra/newview/llnotificationscripthandler.cpp | 89 +++++------ indra/newview/llnotificationtiphandler.cpp | 117 ++++++-------- indra/newview/llscreenchannel.h | 14 +- indra/newview/llsyswellwindow.cpp | 11 +- indra/newview/lltoastgroupnotifypanel.cpp | 2 +- indra/newview/lltoastgroupnotifypanel.h | 2 +- indra/newview/lltoastnotifypanel.cpp | 4 +- indra/newview/lltoastnotifypanel.h | 4 +- indra/newview/llviewermessage.cpp | 2 - indra/newview/llviewerwindow.cpp | 8 +- .../newview/skins/default/xui/en/notifications.xml | 22 +++ 30 files changed, 435 insertions(+), 800 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d232e27ef2..038a86d20a 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -409,7 +409,9 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mUnique(p.unique.isProvided()), mPriority(p.priority), mPersist(p.persist), - mDefaultFunctor(p.functor.isProvided() ? p.functor() : p.name()) + mDefaultFunctor(p.functor.isProvided() ? p.functor() : p.name()), + mLogToChat(p.log_to_chat), + mLogToIM(p.log_to_im) { if (p.sound.isProvided() && LLUI::sSettingGroups["config"]->controlExists(p.sound)) @@ -886,6 +888,24 @@ std::string LLNotification::getURL() const return (mTemplatep ? url : ""); } +bool LLNotification::canLogToChat() const +{ + return mTemplatep->mLogToChat; +} + +bool LLNotification::canLogToIM() const +{ + return mTemplatep->mLogToIM; +} + +bool LLNotification::hasFormElements() const +{ + return mTemplatep->mForm->getNumElements() != 0; +} + + + + // ========================================================= // LLNotificationChannel implementation // --- @@ -1051,20 +1071,6 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt return abortProcessing; } -/* static */ -LLNotificationChannelPtr LLNotificationChannel::buildChannel(const std::string& name, - const std::string& parent, - LLNotificationFilter filter, - LLNotificationComparator comparator) -{ - // note: this is not a leak; notifications are self-registering. - // This factory helps to prevent excess deletions by making sure all smart - // pointers to notification channels come from the same source - new LLNotificationChannel(name, parent, filter, comparator); - return LLNotifications::instance().getChannel(name); -} - - LLNotificationChannel::LLNotificationChannel(const std::string& name, const std::string& parent, LLNotificationFilter filter, @@ -1272,19 +1278,19 @@ void LLNotifications::createDefaultChannels() { // now construct the various channels AFTER loading the notifications, // because the history channel is going to rewrite the stored notifications file - LLNotificationChannel::buildChannel("Enabled", "", + new LLNotificationChannel("Enabled", "", !boost::bind(&LLNotifications::getIgnoreAllNotifications, this)); - LLNotificationChannel::buildChannel("Expiration", "Enabled", + new LLNotificationChannel("Expiration", "Enabled", boost::bind(&LLNotifications::expirationFilter, this, _1)); - LLNotificationChannel::buildChannel("Unexpired", "Enabled", + new LLNotificationChannel("Unexpired", "Enabled", !boost::bind(&LLNotifications::expirationFilter, this, _1)); // use negated bind - LLNotificationChannel::buildChannel("Unique", "Unexpired", + new LLNotificationChannel("Unique", "Unexpired", boost::bind(&LLNotifications::uniqueFilter, this, _1)); - LLNotificationChannel::buildChannel("Ignore", "Unique", + new LLNotificationChannel("Ignore", "Unique", filterIgnoredNotifications); - LLNotificationChannel::buildChannel("VisibilityRules", "Ignore", + new LLNotificationChannel("VisibilityRules", "Ignore", boost::bind(&LLNotifications::isVisibleByRules, this, _1)); - LLNotificationChannel::buildChannel("Visible", "VisibilityRules", + new LLNotificationChannel("Visible", "VisibilityRules", &LLNotificationFilters::includeEverything); // create special persistent notification channel diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 462d69be2e..f83365a97d 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -513,7 +513,10 @@ public: std::string getURL() const; S32 getURLOption() const; S32 getURLOpenExternally() const; - + bool canLogToChat() const; + bool canLogToIM() const; + bool hasFormElements() const; + const LLNotificationFormPtr getForm(); const LLDate getExpiration() const @@ -791,13 +794,6 @@ typedef boost::shared_ptr LLNotificationChannelPtr; // of a queue with notifications being added to different nonequivalent copies. So we // make it inherit from boost::noncopyable, and then create a map of shared_ptr to manage it. // -// NOTE: LLNotificationChannel is self-registering. The *correct* way to create one is to -// do something like: -// LLNotificationChannel::buildChannel("name", "parent"...); -// This returns an LLNotificationChannelPtr, which you can store, or -// you can then retrieve the channel by using the registry: -// LLNotifications::instance().getChannel("name")... -// class LLNotificationChannel : boost::noncopyable, public LLNotificationChannelBase @@ -822,20 +818,13 @@ public: std::string summarize(); - // factory method for constructing these channels; since they're self-registering, - // we want to make sure that you can't use new to make them - static LLNotificationChannelPtr buildChannel(const std::string& name, const std::string& parent, - LLNotificationFilter filter=LLNotificationFilters::includeEverything, - LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); - -protected: // Notification Channels have a filter, which determines which notifications // will be added to this channel. // Channel filters cannot change. // Channels have a protected constructor so you can't make smart pointers that don't // come from our internal reference; call NotificationChannel::build(args) LLNotificationChannel(const std::string& name, const std::string& parent, - LLNotificationFilter filter, LLNotificationComparator comparator); + LLNotificationFilter filter, LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); private: std::string mName; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index fb50c9c123..1df7205b23 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -170,7 +170,9 @@ struct LLNotificationTemplate struct Params : public LLInitParam::Block { Mandatory name; - Optional persist; + Optional persist, + log_to_im, + log_to_chat; Optional functor, icon, label, @@ -190,6 +192,8 @@ struct LLNotificationTemplate Params() : name("name"), persist("persist", false), + log_to_im("log_to_im", false), + log_to_chat("log_to_chat", false), functor("functor"), icon("icon"), label("label"), @@ -291,6 +295,10 @@ struct LLNotificationTemplate LLUUID mSoundEffect; // List of tags that rules can match against. std::list mTags; + + // inject these notifications into chat/IM streams + bool mLogToChat; + bool mLogToIM; }; #endif //LL_LLNOTIFICATION_TEMPLATE_H diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp index 6e77d1e336..9e608d2c8b 100644 --- a/indra/newview/llbrowsernotification.cpp +++ b/indra/newview/llbrowsernotification.cpp @@ -35,11 +35,8 @@ using namespace LLNotificationsUI; -bool LLBrowserNotification::processNotification(const LLSD& notify) +bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification) { - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - if (!notification) return false; - LLUUID media_id = notification->getPayload()["media_id"].asUUID(); LLMediaCtrl* media_instance = LLMediaCtrl::getInstance(media_id); if (media_instance) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index aabab0ccb9..9f19f8dd1c 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -339,9 +339,9 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) , mUreadSystemNotifications(0) { // connect counter handlers to the signals - connectCounterUpdatersToSignal("notify"); - connectCounterUpdatersToSignal("groupnotify"); - connectCounterUpdatersToSignal("offer"); + connectCounterUpdatersToSignal("Notify"); + connectCounterUpdatersToSignal("Group Notify"); + connectCounterUpdatersToSignal("Offer"); // ensure that notification well window exists, to synchronously // handle toast add/delete events. @@ -350,8 +350,7 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) void LLNotificationChiclet::connectCounterUpdatersToSignal(const std::string& notification_type) { - LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance(); - LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type); + LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast(LLNotifications::instance().getChannel(notification_type).get()); if(n_handler) { n_handler->setNewNotificationCallback(boost::bind(&LLNotificationChiclet::incUreadSystemNotifications, this)); diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index 2681d4b34d..90dbabebfb 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -57,7 +57,7 @@ LLNotificationChannelPanel::LLNotificationChannelPanel(const LLNotificationChann { mChannelPtr = LLNotifications::instance().getChannel(p.name); mChannelRejectsPtr = LLNotificationChannelPtr( - LLNotificationChannel::buildChannel(p.name() + "rejects", mChannelPtr->getParentChannelName(), + new LLNotificationChannel(p.name() + "rejects", mChannelPtr->getParentChannelName(), !boost::bind(mChannelPtr->getFilter(), _1))); buildFromFile( "panel_notifications_channel.xml"); } diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 540f977305..2a2b231b53 100644 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -44,14 +44,12 @@ #include "llviewernetwork.h" #include "llwindowshade.h" -#define USE_WINDOWSHADE_DIALOGS 0 - ///---------------------------------------------------------------------------- /// LLOutboxNotification class ///---------------------------------------------------------------------------- -bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLSD& notify) +bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotificationPtr& notify) { LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance("outbox"); @@ -516,52 +514,11 @@ void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content) updateView(); } -void LLFloaterOutbox::showNotification(const LLSD& notify) +void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) { - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if (!notification) - { - llerrs << "Unable to find outbox notification!" << notify.asString() << llendl; - - return; - } - -#if USE_WINDOWSHADE_DIALOGS - - if (mWindowShade) - { - delete mWindowShade; - } - - LLRect floater_rect = getLocalRect(); - floater_rect.mTop -= getHeaderHeight(); - floater_rect.stretch(-5, 0); - - LLWindowShade::Params params; - params.name = "notification_shade"; - params.rect = floater_rect; - params.follows.flags = FOLLOWS_ALL; - params.modal = true; - params.can_close = false; - params.shade_color = LLColor4::white % 0.25f; - params.text_color = LLColor4::white; - - mWindowShade = LLUICtrlFactory::create(params); - - addChild(mWindowShade); - mWindowShade->show(notification); - -#else - - LLNotificationsUI::LLEventHandler * handler = - LLNotificationsUI::LLNotificationManager::instance().getHandlerForNotification("alertmodal"); - - LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast(handler); + LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast(LLNotifications::instance().getChannel("AlertModal").get()); llassert(sys_handler); - sys_handler->processNotification(notify); - -#endif + sys_handler->processNotification(notification); } diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h index 18baccf1c9..a91d8c1139 100644 --- a/indra/newview/llfloateroutbox.h +++ b/indra/newview/llfloateroutbox.h @@ -64,7 +64,7 @@ public: EAcceptance* accept, std::string& tooltip_msg); - void showNotification(const LLSD& notify); + void showNotification(const LLNotificationPtr& notification); BOOL handleHover(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp index cd71da7393..a92c4fa387 100644 --- a/indra/newview/llimhandler.cpp +++ b/indra/newview/llimhandler.cpp @@ -37,10 +37,9 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLIMHandler::LLIMHandler(e_notification_type type, const LLSD& id) +LLIMHandler::LLIMHandler() +: LLSysHandler("IM Notifications", "notifytoast") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); } @@ -59,62 +58,51 @@ void LLIMHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLIMHandler::processNotification(const LLSD& notify) +bool LLIMHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { - LLSD substitutions = notification->getSubstitutions(); - - // According to comments in LLIMMgr::addMessage(), if we get message - // from ourselves, the sender id is set to null. This fixes EXT-875. - LLUUID avatar_id = substitutions["FROM_ID"].asUUID(); - if (avatar_id.isNull()) - avatar_id = gAgentID; - - LLToastIMPanel::Params im_p; - im_p.notification = notification; - im_p.avatar_id = avatar_id; - im_p.from = substitutions["FROM"].asString(); - im_p.time = substitutions["TIME"].asString(); - im_p.message = substitutions["MESSAGE"].asString(); - im_p.session_id = substitutions["SESSION_ID"].asUUID(); - - LLToastIMPanel* im_box = new LLToastIMPanel(im_p); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.session_id = im_p.session_id; - p.notification = notification; - p.panel = im_box; - p.can_be_stored = false; - p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1); - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); - - // send a signal to the counter manager; - mNewNotificationSignal(); - } - else if (notify["sigtype"].asString() == "delete") - { - mChannel->killToastByNotificationID(notification->getID()); - } + LLSD substitutions = notification->getSubstitutions(); + + // According to comments in LLIMMgr::addMessage(), if we get message + // from ourselves, the sender id is set to null. This fixes EXT-875. + LLUUID avatar_id = substitutions["FROM_ID"].asUUID(); + if (avatar_id.isNull()) + avatar_id = gAgentID; + + LLToastIMPanel::Params im_p; + im_p.notification = notification; + im_p.avatar_id = avatar_id; + im_p.from = substitutions["FROM"].asString(); + im_p.time = substitutions["TIME"].asString(); + im_p.message = substitutions["MESSAGE"].asString(); + im_p.session_id = substitutions["SESSION_ID"].asUUID(); + + LLToastIMPanel* im_box = new LLToastIMPanel(im_p); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.session_id = im_p.session_id; + p.notification = notification; + p.panel = im_box; + p.can_be_stored = false; + p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); + + // send a signal to the counter manager; + mNewNotificationSignal(); + return false; } diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 240a7c7a35..269b42bbe9 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -445,10 +445,8 @@ void LLNearbyChatScreenChannel::arrangeToasts() //----------------------------------------------------------------------------------------------- boost::scoped_ptr LLNearbyChatHandler::sChatWatcher(new LLEventStream("LLChat")); -LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& id) +LLNearbyChatHandler::LLNearbyChatHandler() { - mType = type; - // Getting a Channel for our notifications LLNearbyChatScreenChannel::Params p; p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID")); @@ -614,10 +612,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, } } -void LLNearbyChatHandler::onDeleteToast(LLToast* toast) -{ -} - //----------------------------------------------------------------------------------------------- // LLNearbyChatToast diff --git a/indra/newview/llnearbychathandler.h b/indra/newview/llnearbychathandler.h index b0e4f62d51..a5034ac1cb 100644 --- a/indra/newview/llnearbychathandler.h +++ b/indra/newview/llnearbychathandler.h @@ -37,14 +37,13 @@ namespace LLNotificationsUI{ class LLNearbyChatHandler : public LLChatHandler { public: - LLNearbyChatHandler(e_notification_type type,const LLSD& id); + LLNearbyChatHandler(); virtual ~LLNearbyChatHandler(); virtual void processChat(const LLChat& chat_msg, const LLSD &args); protected: - virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); static boost::scoped_ptr sChatWatcher; diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp index cae7d02fed..e6239534f7 100644 --- a/indra/newview/llnotificationalerthandler.cpp +++ b/indra/newview/llnotificationalerthandler.cpp @@ -40,10 +40,10 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLAlertHandler::LLAlertHandler(e_notification_type type, const LLSD& id) : mIsModal(false) +LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal) +: LLSysHandler(name, notification_type), + mIsModal(is_modal) { - mType = type; - LLScreenChannelBase::Params p; p.id = LLUUID(gSavedSettings.getString("AlertChannelUUID")); p.display_toasts_always = true; @@ -68,79 +68,58 @@ void LLAlertHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLAlertHandler::processNotification(const LLSD& notify) +bool LLAlertHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load") + if (notification->canLogToIM() && notification->hasFormElements()) { - if (LLHandlerUtil::canSpawnSessionAndLogToIM(notification)) - { - const std::string name = LLHandlerUtil::getSubstitutionName(notification); - - LLUUID from_id = notification->getPayload()["from_id"]; - - // firstly create session... - LLHandlerUtil::spawnIMSession(name, from_id); - - // ...then log message to have IM Well notified about new message - LLHandlerUtil::logToIMP2P(notification); - } - - LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = dynamic_cast(alert_dialog); - p.enable_hide_btn = false; - p.can_fade = false; - p.is_modal = mIsModal; - p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1); - - // Show alert in middle of progress view (during teleport) (EXT-1093) - LLProgressView* progress = gViewerWindow->getProgressView(); - LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled(); - mChannel->updatePositionAndSize(rc); - - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); - } - else if (notify["sigtype"].asString() == "change") - { - LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog); - } - else - { - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->killToastByNotificationID(notification->getID()); + const std::string name = LLHandlerUtil::getSubstitutionName(notification); + + LLUUID from_id = notification->getPayload()["from_id"]; + + // firstly create session... + LLHandlerUtil::spawnIMSession(name, from_id); + + // ...then log message to have IM Well notified about new message + LLHandlerUtil::logToIMP2P(notification); } + + LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = dynamic_cast(alert_dialog); + p.enable_hide_btn = false; + p.can_fade = false; + p.is_modal = mIsModal; + p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1); + + // Show alert in middle of progress view (during teleport) (EXT-1093) + LLProgressView* progress = gViewerWindow->getProgressView(); + LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled(); + mChannel->updatePositionAndSize(rc); + + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); + return false; } -//-------------------------------------------------------------------------- - -void LLAlertHandler::onDeleteToast(LLToast* toast) +void LLAlertHandler::onChange( LLNotificationPtr notification ) { + LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog); } - -//-------------------------------------------------------------------------- - diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 9b7fdaef82..2ce51fa094 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -37,15 +37,14 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLGroupHandler::LLGroupHandler(e_notification_type type, const LLSD& id) +LLGroupHandler::LLGroupHandler() +: LLSysHandler("Group Notifications", "groupnotify") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) - channel->setOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1)); + channel->addOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1)); } //-------------------------------------------------------------------------- @@ -62,48 +61,37 @@ void LLGroupHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLGroupHandler::processNotification(const LLSD& notify) +bool LLGroupHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { - LLHandlerUtil::logGroupNoticeToIMGroup(notification); + LLHandlerUtil::logGroupNoticeToIMGroup(notification); + + LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); - LLPanel* notify_box = new LLToastGroupNotifyPanel(notification); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1); + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); + // send a signal to the counter manager + mNewNotificationSignal(); - // send a signal to the counter manager - mNewNotificationSignal(); + LLGroupActions::refresh_notices(); - LLGroupActions::refresh_notices(); - } - else if (notify["sigtype"].asString() == "delete") - { - mChannel->killToastByNotificationID(notification->getID()); - } return false; } @@ -123,7 +111,7 @@ void LLGroupHandler::onRejectToast(LLUUID& id) { LLNotificationPtr notification = LLNotifications::instance().find(id); - if (notification && LLNotificationManager::getInstance()->getHandlerForNotification(notification->getType()) == this) + if (notification && mItems.find(notification) != mItems.end()) { LLNotifications::instance().cancel(notification); } diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 23dbb6b047..ff9371f7df 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -30,7 +30,7 @@ #include "llwindow.h" -//#include "llnotificationsutil.h" +#include "llnotifications.h" #include "llchannelmanager.h" #include "llchat.h" #include "llinstantmessage.h" @@ -40,20 +40,6 @@ class LLIMFloater; namespace LLNotificationsUI { -// ENotificationType enumerates all possible types of notifications that could be met -// -typedef enum e_notification_type -{ - NT_NOTIFY, - NT_NOTIFYTIP, - NT_GROUPNOTIFY, - NT_IMCHAT, - NT_GROUPCHAT, - NT_NEARBYCHAT, - NT_ALERT, - NT_ALERTMODAL, - NT_OFFER -} ENotificationType; /** * Handler of notification events. @@ -95,7 +81,7 @@ public: boost::signals2::connection setNotificationIDCallback(notification_id_callback_t cb) { return mNotificationIDSignal.connect(cb); } protected: - virtual void onDeleteToast(LLToast* toast)=0; + virtual void onDeleteToast(LLToast* toast) {} // arrange handler's channel on a screen // is necessary to unbind a moment of creation of a channel and a moment of positioning of it @@ -104,8 +90,6 @@ protected: virtual void initChannel()=0; LLScreenChannelBase* mChannel; - e_notification_type mType; - }; // LLSysHandler and LLChatHandler are more specific base classes @@ -115,13 +99,18 @@ protected: /** * Handler for system notifications. */ -class LLSysHandler : public LLEventHandler +class LLSysHandler : public LLEventHandler, public LLNotificationChannel { public: - LLSysHandler(); + LLSysHandler(const std::string& name, const std::string& notification_type); virtual ~LLSysHandler() {}; - virtual bool processNotification(const LLSD& notify)=0; + // base interface functions + /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel) mChannel->killToastByNotificationID(p->getID());} + + virtual bool processNotification(const LLNotificationPtr& notify)=0; protected : static void init(); @@ -149,13 +138,11 @@ public: class LLIMHandler : public LLSysHandler { public: - LLIMHandler(e_notification_type type, const LLSD& id); + LLIMHandler(); virtual ~LLIMHandler(); - // base interface functions - virtual bool processNotification(const LLSD& notify); - protected: + bool processNotification(const LLNotificationPtr& p); virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); }; @@ -167,14 +154,13 @@ protected: class LLTipHandler : public LLSysHandler { public: - LLTipHandler(e_notification_type type, const LLSD& id); + LLTipHandler(); virtual ~LLTipHandler(); // base interface functions - virtual bool processNotification(const LLSD& notify); + virtual bool processNotification(const LLNotificationPtr& p); protected: - virtual void onDeleteToast(LLToast* toast); virtual void onRejectToast(const LLUUID& id); virtual void initChannel(); }; @@ -186,11 +172,12 @@ protected: class LLScriptHandler : public LLSysHandler { public: - LLScriptHandler(e_notification_type type, const LLSD& id); + LLScriptHandler(); virtual ~LLScriptHandler(); + virtual void onDelete(LLNotificationPtr p); // base interface functions - virtual bool processNotification(const LLSD& notify); + virtual bool processNotification(const LLNotificationPtr& p); protected: virtual void onDeleteToast(LLToast* toast); @@ -207,11 +194,11 @@ protected: class LLGroupHandler : public LLSysHandler { public: - LLGroupHandler(e_notification_type type, const LLSD& id); + LLGroupHandler(); virtual ~LLGroupHandler(); // base interface functions - virtual bool processNotification(const LLSD& notify); + virtual bool processNotification(const LLNotificationPtr& p); protected: virtual void onDeleteToast(LLToast* toast); @@ -227,16 +214,16 @@ protected: class LLAlertHandler : public LLSysHandler { public: - LLAlertHandler(e_notification_type type, const LLSD& id); + LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal); virtual ~LLAlertHandler(); - void setAlertMode(bool is_modal) { mIsModal = is_modal; } + /*virtual*/ void onChange(LLNotificationPtr p); + /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); } // base interface functions - virtual bool processNotification(const LLSD& notify); + virtual bool processNotification(const LLNotificationPtr& p); protected: - virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); bool mIsModal; @@ -249,11 +236,12 @@ protected: class LLOfferHandler : public LLSysHandler { public: - LLOfferHandler(e_notification_type type, const LLSD& id); + LLOfferHandler(); virtual ~LLOfferHandler(); // base interface functions - virtual bool processNotification(const LLSD& notify); + /*virtual*/ void onDelete(LLNotificationPtr notification); + virtual bool processNotification(const LLNotificationPtr& p); protected: virtual void onDeleteToast(LLToast* toast); @@ -266,84 +254,54 @@ protected: /** * Handler for UI hints. */ -class LLHintHandler : public LLSingleton +class LLHintHandler : public LLNotificationChannel { public: - LLHintHandler(); - virtual ~LLHintHandler(); + LLHintHandler() : LLNotificationChannel("Hints", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "hint")) + {} + virtual ~LLHintHandler() {} - // base interface functions - virtual bool processNotification(const LLSD& notify); + /*virtual*/ void onAdd(LLNotificationPtr p); + /*virtual*/ void onChange(LLNotificationPtr p); + /*virtual*/ void onDelete(LLNotificationPtr p); }; /** * Handler for browser notifications */ -class LLBrowserNotification : public LLSingleton +class LLBrowserNotification : public LLNotificationChannel { public: - virtual bool processNotification(const LLSD& notify); + LLBrowserNotification() + : LLNotificationChannel("Browser", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "browser")) + {} + /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + bool processNotification(const LLNotificationPtr& p); }; /** * Handler for outbox notifications */ -class LLOutboxNotification : public LLSingleton +class LLOutboxNotification : public LLNotificationChannel { public: - virtual bool processNotification(const LLSD& notify); + LLOutboxNotification() + : LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "outbox")) + {} + /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + bool processNotification(const LLNotificationPtr& p); }; class LLHandlerUtil { public: - /** - * Checks sufficient conditions to log notification message to IM session. - */ - static bool canLogToIM(const LLNotificationPtr& notification); - - /** - * Checks sufficient conditions to log notification message to nearby chat session. - */ - static bool canLogToNearbyChat(const LLNotificationPtr& notification); - - /** - * Checks sufficient conditions to spawn IM session. - */ - static bool canSpawnIMSession(const LLNotificationPtr& notification); - - /** - * Checks sufficient conditions to add notification toast panel IM floater. - */ - static bool canAddNotifPanelToIM(const LLNotificationPtr& notification); - - /** - * Checks whether notification can be used multiple times or not. - */ - static bool isNotificationReusable(const LLNotificationPtr& notification); - - /** - * Checks if passed notification can create IM session and be written into it. - * - * This method uses canLogToIM() & canSpawnIMSession(). - */ - static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); - - /** - * Checks if passed notification can create toast. - */ - static bool canSpawnToast(const LLNotificationPtr& notification); - /** * Determines whether IM floater is opened. */ static bool isIMFloaterOpened(const LLNotificationPtr& notification); - /** - * Determines whether IM floater is focused. - */ - static bool isIMFloaterFocused(const LLNotificationPtr& notification); - /** * Writes notification message to IM session. */ @@ -406,13 +364,6 @@ public: */ static void decIMMesageCounter(const LLNotificationPtr& notification); -private: - - /** - * Find IM floater based on "from_id" - */ - static LLIMFloater* findIMFloater(const LLNotificationPtr& notification); - }; } diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 1b767e80d4..dca7fda151 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -54,7 +54,8 @@ void LLSysHandler::init() sExclusiveNotificationGroups.push_back(online_offline_group); } -LLSysHandler::LLSysHandler() +LLSysHandler::LLSysHandler(const std::string& name, const std::string& notification_type) +: LLNotificationChannel(name, "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, notification_type)) { if(sExclusiveNotificationGroups.empty()) { @@ -110,119 +111,9 @@ void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif) } } -const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), - REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), - OBJECT_GIVE_ITEM("ObjectGiveItem"), - OBJECT_GIVE_ITEM_UNKNOWN_USER("ObjectGiveItemUnknownUser"), - PAYMENT_RECEIVED("PaymentReceived"), - PAYMENT_SENT("PaymentSent"), - ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"), - USER_GIVE_ITEM("UserGiveItem"), - INVENTORY_ACCEPTED("InventoryAccepted"), - INVENTORY_DECLINED("InventoryDeclined"), - OFFER_FRIENDSHIP("OfferFriendship"), - FRIENDSHIP_ACCEPTED("FriendshipAccepted"), - FRIENDSHIP_OFFERED("FriendshipOffered"), - FRIENDSHIP_ACCEPTED_BYME("FriendshipAcceptedByMe"), - FRIENDSHIP_DECLINED_BYME("FriendshipDeclinedByMe"), - FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"), - SERVER_OBJECT_MESSAGE("ServerObjectMessage"), - TELEPORT_OFFERED("TeleportOffered"), - TELEPORT_OFFER_SENT("TeleportOfferSent"), - IM_SYSTEM_MESSAGE_TIP("IMSystemMessageTip"); +const static std::string OBJECT_GIVE_ITEM("ObjectGiveItem"); - -// static -bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) -{ - return GRANTED_MODIFY_RIGHTS == notification->getName() - || REVOKED_MODIFY_RIGHTS == notification->getName() - || PAYMENT_RECEIVED == notification->getName() - || PAYMENT_SENT == notification->getName() - || OFFER_FRIENDSHIP == notification->getName() - || FRIENDSHIP_OFFERED == notification->getName() - || FRIENDSHIP_ACCEPTED == notification->getName() - || FRIENDSHIP_ACCEPTED_BYME == notification->getName() - || FRIENDSHIP_DECLINED_BYME == notification->getName() - || SERVER_OBJECT_MESSAGE == notification->getName() - || INVENTORY_ACCEPTED == notification->getName() - || INVENTORY_DECLINED == notification->getName() - || USER_GIVE_ITEM == notification->getName() - || TELEPORT_OFFERED == notification->getName() - || TELEPORT_OFFER_SENT == notification->getName() - || IM_SYSTEM_MESSAGE_TIP == notification->getName(); -} - -// static -bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification) -{ - return notification->getType() == "notifytip" - && FRIEND_ONLINE != notification->getName() - && FRIEND_OFFLINE != notification->getName() - && INVENTORY_ACCEPTED != notification->getName() - && INVENTORY_DECLINED != notification->getName() - && IM_SYSTEM_MESSAGE_TIP != notification->getName(); -} - -// static -bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) -{ - return OFFER_FRIENDSHIP == notification->getName() - || USER_GIVE_ITEM == notification->getName() - || TELEPORT_OFFERED == notification->getName(); -} - -// static -bool LLHandlerUtil::canAddNotifPanelToIM(const LLNotificationPtr& notification) -{ - return OFFER_FRIENDSHIP == notification->getName() - || USER_GIVE_ITEM == notification->getName() - || TELEPORT_OFFERED == notification->getName(); -} - -// static -bool LLHandlerUtil::isNotificationReusable(const LLNotificationPtr& notification) -{ - return OFFER_FRIENDSHIP == notification->getName() - || USER_GIVE_ITEM == notification->getName() - || TELEPORT_OFFERED == notification->getName(); -} - -// static -bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification) -{ - return canLogToIM(notification) && canSpawnIMSession(notification); -} - -// static -bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification) -{ - if(INVENTORY_DECLINED == notification->getName() - || INVENTORY_ACCEPTED == notification->getName()) - { - // return false for inventory accepted/declined notifications if respective IM window is open (EXT-5909) - return ! isIMFloaterOpened(notification); - } - - if(FRIENDSHIP_ACCEPTED == notification->getName()) - { - // don't show FRIENDSHIP_ACCEPTED if IM window is opened and focused - EXT-6441 - return ! isIMFloaterFocused(notification); - } - - if(OFFER_FRIENDSHIP == notification->getName() - || USER_GIVE_ITEM == notification->getName() - || TELEPORT_OFFERED == notification->getName()) - { - // When ANY offer arrives, show toast, unless IM window is already open - EXT-5904 - return ! isIMFloaterOpened(notification); - } - - return true; -} - -// static -LLIMFloater* LLHandlerUtil::findIMFloater(const LLNotificationPtr& notification) +static LLIMFloater* find_im_floater(const LLNotificationPtr& notification) { LLUUID from_id = notification->getPayload()["from_id"]; LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); @@ -234,7 +125,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { bool res = false; - LLIMFloater* im_floater = findIMFloater(notification); + LLIMFloater* im_floater = find_im_floater(notification); if (im_floater != NULL) { res = im_floater->getVisible() == TRUE; @@ -243,11 +134,11 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) return res; } -bool LLHandlerUtil::isIMFloaterFocused(const LLNotificationPtr& notification) +static bool is_IM_floater_focused(const LLNotificationPtr& notification) { bool res = false; - LLIMFloater* im_floater = findIMFloater(notification); + LLIMFloater* im_floater = find_im_floater(notification); if (im_floater != NULL) { res = im_floater->hasFocus() == TRUE; @@ -335,7 +226,7 @@ void log_name_callback(const std::string& full_name, const std::string& from_nam void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) { // don't create IM p2p session with objects, it's necessary condition to log - if (notification->getName() != OBJECT_GIVE_ITEM) + //if (notification->getName() != OBJECT_GIVE_ITEM) { LLUUID from_id = notification->getPayload()["from_id"]; @@ -505,3 +396,4 @@ void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification) arg["participant_unread"] = session->mParticipantUnreadMessageCount; LLIMModel::getInstance()->mNewMsgSignal(arg); } + diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp index f7163cb04f..47156a3915 100644 --- a/indra/newview/llnotificationhinthandler.cpp +++ b/indra/newview/llnotificationhinthandler.cpp @@ -33,26 +33,6 @@ using namespace LLNotificationsUI; -LLHintHandler::LLHintHandler() -{ -} - -LLHintHandler::~LLHintHandler() -{ -} - -bool LLHintHandler::processNotification(const LLSD& notify) -{ - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - std::string sigtype = notify["sigtype"].asString(); - if (sigtype == "add" || sigtype == "load") - { - LLHints::show(notification); - } - else if (sigtype == "delete") - { - LLHints::hide(notification); - } - return false; -} +void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); } +void LLHintHandler::onChange(LLNotificationPtr p) { LLHints::show(p); } +void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); } diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 6105eff8ea..394ae2ac21 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -41,7 +41,6 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLNotificationManager::LLNotificationManager() { - mNotifyHandlers.clear(); init(); } @@ -53,88 +52,23 @@ LLNotificationManager::~LLNotificationManager() //-------------------------------------------------------------------------- void LLNotificationManager::init() { - LLNotificationChannel::buildChannel("Notifications", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "notify")); - LLNotificationChannel::buildChannel("NotificationTips", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "notifytip")); - LLNotificationChannel::buildChannel("Group Notifications", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "groupnotify")); - LLNotificationChannel::buildChannel("Alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert")); - LLNotificationChannel::buildChannel("AlertModal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal")); - LLNotificationChannel::buildChannel("IM Notifications", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "notifytoast")); - LLNotificationChannel::buildChannel("Offer", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "offer")); - LLNotificationChannel::buildChannel("Hints", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "hint")); - LLNotificationChannel::buildChannel("Browser", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "browser")); - LLNotificationChannel::buildChannel("Outbox", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "outbox")); - - LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1)); - LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1)); - LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1)); - LLNotifications::instance().getChannel("Outbox")->connectChanged(boost::bind(&LLOutboxNotification::processNotification, LLOutboxNotification::getInstance(), _1)); - - mNotifyHandlers["notify"] = boost::shared_ptr(new LLScriptHandler(NT_NOTIFY, LLSD())); - mNotifyHandlers["notifytip"] = boost::shared_ptr(new LLTipHandler(NT_NOTIFY, LLSD())); - mNotifyHandlers["groupnotify"] = boost::shared_ptr(new LLGroupHandler(NT_GROUPNOTIFY, LLSD())); - mNotifyHandlers["alert"] = boost::shared_ptr(new LLAlertHandler(NT_ALERT, LLSD())); - mNotifyHandlers["alertmodal"] = boost::shared_ptr(new LLAlertHandler(NT_ALERT, LLSD())); - static_cast(mNotifyHandlers["alertmodal"].get())->setAlertMode(true); - mNotifyHandlers["notifytoast"] = boost::shared_ptr(new LLIMHandler(NT_IMCHAT, LLSD())); - - mNotifyHandlers["nearbychat"] = boost::shared_ptr(new LLNearbyChatHandler(NT_NEARBYCHAT, LLSD())); - mNotifyHandlers["offer"] = boost::shared_ptr(new LLOfferHandler(NT_OFFER, LLSD())); -} - -//-------------------------------------------------------------------------- -bool LLNotificationManager::onNotification(const LLSD& notify) -{ - LLSysHandler* handle = NULL; - - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if (!notification) - return false; - - std::string notification_type = notification->getType(); - handle = static_cast(mNotifyHandlers[notification_type].get()); - - if(!handle) - return false; + new LLScriptHandler(); + new LLTipHandler(); + new LLGroupHandler(); + new LLAlertHandler("Alerts", "alert", false); + new LLAlertHandler("AlertModal", "alertmodal", true); + new LLOfferHandler(); + new LLHintHandler(); + new LLBrowserNotification(); + new LLOutboxNotification(); - return handle->processNotification(notify); + mChatHandler = boost::shared_ptr(new LLNearbyChatHandler()); } //-------------------------------------------------------------------------- void LLNotificationManager::onChat(const LLChat& msg, const LLSD &args) { - // check ENotificationType argument - switch(args["type"].asInteger()) - { - case NT_NEARBYCHAT: - { - LLNearbyChatHandler* handle = dynamic_cast(mNotifyHandlers["nearbychat"].get()); - - if(handle) - handle->processChat(msg, args); - } - break; - default: //no need to handle all enum types - break; - } + if(mChatHandler) + mChatHandler->processChat(msg, args); } -//-------------------------------------------------------------------------- -LLEventHandler* LLNotificationManager::getHandlerForNotification(std::string notification_type) -{ - std::map >::iterator it = mNotifyHandlers.find(notification_type); - - if(it != mNotifyHandlers.end()) - return (*it).second.get(); - - return NULL; -} - -//-------------------------------------------------------------------------- - diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h index 16e82e4cce..4d124e1379 100644 --- a/indra/newview/llnotificationmanager.h +++ b/indra/newview/llnotificationmanager.h @@ -56,20 +56,11 @@ public: void init(void); //TODO: combine processing and storage (*) - // this method reacts on system notifications and calls an appropriate handler - bool onNotification(const LLSD& notification); - // this method reacts on chat notifications and calls an appropriate handler void onChat(const LLChat& msg, const LLSD &args); - // get a handler for a certain type of notification - LLEventHandler* getHandlerForNotification(std::string notification_type); - - private: - //TODO (*) - std::map > mNotifyHandlers; - // cruft std::map mChatHandlers; + boost::shared_ptr mChatHandler; }; } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 68fd65be0f..8010417d43 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -40,17 +40,16 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLOfferHandler::LLOfferHandler(e_notification_type type, const LLSD& id) +LLOfferHandler::LLOfferHandler() +: LLSysHandler("Offer", "offer") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); mChannel->setControlHovering(true); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) - channel->setOnRejectToastCallback(boost::bind(&LLOfferHandler::onRejectToast, this, _1)); + channel->addOnRejectToastCallback(boost::bind(&LLOfferHandler::onRejectToast, this, _1)); } //-------------------------------------------------------------------------- @@ -67,126 +66,118 @@ void LLOfferHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLOfferHandler::processNotification(const LLSD& notify) +bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") - { + bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements(); + if( notification->getPayload().has("give_inventory_notification") + && !notification->getPayload()["give_inventory_notification"] ) + { + // This is an original inventory offer, so add a script floater + LLScriptFloaterManager::instance().onAddNotification(notification->getID()); + } + else + { + notification->setReusable(add_notif_to_im); - if( notification->getPayload().has("give_inventory_notification") - && !notification->getPayload()["give_inventory_notification"] ) - { - // This is an original inventory offer, so add a script floater - LLScriptFloaterManager::instance().onAddNotification(notification->getID()); - } - else + LLUUID session_id; + if (add_notif_to_im) { - notification->setReusable(LLHandlerUtil::isNotificationReusable(notification)); + const std::string name = LLHandlerUtil::getSubstitutionName(notification); - LLUUID session_id; - if (LLHandlerUtil::canSpawnIMSession(notification)) - { - const std::string name = LLHandlerUtil::getSubstitutionName(notification); + LLUUID from_id = notification->getPayload()["from_id"]; - LLUUID from_id = notification->getPayload()["from_id"]; + session_id = LLHandlerUtil::spawnIMSession(name, from_id); + } - session_id = LLHandlerUtil::spawnIMSession(name, from_id); - } + if (add_notif_to_im) + { + LLHandlerUtil::addNotifPanelToIM(notification); + } - bool show_toast = LLHandlerUtil::canSpawnToast(notification); - bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); - if (add_notid_to_im) + if (notification->getPayload().has("SUPPRESS_TOAST") + && notification->getPayload()["SUPPRESS_TOAST"]) + { + LLNotificationsUtil::cancel(notification); + } + else if(!notification->canLogToIM() || !LLHandlerUtil::isIMFloaterOpened(notification)) + { + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); + // don't close notification on panel destroy since it will be used by IM floater + notify_box->setCloseNotificationOnDestroy(!add_notif_to_im); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); + // we not save offer notifications to the syswell floater that should be added to the IM floater + p.can_be_stored = !add_notif_to_im; + + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); + + // if we not add notification to IM - add it to notification well + if (!add_notif_to_im) { - LLHandlerUtil::addNotifPanelToIM(notification); + // send a signal to the counter manager + mNewNotificationSignal(); } + } - if (notification->getPayload().has("SUPPRESS_TOAST") - && notification->getPayload()["SUPPRESS_TOAST"]) - { - LLNotificationsUtil::cancel(notification); - } - else if(show_toast) + if (notification->canLogToIM()) + { + // log only to file if notif panel can be embedded to IM and IM is opened + if (add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) { - LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - // don't close notification on panel destroy since it will be used by IM floater - notify_box->setCloseNotificationOnDestroy(!add_notid_to_im); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); - // we not save offer notifications to the syswell floater that should be added to the IM floater - p.can_be_stored = !add_notid_to_im; - - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); - - // if we not add notification to IM - add it to notification well - if (!add_notid_to_im) - { - // send a signal to the counter manager - mNewNotificationSignal(); - } + LLHandlerUtil::logToIMP2P(notification, true); } - - if (LLHandlerUtil::canLogToIM(notification)) + else { - // log only to file if notif panel can be embedded to IM and IM is opened - if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) - { - LLHandlerUtil::logToIMP2P(notification, true); - } - else - { - LLHandlerUtil::logToIMP2P(notification); - } + LLHandlerUtil::logToIMP2P(notification); } } } - else if (notify["sigtype"].asString() == "delete") + + return false; +} + +/*virtual*/ void LLOfferHandler::onDelete(LLNotificationPtr notification) +{ + if( notification->getPayload().has("give_inventory_notification") + && !notification->getPayload()["give_inventory_notification"] ) + { + // Remove original inventory offer script floater + LLScriptFloaterManager::instance().onRemoveNotification(notification->getID()); + } + else { - if( notification->getPayload().has("give_inventory_notification") - && !notification->getPayload()["give_inventory_notification"] ) + if (notification->canLogToIM() + && notification->hasFormElements() + && !LLHandlerUtil::isIMFloaterOpened(notification)) { - // Remove original inventory offer script floater - LLScriptFloaterManager::instance().onRemoveNotification(notification->getID()); - } - else - { - if (LLHandlerUtil::canAddNotifPanelToIM(notification) - && !LLHandlerUtil::isIMFloaterOpened(notification)) - { - LLHandlerUtil::decIMMesageCounter(notification); - } - mChannel->killToastByNotificationID(notification->getID()); + LLHandlerUtil::decIMMesageCounter(notification); } + mChannel->killToastByNotificationID(notification->getID()); } - - return false; } //-------------------------------------------------------------------------- void LLOfferHandler::onDeleteToast(LLToast* toast) { - if (!LLHandlerUtil::canAddNotifPanelToIM(toast->getNotification())) + if (!toast->getNotification()->canLogToIM() || !toast->getNotification()->hasFormElements()) { // send a signal to the counter manager mDelNotificationSignal(); @@ -202,11 +193,10 @@ void LLOfferHandler::onRejectToast(LLUUID& id) { LLNotificationPtr notification = LLNotifications::instance().find(id); - if (notification - && LLNotificationManager::getInstance()->getHandlerForNotification( - notification->getType()) == this - // don't delete notification since it may be used by IM floater - && !LLHandlerUtil::canAddNotifPanelToIM(notification)) + if (notification + && mItems.find(notification) != mItems.end() + // don't delete notification since it may be used by IM floater + && (!notification->canLogToIM() || !notification->hasFormElements())) { LLNotifications::instance().cancel(notification); } diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index bbb4d03768..714f14963c 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -42,17 +42,16 @@ static const std::string SCRIPT_DIALOG_GROUP ("ScriptDialogGroup"); static const std::string SCRIPT_LOAD_URL ("LoadWebPage"); //-------------------------------------------------------------------------- -LLScriptHandler::LLScriptHandler(e_notification_type type, const LLSD& id) +LLScriptHandler::LLScriptHandler() +: LLSysHandler("Notifications", "notify") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); mChannel->setControlHovering(true); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) - channel->setOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1)); + channel->addOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1)); } @@ -70,69 +69,65 @@ void LLScriptHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLScriptHandler::processNotification(const LLSD& notify) +bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add") + if (notification->canLogToIM()) { - if (LLHandlerUtil::canLogToIM(notification)) - { - LLHandlerUtil::logToIMP2P(notification); - } + LLHandlerUtil::logToIMP2P(notification); + } - if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) - { - LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID()); - } - else - { - LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); - - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - { - channel->addToast(p); - } - - // send a signal to the counter manager - mNewNotificationSignal(); - } + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID()); } - else if (notify["sigtype"].asString() == "delete") + else { - if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) - { - LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); - } - else + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); + + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) { - mChannel->killToastByNotificationID(notification->getID()); + channel->addToast(p); } + + // send a signal to the counter manager + mNewNotificationSignal(); } + return false; } + +void LLScriptHandler::onDelete( LLNotificationPtr notification ) +{ + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); + } + else + { + mChannel->killToastByNotificationID(notification->getID()); + } +} + + //-------------------------------------------------------------------------- void LLScriptHandler::onDeleteToast(LLToast* toast) @@ -158,9 +153,7 @@ void LLScriptHandler::onRejectToast(LLUUID& id) { LLNotificationPtr notification = LLNotifications::instance().find(id); - if (notification - && LLNotificationManager::getInstance()->getHandlerForNotification( - notification->getType()) == this) + if (notification && mItems.find(notification) != mItems.end()) { LLNotifications::instance().cancel(notification); } diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index fb0891c4c5..0b0ac040cb 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -41,16 +41,15 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- -LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id) +LLTipHandler::LLTipHandler() +: LLSysHandler("NotificationTips", "notifytip") { - mType = type; - // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel(); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) - channel->setOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1)); + channel->addOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1)); } //-------------------------------------------------------------------------- @@ -67,90 +66,74 @@ void LLTipHandler::initChannel() } //-------------------------------------------------------------------------- -bool LLTipHandler::processNotification(const LLSD& notify) +bool LLTipHandler::processNotification(const LLNotificationPtr& notification) { if(!mChannel) { return false; } - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if(!notification) - return false; - // arrange a channel on a screen if(!mChannel->getVisible()) { initChannel(); } - if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") + // archive message in nearby chat + if (notification->canLogToChat()) { - // archive message in nearby chat - if (LLHandlerUtil::canLogToNearbyChat(notification)) - { - LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); - - // don't show toast if Nearby Chat is opened - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); - if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible()) - { - return false; - } - } + LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); - std::string session_name = notification->getPayload()["SESSION_NAME"]; - const std::string name = notification->getSubstitutions()["NAME"]; - if (session_name.empty()) - { - session_name = name; - } - LLUUID from_id = notification->getPayload()["from_id"]; - if (LLHandlerUtil::canLogToIM(notification)) - { - LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name, - notification->getMessage(), from_id, from_id); - } - - if (LLHandlerUtil::canSpawnIMSession(notification)) - { - LLHandlerUtil::spawnIMSession(name, from_id); - } - - // don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909) - if (!LLHandlerUtil::canSpawnToast(notification)) + // don't show toast if Nearby Chat is opened + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); + LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); + if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible()) { return false; } + } - LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime"); - p.panel = notify_box; - p.is_tip = true; - p.can_be_stored = false; - - removeExclusiveNotifications(notification); + std::string session_name = notification->getPayload()["SESSION_NAME"]; + const std::string name = notification->getSubstitutions()["NAME"]; + if (session_name.empty()) + { + session_name = name; + } + LLUUID from_id = notification->getPayload()["from_id"]; + if (notification->canLogToIM()) + { + LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name, + notification->getMessage(), from_id, from_id); + } - LLScreenChannel* channel = dynamic_cast(mChannel); - if(channel) - channel->addToast(p); + if (notification->canLogToIM() && notification->hasFormElements()) + { + LLHandlerUtil::spawnIMSession(name, from_id); } - else if (notify["sigtype"].asString() == "delete") + + if (notification->canLogToIM() && LLHandlerUtil::isIMFloaterOpened(notification)) { - mChannel->killToastByNotificationID(notification->getID()); + return false; } - return false; -} -//-------------------------------------------------------------------------- -void LLTipHandler::onDeleteToast(LLToast* toast) -{ + LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime"); + p.panel = notify_box; + p.is_tip = true; + p.can_be_stored = false; + + removeExclusiveNotifications(notification); + + LLScreenChannel* channel = dynamic_cast(mChannel); + if(channel) + channel->addToast(p); + + + return false; } //-------------------------------------------------------------------------- @@ -159,9 +142,7 @@ void LLTipHandler::onRejectToast(const LLUUID& id) { LLNotificationPtr notification = LLNotifications::instance().find(id); - if (notification - && LLNotificationManager::getInstance()->getHandlerForNotification( - notification->getType()) == this) + if (notification && mItems.find(notification) != mItems.end()) { LLNotifications::instance().cancel(notification); } diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index c9f8855fe6..2ea5b8e546 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -228,16 +228,16 @@ public: // Channel's signals // signal on storing of faded toasts event - typedef boost::function store_tost_callback_t; - typedef boost::signals2::signal store_tost_signal_t; - store_tost_signal_t mOnStoreToast; - boost::signals2::connection setOnStoreToastCallback(store_tost_callback_t cb) { return mOnStoreToast.connect(cb); } + typedef boost::signals2::signal store_toast_signal_t; + boost::signals2::connection addOnStoreToastCallback(store_toast_signal_t::slot_type cb) { return mOnStoreToast.connect(cb); } // signal on rejecting of a toast event - typedef boost::function reject_tost_callback_t; - typedef boost::signals2::signal reject_tost_signal_t; - reject_tost_signal_t mRejectToastSignal; boost::signals2::connection setOnRejectToastCallback(reject_tost_callback_t cb) { return mRejectToastSignal.connect(cb); } + typedef boost::signals2::signal reject_toast_signal_t; + boost::signals2::connection addOnRejectToastCallback(reject_toast_signal_t::slot_type cb) { return mRejectToastSignal.connect(cb); } private: + store_toast_signal_t mOnStoreToast; + reject_toast_signal_t mRejectToastSignal; + struct ToastElem { LLUUID id; diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 0cb6c85012..e8293ebe2b 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -437,9 +437,9 @@ LLNotificationWellWindow::LLNotificationWellWindow(const LLSD& key) : LLSysWellWindow(key) { // init connections to the list's update events - connectListUpdaterToSignal("notify"); - connectListUpdaterToSignal("groupnotify"); - connectListUpdaterToSignal("offer"); + connectListUpdaterToSignal("Notifications"); + connectListUpdaterToSignal("Group Notifications"); + connectListUpdaterToSignal("Offer"); } // static @@ -519,7 +519,7 @@ void LLNotificationWellWindow::initChannel() LLSysWellWindow::initChannel(); if(mChannel) { - mChannel->setOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2)); + mChannel->addOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2)); } } @@ -548,8 +548,7 @@ void LLNotificationWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id) void LLNotificationWellWindow::connectListUpdaterToSignal(std::string notification_type) { - LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance(); - LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type); + LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast(LLNotifications::instance().getChannel(notification_type).get()); if(n_handler) { n_handler->setNotificationIDCallback(boost::bind(&LLNotificationWellWindow::removeItemByID, this, _1)); diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index 75178a6ef8..707d2d9765 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -51,7 +51,7 @@ const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7; -LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification) +LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notification) : LLToastPanel(notification), mInventoryOffer(NULL) { diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h index 7794ec9f63..3b8b31eac1 100644 --- a/indra/newview/lltoastgroupnotifypanel.h +++ b/indra/newview/lltoastgroupnotifypanel.h @@ -53,7 +53,7 @@ public: // Non-transient messages. You can specify non-default button // layouts (like one for script dialogs) by passing various // numbers in for "layout". - LLToastGroupNotifyPanel(LLNotificationPtr& notification); + LLToastGroupNotifyPanel(const LLNotificationPtr& notification); /*virtual*/ ~LLToastGroupNotifyPanel(); protected: diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index de305bf3d9..dc5cc88dc4 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -52,7 +52,7 @@ const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; -LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect, bool show_images) : +LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images) : LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), @@ -536,7 +536,7 @@ void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id } } -void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification) +void LLToastNotifyPanel::disableRespondedOptions(const LLNotificationPtr& notification) { LLSD response = notification->getResponse(); for (LLSD::map_const_iterator response_it = response.beginMap(); diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 57711b3d80..db517ec858 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -60,7 +60,7 @@ public: * @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, bool show_images = true); + LLToastNotifyPanel(const LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true); virtual ~LLToastNotifyPanel(); LLPanel * getControlPanel() { return mControlPanel; } @@ -118,7 +118,7 @@ protected: /** * Process response data. Will disable selected options */ - void disableRespondedOptions(LLNotificationPtr& notification); + void disableRespondedOptions(const LLNotificationPtr& notification); bool mIsTip; bool mAddedDefaultBtn; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3c6770df43..4f83d9096c 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2776,7 +2776,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mOwnerID = from_id; LLSD args; args["slurl"] = location; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; // Look for IRC-style emotes here so object name formatting is correct std::string prefix = message.substr(0, 4); @@ -3379,7 +3378,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // pass owner_id to chat so that we can display the remote // object inspect for an object that is chatting with you LLSD args; - args["type"] = LLNotificationsUI::NT_NEARBYCHAT; chat.mOwnerID = owner_id; if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index e0653fec30..6d9b8b4eb3 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1548,11 +1548,11 @@ LLViewerWindow::LLViewerWindow(const Params& p) mViewerWindowListener(new LLViewerWindowListener(this)), mProgressView(NULL) { - LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert")); - LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal")); + LLNotificationChannelPtr vw_alerts_channel(new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert"))); + LLNotificationChannelPtr vw_alerts_modal_channel(new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal"))); - LLNotifications::instance().getChannel("VW_alerts")->connectChanged(&LLViewerWindow::onAlert); - LLNotifications::instance().getChannel("VW_alertmodal")->connectChanged(&LLViewerWindow::onAlert); + vw_alerts_channel->connectChanged(&LLViewerWindow::onAlert); + vw_alerts_modal_channel->connectChanged(&LLViewerWindow::onAlert); LLNotifications::instance().setIgnoreAllNotifications(gSavedSettings.getBOOL("IgnoreAllNotifications")); llinfos << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << llendl; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index af75d49353..da83ffbab4 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2904,6 +2904,7 @@ Would you like to trust this authority? icon="alertmodal.tga" name="GrantedModifyRights" persist="true" + log_to_im="true" type="notify"> [NAME] has given you permission to edit their objects. @@ -2912,6 +2913,7 @@ Would you like to trust this authority? icon="alertmodal.tga" name="RevokedModifyRights" persist="true" + log_to_im="true" type="notify"> Your privilege to modify [NAME]'s objects has been revoked @@ -5161,6 +5163,8 @@ The string [STRING_NAME] is missing from strings.xml [MESSAGE] @@ -5205,6 +5209,7 @@ Topic: [SUBJECT], Message: [MESSAGE] friendship <nolink>[NAME]</nolink> is Online @@ -5213,6 +5218,7 @@ Topic: [SUBJECT], Message: [MESSAGE] friendship <nolink>[NAME]</nolink> is Offline @@ -5459,6 +5465,8 @@ You don't have permission to copy this. [NAME] received your inventory offer. @@ -5466,6 +5474,8 @@ You don't have permission to copy this. [NAME] declined your inventory offer. @@ -5547,6 +5557,7 @@ Please select at least one type of content to search (General, Moderate, or Adul funds @@ -5556,6 +5567,7 @@ Please select at least one type of content to search (General, Moderate, or Adul funds @@ -5700,6 +5712,7 @@ The objects on the selected parcel that are NOT owned by you have been returned Message from [NAME]: @@ -6070,6 +6083,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th [NAME_SLURL] has given you this [OBJECTTYPE]: [ITEM_SLURL] @@ -6125,6 +6139,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th [NAME_SLURL] has offered to teleport you to their location: @@ -6145,6 +6160,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th Teleport offer sent to [TO_NAME] @@ -6172,6 +6188,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th friendship confirm @@ -6195,6 +6212,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th friendship You have offered friendship to [TO_NAME] @@ -6224,6 +6242,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th friendship <nolink>[NAME]</nolink> accepted your friendship offer. @@ -6232,6 +6251,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th friendship @@ -6241,6 +6261,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th friendship Friendship offer accepted. @@ -6249,6 +6270,7 @@ Friendship offer accepted. friendship Friendship offer declined. -- cgit v1.2.3 From 27ce5c301633fa75c32087e347347ab9111aa787 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 28 Mar 2012 11:27:48 -0700 Subject: CHUI-51 WIP notifications routing code cleanup fixed crash on login --- indra/newview/llchiclet.cpp | 4 ++-- indra/newview/llnotificationmanager.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 9f19f8dd1c..5e07db0d59 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -339,8 +339,8 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) , mUreadSystemNotifications(0) { // connect counter handlers to the signals - connectCounterUpdatersToSignal("Notify"); - connectCounterUpdatersToSignal("Group Notify"); + connectCounterUpdatersToSignal("IM Notifications"); + connectCounterUpdatersToSignal("Group Notifications"); connectCounterUpdatersToSignal("Offer"); // ensure that notification well window exists, to synchronously diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 394ae2ac21..4e77b38757 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -52,6 +52,7 @@ LLNotificationManager::~LLNotificationManager() //-------------------------------------------------------------------------- void LLNotificationManager::init() { + new LLIMHandler(); new LLScriptHandler(); new LLTipHandler(); new LLGroupHandler(); -- cgit v1.2.3 From 2fa1c42aadbe2a29e1bcced9a487c0e5abf0602b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 29 Mar 2012 23:48:29 -0700 Subject: CHUI-51 WIP notifications routig code cleanup phase 2, removal of extraneous signaling in favor of llnotificationchannels made notificationchannels work better with overrides and lifetime managed by creator --- indra/llcommon/llinstancetracker.h | 5 +- indra/llcommon/llrefcount.h | 19 +++++ indra/llcommon/llthread.h | 17 +++++ indra/llui/llnotifications.cpp | 92 +++++++++++++------------ indra/llui/llnotifications.h | 49 ++++++++----- indra/llui/llnotificationslistener.cpp | 8 +-- indra/newview/llchiclet.cpp | 26 +++---- indra/newview/llchiclet.h | 31 +++++++-- indra/newview/llfloaternotificationsconsole.cpp | 38 ++-------- indra/newview/llimhandler.cpp | 12 ---- indra/newview/llnotificationgrouphandler.cpp | 14 ---- indra/newview/llnotificationhandler.h | 23 +------ indra/newview/llnotificationhandlerutil.cpp | 88 ++++++++--------------- indra/newview/llnotificationmanager.cpp | 19 ++--- indra/newview/llnotificationmanager.h | 1 + indra/newview/llnotificationofferhandler.cpp | 42 ++--------- indra/newview/llnotificationscripthandler.cpp | 19 +---- indra/newview/llsyswellwindow.cpp | 37 +++++----- indra/newview/llsyswellwindow.h | 19 +++-- indra/newview/lltoastgroupnotifypanel.h | 3 - indra/newview/lltoastscripttextbox.h | 2 - 21 files changed, 241 insertions(+), 323 deletions(-) diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 34d841a4e0..11f582372e 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -43,7 +43,7 @@ * semantics: one instance per process, rather than one instance per module as * sometimes happens with data simply declared static. */ -class LL_COMMON_API LLInstanceTrackerBase : public boost::noncopyable +class LL_COMMON_API LLInstanceTrackerBase { protected: /// Get a process-unique void* pointer slot for the specified type_info @@ -209,6 +209,9 @@ protected: virtual const KEY& getKey() const { return mInstanceKey; } private: + LLInstanceTracker( const LLInstanceTracker& ); + const LLInstanceTracker& operator=( const LLInstanceTracker& ); + void add_(KEY key) { mInstanceKey = key; diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 8eb5d53f3f..32ae15435a 100644 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -27,6 +27,7 @@ #define LLREFCOUNT_H #include +#include #define LL_REF_COUNT_DEBUG 0 #if LL_REF_COUNT_DEBUG @@ -86,4 +87,22 @@ private: #endif }; +/** + * intrusive pointer support + * this allows you to use boost::intrusive_ptr with any LLRefCount-derived type + */ +namespace boost +{ + inline void intrusive_ptr_add_ref(LLRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLRefCount* p) + { + p->unref(); + } +}; + + #endif diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b52e70ab2e..cf39696b4f 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -30,6 +30,7 @@ #include "llapp.h" #include "llapr.h" #include "apr_thread_cond.h" +#include "boost/intrusive_ptr.hpp" class LLThread; class LLMutex; @@ -266,6 +267,22 @@ private: S32 mRef; }; +/** + * intrusive pointer support for LLThreadSafeRefCount + * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type + */ +namespace boost +{ + inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLThreadSafeRefCount* p) + { + p->unref(); + } +}; //============================================================================ // Simple responder for self destructing callbacks diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 038a86d20a..c45899a4bd 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -966,7 +966,7 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt std::string cmd = payload["sigtype"]; LLNotificationSet::iterator foundItem = mItems.find(pNotification); bool wasFound = (foundItem != mItems.end()); - bool passesFilter = mFilter(pNotification); + bool passesFilter = mFilter ? mFilter(pNotification) : true; // first, we offer the result of the filter test to the simple // signals for pass/fail. One of these is guaranteed to be called. @@ -1071,27 +1071,28 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt return abortProcessing; } +LLNotificationChannel::LLNotificationChannel(const Params& p) +: LLNotificationChannelBase(p.filter(), p.comparator()), + LLInstanceTracker(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()), + mName(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()) +{ + BOOST_FOREACH(const std::string& source, p.sources) + { + connectToChannel(source); + } +} + + LLNotificationChannel::LLNotificationChannel(const std::string& name, const std::string& parent, LLNotificationFilter filter, - LLNotificationComparator comparator) : -LLNotificationChannelBase(filter, comparator), -mName(name), -mParent(parent) + LLNotificationComparator comparator) +: LLNotificationChannelBase(filter, comparator), + LLInstanceTracker(name), + mName(name) { - // store myself in the channel map - LLNotifications::instance().addChannel(LLNotificationChannelPtr(this)); // bind to notification broadcast - if (parent.empty()) - { - LLNotifications::instance().connectChanged( - boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); - } - else - { - LLNotificationChannelPtr p = LLNotifications::instance().getChannel(parent); - p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); - } + connectToChannel(parent); } @@ -1134,6 +1135,21 @@ std::string LLNotificationChannel::summarize() return s; } +void LLNotificationChannel::connectToChannel( const std::string& channel_name ) +{ + if (channel_name.empty()) + { + LLNotifications::instance().connectChanged( + boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); + } + else + { + LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name); + p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); + } +} + + // --- // END OF LLNotificationChannel implementation @@ -1248,21 +1264,9 @@ bool LLNotifications::failedUniquenessTest(const LLSD& payload) return false; } - -void LLNotifications::addChannel(LLNotificationChannelPtr pChan) -{ - mChannels[pChan->getName()] = pChan; -} - LLNotificationChannelPtr LLNotifications::getChannel(const std::string& channelName) { - ChannelMap::iterator p = mChannels.find(channelName); - if(p == mChannels.end()) - { - llerrs << "Did not find channel named " << channelName << llendl; - return LLNotificationChannelPtr(); - } - return p->second; + return LLNotificationChannelPtr(LLNotificationChannel::getInstance(channelName)); } @@ -1278,20 +1282,20 @@ void LLNotifications::createDefaultChannels() { // now construct the various channels AFTER loading the notifications, // because the history channel is going to rewrite the stored notifications file - new LLNotificationChannel("Enabled", "", - !boost::bind(&LLNotifications::getIgnoreAllNotifications, this)); - new LLNotificationChannel("Expiration", "Enabled", - boost::bind(&LLNotifications::expirationFilter, this, _1)); - new LLNotificationChannel("Unexpired", "Enabled", - !boost::bind(&LLNotifications::expirationFilter, this, _1)); // use negated bind - new LLNotificationChannel("Unique", "Unexpired", - boost::bind(&LLNotifications::uniqueFilter, this, _1)); - new LLNotificationChannel("Ignore", "Unique", - filterIgnoredNotifications); - new LLNotificationChannel("VisibilityRules", "Ignore", - boost::bind(&LLNotifications::isVisibleByRules, this, _1)); - new LLNotificationChannel("Visible", "VisibilityRules", - &LLNotificationFilters::includeEverything); + mDefaultChannels.push_back(new LLNotificationChannel("Enabled", "", + !boost::bind(&LLNotifications::getIgnoreAllNotifications, this))); + mDefaultChannels.push_back(new LLNotificationChannel("Expiration", "Enabled", + boost::bind(&LLNotifications::expirationFilter, this, _1))); + mDefaultChannels.push_back(new LLNotificationChannel("Unexpired", "Enabled", + !boost::bind(&LLNotifications::expirationFilter, this, _1))); // use negated bind + mDefaultChannels.push_back(new LLNotificationChannel("Unique", "Unexpired", + boost::bind(&LLNotifications::uniqueFilter, this, _1))); + mDefaultChannels.push_back(new LLNotificationChannel("Ignore", "Unique", + filterIgnoredNotifications)); + mDefaultChannels.push_back(new LLNotificationChannel("VisibilityRules", "Ignore", + boost::bind(&LLNotifications::isVisibleByRules, this, _1))); + mDefaultChannels.push_back(new LLNotificationChannel("Visible", "VisibilityRules", + &LLNotificationFilters::includeEverything)); // create special persistent notification channel // this isn't a leak, don't worry about the empty "new" diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index f83365a97d..344108ecbf 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -94,10 +94,11 @@ // and we need this to manage the notification callbacks #include "llevents.h" #include "llfunctorregistry.h" -#include "llpointer.h" #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" +#include "llpointer.h" +#include "llrefcount.h" class LLAvatarName; typedef enum e_notification_priority @@ -707,7 +708,8 @@ typedef std::multimap LLNotificationMap; // all of the built-in tests should attach to the "Visible" channel // class LLNotificationChannelBase : - public LLEventTrackable + public LLEventTrackable, + public LLRefCount { LOG_CLASS(LLNotificationChannelBase); public: @@ -787,26 +789,48 @@ protected: // destroy it, but if it becomes necessary to do so, the shared_ptr model // will ensure that we don't leak resources. class LLNotificationChannel; -typedef boost::shared_ptr LLNotificationChannelPtr; +typedef boost::intrusive_ptr LLNotificationChannelPtr; // manages a list of notifications // Note that if this is ever copied around, we might find ourselves with multiple copies // of a queue with notifications being added to different nonequivalent copies. So we -// make it inherit from boost::noncopyable, and then create a map of shared_ptr to manage it. +// make it inherit from boost::noncopyable, and then create a map of LLPointer to manage it. // class LLNotificationChannel : boost::noncopyable, - public LLNotificationChannelBase + public LLNotificationChannelBase, + public LLInstanceTracker { LOG_CLASS(LLNotificationChannel); public: + // Notification Channels have a filter, which determines which notifications + // will be added to this channel. + // Channel filters cannot change. + struct Params : public LLInitParam::Block + { + Mandatory name; + Optional filter; + Optional comparator; + Multiple sources; + + Params() + : comparator("", LLNotificationComparators::orderByUUID()) + {} + }; + + LLNotificationChannel(const Params& p = Params()); + + LLNotificationChannel(const std::string& name, const std::string& parent, + LLNotificationFilter filter, LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); + virtual ~LLNotificationChannel() {} typedef LLNotificationSet::iterator Iterator; std::string getName() const { return mName; } - std::string getParentChannelName() { return mParent; } + void connectToChannel(const std::string& channel_name); + bool isEmpty() const; Iterator begin(); @@ -818,14 +842,6 @@ public: std::string summarize(); - // Notification Channels have a filter, which determines which notifications - // will be added to this channel. - // Channel filters cannot change. - // Channels have a protected constructor so you can't make smart pointers that don't - // come from our internal reference; call NotificationChannel::build(args) - LLNotificationChannel(const std::string& name, const std::string& parent, - LLNotificationFilter filter, LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); - private: std::string mName; std::string mParent; @@ -912,10 +928,6 @@ public: void createDefaultChannels(); - typedef std::map ChannelMap; - ChannelMap mChannels; - - void addChannel(LLNotificationChannelPtr pChan); LLNotificationChannelPtr getChannel(const std::string& channelName); std::string getGlobalString(const std::string& key) const; @@ -954,6 +966,7 @@ private: bool mIgnoreAllNotifications; boost::scoped_ptr mListener; + std::vector mDefaultChannels; }; /** diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index 3bbeb3a778..e4e127336b 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -121,13 +121,13 @@ void LLNotificationsListener::listChannels(const LLSD& params) const { LLReqID reqID(params); LLSD response(reqID.makeResponse()); - for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()), - cmend(mNotifications.mChannels.end()); + for (LLNotificationChannel::instance_iter cmi(LLNotificationChannel::beginInstances()), + cmend(LLNotificationChannel::endInstances()); cmi != cmend; ++cmi) { LLSD channelInfo; - channelInfo["parent"] = cmi->second->getParentChannelName(); - response[cmi->first] = channelInfo; + //channelInfo["parent"] = cmi->second->getParentChannelName(); + response[cmi->getName()] = channelInfo; } LLEventPumps::instance().obtain(params["reply"]).post(response); } diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 9f19f8dd1c..67519a3ca6 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -335,29 +335,15 @@ void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) /* LLNotificationChiclet implementation */ /************************************************************************/ LLNotificationChiclet::LLNotificationChiclet(const Params& p) -: LLSysWellChiclet(p) -, mUreadSystemNotifications(0) +: LLSysWellChiclet(p), + mUreadSystemNotifications(0) { - // connect counter handlers to the signals - connectCounterUpdatersToSignal("Notify"); - connectCounterUpdatersToSignal("Group Notify"); - connectCounterUpdatersToSignal("Offer"); - + mNotificationChannel.reset(new ChicletNotificationChannel(this)); // ensure that notification well window exists, to synchronously // handle toast add/delete events. LLNotificationWellWindow::getInstance()->setSysWellChiclet(this); } -void LLNotificationChiclet::connectCounterUpdatersToSignal(const std::string& notification_type) -{ - LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast(LLNotifications::instance().getChannel(notification_type).get()); - if(n_handler) - { - n_handler->setNewNotificationCallback(boost::bind(&LLNotificationChiclet::incUreadSystemNotifications, this)); - n_handler->setDelNotification(boost::bind(&LLNotificationChiclet::decUreadSystemNotifications, this)); - } -} - void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data) { std::string action = user_data.asString(); @@ -406,6 +392,12 @@ void LLNotificationChiclet::setCounter(S32 counter) updateWidget(getCounter() == 0); } + +bool LLNotificationChiclet::ChicletNotificationChannel::filterNotification( LLNotificationPtr notify ) +{ + return !(notify->canLogToIM() && notify->hasFormElements()); +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 1f1069dcb4..dd0d47cccd 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -34,6 +34,7 @@ #include "lloutputmonitorctrl.h" #include "llgroupmgr.h" #include "llimview.h" +#include "llnotifications.h" class LLMenuGL; class LLIMFloater; @@ -911,11 +912,35 @@ protected: class LLNotificationChiclet : public LLSysWellChiclet { + LOG_CLASS(LLNotificationChiclet); + friend class LLUICtrlFactory; public: struct Params : public LLInitParam::Block{}; protected: + struct ChicletNotificationChannel : public LLNotificationChannel + { + ChicletNotificationChannel(LLNotificationChiclet* chiclet) + : LLNotificationChannel(LLNotificationChannel::Params().filter(filterNotification).name(chiclet->getSessionId().asString())), + mChiclet(chiclet) + { + // connect counter handlers to the signals + connectToChannel("IM Notifications"); + connectToChannel("Group Notifications"); + connectToChannel("Offer"); + } + + static bool filterNotification(LLNotificationPtr notify); + // connect counter updaters to the corresponding signals + /*virtual*/ void onAdd(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); } + /*virtual*/ void onDelete(LLNotificationPtr p) { mChiclet->setCounter(--mChiclet->mUreadSystemNotifications); } + + LLNotificationChiclet* const mChiclet; + }; + + boost::scoped_ptr mNotificationChannel; + LLNotificationChiclet(const Params& p); /** @@ -933,12 +958,6 @@ protected: */ /*virtual*/ void createMenu(); - // connect counter updaters to the corresponding signals - void connectCounterUpdatersToSignal(const std::string& notification_type); - - // methods for updating a number of unread System notifications - void incUreadSystemNotifications() { setCounter(++mUreadSystemNotifications); } - void decUreadSystemNotifications() { setCounter(--mUreadSystemNotifications); } /*virtual*/ void setCounter(S32 counter); S32 mUreadSystemNotifications; }; diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index 90dbabebfb..4f35c325a8 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -44,21 +44,16 @@ public: BOOL postBuild(); private: - bool update(const LLSD& payload, bool passed_filter); + bool update(const LLSD& payload); static void toggleClick(void* user_data); static void onClickNotification(void* user_data); - static void onClickNotificationReject(void* user_data); LLNotificationChannelPtr mChannelPtr; - LLNotificationChannelPtr mChannelRejectsPtr; }; LLNotificationChannelPanel::LLNotificationChannelPanel(const LLNotificationChannelPanel::Params& p) : LLLayoutPanel(p) { mChannelPtr = LLNotifications::instance().getChannel(p.name); - mChannelRejectsPtr = LLNotificationChannelPtr( - new LLNotificationChannel(p.name() + "rejects", mChannelPtr->getParentChannelName(), - !boost::bind(mChannelPtr->getFilter(), _1))); buildFromFile( "panel_notifications_channel.xml"); } @@ -68,15 +63,11 @@ BOOL LLNotificationChannelPanel::postBuild() header_button->setLabel(mChannelPtr->getName()); header_button->setClickedCallback(toggleClick, this); - mChannelPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, true)); - mChannelRejectsPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, false)); + mChannelPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1)); LLScrollListCtrl* scroll = getChild("notifications_list"); scroll->setDoubleClickCallback(onClickNotification, this); scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); - scroll = getChild("notification_rejects_list"); - scroll->setDoubleClickCallback(onClickNotificationReject, this); - scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); return TRUE; } @@ -97,8 +88,6 @@ void LLNotificationChannelPanel::toggleClick(void *user_data) // turn off tab stop for collapsed panel self->getChild("notifications_list")->setTabStop(!header_button->getToggleState()); self->getChild("notifications_list")->setVisible(!header_button->getToggleState()); - self->getChild("notification_rejects_list")->setTabStop(!header_button->getToggleState()); - self->getChild("notification_rejects_list")->setVisible(!header_button->getToggleState()); } /*static*/ @@ -118,24 +107,7 @@ void LLNotificationChannelPanel::onClickNotification(void* user_data) } } -/*static*/ -void LLNotificationChannelPanel::onClickNotificationReject(void* user_data) -{ - LLNotificationChannelPanel* self = (LLNotificationChannelPanel*)user_data; - if (!self) return; - LLScrollListItem* firstselected = self->getChild("notification_rejects_list")->getFirstSelected(); - llassert(firstselected); - if (firstselected) - { - void* data = firstselected->getUserdata(); - if (data) - { - gFloaterView->getParentFloater(self)->addDependentFloater(new LLFloaterNotification((LLNotification*)data), TRUE); - } - } -} - -bool LLNotificationChannelPanel::update(const LLSD& payload, bool passed_filter) +bool LLNotificationChannelPanel::update(const LLSD& payload) { LLNotificationPtr notification = LLNotifications::instance().find(payload["id"].asUUID()); if (notification) @@ -151,9 +123,7 @@ bool LLNotificationChannelPanel::update(const LLSD& payload, bool passed_filter) row["columns"][2]["column"] = "date"; row["columns"][2]["type"] = "date"; - LLScrollListItem* sli = passed_filter ? - getChild("notifications_list")->addElement(row) : - getChild("notification_rejects_list")->addElement(row); + LLScrollListItem* sli = getChild("notifications_list")->addElement(row); sli->setUserdata(&(*notification)); } diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp index a92c4fa387..1437d0747c 100644 --- a/indra/newview/llimhandler.cpp +++ b/indra/newview/llimhandler.cpp @@ -95,24 +95,12 @@ bool LLIMHandler::processNotification(const LLNotificationPtr& notification) p.notification = notification; p.panel = im_box; p.can_be_stored = false; - p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1); LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) channel->addToast(p); - // send a signal to the counter manager; - mNewNotificationSignal(); - return false; } -//-------------------------------------------------------------------------- -void LLIMHandler::onDeleteToast(LLToast* toast) -{ - // send a signal to the counter manager - mDelNotificationSignal(); -} - -//-------------------------------------------------------------------------- diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 2ce51fa094..97e382e42f 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -87,25 +87,11 @@ bool LLGroupHandler::processNotification(const LLNotificationPtr& notification) if(channel) channel->addToast(p); - // send a signal to the counter manager - mNewNotificationSignal(); - LLGroupActions::refresh_notices(); return false; } -//-------------------------------------------------------------------------- -void LLGroupHandler::onDeleteToast(LLToast* toast) -{ - // send a signal to the counter manager - mDelNotificationSignal(); - - // send a signal to a listener to let him perform some action - // in this case listener is a SysWellWindow and it will remove a corresponding item from its list - mNotificationIDSignal(toast->getNotificationID()); -} - //-------------------------------------------------------------------------- void LLGroupHandler::onRejectToast(LLUUID& id) { diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index ff9371f7df..419b8a14b6 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -67,19 +67,6 @@ class LLEventHandler public: virtual ~LLEventHandler() {}; - // callbacks for counters - typedef boost::function notification_callback_t; - typedef boost::signals2::signal notification_signal_t; - notification_signal_t mNewNotificationSignal; - notification_signal_t mDelNotificationSignal; - boost::signals2::connection setNewNotificationCallback(notification_callback_t cb) { return mNewNotificationSignal.connect(cb); } - boost::signals2::connection setDelNotification(notification_callback_t cb) { return mDelNotificationSignal.connect(cb); } - // callback for notification/toast - typedef boost::function notification_id_callback_t; - typedef boost::signals2::signal notification_id_signal_t; - notification_id_signal_t mNotificationIDSignal; - boost::signals2::connection setNotificationIDCallback(notification_id_callback_t cb) { return mNotificationIDSignal.connect(cb); } - protected: virtual void onDeleteToast(LLToast* toast) {} @@ -143,7 +130,6 @@ public: protected: bool processNotification(const LLNotificationPtr& p); - virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); }; @@ -201,7 +187,6 @@ public: virtual bool processNotification(const LLNotificationPtr& p); protected: - virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); // own handlers @@ -244,7 +229,6 @@ public: virtual bool processNotification(const LLNotificationPtr& p); protected: - virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); // own handlers @@ -313,12 +297,7 @@ public: /** * Writes notification message to IM p2p session. */ - static void logToIMP2P(const LLNotificationPtr& notification); - - /** - * Writes notification message to IM p2p session. - */ - static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only); + static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only = false); /** * Writes group notice notification message to IM group session. diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index dca7fda151..3ebf0bcc9e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -111,37 +111,18 @@ void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif) } } -const static std::string OBJECT_GIVE_ITEM("ObjectGiveItem"); - -static LLIMFloater* find_im_floater(const LLNotificationPtr& notification) -{ - LLUUID from_id = notification->getPayload()["from_id"]; - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); - return LLFloaterReg::findTypedInstance("impanel", session_id); -} - // static bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { bool res = false; - LLIMFloater* im_floater = find_im_floater(notification); - if (im_floater != NULL) - { - res = im_floater->getVisible() == TRUE; - } - - return res; -} - -static bool is_IM_floater_focused(const LLNotificationPtr& notification) -{ - bool res = false; + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); + LLIMFloater* im_floater = LLFloaterReg::findTypedInstance("impanel", session_id); - LLIMFloater* im_floater = find_im_floater(notification); if (im_floater != NULL) { - res = im_floater->hasFocus() == TRUE; + res = im_floater->getVisible() == TRUE; } return res; @@ -208,12 +189,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type, } } -// static -void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification) -{ - logToIMP2P(notification, false); -} - void log_name_callback(const std::string& full_name, const std::string& from_name, const std::string& message, const LLUUID& from_id) @@ -225,25 +200,21 @@ void log_name_callback(const std::string& full_name, const std::string& from_nam // static void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) { - // don't create IM p2p session with objects, it's necessary condition to log - //if (notification->getName() != OBJECT_GIVE_ITEM) - { - LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID from_id = notification->getPayload()["from_id"]; - if (from_id.isNull()) - { - llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; - return; - } + if (from_id.isNull()) + { + llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; + return; + } - if(to_file_only) - { - gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID())); - } - else - { - gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id)); - } + if(to_file_only) + { + gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID())); + } + else + { + gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id)); } } @@ -377,23 +348,20 @@ void LLHandlerUtil::updateVisibleIMFLoaterMesages(const LLNotificationPtr& notif void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification) { const std::string name = LLHandlerUtil::getSubstitutionName(notification); - LLUUID from_id = notification->getPayload()["from_id"]; - LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); + LLUUID from_id = notification->getPayload()["from_id"]; + LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); - LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession( - session_id); + LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(session_id); - if (session == NULL) + if (session) { - return; + LLSD arg; + arg["session_id"] = session_id; + session->mNumUnread--; + arg["num_unread"] = session->mNumUnread; + session->mParticipantUnreadMessageCount--; + arg["participant_unread"] = session->mParticipantUnreadMessageCount; + LLIMModel::getInstance()->mNewMsgSignal(arg); } - - LLSD arg; - arg["session_id"] = session_id; - session->mNumUnread--; - arg["num_unread"] = session->mNumUnread; - session->mParticipantUnreadMessageCount--; - arg["participant_unread"] = session->mParticipantUnreadMessageCount; - LLIMModel::getInstance()->mNewMsgSignal(arg); } diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 394ae2ac21..9beb8afac6 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -52,15 +52,16 @@ LLNotificationManager::~LLNotificationManager() //-------------------------------------------------------------------------- void LLNotificationManager::init() { - new LLScriptHandler(); - new LLTipHandler(); - new LLGroupHandler(); - new LLAlertHandler("Alerts", "alert", false); - new LLAlertHandler("AlertModal", "alertmodal", true); - new LLOfferHandler(); - new LLHintHandler(); - new LLBrowserNotification(); - new LLOutboxNotification(); + mChannels.push_back(new LLScriptHandler()); + mChannels.push_back(new LLTipHandler()); + mChannels.push_back(new LLGroupHandler()); + mChannels.push_back(new LLAlertHandler("Alerts", "alert", false)); + mChannels.push_back(new LLAlertHandler("AlertModal", "alertmodal", true)); + mChannels.push_back(new LLOfferHandler()); + mChannels.push_back(new LLHintHandler()); + mChannels.push_back(new LLBrowserNotification()); + mChannels.push_back(new LLOutboxNotification()); + mChannels.push_back(new LLIMHandler()); mChatHandler = boost::shared_ptr(new LLNearbyChatHandler()); } diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h index 4d124e1379..c8afdf9e46 100644 --- a/indra/newview/llnotificationmanager.h +++ b/indra/newview/llnotificationmanager.h @@ -61,6 +61,7 @@ public: private: boost::shared_ptr mChatHandler; + std::vector mChannels; }; } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 8010417d43..051075cff9 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -79,16 +79,17 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) initChannel(); } - bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements(); if( notification->getPayload().has("give_inventory_notification") - && !notification->getPayload()["give_inventory_notification"] ) + && notification->getPayload()["give_inventory_notification"].asBoolean() == false) { // This is an original inventory offer, so add a script floater LLScriptFloaterManager::instance().onAddNotification(notification->getID()); } else { + bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements(); + notification->setReusable(add_notif_to_im); LLUUID session_id; @@ -99,10 +100,6 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) LLUUID from_id = notification->getPayload()["from_id"]; session_id = LLHandlerUtil::spawnIMSession(name, from_id); - } - - if (add_notif_to_im) - { LLHandlerUtil::addNotifPanelToIM(notification); } @@ -120,33 +117,19 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) p.notif_id = notification->getID(); p.notification = notification; p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); // we not save offer notifications to the syswell floater that should be added to the IM floater p.can_be_stored = !add_notif_to_im; LLScreenChannel* channel = dynamic_cast(mChannel); if(channel) channel->addToast(p); - - // if we not add notification to IM - add it to notification well - if (!add_notif_to_im) - { - // send a signal to the counter manager - mNewNotificationSignal(); - } } if (notification->canLogToIM()) { // log only to file if notif panel can be embedded to IM and IM is opened - if (add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) - { - LLHandlerUtil::logToIMP2P(notification, true); - } - else - { - LLHandlerUtil::logToIMP2P(notification); - } + bool file_only = add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification); + LLHandlerUtil::logToIMP2P(notification, file_only); } } @@ -173,21 +156,6 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) } } -//-------------------------------------------------------------------------- - -void LLOfferHandler::onDeleteToast(LLToast* toast) -{ - if (!toast->getNotification()->canLogToIM() || !toast->getNotification()->hasFormElements()) - { - // send a signal to the counter manager - mDelNotificationSignal(); - } - - // send a signal to a listener to let him perform some action - // in this case listener is a SysWellWindow and it will remove a corresponding item from its list - mNotificationIDSignal(toast->getNotificationID()); -} - //-------------------------------------------------------------------------- void LLOfferHandler::onRejectToast(LLUUID& id) { diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index 714f14963c..c74c967722 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -37,10 +37,6 @@ using namespace LLNotificationsUI; -static const std::string SCRIPT_DIALOG ("ScriptDialog"); -static const std::string SCRIPT_DIALOG_GROUP ("ScriptDialogGroup"); -static const std::string SCRIPT_LOAD_URL ("LoadWebPage"); - //-------------------------------------------------------------------------- LLScriptHandler::LLScriptHandler() : LLSysHandler("Notifications", "notify") @@ -87,7 +83,7 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) LLHandlerUtil::logToIMP2P(notification); } - if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + if(notification->hasFormElements()) { LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID()); } @@ -106,9 +102,6 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) { channel->addToast(p); } - - // send a signal to the counter manager - mNewNotificationSignal(); } return false; @@ -117,7 +110,7 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification) void LLScriptHandler::onDelete( LLNotificationPtr notification ) { - if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName()) + if(notification->hasFormElements()) { LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); } @@ -132,17 +125,11 @@ void LLScriptHandler::onDelete( LLNotificationPtr notification ) void LLScriptHandler::onDeleteToast(LLToast* toast) { - // send a signal to the counter manager - mDelNotificationSignal(); - // send a signal to a listener to let him perform some action // in this case listener is a SysWellWindow and it will remove a corresponding item from its list - mNotificationIDSignal(toast->getNotificationID()); - LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID()); - if( notification && - (SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) ) + if( notification && notification->hasFormElements()) { LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); } diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index e8293ebe2b..18e0d9d0d2 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -433,13 +433,19 @@ BOOL LLIMWellWindow::ObjectRowPanel::handleRightMouseDown(S32 x, S32 y, MASK mas ////////////////////////////////////////////////////////////////////////// // PUBLIC METHODS +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) +: LLSysWellWindow(key) { - // init connections to the list's update events - connectListUpdaterToSignal("Notifications"); - connectListUpdaterToSignal("Group Notifications"); - connectListUpdaterToSignal("Offer"); + mNotificationUpdates.reset(new WellNotificationChannel(this)); } // static @@ -546,19 +552,6 @@ void LLNotificationWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id) addItem(p); } -void LLNotificationWellWindow::connectListUpdaterToSignal(std::string notification_type) -{ - LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast(LLNotifications::instance().getChannel(notification_type).get()); - if(n_handler) - { - n_handler->setNotificationIDCallback(boost::bind(&LLNotificationWellWindow::removeItemByID, this, _1)); - } - else - { - llwarns << "LLSysWellWindow::connectListUpdaterToSignal() - could not get a handler for '" << notification_type <<"' type of notifications" << llendl; - } -} - void LLNotificationWellWindow::onItemClick(LLSysWellItem* item) { LLUUID id = item->getID(); @@ -573,6 +566,12 @@ void LLNotificationWellWindow::onItemClose(LLSysWellItem* item) mChannel->killToastByNotificationID(id); } +void LLNotificationWellWindow::onAdd( LLNotificationPtr notify ) +{ + removeItemByID(notify->getID()); +} + + /************************************************************************/ @@ -866,4 +865,4 @@ bool LLIMWellWindow::confirmCloseAll(const LLSD& notification, const LLSD& respo return false; } -// EOF + diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index 272e9cfcb1..caf30cfd67 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -34,6 +34,7 @@ #include "llscreenchannel.h" #include "llscrollcontainer.h" #include "llimview.h" +#include "llnotifications.h" #include "boost/shared_ptr.hpp" @@ -111,7 +112,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void setVisible(BOOL visible); - + /*virtual*/ void onAdd(LLNotificationPtr notify); // Operating with items void addItem(LLSysWellItem::Params p); @@ -119,6 +120,18 @@ public: void closeAll(); protected: + struct WellNotificationChannel : public LLNotificationChannel + { + WellNotificationChannel(LLNotificationWellWindow*); + void onAdd(LLNotificationPtr notify) + { + mWellWindow->removeItemByID(notify->getID()); + } + + LLNotificationWellWindow* mWellWindow; + }; + + LLNotificationChannelPtr mNotificationUpdates; /*virtual*/ const std::string& getAnchorViewName() { return NOTIFICATION_WELL_ANCHOR_NAME; } private: @@ -126,12 +139,8 @@ private: void initChannel(); void clearScreenChannels(); - void onStoreToast(LLPanel* info_panel, LLUUID id); - // connect counter and list updaters to the corresponding signals - void connectListUpdaterToSignal(std::string notification_type); - // Handlers void onItemClick(LLSysWellItem* item); void onItemClose(LLSysWellItem* item); diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h index 3b8b31eac1..dfdc6ae559 100644 --- a/indra/newview/lltoastgroupnotifypanel.h +++ b/indra/newview/lltoastgroupnotifypanel.h @@ -47,9 +47,6 @@ class LLToastGroupNotifyPanel public: void close(); - static bool onNewNotification(const LLSD& notification); - - // Non-transient messages. You can specify non-default button // layouts (like one for script dialogs) by passing various // numbers in for "layout". diff --git a/indra/newview/lltoastscripttextbox.h b/indra/newview/lltoastscripttextbox.h index 8e69d8834d..7d33446248 100644 --- a/indra/newview/lltoastscripttextbox.h +++ b/indra/newview/lltoastscripttextbox.h @@ -39,8 +39,6 @@ class LLToastScriptTextbox public: void close(); - static bool onNewNotification(const LLSD& notification); - // Non-transient messages. You can specify non-default button // layouts (like one for script dialogs) by passing various // numbers in for "layout". -- cgit v1.2.3 From c2afd200a0d55c5137de6f89200a8d4b09ba8b6e Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 30 Mar 2012 18:36:43 -0700 Subject: CHUI-51 WIP notifications routing code cleanup object inventory offers don't increment system menu count added customizable merging behavior for duplicate "unique" notifications fixed overeager notification channels --- indra/llui/llnotifications.cpp | 43 ++++++++++++++++------------- indra/llui/llnotifications.h | 8 ++++++ indra/llui/llnotificationtemplate.h | 14 ++++++++++ indra/newview/llchiclet.cpp | 10 +++++-- indra/newview/llnotificationhandler.h | 33 +++++++++++----------- indra/newview/llnotificationhinthandler.cpp | 2 +- indra/newview/llscreenchannel.cpp | 9 +++++- 7 files changed, 80 insertions(+), 39 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index c45899a4bd..79135d2c60 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -246,7 +246,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica LLParamSDParser parser; parser.writeSD(mFormData, p.form_elements); - if (!mFormData.isArray()) + if (!mFormData.isArray() && !mFormData.isUndefined()) { // change existing contents to a one element array LLSD new_llsd_array = LLSD::emptyArray(); @@ -407,6 +407,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mURLOption(p.url.option), mURLTarget(p.url.target), mUnique(p.unique.isProvided()), + mCombineBehavior(p.unique.combine), mPriority(p.priority), mPersist(p.persist), mDefaultFunctor(p.functor.isProvided() ? p.functor() : p.name()), @@ -903,6 +904,10 @@ bool LLNotification::hasFormElements() const return mTemplatep->mForm->getNumElements() != 0; } +LLNotification::ECombineBehavior LLNotification::getCombineBehavior() const +{ + return mTemplatep->mCombineBehavior; +} @@ -1242,22 +1247,25 @@ bool LLNotifications::failedUniquenessTest(const LLSD& payload) return false; } - // Update the existing unique notification with the data from this particular instance... - // This guarantees that duplicate notifications will be collapsed to the one - // most recently triggered - for (LLNotificationMap::iterator existing_it = mUniqueNotifications.find(pNotif->getName()); - existing_it != mUniqueNotifications.end(); - ++existing_it) + if (pNotif->getCombineBehavior() == LLNotification::USE_NEWEST) { - LLNotificationPtr existing_notification = existing_it->second; - if (pNotif != existing_notification - && pNotif->isEquivalentTo(existing_notification)) + // Update the existing unique notification with the data from this particular instance... + // This guarantees that duplicate notifications will be collapsed to the one + // most recently triggered + for (LLNotificationMap::iterator existing_it = mUniqueNotifications.find(pNotif->getName()); + existing_it != mUniqueNotifications.end(); + ++existing_it) { - // copy notification instance data over to oldest instance - // of this unique notification and update it - existing_notification->updateFrom(pNotif); - // then delete the new one - cancel(pNotif); + LLNotificationPtr existing_notification = existing_it->second; + if (pNotif != existing_notification + && pNotif->isEquivalentTo(existing_notification)) + { + // copy notification instance data over to oldest instance + // of this unique notification and update it + existing_notification->updateFrom(pNotif); + // then delete the new one + cancel(pNotif); + } } } @@ -1296,10 +1304,7 @@ void LLNotifications::createDefaultChannels() boost::bind(&LLNotifications::isVisibleByRules, this, _1))); mDefaultChannels.push_back(new LLNotificationChannel("Visible", "VisibilityRules", &LLNotificationFilters::includeEverything)); - - // create special persistent notification channel - // this isn't a leak, don't worry about the empty "new" - new LLPersistentNotificationChannel(); + mDefaultChannels.push_back(new LLPersistentNotificationChannel()); // connect action methods to these channels LLNotifications::instance().getChannel("Enabled")-> diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 344108ecbf..4e2b997156 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -297,6 +297,7 @@ LOG_CLASS(LLNotification); friend class LLNotifications; public: + // parameter object used to instantiate a new notification struct Params : public LLInitParam::Block { @@ -518,6 +519,13 @@ public: bool canLogToIM() const; bool hasFormElements() const; + typedef enum e_combine_behavior + { + USE_NEWEST, + USE_OLDEST + } ECombineBehavior; + + ECombineBehavior getCombineBehavior() const; const LLNotificationFormPtr getForm(); const LLDate getExpiration() const diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 1df7205b23..8080acbf87 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -61,6 +61,17 @@ typedef boost::shared_ptr LLNotificationFormPtr; // from the appropriate local language directory). struct LLNotificationTemplate { + struct CombineBehaviorNames + : public LLInitParam::TypeValuesHelper + { + static void declareValues() + { + declare("newest", LLNotification::USE_NEWEST); + declare("oldest", LLNotification::USE_OLDEST); + } + }; + + struct GlobalString : public LLInitParam::Block { Mandatory name, @@ -94,9 +105,11 @@ struct LLNotificationTemplate Optional dummy_val; public: Multiple contexts; + Optional combine; UniquenessConstraint() : contexts("context"), + combine("combine", LLNotification::USE_NEWEST), dummy_val("") {} }; @@ -249,6 +262,7 @@ struct LLNotificationTemplate // (used for things like progress indications, or repeating warnings // like "the grid is going down in N minutes") bool mUnique; + LLNotification::ECombineBehavior mCombineBehavior; // if we want to be unique only if a certain part of the payload or substitutions args // are constant specify the field names for the payload. The notification will only be // combined if all of the fields named in the context are identical in the diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 67519a3ca6..b4c70b6edb 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -393,9 +393,15 @@ void LLNotificationChiclet::setCounter(S32 counter) } -bool LLNotificationChiclet::ChicletNotificationChannel::filterNotification( LLNotificationPtr notify ) +bool LLNotificationChiclet::ChicletNotificationChannel::filterNotification( LLNotificationPtr notification ) { - return !(notify->canLogToIM() && notify->hasFormElements()); + if( !(notification->canLogToIM() && notification->hasFormElements()) + && (!notification->getPayload().has("give_inventory_notification") + || notification->getPayload()["give_inventory_notification"])) + { + return true; + } + return false; } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 419b8a14b6..21f3961d18 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -94,7 +94,7 @@ public: // base interface functions /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); } /*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel) mChannel->killToastByNotificationID(p->getID());} virtual bool processNotification(const LLNotificationPtr& notify)=0; @@ -130,7 +130,7 @@ public: protected: bool processNotification(const LLNotificationPtr& p); - virtual void initChannel(); + /*virtual*/ void initChannel(); }; /** @@ -144,11 +144,12 @@ public: virtual ~LLTipHandler(); // base interface functions - virtual bool processNotification(const LLNotificationPtr& p); + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ bool processNotification(const LLNotificationPtr& p); protected: - virtual void onRejectToast(const LLUUID& id); - virtual void initChannel(); + /*virtual*/ void onRejectToast(const LLUUID& id); + /*virtual*/ void initChannel(); }; /** @@ -161,13 +162,13 @@ public: LLScriptHandler(); virtual ~LLScriptHandler(); - virtual void onDelete(LLNotificationPtr p); + /*virtual*/ void onDelete(LLNotificationPtr p); // base interface functions - virtual bool processNotification(const LLNotificationPtr& p); + /*virtual*/ bool processNotification(const LLNotificationPtr& p); protected: - virtual void onDeleteToast(LLToast* toast); - virtual void initChannel(); + /*virtual*/ void onDeleteToast(LLToast* toast); + /*virtual*/ void initChannel(); // own handlers void onRejectToast(LLUUID& id); @@ -184,7 +185,8 @@ public: virtual ~LLGroupHandler(); // base interface functions - virtual bool processNotification(const LLNotificationPtr& p); + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ bool processNotification(const LLNotificationPtr& p); protected: virtual void initChannel(); @@ -204,9 +206,7 @@ public: /*virtual*/ void onChange(LLNotificationPtr p); /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); } - - // base interface functions - virtual bool processNotification(const LLNotificationPtr& p); + /*virtual*/ bool processNotification(const LLNotificationPtr& p); protected: virtual void initChannel(); @@ -225,11 +225,12 @@ public: virtual ~LLOfferHandler(); // base interface functions + /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } /*virtual*/ void onDelete(LLNotificationPtr notification); - virtual bool processNotification(const LLNotificationPtr& p); + /*virtual*/ bool processNotification(const LLNotificationPtr& p); protected: - virtual void initChannel(); + /*virtual*/ void initChannel(); // own handlers void onRejectToast(LLUUID& id); @@ -246,7 +247,7 @@ public: virtual ~LLHintHandler() {} /*virtual*/ void onAdd(LLNotificationPtr p); - /*virtual*/ void onChange(LLNotificationPtr p); + /*virtual*/ void onLoad(LLNotificationPtr p); /*virtual*/ void onDelete(LLNotificationPtr p); }; diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp index 47156a3915..271f418507 100644 --- a/indra/newview/llnotificationhinthandler.cpp +++ b/indra/newview/llnotificationhinthandler.cpp @@ -34,5 +34,5 @@ using namespace LLNotificationsUI; void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); } -void LLHintHandler::onChange(LLNotificationPtr p) { LLHints::show(p); } +void LLHintHandler::onLoad(LLNotificationPtr p) { LLHints::show(p); } void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); } diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 5301955964..cc68c4c91a 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -251,7 +251,14 @@ void LLScreenChannel::addToast(const LLToast::Params& p) { bool store_toast = false, show_toast = false; - mDisplayToastsAlways ? show_toast = true : show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show); + if (mDisplayToastsAlways) + { + show_toast = true; + } + else + { + show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show); + } store_toast = !show_toast && p.can_be_stored && mCanStoreToasts; if(!show_toast && !store_toast) -- cgit v1.2.3 From 10503b13e0cd5b6f89d885982b72ed23ec131e85 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 5 Apr 2012 19:22:37 +0300 Subject: CHUI-77 WIP People panel layout change: filter pane moved inside the tab. --- .../newview/skins/default/xui/en/panel_people.xml | 587 ++++++++++----------- 1 file changed, 285 insertions(+), 302 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 98c7c49ff4..919661eff6 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -60,21 +60,9 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M - - + + + + + - - + + + + + - + left_pad="2" + name="recent_add_btn" + top="1" + width="31" /> + + Date: Wed, 4 Apr 2012 22:04:38 +0300 Subject: CHUI-78 WIP Fixed parsing of menu_button.menu_position XUI parameter. --- indra/llui/llmenubutton.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index e2396e7fb2..84e63911a3 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -53,7 +53,7 @@ public: { // filename for it's toggleable menu Optional menu_filename; - Optional position; + Optional position; Params(); }; -- cgit v1.2.3 From 69cf10a1e9b969a1c87473a8b153281dc60e7b56 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 5 Apr 2012 17:29:25 +0300 Subject: CHUI-78 WIP Renamamed menu_button.position XUI attribute to menu_position for consistency with menu_filename. --- indra/llui/llmenubutton.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 50d59f79f4..cfae524f3b 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -44,8 +44,9 @@ void LLMenuButton::MenuPositions::declareValues() LLMenuButton::Params::Params() : menu_filename("menu_filename"), - position("position", MP_BOTTOM_LEFT) + position("menu_position", MP_BOTTOM_LEFT) { + addSynonym(position, "position"); } -- cgit v1.2.3 From 177c1f80bc132fdad4e46009b074c0609454332f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 5 Apr 2012 20:37:28 +0300 Subject: CHUI-78 WIP Enabled LLMenuButton to manage its menu's lifetime. --- indra/llui/llmenubutton.cpp | 53 +++++++++++++++++++++++++++++++-------------- indra/llui/llmenubutton.h | 9 +++++++- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index cfae524f3b..2f5e29c36e 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -53,25 +53,18 @@ LLMenuButton::Params::Params() LLMenuButton::LLMenuButton(const LLMenuButton::Params& p) : LLButton(p), mIsMenuShown(false), - mMenuPosition(p.position) + mMenuPosition(p.position), + mOwnMenu(false) { std::string menu_filename = p.menu_filename; - if (!menu_filename.empty()) - { - LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); - if (!menu) - { - llwarns << "Error loading menu_button menu" << llendl; - return; - } - - menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2)); - - mMenuHandle = menu->getHandle(); + setMenu(menu_filename, mMenuPosition); + updateMenuOrigin(); +} - updateMenuOrigin(); - } +LLMenuButton::~LLMenuButton() +{ + cleanup(); } boost::signals2::connection LLMenuButton::setMouseDownCallback( const mouse_signal_t::slot_type& cb ) @@ -95,12 +88,32 @@ LLToggleableMenu* LLMenuButton::getMenu() return dynamic_cast(mMenuHandle.get()); } -void LLMenuButton::setMenu(LLToggleableMenu* menu, EMenuPosition position /*MP_TOP_LEFT*/) +void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition position /*MP_TOP_LEFT*/) +{ + if (menu_filename.empty()) + { + return; + } + + LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + if (!menu) + { + llwarns << "Error loading menu_button menu" << llendl; + return; + } + + setMenu(menu, position, true); +} + +void LLMenuButton::setMenu(LLToggleableMenu* menu, EMenuPosition position /*MP_TOP_LEFT*/, bool take_ownership /*false*/) { if (!menu) return; + cleanup(); // destroy the previous memnu if we own it + mMenuHandle = menu->getHandle(); mMenuPosition = position; + mOwnMenu = take_ownership; menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2)); } @@ -212,3 +225,11 @@ void LLMenuButton::onMenuVisibilityChange(const LLSD& param) mIsMenuShown = false; } } + +void LLMenuButton::cleanup() +{ + if (mMenuHandle.get() && mOwnMenu) + { + mMenuHandle.get()->die(); + } +} diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h index 84e63911a3..67ec1983b3 100644 --- a/indra/llui/llmenubutton.h +++ b/indra/llui/llmenubutton.h @@ -34,6 +34,8 @@ class LLToggleableMenu; class LLMenuButton : public LLButton { + LOG_CLASS(LLMenuButton); + public: typedef enum e_menu_position { @@ -68,13 +70,15 @@ public: void hideMenu(); LLToggleableMenu* getMenu(); - void setMenu(LLToggleableMenu* menu, EMenuPosition position = MP_TOP_LEFT); + void setMenu(const std::string& menu_filename, EMenuPosition position = MP_TOP_LEFT); + void setMenu(LLToggleableMenu* menu, EMenuPosition position = MP_TOP_LEFT, bool take_ownership = false); void setMenuPosition(EMenuPosition position) { mMenuPosition = position; } protected: friend class LLUICtrlFactory; LLMenuButton(const Params&); + ~LLMenuButton(); void toggleMenu(); void updateMenuOrigin(); @@ -82,11 +86,14 @@ protected: void onMenuVisibilityChange(const LLSD& param); private: + void cleanup(); + LLHandle mMenuHandle; bool mIsMenuShown; EMenuPosition mMenuPosition; S32 mX; S32 mY; + bool mOwnMenu; // true if we manage the menu lifetime }; -- cgit v1.2.3 From 2dc032e3e582d39a04c40b7cfb3366424491b491 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 5 Apr 2012 22:56:18 +0300 Subject: CHUI-78 WIP Added drop-down menus and connected callbacks to the new view/sort/add/remove buttons. --- indra/llui/llmenubutton.cpp | 5 + indra/newview/llpanelpeople.cpp | 137 +++++-------------- indra/newview/llpanelpeople.h | 16 +-- .../skins/default/xui/en/menu_group_plus.xml | 4 +- .../default/xui/en/menu_people_friends_sort.xml | 26 ++++ .../default/xui/en/menu_people_friends_view.xml | 26 ++++ .../xui/en/menu_people_friends_view_sort.xml | 47 ------- .../default/xui/en/menu_people_groups_view.xml | 17 +++ .../xui/en/menu_people_groups_view_sort.xml | 26 ---- .../default/xui/en/menu_people_nearby_sort.xml | 36 +++++ .../default/xui/en/menu_people_nearby_view.xml | 31 +++++ .../xui/en/menu_people_nearby_view_sort.xml | 57 -------- .../default/xui/en/menu_people_recent_sort.xml | 26 ++++ .../default/xui/en/menu_people_recent_view.xml | 18 +++ .../xui/en/menu_people_recent_view_sort.xml | 39 ------ .../newview/skins/default/xui/en/panel_people.xml | 152 ++++++++++++++++----- 16 files changed, 339 insertions(+), 324 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_people_friends_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_friends_view.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_groups_view.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_nearby_view.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_recent_sort.xml create mode 100644 indra/newview/skins/default/xui/en/menu_people_recent_view.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 2f5e29c36e..98f7e0540c 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -153,6 +153,11 @@ BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask) void LLMenuButton::toggleMenu() { + if (mValidateSignal && !(*mValidateSignal)(this, LLSD())) + { + return; + } + if(mMenuHandle.isDead()) return; LLToggleableMenu* menu = dynamic_cast(mMenuHandle.get()); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 9c46f04abf..238834aa92 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -501,17 +501,38 @@ LLPanelPeople::LLPanelPeople() mNearbyList(NULL), mRecentList(NULL), mGroupList(NULL), - mNearbyGearButton(NULL), - mFriendsGearButton(NULL), - mGroupsGearButton(NULL), - mRecentGearButton(NULL), mMiniMap(NULL) { mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this)); mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this)); mRecentListUpdater = new LLRecentListUpdater(boost::bind(&LLPanelPeople::updateRecentList, this)); mButtonsUpdater = new LLButtonsUpdater(boost::bind(&LLPanelPeople::updateButtons, this)); - mCommitCallbackRegistrar.add("People.addFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this)); + + mCommitCallbackRegistrar.add("People.AddFriend", boost::bind(&LLPanelPeople::onAddFriendButtonClicked, this)); + mCommitCallbackRegistrar.add("People.AddFriendWizard", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this)); + mCommitCallbackRegistrar.add("People.DelFriend", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Group.Activate", boost::bind(&LLPanelPeople::onActivateButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Group.Minus", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this)); + mCommitCallbackRegistrar.add("People.ViewProfile", boost::bind(&LLPanelPeople::onViewProfileButtonClicked, this)); + mCommitCallbackRegistrar.add("People.GroupInfo", boost::bind(&LLPanelPeople::onGroupInfoButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Chat", boost::bind(&LLPanelPeople::onChatButtonClicked, this)); + mCommitCallbackRegistrar.add("People.IM", boost::bind(&LLPanelPeople::onImButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Call", boost::bind(&LLPanelPeople::onCallButtonClicked, this)); + mCommitCallbackRegistrar.add("People.GroupCall", boost::bind(&LLPanelPeople::onGroupCallButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Teleport", boost::bind(&LLPanelPeople::onTeleportButtonClicked, this)); + mCommitCallbackRegistrar.add("People.Share", boost::bind(&LLPanelPeople::onShareButtonClicked, this)); + + mCommitCallbackRegistrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2)); + mCommitCallbackRegistrar.add("People.Friends.ViewSort.Action", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2)); + mCommitCallbackRegistrar.add("People.Nearby.ViewSort.Action", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2)); + mCommitCallbackRegistrar.add("People.Groups.ViewSort.Action", boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2)); + mCommitCallbackRegistrar.add("People.Recent.ViewSort.Action", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2)); + + mEnableCallbackRegistrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2)); + mEnableCallbackRegistrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2)); + + mEnableCallbackRegistrar.add("People.Group.Plus.Validate", boost::bind(&LLPanelPeople::onGroupPlusButtonValidate, this)); } LLPanelPeople::~LLPanelPeople() @@ -525,13 +546,6 @@ LLPanelPeople::~LLPanelPeople() { LLVoiceClient::getInstance()->removeObserver(this); } - - if (mGroupPlusMenuHandle.get()) mGroupPlusMenuHandle.get()->die(); - if (mNearbyViewSortMenuHandle.get()) mNearbyViewSortMenuHandle.get()->die(); - if (mNearbyViewSortMenuHandle.get()) mNearbyViewSortMenuHandle.get()->die(); - if (mGroupsViewSortMenuHandle.get()) mGroupsViewSortMenuHandle.get()->die(); - if (mRecentViewSortMenuHandle.get()) mRecentViewSortMenuHandle.get()->die(); - } void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list) @@ -601,14 +615,6 @@ BOOL LLPanelPeople::postBuild() setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false); setSortOrder(mNearbyList, (ESortOrder)gSavedSettings.getU32("NearbyPeopleSortOrder"), false); - LLPanel* groups_panel = getChild(GROUP_TAB_NAME); - groups_panel->childSetAction("activate_btn", boost::bind(&LLPanelPeople::onActivateButtonClicked, this)); - groups_panel->childSetAction("plus_btn", boost::bind(&LLPanelPeople::onGroupPlusButtonClicked, this)); - - LLPanel* friends_panel = getChild(FRIENDS_TAB_NAME); - friends_panel->childSetAction("add_btn", boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked, this)); - friends_panel->childSetAction("del_btn", boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked, this)); - mOnlineFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1)); mAllFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1)); mNearbyList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1)); @@ -637,70 +643,9 @@ BOOL LLPanelPeople::postBuild() accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLPanelPeople::onFriendsAccordionExpandedCollapsed, this, _1, _2, mOnlineFriendList)); - buttonSetAction("view_profile_btn", boost::bind(&LLPanelPeople::onViewProfileButtonClicked, this)); - buttonSetAction("group_info_btn", boost::bind(&LLPanelPeople::onGroupInfoButtonClicked, this)); - buttonSetAction("chat_btn", boost::bind(&LLPanelPeople::onChatButtonClicked, this)); - buttonSetAction("im_btn", boost::bind(&LLPanelPeople::onImButtonClicked, this)); - buttonSetAction("call_btn", boost::bind(&LLPanelPeople::onCallButtonClicked, this)); - buttonSetAction("group_call_btn", boost::bind(&LLPanelPeople::onGroupCallButtonClicked, this)); - buttonSetAction("teleport_btn", boost::bind(&LLPanelPeople::onTeleportButtonClicked, this)); - buttonSetAction("share_btn", boost::bind(&LLPanelPeople::onShareButtonClicked, this)); - // Must go after setting commit callback and initializing all pointers to children. mTabContainer->selectTabByName(NEARBY_TAB_NAME); - // Create menus. - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; - - registrar.add("People.Group.Plus.Action", boost::bind(&LLPanelPeople::onGroupPlusMenuItemClicked, this, _2)); - registrar.add("People.Group.Minus.Action", boost::bind(&LLPanelPeople::onGroupMinusButtonClicked, this)); - registrar.add("People.Friends.ViewSort.Action", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemClicked, this, _2)); - registrar.add("People.Nearby.ViewSort.Action", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemClicked, this, _2)); - registrar.add("People.Groups.ViewSort.Action", boost::bind(&LLPanelPeople::onGroupsViewSortMenuItemClicked, this, _2)); - registrar.add("People.Recent.ViewSort.Action", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemClicked, this, _2)); - - enable_registrar.add("People.Group.Minus.Enable", boost::bind(&LLPanelPeople::isRealGroup, this)); - enable_registrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2)); - enable_registrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2)); - enable_registrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2)); - - mNearbyGearButton = getChild("nearby_view_sort_btn"); - mFriendsGearButton = getChild("friends_viewsort_btn"); - mGroupsGearButton = getChild("groups_viewsort_btn"); - mRecentGearButton = getChild("recent_viewsort_btn"); - - LLMenuGL* plus_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_group_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mGroupPlusMenuHandle = plus_menu->getHandle(); - - LLToggleableMenu* nearby_view_sort = LLUICtrlFactory::getInstance()->createFromFile("menu_people_nearby_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(nearby_view_sort) - { - mNearbyViewSortMenuHandle = nearby_view_sort->getHandle(); - mNearbyGearButton->setMenu(nearby_view_sort); - } - - LLToggleableMenu* friend_view_sort = LLUICtrlFactory::getInstance()->createFromFile("menu_people_friends_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(friend_view_sort) - { - mFriendsViewSortMenuHandle = friend_view_sort->getHandle(); - mFriendsGearButton->setMenu(friend_view_sort); - } - - LLToggleableMenu* group_view_sort = LLUICtrlFactory::getInstance()->createFromFile("menu_people_groups_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(group_view_sort) - { - mGroupsViewSortMenuHandle = group_view_sort->getHandle(); - mGroupsGearButton->setMenu(group_view_sort); - } - - LLToggleableMenu* recent_view_sort = LLUICtrlFactory::getInstance()->createFromFile("menu_people_recent_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(recent_view_sort) - { - mRecentViewSortMenuHandle = recent_view_sort->getHandle(); - mRecentGearButton->setMenu(recent_view_sort); - } - LLVoiceClient::getInstance()->addObserver(this); // call this method in case some list is empty and buttons can be in inconsistent state @@ -835,13 +780,6 @@ void LLPanelPeople::buttonSetEnabled(const std::string& btn_name, bool enabled) button->setEnabled(enabled); } -void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb) -{ - // To make sure we're referencing the right widget (a child of the button bar). - LLButton* button = getChild("button_bar")->getChild(btn_name); - button->setClickedCallback(cb); -} - void LLPanelPeople::updateButtons() { std::string cur_tab = getActiveTabName(); @@ -877,7 +815,7 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("activate_btn")->setEnabled(item_selected && !cur_group_active); // "none" or a non-active group selected - groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); + groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected } else { @@ -893,10 +831,12 @@ void LLPanelPeople::updateButtons() LLPanel* cur_panel = mTabContainer->getCurrentPanel(); if (cur_panel) { - cur_panel->getChildView("add_friend_btn")->setEnabled(!is_friend); + if (cur_panel->hasChild("add_friend_btn", TRUE)) + cur_panel->getChildView("add_friend_btn")->setEnabled(item_selected && !is_friend); + if (friends_tab_active) { - cur_panel->getChildView("del_btn")->setEnabled(multiple_selected); + cur_panel->getChildView("friends_del_btn")->setEnabled(multiple_selected); } } } @@ -1031,11 +971,6 @@ void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save } } -bool LLPanelPeople::isRealGroup() -{ - return getCurrentItemID() != LLUUID::null; -} - void LLPanelPeople::onFilterEdit(const std::string& search_string) { mFilterSubStringOrig = search_string; @@ -1226,19 +1161,15 @@ void LLPanelPeople::onAvatarPicked(const uuid_vec_t& ids, const std::vector mGroupPlusMenuHandle; - LLHandle mNearbyViewSortMenuHandle; - LLHandle mFriendsViewSortMenuHandle; - LLHandle mGroupsViewSortMenuHandle; - LLHandle mRecentViewSortMenuHandle; - Updater* mFriendListUpdater; Updater* mNearbyListUpdater; Updater* mRecentListUpdater; Updater* mButtonsUpdater; - LLMenuButton* mNearbyGearButton; - LLMenuButton* mFriendsGearButton; - LLMenuButton* mGroupsGearButton; - LLMenuButton* mRecentGearButton; - std::string mFilterSubString; std::string mFilterSubStringOrig; }; diff --git a/indra/newview/skins/default/xui/en/menu_group_plus.xml b/indra/newview/skins/default/xui/en/menu_group_plus.xml index fce7414d80..eca9e7f3c9 100644 --- a/indra/newview/skins/default/xui/en/menu_group_plus.xml +++ b/indra/newview/skins/default/xui/en/menu_group_plus.xml @@ -1,5 +1,5 @@ - @@ -8,4 +8,4 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml new file mode 100644 index 0000000000..532e295386 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml new file mode 100644 index 0000000000..be23e91587 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml deleted file mode 100644 index b452f96e7a..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_groups_view.xml b/indra/newview/skins/default/xui/en/menu_people_groups_view.xml new file mode 100644 index 0000000000..73f79f1e70 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_groups_view.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml deleted file mode 100644 index c710fe3b9b..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml new file mode 100644 index 0000000000..cf7f4f4fce --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml new file mode 100644 index 0000000000..187dd3bcb5 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml deleted file mode 100644 index 614dd693c5..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_sort.xml new file mode 100644 index 0000000000..f14be88780 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_recent_sort.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view.xml new file mode 100644 index 0000000000..5520bc993c --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_people_recent_view.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml deleted file mode 100644 index 485a5a658c..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 919661eff6..f61b0b3dbd 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -73,6 +73,9 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M top="0" halign="center" width="319"> + + + + width="31"> + + + + + + width="31"> + + + + + + + width="31"> + + + width="31"> + + + + + + width="31"> + + + width="67"> + + + width="40"> + + + width="51"> + + + width="65"> + + + width="76"> + + @@ -706,7 +779,10 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M name="group_info_btn" tool_tip="Show group information" top="0" - width="107" /> + width="107"> + + + width="100"> + + + width="95"> + + -- cgit v1.2.3 From 9626ab8fec34f73cd60822bd34376c1cb94e11d7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Apr 2012 16:10:07 -0700 Subject: CHUI-89 FIX Make nametags appear consistently next to avatar heads nametags now track avatar head avatar_skeleton now loaded as param block vector3 param block parsing support fixes for param block recursion --- indra/llxuixml/llinitparam.h | 227 +++++---- indra/llxuixml/llxuiparser.cpp | 27 + indra/llxuixml/llxuiparser.h | 2 + indra/newview/llhudnametag.cpp | 279 +++-------- indra/newview/llhudnametag.h | 2 - indra/newview/llspatialpartition.cpp | 4 +- indra/newview/llviewermenu.cpp | 9 - indra/newview/llvoavatar.cpp | 948 ++++++++++++++++------------------- indra/newview/llvoavatar.h | 15 +- indra/newview/pipeline.cpp | 5 - 10 files changed, 689 insertions(+), 829 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index ab20957760..6fffb73acd 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -377,8 +377,9 @@ namespace LLInitParam class Lazy { public: + Lazy() - : mPtr(NULL) + : mPtr(NULL) {} ~Lazy() @@ -386,6 +387,11 @@ namespace LLInitParam delete mPtr; } + Lazy(const T& value) + { + mPtr = new T(value); + } + Lazy(const Lazy& other) { if (other.mPtr) @@ -424,12 +430,17 @@ namespace LLInitParam const T& get() const { - return ensureInstance(); + return *ensureInstance(); } T& get() { - return ensureInstance(); + return *ensureInstance(); + } + + operator const T&() const + { + return get(); } private: @@ -520,8 +531,8 @@ namespace LLInitParam void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } + virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } + virtual BlockDescriptor& mostDerivedBlockDescriptor() { return getBlockDescriptor(); } // take all provided params from other and apply to self bool overwriteFrom(const BaseBlock& other) @@ -539,6 +550,15 @@ namespace LLInitParam ParamDescriptorPtr findParamDescriptor(const Param& param); + // take all provided params from other and apply to self + bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite); + + static BlockDescriptor& getBlockDescriptor() + { + static BlockDescriptor sBlockDescriptor; + return sBlockDescriptor; + } + protected: void init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size); @@ -547,25 +567,11 @@ namespace LLInitParam { return mergeBlock(block_data, source, overwrite); } - // take all provided params from other and apply to self - bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite); - - static BlockDescriptor& selfBlockDescriptor() - { - static BlockDescriptor sBlockDescriptor; - return sBlockDescriptor; - } private: const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; - template - struct ParamCompare, false > - { - static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { return !a.empty() || !b.empty(); } - }; - class Param { public: @@ -607,26 +613,16 @@ namespace LLInitParam // these templates allow us to distinguish between template parameters // that derive from BaseBlock and those that don't - template + template struct IsBlock { static const bool value = false; - struct EmptyBase {}; - typedef EmptyBase base_class_t; }; template struct IsBlock { static const bool value = true; - typedef BaseBlock base_class_t; - }; - - template - struct IsBlock, typename T::baseblock_base_class_t > - { - static const bool value = true; - typedef BaseBlock base_class_t; }; template::value> @@ -817,13 +813,13 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef typename param_value_t::value_assignment_t value_assignment_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; + typedef typename param_value_t::value_assignment_t value_assignment_t; using param_value_t::operator(); - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) + TypedParam(BlockDescriptor& block_descriptor, const char* name, const T& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) + : Param(block_descriptor.mCurrentBlockPtr), + param_value_t(value) { if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { @@ -837,8 +833,6 @@ namespace LLInitParam min_count, max_count)); BaseBlock::addParam(block_descriptor, param_descriptor, name); } - - setValue(value); } bool isProvided() const { return Param::anyProvided(); } @@ -857,14 +851,14 @@ namespace LLInitParam } // try to parse a known named value - if(name_value_lookup_t::valueNamesExist()) + if(param_value_t::valueNamesExist()) { // try to parse a known named value std::string name; if (parser.readValue(name)) { // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) + if (param_value_t::getValueFromName(name, typed_param.getValue())) { typed_param.setValueName(name); typed_param.setProvided(); @@ -917,9 +911,9 @@ namespace LLInitParam // tell parser about our actual type parser.inspectValue(name_stack, min_count, max_count, NULL); // then tell it about string-based alternatives ("red", "blue", etc. for LLColor4) - if (name_value_lookup_t::getPossibleValues()) + if (param_value_t::getPossibleValues()) { - parser.inspectValue(name_stack, min_count, max_count, name_value_lookup_t::getPossibleValues()); + parser.inspectValue(name_stack, min_count, max_count, param_value_t::getPossibleValues()); } } @@ -969,11 +963,10 @@ namespace LLInitParam typedef ParamValue param_value_t; typedef typename param_value_t::value_assignment_t value_assignment_t; typedef TypedParam self_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; using param_value_t::operator(); - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) + TypedParam(BlockDescriptor& block_descriptor, const char* name, const T& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr), param_value_t(value) { @@ -1002,14 +995,14 @@ namespace LLInitParam return true; } - if(name_value_lookup_t::valueNamesExist()) + if(param_value_t::valueNamesExist()) { // try to parse a known named value std::string name; if (parser.readValue(name)) { // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, typed_param.getValue())) + if (param_value_t::getValueFromName(name, typed_param.getValue())) { typed_param.setValueName(name); typed_param.setProvided(); @@ -1041,7 +1034,7 @@ namespace LLInitParam } else { - typed_param.serializeBlock(parser, name_stack, static_cast(diff_param)); + typed_param.serializeBlock(parser, name_stack, &static_cast(*static_cast(diff_param))); } } @@ -1115,7 +1108,7 @@ namespace LLInitParam if (src_typed_param.anyProvided()) { - if (dst_typed_param.mergeBlockParam(src_typed_param.isProvided(), dst_typed_param.isProvided(), param_value_t::selfBlockDescriptor(), src_typed_param, overwrite)) + if (dst_typed_param.mergeBlockParam(src_typed_param.isProvided(), dst_typed_param.isProvided(), param_value_t::getBlockDescriptor(), src_typed_param, overwrite)) { dst_typed_param.clearValueName(); dst_typed_param.setProvided(true); @@ -1138,9 +1131,8 @@ namespace LLInitParam typedef const container_t& value_assignment_t; typedef typename param_value_t::value_t value_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) + TypedParam(BlockDescriptor& block_descriptor, const char* name, const container_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr) { std::copy(value.begin(), value.end(), std::back_inserter(mValues)); @@ -1176,14 +1168,14 @@ namespace LLInitParam } // try to parse a known named value - if(name_value_lookup_t::valueNamesExist()) + if(param_value_t::valueNamesExist()) { // try to parse a known named value std::string name; if (parser.readValue(name)) { // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) + if (param_value_t::getValueFromName(name, value)) { typed_param.add(value); typed_param.mValues.back().setValueName(name); @@ -1234,9 +1226,9 @@ namespace LLInitParam static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) { parser.inspectValue(name_stack, min_count, max_count, NULL); - if (name_value_lookup_t::getPossibleValues()) + if (param_value_t::getPossibleValues()) { - parser.inspectValue(name_stack, min_count, max_count, name_value_lookup_t::getPossibleValues()); + parser.inspectValue(name_stack, min_count, max_count, param_value_t::getPossibleValues()); } } @@ -1261,12 +1253,12 @@ namespace LLInitParam setProvided(); } - void add(const typename name_value_lookup_t::name_t& name) + void add(const typename param_value_t::name_t& name) { value_t value; // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) + if (param_value_t::getValueFromName(name, value)) { add(value); mValues.back().setValueName(name); @@ -1330,9 +1322,8 @@ namespace LLInitParam typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef typename param_value_t::value_t value_t; - typedef NAME_VALUE_LOOKUP name_value_lookup_t; - TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) + TypedParam(BlockDescriptor& block_descriptor, const char* name, const container_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr) { std::copy(value.begin(), value.end(), back_inserter(mValues)); @@ -1372,14 +1363,14 @@ namespace LLInitParam typed_param.setProvided(); return true; } - else if(name_value_lookup_t::valueNamesExist()) + else if(param_value_t::valueNamesExist()) { // try to parse a known named value std::string name; if (parser.readValue(name)) { // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value.getValue())) + if (param_value_t::getValueFromName(name, value.getValue())) { typed_param.mValues.back().setValueName(name); typed_param.setProvided(); @@ -1447,12 +1438,12 @@ namespace LLInitParam setProvided(); } - void add(const typename name_value_lookup_t::name_t& name) + void add(const typename param_value_t::name_t& name) { value_t value; // try to parse a per type named value - if (name_value_lookup_t::getValueFromName(name, value)) + if (param_value_t::getValueFromName(name, value)) { add(value); mValues.back().setValueName(name); @@ -1526,13 +1517,13 @@ namespace LLInitParam // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, true); + return static_cast(this)->mergeBlock(getBlockDescriptor(), other, true); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, false); + return static_cast(this)->mergeBlock(getBlockDescriptor(), other, false); } bool mergeBlockParam(bool source_provided, bool dest_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) @@ -1550,7 +1541,7 @@ namespace LLInitParam bool mergeBlock(BlockDescriptor& block_data, const self_t& other, bool overwrite) { mCurChoice = other.mCurChoice; - return base_block_t::mergeBlock(selfBlockDescriptor(), other, overwrite); + return base_block_t::mergeBlock(getBlockDescriptor(), other, overwrite); } // clear out old choice when param has changed @@ -1571,14 +1562,14 @@ namespace LLInitParam base_block_t::paramChanged(changed_param, user_provided); } - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } + virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } + virtual BlockDescriptor& mostDerivedBlockDescriptor() { return getBlockDescriptor(); } protected: ChoiceBlock() : mCurChoice(0) { - BaseBlock::init(selfBlockDescriptor(), base_block_t::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); + BaseBlock::init(getBlockDescriptor(), base_block_t::getBlockDescriptor(), sizeof(DERIVED_BLOCK)); } // Alternatives are mutually exclusive wrt other Alternatives in the same block. @@ -1596,13 +1587,13 @@ namespace LLInitParam using super_t::operator =; - explicit Alternative(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), + explicit Alternative(const char* name = "", const T& val = defaultValue()) + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, NULL, 0, 1), mOriginalValue(val) { // assign initial choice to first declared option - DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr); - if (LL_UNLIKELY(DERIVED_BLOCK::selfBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) + DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::getBlockDescriptor().mCurrentBlockPtr); + if (LL_UNLIKELY(DERIVED_BLOCK::getBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) { if(blockp->mCurChoice == 0) { @@ -1654,8 +1645,8 @@ namespace LLInitParam T mOriginalValue; }; - protected: - static BlockDescriptor& selfBlockDescriptor() + public: + static BlockDescriptor& getBlockDescriptor() { static BlockDescriptor sBlockDescriptor; return sBlockDescriptor; @@ -1683,23 +1674,23 @@ namespace LLInitParam // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, true); + return static_cast(this)->mergeBlock(getBlockDescriptor(), other, true); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { - return static_cast(this)->mergeBlock(selfBlockDescriptor(), other, false); + return static_cast(this)->mergeBlock(getBlockDescriptor(), other, false); } - virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return selfBlockDescriptor(); } - virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } + virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } + virtual BlockDescriptor& mostDerivedBlockDescriptor() { return getBlockDescriptor(); } protected: Block() { //#pragma message("Parsing LLInitParam::Block") - BaseBlock::init(selfBlockDescriptor(), BASE_BLOCK::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); + BaseBlock::init(getBlockDescriptor(), BASE_BLOCK::getBlockDescriptor(), sizeof(DERIVED_BLOCK)); } // @@ -1715,8 +1706,8 @@ namespace LLInitParam using super_t::operator(); using super_t::operator =; - explicit Optional(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) + explicit Optional(const char* name = "", const T& val = defaultValue()) + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, NULL, 0, 1) { //#pragma message("Parsing LLInitParam::Block::Optional") } @@ -1746,8 +1737,8 @@ namespace LLInitParam using super_t::operator =; // mandatory parameters require a name to be parseable - explicit Mandatory(const char* name = "", value_assignment_t val = defaultValue()) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1) + explicit Mandatory(const char* name = "", const T& val = defaultValue()) + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, val, &validate, 1, 1) {} Mandatory& operator =(value_assignment_t val) @@ -1782,7 +1773,7 @@ namespace LLInitParam typedef typename super_t::const_iterator const_iterator; explicit Multiple(const char* name = "") - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount) + : super_t(DERIVED_BLOCK::getBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount) {} Multiple& operator =(value_assignment_t val) @@ -1808,9 +1799,9 @@ namespace LLInitParam { public: explicit Deprecated(const char* name) - : Param(DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) + : Param(DERIVED_BLOCK::getBlockDescriptor().mCurrentBlockPtr) { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor(); + BlockDescriptor& block_descriptor = DERIVED_BLOCK::getBlockDescriptor(); if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( @@ -1841,13 +1832,14 @@ namespace LLInitParam // different semantics for documentation purposes, but functionally identical typedef Deprecated Ignored; - protected: - static BlockDescriptor& selfBlockDescriptor() + public: + static BlockDescriptor& getBlockDescriptor() { static BlockDescriptor sBlockDescriptor; return sBlockDescriptor; } + protected: template void changeDefault(TypedParam& param, typename TypedParam::value_assignment_t value) @@ -1887,7 +1879,7 @@ namespace LLInitParam { *static_cast(this) = defaultBatchValue(); // merge individual parameters into destination - return super_t::mergeBlock(super_t::selfBlockDescriptor(), other, overwrite); + return super_t::mergeBlock(super_t::getBlockDescriptor(), other, overwrite); } return false; } @@ -1955,14 +1947,36 @@ namespace LLInitParam mutable bool mValidated; // lazy validation flag }; - template + template + struct IsBlock, TypeValues > > , BLOCK_IDENTIFIER> + { + static const bool value = true;//IsBlock::value; + }; + + template + struct ParamCompare, false> + { + static bool equals(const T&a, const T &b) + { + return a == b; + } + + static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) + { + if (a.empty() || b.empty()) return false; + return a.get() == b.get(); + } + }; + + + template class ParamValue , - TypeValues, - IS_BLOCK> - : public IsBlock::base_class_t + TypeValues >, + VALUE_IS_BLOCK> + : public TypeValues { public: - typedef ParamValue , TypeValues, false> self_t; + typedef ParamValue , TypeValues >, false> self_t; typedef const T& value_assignment_t; typedef T value_t; @@ -1971,11 +1985,16 @@ namespace LLInitParam mValidated(false) {} - ParamValue(value_assignment_t other) + ParamValue(const BaseBlock::Lazy& other) : mValue(other), mValidated(false) {} + ParamValue(const T& value) + : mValue(value), + mValidated(false) + {} + void setValue(value_assignment_t val) { mValue.set(val); @@ -1991,6 +2010,11 @@ namespace LLInitParam return mValue.get(); } + operator const BaseBlock&() const + { + return mValue.get(); + } + operator value_assignment_t() const { return mValue.get(); @@ -2020,7 +2044,22 @@ namespace LLInitParam return mValue.get().inspectBlock(p, name_stack, min_count, max_count); } - protected: + bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) + { + return mValue.get().mergeBlock(block_data, source.getValue(), overwrite); + } + + bool validateBlock(bool emit_errors = true) const + { + return mValue.get().validateBlock(emit_errors); + } + + static BlockDescriptor& getBlockDescriptor() + { + return T::getBlockDescriptor(); + } + + mutable bool mValidated; // lazy validation flag private: diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index afc76024d1..3c89fa3aaf 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -42,6 +42,7 @@ #include #include "lluicolor.h" +#include "v3math.h" using namespace BOOST_SPIRIT_CLASSIC_NS; @@ -670,6 +671,7 @@ LLXUIParser::LLXUIParser() registerParserFuncs(readS32Value, writeS32Value); registerParserFuncs(readF32Value, writeF32Value); registerParserFuncs(readF64Value, writeF64Value); + registerParserFuncs(readVector3Value, writeVector3Value); registerParserFuncs(readColor4Value, writeColor4Value); registerParserFuncs(readUIColorValue, writeUIColorValue); registerParserFuncs(readUUIDValue, writeUUIDValue); @@ -1144,6 +1146,31 @@ bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_ return false; } +bool LLXUIParser::readVector3Value(Parser& parser, void* val_ptr) +{ + LLXUIParser& self = static_cast(parser); + LLVector3* vecp = (LLVector3*)val_ptr; + if(self.mCurReadNode->getFloatValue(3, vecp->mV) >= 3) + { + return true; + } + + return false; +} + +bool LLXUIParser::writeVector3Value(Parser& parser, const void* val_ptr, name_stack_t& stack) +{ + LLXUIParser& self = static_cast(parser); + LLXMLNodePtr node = self.getNode(stack); + if (node.notNull()) + { + LLVector3 vector = *((LLVector3*)val_ptr); + node->setFloatValue(3, vector.mV); + return true; + } + return false; +} + bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) { LLXUIParser& self = static_cast(parser); diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index d7cd256967..e48663e5cc 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -127,6 +127,7 @@ private: static bool readS32Value(Parser& parser, void* val_ptr); static bool readF32Value(Parser& parser, void* val_ptr); static bool readF64Value(Parser& parser, void* val_ptr); + static bool readVector3Value(Parser& parser, void* val_ptr); static bool readColor4Value(Parser& parser, void* val_ptr); static bool readUIColorValue(Parser& parser, void* val_ptr); static bool readUUIDValue(Parser& parser, void* val_ptr); @@ -144,6 +145,7 @@ private: static bool writeS32Value(Parser& parser, const void* val_ptr, name_stack_t&); static bool writeF32Value(Parser& parser, const void* val_ptr, name_stack_t&); static bool writeF64Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeVector3Value(Parser& parser, const void* val_ptr, name_stack_t&); static bool writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t&); static bool writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t&); static bool writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t&); diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 482294c8a6..cf55954d7d 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -187,45 +187,42 @@ BOOL LLHUDNameTag::lineSegmentIntersect(const LLVector3& start, const LLVector3& + (y_pixel_vec * screen_offset.mV[VY]); - //if (mUseBubble) - { - LLVector3 bg_pos = render_position - + (F32)mOffsetY * y_pixel_vec - - (width_vec / 2.f) - - (height_vec); - //LLUI::translate(bg_pos.mV[VX], bg_pos.mV[VY], bg_pos.mV[VZ]); + LLVector3 bg_pos = render_position + + (F32)mOffsetY * y_pixel_vec + - (width_vec / 2.f) + - (height_vec); + //LLUI::translate(bg_pos.mV[VX], bg_pos.mV[VY], bg_pos.mV[VZ]); - LLVector3 v[] = - { - bg_pos, - bg_pos + width_vec, - bg_pos + width_vec + height_vec, - bg_pos + height_vec, - }; + LLVector3 v[] = + { + bg_pos, + bg_pos + width_vec, + bg_pos + width_vec + height_vec, + bg_pos + height_vec, + }; - if (debug_render) - { - gGL.begin(LLRender::LINE_STRIP); - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[1].mV); - gGL.vertex3fv(v[2].mV); - gGL.vertex3fv(v[3].mV); - gGL.vertex3fv(v[0].mV); - gGL.vertex3fv(v[2].mV); - gGL.end(); - } + if (debug_render) + { + gGL.begin(LLRender::LINE_STRIP); + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[1].mV); + gGL.vertex3fv(v[2].mV); + gGL.vertex3fv(v[3].mV); + gGL.vertex3fv(v[0].mV); + gGL.vertex3fv(v[2].mV); + gGL.end(); + } - LLVector3 dir = end-start; - F32 a, b, t; + LLVector3 dir = end-start; + F32 a, b, t; - if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, a, b, t, FALSE) || - LLTriangleRayIntersect(v[2], v[3], v[0], start, dir, a, b, t, FALSE) ) + if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, a, b, t, FALSE) || + LLTriangleRayIntersect(v[2], v[3], v[0], start, dir, a, b, t, FALSE) ) + { + if (t <= 1.f) { - if (t <= 1.f) - { - intersection = start + dir*t; - return TRUE; - } + intersection = start + dir*t; + return TRUE; } } @@ -241,12 +238,6 @@ void LLHUDNameTag::render() } } -void LLHUDNameTag::renderForSelect() -{ - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - renderText(TRUE); -} - void LLHUDNameTag::renderText(BOOL for_select) { if (!mVisible || mHidden) @@ -336,142 +327,53 @@ void LLHUDNameTag::renderText(BOOL for_select) LLCoordGL screen_pos; LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, FALSE); - LLVector2 screen_offset; -// if (!mUseBubble) -// { -// screen_offset = mPositionOffset; -// } -// else -// { - screen_offset = updateScreenPos(mPositionOffset); -// } + LLVector2 screen_offset = updateScreenPos(mPositionOffset); LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); -// if (mUseBubble) + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); + LLUI::pushMatrix(); { - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - LLUI::pushMatrix(); - { - LLVector3 bg_pos = render_position - + (F32)mOffsetY * y_pixel_vec - - (width_vec / 2.f) - - (height_vec); - LLUI::translate(bg_pos.mV[VX], bg_pos.mV[VY], bg_pos.mV[VZ]); + LLVector3 bg_pos = render_position + + (F32)mOffsetY * y_pixel_vec + - (width_vec / 2.f) + - (height_vec); + LLUI::translate(bg_pos.mV[VX], bg_pos.mV[VY], bg_pos.mV[VZ]); - if (for_select) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - S32 name = mSourceObject->mGLName; - LLColor4U coloru((U8)(name >> 16), (U8)(name >> 8), (U8)name); - gGL.color4ubv(coloru.mV); - gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); - LLUI::popMatrix(); - return; - } - else - { - gGL.getTexUnit(0)->bind(imagep->getImage()); + if (for_select) + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + S32 name = mSourceObject->mGLName; + LLColor4U coloru((U8)(name >> 16), (U8)(name >> 8), (U8)name); + gGL.color4ubv(coloru.mV); + gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); + LLUI::popMatrix(); + return; + } + else + { + gGL.getTexUnit(0)->bind(imagep->getImage()); - gGL.color4fv(bg_color.mV); - gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); + gGL.color4fv(bg_color.mV); + gl_segmented_rect_3d_tex(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, height_vec); - if ( mLabelSegments.size()) - { - LLUI::pushMatrix(); - { - gGL.color4f(text_color.mV[VX], text_color.mV[VY], text_color.mV[VZ], gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); - LLVector3 label_height = (mFontp->getLineHeight() * mLabelSegments.size() + (VERTICAL_PADDING / 3.f)) * y_pixel_vec; - LLVector3 label_offset = height_vec - label_height; - LLUI::translate(label_offset.mV[VX], label_offset.mV[VY], label_offset.mV[VZ]); - gl_segmented_rect_3d_tex_top(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, label_height); - } - LLUI::popMatrix(); - } - } - - BOOL outside_width = llabs(mPositionOffset.mV[VX]) > mWidth * 0.5f; - BOOL outside_height = llabs(mPositionOffset.mV[VY] + (mVertAlignment == ALIGN_VERT_TOP ? mHeight * 0.5f : 0.f)) > mHeight * (mVertAlignment == ALIGN_VERT_TOP ? mHeight * 0.75f : 0.5f); - - // draw line segments pointing to parent object - if (!mOffscreen && (outside_width || outside_height)) + if ( mLabelSegments.size()) { LLUI::pushMatrix(); { - gGL.color4fv(bg_color.mV); - LLVector3 target_pos = -1.f * (mPositionOffset.mV[VX] * x_pixel_vec + mPositionOffset.mV[VY] * y_pixel_vec); - target_pos += (width_vec / 2.f); - target_pos += mVertAlignment == ALIGN_VERT_CENTER ? (height_vec * 0.5f) : LLVector3::zero; - target_pos -= 3.f * x_pixel_vec; - target_pos -= 6.f * y_pixel_vec; - LLUI::translate(target_pos.mV[VX], target_pos.mV[VY], target_pos.mV[VZ]); - gl_segmented_rect_3d_tex(border_scale_vec, 3.f * x_pixel_vec, 3.f * y_pixel_vec, 6.f * x_pixel_vec, 6.f * y_pixel_vec); + gGL.color4f(text_color.mV[VX], text_color.mV[VY], text_color.mV[VZ], gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor); + LLVector3 label_height = (mFontp->getLineHeight() * mLabelSegments.size() + (VERTICAL_PADDING / 3.f)) * y_pixel_vec; + LLVector3 label_offset = height_vec - label_height; + LLUI::translate(label_offset.mV[VX], label_offset.mV[VY], label_offset.mV[VZ]); + gl_segmented_rect_3d_tex_top(border_scale_vec, scaled_border_width, scaled_border_height, width_vec, label_height); } LLUI::popMatrix(); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLDepthTest gls_depth(mZCompare ? GL_TRUE : GL_FALSE, GL_FALSE); - - LLVector3 box_center_offset; - box_center_offset = (width_vec * 0.5f) + (height_vec * 0.5f); - LLUI::translate(box_center_offset.mV[VX], box_center_offset.mV[VY], box_center_offset.mV[VZ]); - gGL.color4fv(bg_color.mV); - LLUI::setLineWidth(2.0); - gGL.begin(LLRender::LINES); - { - if (outside_width) - { - LLVector3 vert; - // draw line in x then y - if (mPositionOffset.mV[VX] < 0.f) - { - // start at right edge - vert = width_vec * 0.5f; - gGL.vertex3fv(vert.mV); - } - else - { - // start at left edge - vert = width_vec * -0.5f; - gGL.vertex3fv(vert.mV); - } - vert = -mPositionOffset.mV[VX] * x_pixel_vec; - gGL.vertex3fv(vert.mV); - gGL.vertex3fv(vert.mV); - vert -= mPositionOffset.mV[VY] * y_pixel_vec; - vert -= ((mVertAlignment == ALIGN_VERT_TOP) ? (height_vec * 0.5f) : LLVector3::zero); - gGL.vertex3fv(vert.mV); - } - else - { - LLVector3 vert; - // draw line in y then x - if (mPositionOffset.mV[VY] < 0.f) - { - // start at top edge - vert = (height_vec * 0.5f) - (mPositionOffset.mV[VX] * x_pixel_vec); - gGL.vertex3fv(vert.mV); - } - else - { - // start at bottom edge - vert = (height_vec * -0.5f) - (mPositionOffset.mV[VX] * x_pixel_vec); - gGL.vertex3fv(vert.mV); - } - vert = -mPositionOffset.mV[VY] * y_pixel_vec - mPositionOffset.mV[VX] * x_pixel_vec; - vert -= ((mVertAlignment == ALIGN_VERT_TOP) ? (height_vec * 0.5f) : LLVector3::zero); - gGL.vertex3fv(vert.mV); - } - } - gGL.end(); - LLUI::setLineWidth(1.0); - } } - LLUI::popMatrix(); } + LLUI::popMatrix(); F32 y_offset = (F32)mOffsetY; @@ -874,29 +776,26 @@ void LLHUDNameTag::updateAll() for (r_it = sVisibleTextObjects.rbegin(); r_it != sVisibleTextObjects.rend(); ++r_it) { LLHUDNameTag* textp = (*r_it); -// if (textp->mUseBubble) -// { - if (current_screen_area / screen_area > LOD_2_SCREEN_COVERAGE) - { - textp->setLOD(3); - } - else if (current_screen_area / screen_area > LOD_1_SCREEN_COVERAGE) - { - textp->setLOD(2); - } - else if (current_screen_area / screen_area > LOD_0_SCREEN_COVERAGE) - { - textp->setLOD(1); - } - else - { - textp->setLOD(0); - } - textp->updateSize(); - // find on-screen position and initialize collision rectangle - textp->mTargetPositionOffset = textp->updateScreenPos(LLVector2::zero); - current_screen_area += (F32)(textp->mSoftScreenRect.getWidth() * textp->mSoftScreenRect.getHeight()); -// } + if (current_screen_area / screen_area > LOD_2_SCREEN_COVERAGE) + { + textp->setLOD(3); + } + else if (current_screen_area / screen_area > LOD_1_SCREEN_COVERAGE) + { + textp->setLOD(2); + } + else if (current_screen_area / screen_area > LOD_0_SCREEN_COVERAGE) + { + textp->setLOD(1); + } + else + { + textp->setLOD(0); + } + textp->updateSize(); + // find on-screen position and initialize collision rectangle + textp->mTargetPositionOffset = textp->updateScreenPos(LLVector2::zero); + current_screen_area += (F32)(textp->mSoftScreenRect.getWidth() * textp->mSoftScreenRect.getHeight()); } LLStat* camera_vel_stat = LLViewerCamera::getInstance()->getVelocityStat(); @@ -914,20 +813,12 @@ void LLHUDNameTag::updateAll() { LLHUDNameTag* src_textp = (*src_it); -// if (!src_textp->mUseBubble) -// { -// continue; -// } VisibleTextObjectIterator dst_it = src_it; ++dst_it; for (; dst_it != sVisibleTextObjects.end(); ++dst_it) { LLHUDNameTag* dst_textp = (*dst_it); -// if (!dst_textp->mUseBubble) -// { -// continue; -// } if (src_textp->mSoftScreenRect.overlaps(dst_textp->mSoftScreenRect)) { LLRectf intersect_rect = src_textp->mSoftScreenRect; @@ -976,10 +867,6 @@ void LLHUDNameTag::updateAll() VisibleTextObjectIterator this_object_it; for (this_object_it = sVisibleTextObjects.begin(); this_object_it != sVisibleTextObjects.end(); ++this_object_it) { -// if (!(*this_object_it)->mUseBubble) -// { -// continue; -// } (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(POSITION_DAMPING_TC)); } } @@ -1037,10 +924,6 @@ void LLHUDNameTag::addPickable(std::set &pick_list) VisibleTextObjectIterator text_it; for (text_it = sVisibleTextObjects.begin(); text_it != sVisibleTextObjects.end(); ++text_it) { -// if (!(*text_it)->mUseBubble) -// { -// continue; -// } pick_list.insert((*text_it)->mSourceObject); } } diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h index 3325c22def..72647d5b26 100644 --- a/indra/newview/llhudnametag.h +++ b/indra/newview/llhudnametag.h @@ -118,7 +118,6 @@ public: /*virtual*/ void markDead(); friend class LLHUDObject; /*virtual*/ F32 getDistance() const { return mLastDistance; } - //void setUseBubble(BOOL use_bubble) { mUseBubble = use_bubble; } S32 getLOD() { return mLOD; } BOOL getVisible() { return mVisible; } BOOL getHidden() const { return mHidden; } @@ -136,7 +135,6 @@ protected: LLHUDNameTag(const U8 type); /*virtual*/ void render(); - /*virtual*/ void renderForSelect(); void renderText(BOOL for_select); static void updateAll(); void setLOD(S32 lod); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5d196a465f..1333862855 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2774,7 +2774,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color) { - gGL.diffuseColor4fv(color.mV); + gGL.color4fv(color.mV); gGL.begin(LLRender::LINES); { gGL.vertex3fv((position - LLVector3(size, 0.f, 0.f)).mV); @@ -3904,7 +3904,7 @@ void renderAgentTarget(LLVOAvatar* avatar) if (avatar->isSelf()) { renderCrossHairs(avatar->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f)); - renderCrossHairs(avatar->mDrawable->getPositionAgent(), 0.2f, LLColor4(1, 0, 0, 0.8f)); + renderCrossHairs(avatar->mDrawable->getPositionAgent(), 0.2f, LLColor4(0, 1, 0, 0.8f)); renderCrossHairs(avatar->mRoot.getWorldPosition(), 0.2f, LLColor4(1, 1, 1, 0.8f)); renderCrossHairs(avatar->mPelvisp->getWorldPosition(), 0.2f, LLColor4(0, 0, 1, 0.8f)); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 99540ccce9..ae32683c99 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3190,15 +3190,6 @@ bool enable_freeze_eject(const LLSD& avatar_id) return new_value; } - -void login_done(S32 which, void *user) -{ - llinfos << "Login done " << which << llendl; - - LLPanelLogin::closePanel(); -} - - bool callback_leave_group(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index bc7f5a9744..f00363bfa6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -62,6 +62,7 @@ #include "llhudmanager.h" #include "llhudnametag.h" #include "llhudtext.h" // for mText/mDebugText +#include "llinitparam.h" #include "llkeyframefallmotion.h" #include "llkeyframestandmotion.h" #include "llkeyframewalkmotion.h" @@ -193,6 +194,9 @@ const S32 MAX_BUBBLE_CHAT_LENGTH = DB_CHAT_MSG_STR_LEN; const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12; const F32 CHAT_FADE_TIME = 8.0; const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; +const F32 NAMETAG_UPDATE_THRESHOLD = 0.3f; +const F32 NAMETAG_VERTICAL_SCREEN_OFFSET = 25.f; +const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.15f; const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0); @@ -224,55 +228,62 @@ struct LLTextureMaskData **/ //------------------------------------------------------------------------ -// LLVOBoneInfo +// LLVOAvatarBoneInfo // Trans/Scale/Rot etc. info about each avatar bone. Used by LLVOAvatarSkeleton. //------------------------------------------------------------------------ -class LLVOAvatarBoneInfo +struct LLVOAvatarCollisionVolumeInfo : public LLInitParam::Block { - friend class LLVOAvatar; - friend class LLVOAvatarSkeletonInfo; -public: - LLVOAvatarBoneInfo() : mIsJoint(FALSE) {} - ~LLVOAvatarBoneInfo() - { - std::for_each(mChildList.begin(), mChildList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); + LLVOAvatarCollisionVolumeInfo() + : name("name"), + pos("pos"), + rot("rot"), + scale("scale") + {} + + Mandatory name; + Mandatory pos, + rot, + scale; +}; + +struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock +{ + Alternative > bone; + Alternative collision_volume; + + LLVOAvatarChildJoint() + : bone("bone"), + collision_volume("collision_volume") + {} +}; + +struct LLVOAvatarBoneInfo : public LLInitParam::Block +{ + LLVOAvatarBoneInfo() + : pivot("pivot") + {} -private: - std::string mName; - BOOL mIsJoint; - LLVector3 mPos; - LLVector3 mRot; - LLVector3 mScale; - LLVector3 mPivot; - typedef std::vector child_list_t; - child_list_t mChildList; + Mandatory pivot; + Multiple children; }; //------------------------------------------------------------------------ // LLVOAvatarSkeletonInfo // Overall avatar skeleton //------------------------------------------------------------------------ -class LLVOAvatarSkeletonInfo +struct LLVOAvatarSkeletonInfo : public LLInitParam::Block { - friend class LLVOAvatar; -public: - LLVOAvatarSkeletonInfo() : - mNumBones(0), mNumCollisionVolumes(0) {} - ~LLVOAvatarSkeletonInfo() - { - std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer()); - } - BOOL parseXml(LLXmlTreeNode* node); - S32 getNumBones() const { return mNumBones; } - S32 getNumCollisionVolumes() const { return mNumCollisionVolumes; } + LLVOAvatarSkeletonInfo() + : skeleton_root(""), + num_bones("num_bones"), + num_collision_volumes("num_collision_volumes"), + version("version") + {} -private: - S32 mNumBones; - S32 mNumCollisionVolumes; - typedef std::vector bone_info_list_t; - bone_info_list_t mBoneInfoList; + Mandatory version; + Mandatory num_bones, + num_collision_volumes; + Mandatory skeleton_root; }; //----------------------------------------------------------------------------- @@ -597,7 +608,7 @@ private: // Static Data //----------------------------------------------------------------------------- LLXmlTree LLVOAvatar::sXMLTree; -LLXmlTree LLVOAvatar::sSkeletonXMLTree; +LLXMLNodePtr LLVOAvatar::sSkeletonXMLTree; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; @@ -1123,18 +1134,6 @@ void LLVOAvatar::initClass() llerrs << "Error parsing skeleton file: " << skeleton_path << llendl; } - // Process XML data - - // avatar_skeleton.xml - if (sAvatarSkeletonInfo) - { //this can happen if a login attempt failed - delete sAvatarSkeletonInfo; - } - sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; - if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) - { - llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; - } // parse avatar_lad.xml if (sAvatarXmlInfo) { //this can happen if a login attempt failed @@ -1183,7 +1182,7 @@ void LLVOAvatar::initClass() void LLVOAvatar::cleanupClass() { deleteAndClear(sAvatarXmlInfo); - sSkeletonXMLTree.cleanup(); + sSkeletonXMLTree = NULL; sXMLTree.cleanup(); } @@ -1655,33 +1654,39 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) //------------------------------------------------------------------------- // parse the file //------------------------------------------------------------------------- - BOOL parsesuccess = sSkeletonXMLTree.parseFile( filename, FALSE ); + + LLXMLNodePtr skeleton_xml; + BOOL parsesuccess = LLXMLNode::parseFile(filename, skeleton_xml, NULL); - if (!parsesuccess) + if (!parsesuccess || skeleton_xml.isNull()) { llerrs << "Can't parse skeleton file: " << filename << llendl; return FALSE; } - // now sanity check xml file - LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); - if (!root) + // Process XML data + if (sAvatarSkeletonInfo) + { //this can happen if a login attempt failed + delete sAvatarSkeletonInfo; + } + sAvatarSkeletonInfo = new LLVOAvatarSkeletonInfo; + + LLXUIParser parser; + parser.readXUI(skeleton_xml, *sAvatarSkeletonInfo, filename); + if (!sAvatarSkeletonInfo->validateBlock()) { - llerrs << "No root node found in avatar skeleton file: " << filename << llendl; - return FALSE; + llerrs << "Error parsing skeleton XML file: " << filename << llendl; } - if( !root->hasName( "linden_skeleton" ) ) + if( !skeleton_xml->hasName( "linden_skeleton" ) ) { llerrs << "Invalid avatar skeleton file header: " << filename << llendl; return FALSE; } - std::string version; - static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); - if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) + if (sAvatarSkeletonInfo->version() != "1.0") { - llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl; + llerrs << "Invalid avatar skeleton file version: " << sAvatarSkeletonInfo->version() << " in file: " << filename << llendl; return FALSE; } @@ -1690,14 +1695,13 @@ BOOL LLVOAvatar::parseSkeletonFile(const std::string& filename) //----------------------------------------------------------------------------- // setupBone() -//----------------------------------------------------------------------------- -BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) +//----------------------------------------------------------- +BOOL LLVOAvatar::setupBone(const LLVOAvatarChildJoint& info, LLViewerJoint* parent, S32 &volume_num, S32 &joint_num) { LLMemType mt(LLMemType::MTYPE_AVATAR); LLViewerJoint* joint = NULL; - - if (info->mIsJoint) + if (info.bone.isChosen()) { joint = (LLViewerJoint*)getCharacterJoint(joint_num); if (!joint) @@ -1705,7 +1709,23 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent llwarns << "Too many bones" << llendl; return FALSE; } - joint->setName( info->mName ); + joint->setName( info.bone().name ); + joint->setPosition(info.bone().pos); + joint->setRotation(mayaQ(info.bone().rot().mV[VX], info.bone().rot().mV[VY], info.bone().rot().mV[VZ], LLQuaternion::XYZ)); + joint->setScale(info.bone().scale); + joint->setSkinOffset( info.bone().pivot ); + joint_num++; + + for (LLInitParam::ParamIterator::const_iterator child_it = info.bone().children.begin(), + end_it = info.bone().children.end(); + child_it != end_it; + ++child_it) + { + if (!setupBone(*child_it, joint, volume_num, joint_num)) + { + return FALSE; + } + } } else // collision volume { @@ -1715,7 +1735,11 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent return FALSE; } joint = (LLViewerJoint*)(&mCollisionVolumes[volume_num]); - joint->setName( info->mName ); + joint->setName( info.collision_volume.name); + joint->setPosition(info.collision_volume.pos); + joint->setRotation(mayaQ(info.collision_volume.rot().mV[VX], info.collision_volume.rot().mV[VY], info.collision_volume.rot().mV[VZ], LLQuaternion::XYZ)); + joint->setScale(info.collision_volume.scale); + volume_num++; } // add to parent @@ -1724,34 +1748,8 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent parent->addChild( joint ); } - joint->setPosition(info->mPos); - joint->setRotation(mayaQ(info->mRot.mV[VX], info->mRot.mV[VY], - info->mRot.mV[VZ], LLQuaternion::XYZ)); - joint->setScale(info->mScale); - joint->setDefaultFromCurrentXform(); - if (info->mIsJoint) - { - joint->setSkinOffset( info->mPivot ); - joint_num++; - } - else // collision volume - { - volume_num++; - } - - // setup children - LLVOAvatarBoneInfo::child_list_t::const_iterator iter; - for (iter = info->mChildList.begin(); iter != info->mChildList.end(); ++iter) - { - LLVOAvatarBoneInfo *child_info = *iter; - if (!setupBone(child_info, joint, volume_num, joint_num)) - { - return FALSE; - } - } - return TRUE; } @@ -1765,35 +1763,31 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) //------------------------------------------------------------------------- // allocate joints //------------------------------------------------------------------------- - if (!allocateCharacterJoints(info->mNumBones)) + if (!allocateCharacterJoints(info->num_bones)) { - llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl; + llerrs << "Can't allocate " << info->num_bones() << " joints" << llendl; return FALSE; } //------------------------------------------------------------------------- // allocate volumes //------------------------------------------------------------------------- - if (info->mNumCollisionVolumes) + if (info->num_collision_volumes) { - if (!allocateCollisionVolumes(info->mNumCollisionVolumes)) + if (!allocateCollisionVolumes(info->num_collision_volumes)) { - llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl; + llerrs << "Can't allocate " << info->num_collision_volumes() << " collision volumes" << llendl; return FALSE; } } S32 current_joint_num = 0; S32 current_volume_num = 0; - LLVOAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter) + + if (!setupBone(info->skeleton_root, NULL, current_volume_num, current_joint_num)) { - LLVOAvatarBoneInfo *info = *iter; - if (!setupBone(info, NULL, current_volume_num, current_joint_num)) - { - llerrs << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } + llerrs << "Error parsing bone in skeleton file" << llendl; + return FALSE; } return TRUE; @@ -2922,43 +2916,43 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - BOOL new_name = FALSE; - if (visible_chat != mVisibleChat) - { - mVisibleChat = visible_chat; - new_name = TRUE; - } + BOOL new_name = FALSE; + if (visible_chat != mVisibleChat) + { + mVisibleChat = visible_chat; + new_name = TRUE; + } - if (sRenderGroupTitles != mRenderGroupTitles) - { - mRenderGroupTitles = sRenderGroupTitles; - new_name = TRUE; - } + if (sRenderGroupTitles != mRenderGroupTitles) + { + mRenderGroupTitles = sRenderGroupTitles; + new_name = TRUE; + } - // First Calculate Alpha - // If alpha > 0, create mNameText if necessary, otherwise delete it - F32 alpha = 0.f; - if (mAppAngle > 5.f) + // First Calculate Alpha + // If alpha > 0, create mNameText if necessary, otherwise delete it + F32 alpha = 0.f; + if (mAppAngle > 5.f) + { + const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; + if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) { - const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION; - if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME) - { - alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; - } - else - { - // ...not fading, full alpha - alpha = 1.f; - } + alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION; } - else if (mAppAngle > 2.f) + else { - // far away is faded out also - alpha = (mAppAngle-2.f)/3.f; + // ...not fading, full alpha + alpha = 1.f; } + } + else if (mAppAngle > 2.f) + { + // far away is faded out also + alpha = (mAppAngle-2.f)/3.f; + } if (alpha <= 0.f) - { + { if (mNameText) { mNameText->markDead(); @@ -2968,31 +2962,30 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) return; } - if (!mNameText) - { + if (!mNameText) + { mNameText = static_cast( LLHUDObject::addHUDObject( LLHUDObject::LL_HUD_NAME_TAG) ); //mNameText->setMass(10.f); - mNameText->setSourceObject(this); + mNameText->setSourceObject(this); mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP); - mNameText->setVisibleOffScreen(TRUE); - mNameText->setMaxLines(11); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - sNumVisibleChatBubbles++; - new_name = TRUE; - } + mNameText->setVisibleOffScreen(TRUE); + mNameText->setMaxLines(11); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + sNumVisibleChatBubbles++; + new_name = TRUE; + } - LLVector3 name_position = idleUpdateNameTagPosition(root_pos_last); - mNameText->setPositionAgent(name_position); + idleUpdateNameTagPosition(root_pos_last); idleUpdateNameTagText(new_name); idleUpdateNameTagAlpha(new_name, alpha); } void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) - { - LLNameValue *title = getNVPair("Title"); - LLNameValue* firstname = getNVPair("FirstName"); - LLNameValue* lastname = getNVPair("LastName"); +{ + LLNameValue *title = getNVPair("Title"); + LLNameValue* firstname = getNVPair("FirstName"); + LLNameValue* lastname = getNVPair("LastName"); // Avatars must have a first and last name if (!firstname || !lastname) return; @@ -3006,34 +2999,29 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) is_muted = false; } else - { + { is_muted = LLMuteList::getInstance()->isMuted(getID()); } bool is_friend = LLAvatarTracker::instance().isBuddy(getID()); bool is_cloud = getIsCloud(); - if (gSavedSettings.getBOOL("DebugAvatarRezTime")) - { - if (is_appearance != mNameAppearance) - { - if (is_appearance) - { - LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32()); - args["NAME"] = getFullname(); - LLNotificationsUtil::add("AvatarRezEnteredAppearanceNotification",args); - llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' entered appearance mode." << llendl; - } - else - { - LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32()); - args["NAME"] = getFullname(); - LLNotificationsUtil::add("AvatarRezLeftAppearanceNotification",args); - llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' left appearance mode." << llendl; - } - } - } + if (gSavedSettings.getBOOL("DebugAvatarRezTime") + && is_appearance != mNameAppearance) + { + LLSD args; + args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32()); + args["NAME"] = getFullname(); + if (is_appearance) + { + LLNotificationsUtil::add("AvatarRezEnteredAppearanceNotification",args); + llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' entered appearance mode." << llendl; + } + else + { + LLNotificationsUtil::add("AvatarRezLeftAppearanceNotification",args); + llinfos << "REZTIME: [ " << (U32)mDebugExistenceTimer.getElapsedTimeF32() << "sec ] Avatar '" << getFullname() << "' left appearance mode." << llendl; + } + } // Rebuild name tag if state change detected if (mNameString.empty() @@ -3043,39 +3031,39 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) || is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute - || is_appearance != mNameAppearance + || is_appearance != mNameAppearance || is_friend != mNameFriend || is_cloud != mNameCloud) - { + { LLColor4 name_tag_color = getNameTagColor(is_friend); clearNameTag(); if (is_away || is_muted || is_busy || is_appearance) - { + { std::string line; - if (is_away) - { - line += LLTrans::getString("AvatarAway"); + if (is_away) + { + line += LLTrans::getString("AvatarAway"); line += ", "; - } - if (is_busy) - { + } + if (is_busy) + { line += LLTrans::getString("AvatarBusy"); line += ", "; } if (is_muted) - { + { line += LLTrans::getString("AvatarMuted"); - line += ", "; - } + line += ", "; + } if (is_appearance) { line += LLTrans::getString("AvatarEditingAppearance"); line += ", "; - } + } if (is_cloud) - { + { line += LLTrans::getString("LoadingData"); line += ", "; } @@ -3087,12 +3075,12 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) if (sRenderGroupTitles && title && title->getString() && title->getString()[0] != '\0') - { + { std::string title_str = title->getString(); LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); - } + } static LLUICachedControl show_display_names("NameTagShowDisplayNames"); static LLUICachedControl show_usernames("NameTagShowUsernames"); @@ -3106,119 +3094,118 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // and force a rebuild LLAvatarNameCache::get(getID(), boost::bind(&LLVOAvatar::clearNameTag, this)); - } + } // Might be blank if name not available yet, that's OK if (show_display_names) { addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); - } + } // Suppress SLID display if display name matches exactly (ugh) if (show_usernames && !av_name.mIsDisplayNameDefault) - { + { // *HACK: Desaturate the color LLColor4 username_color = name_tag_color * 0.83f; addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } - } + } else - { + { const LLFontGL* font = LLFontGL::getFontSansSerif(); - std::string full_name = - LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); - } + } - mNameAway = is_away; - mNameBusy = is_busy; - mNameMute = is_muted; - mNameAppearance = is_appearance; - mNameFriend = is_friend; - mNameCloud = is_cloud; - mTitle = title ? title->getString() : ""; - LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - new_name = TRUE; - } + mNameAway = is_away; + mNameBusy = is_busy; + mNameMute = is_muted; + mNameAppearance = is_appearance; + mNameFriend = is_friend; + mNameCloud = is_cloud; + mTitle = title ? title->getString() : ""; + LLStringFn::replace_ascii_controlchars(mTitle, LL_UNKNOWN_CHAR); + new_name = TRUE; + } if (mVisibleChat) - { - mNameText->setFont(LLFontGL::getFontSansSerif()); + { + mNameText->setFont(LLFontGL::getFontSansSerif()); mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; - std::deque::iterator chat_iter = mChats.begin(); - mNameText->clearString(); - - LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); - LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); - LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); - if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) - { - ++chat_iter; - } + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); - for(; chat_iter != mChats.end(); ++chat_iter) - { - F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); - LLFontGL::StyleFlags style; - switch(chat_iter->mChatType) - { - case CHAT_TYPE_WHISPER: - style = LLFontGL::ITALIC; - break; - case CHAT_TYPE_SHOUT: - style = LLFontGL::BOLD; - break; - default: - style = LLFontGL::NORMAL; - break; - } - if (chat_fade_amt < 1.f) - { - F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); - mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); - } - else if (chat_fade_amt < 2.f) - { - F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); - mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); - } - else if (chat_fade_amt < 3.f) - { - // *NOTE: only remove lines down to minimum number - mNameText->addLine(chat_iter->mText, old_chat, style); - } - } - mNameText->setVisibleOffScreen(TRUE); + char line[MAX_STRING]; /* Flawfinder: ignore */ + line[0] = '\0'; + std::deque::iterator chat_iter = mChats.begin(); + mNameText->clearString(); - if (mTyping) - { - S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; - switch(dot_count) - { - case 1: - mNameText->addLine(".", new_chat); - break; - case 2: - mNameText->addLine("..", new_chat); - break; - case 3: - mNameText->addLine("...", new_chat); - break; - } + LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); + LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); + LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); + if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) + { + ++chat_iter; + } - } + for(; chat_iter != mChats.end(); ++chat_iter) + { + F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); + LLFontGL::StyleFlags style; + switch(chat_iter->mChatType) + { + case CHAT_TYPE_WHISPER: + style = LLFontGL::ITALIC; + break; + case CHAT_TYPE_SHOUT: + style = LLFontGL::BOLD; + break; + default: + style = LLFontGL::NORMAL; + break; } - else + if (chat_fade_amt < 1.f) { + F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); + mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); + } + else if (chat_fade_amt < 2.f) + { + F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); + mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); + } + else if (chat_fade_amt < 3.f) + { + // *NOTE: only remove lines down to minimum number + mNameText->addLine(chat_iter->mText, old_chat, style); + } + } + mNameText->setVisibleOffScreen(TRUE); + + if (mTyping) + { + S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; + switch(dot_count) + { + case 1: + mNameText->addLine(".", new_chat); + break; + case 2: + mNameText->addLine("..", new_chat); + break; + case 3: + mNameText->addLine("...", new_chat); + break; + } + + } + } + else + { // ...not using chat bubbles, just names mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setVisibleOffScreen(FALSE); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + mNameText->setVisibleOffScreen(FALSE); } } @@ -3241,8 +3228,8 @@ void LLVOAvatar::clearNameTag() { mNameString.clear(); if (mNameText) - { - mNameText->setLabel(""); + { + mNameText->setLabel(""); mNameText->setString( "" ); } } @@ -3270,34 +3257,45 @@ void LLVOAvatar::invalidateNameTags() if (avatar->isDead()) continue; avatar->clearNameTag(); - } } // Compute name tag position during idle update -LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) +void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) { LLQuaternion root_rot = mRoot.getWorldRotation(); + LLQuaternion inv_root_rot = ~root_rot; LLVector3 pixel_right_vec; LLVector3 pixel_up_vec; LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); camera_to_av.normalize(); - LLVector3 local_camera_at = camera_to_av * ~root_rot; + LLVector3 local_camera_at = camera_to_av * inv_root_rot; LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); local_camera_up.normalize(); - local_camera_up = local_camera_up * ~root_rot; + local_camera_up = local_camera_up * inv_root_rot; + + LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f, + mBodySize.mV[VY] * 0.4f, + mBodySize.mV[VZ] * NAMETAG_VERT_OFFSET_WEIGHT); - local_camera_up.scaleVec(mBodySize * 0.5f); - local_camera_at.scaleVec(mBodySize * 0.5f); + local_camera_up.scaleVec(avatar_ellipsoid); + local_camera_at.scaleVec(avatar_ellipsoid); - LLVector3 name_position = mRoot.getWorldPosition(); - name_position[VZ] -= mPelvisToFoot; - name_position[VZ] += (mBodySize[VZ]* 0.55f); + LLVector3 head_offset = (mHeadp->getLastWorldPosition() - mRoot.getLastWorldPosition()) * inv_root_rot; + + if (dist_vec(head_offset, mTargetRootToHeadOffset) > NAMETAG_UPDATE_THRESHOLD) + { + mTargetRootToHeadOffset = head_offset; + } + + mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLCriticalDamp::getInterpolant(0.2f)); + + LLVector3 name_position = mRoot.getLastWorldPosition() + (mCurRootToHeadOffset * root_rot); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); - name_position += pixel_up_vec * 15.f; + name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET; - return name_position; + mNameText->setPositionAgent(name_position); } void LLVOAvatar::idleUpdateNameTagAlpha(BOOL new_name, F32 alpha) @@ -3333,7 +3331,7 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) else { color_name = "NameTagMismatch"; - } + } } else { @@ -3370,9 +3368,9 @@ bool LLVOAvatar::isVisuallyMuted() static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit"); static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit"); - return LLMuteList::getInstance()->isMuted(getID()) || - (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || - (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f); + return LLMuteList::getInstance()->isMuted(getID()) + || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) + || (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f); } //------------------------------------------------------------------------ @@ -3413,8 +3411,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } - LLVector3d root_pos_global; - if (!mIsBuilt) { return FALSE; @@ -3428,7 +3424,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { mTimeVisible.reset(); } - //-------------------------------------------------------------------- // the rest should only be done occasionally for far away avatars @@ -3823,10 +3818,6 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if ( playSound ) { -// F32 gain = clamp_rescale( mSpeedAccum, -// AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, -// AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); - const F32 STEP_VOLUME = 0.1f; const LLUUID& step_sound_id = getStepSound(); @@ -4043,13 +4034,6 @@ void LLVOAvatar::updateVisibility() { releaseMeshData(); } - // this breaks off-screen chat bubbles - //if (mNameText) - //{ - // mNameText->markDead(); - // mNameText = NULL; - // sNumVisibleChatBubbles--; - //} } mVisible = visible; @@ -4065,46 +4049,6 @@ bool LLVOAvatar::shouldAlphaMask() } -U32 LLVOAvatar::renderSkinnedAttachments() -{ - /*U32 num_indices = 0; - - const U32 data_mask = LLVertexBuffer::MAP_VERTEX | - LLVertexBuffer::MAP_NORMAL | - LLVertexBuffer::MAP_TEXCOORD0 | - LLVertexBuffer::MAP_COLOR | - LLVertexBuffer::MAP_WEIGHT4; - - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) - { - LLViewerJointAttachment* attachment = iter->second; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - const LLViewerObject* attached_object = (*attachment_iter); - if (attached_object && !attached_object->isHUDAttachment()) - { - const LLDrawable* drawable = attached_object->mDrawable; - if (drawable) - { - for (S32 i = 0; i < drawable->getNumFaces(); ++i) - { - LLFace* face = drawable->getFace(i); - if (face->isState(LLFace::RIGGED)) - { - - } - } - } - } - - return num_indices;*/ - return 0; -} - //----------------------------------------------------------------------------- // renderSkinned() //----------------------------------------------------------------------------- @@ -4125,11 +4069,11 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) { //LOD changed or new mesh created, allocate new vertex buffer if needed if (needs_rebuild || mDirtyMesh >= 2 || mVisibilityRank <= 4) { - updateMeshData(); + updateMeshData(); mDirtyMesh = 0; - mNeedsSkin = TRUE; - mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); - } + mNeedsSkin = TRUE; + mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); + } } if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0) @@ -5790,36 +5734,34 @@ BOOL LLVOAvatar::updateJointLODs() F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor); F32 area_scale = 0.16f; + if (isSelf()) { - if (isSelf()) - { - if(gAgentCamera.cameraCustomizeAvatar() || gAgentCamera.cameraMouselook()) - { - mAdjustedPixelArea = MAX_PIXEL_AREA; - } - else - { - mAdjustedPixelArea = mPixelArea*area_scale; - } - } - else if (mIsDummy) + if(gAgentCamera.cameraCustomizeAvatar() || gAgentCamera.cameraMouselook()) { mAdjustedPixelArea = MAX_PIXEL_AREA; } else { - // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars - mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor; + mAdjustedPixelArea = mPixelArea*area_scale; } + } + else if (mIsDummy) + { + mAdjustedPixelArea = MAX_PIXEL_AREA; + } + else + { + // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars + mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor; + } - // now select meshes to render based on adjusted pixel area - BOOL res = mRoot.updateLOD(mAdjustedPixelArea, TRUE); - if (res) - { - sNumLODChangesThisFrame++; - dirtyMesh(2); - return TRUE; - } + // now select meshes to render based on adjusted pixel area + BOOL res = mRoot.updateLOD(mAdjustedPixelArea, TRUE); + if (res) + { + sNumLODChangesThisFrame++; + dirtyMesh(2); + return TRUE; } return FALSE; @@ -6109,25 +6051,18 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) if ( pVObj ) { const LLMeshSkinInfo* pSkinData = gMeshRepo.getSkinInfo( pVObj->getVolume()->getParams().getSculptID(), pVObj ); - if ( pSkinData ) - { - const int jointCnt = pSkinData->mJointNames.size(); - bool fullRig = ( jointCnt>=20 ) ? true : false; - if ( fullRig ) + if (pSkinData + && pSkinData->mJointNames.size() > 20 // full rig + && pSkinData->mAlternateBindMatrix.size() > 0) + { + LLVOAvatar::resetJointPositionsToDefault(); + //Need to handle the repositioning of the cam, updating rig data etc during outfit editing + //This handles the case where we detach a replacement rig. + if ( gAgentCamera.cameraCustomizeAvatar() ) { - const int bindCnt = pSkinData->mAlternateBindMatrix.size(); - if ( bindCnt > 0 ) - { - LLVOAvatar::resetJointPositionsToDefault(); - //Need to handle the repositioning of the cam, updating rig data etc during outfit editing - //This handles the case where we detach a replacement rig. - if ( gAgentCamera.cameraCustomizeAvatar() ) - { - gAgent.unpauseAnimation(); - //Still want to refocus on head bone - gAgentCamera.changeCameraToCustomizeAvatar(); - } - } + gAgent.unpauseAnimation(); + //Still want to refocus on head bone + gAgentCamera.changeCameraToCustomizeAvatar(); } } } @@ -6281,11 +6216,7 @@ void LLVOAvatar::getOffObject() at_axis.mV[VZ] = 0.f; at_axis.normalize(); gAgent.resetAxes(at_axis); - - //reset orientation -// mRoot.setRotation(avWorldRot); gAgentCamera.setThirdPersonHeadOffset(LLVector3(0.f, 0.f, 1.f)); - gAgentCamera.setSitCamera(LLUUID::null); } } @@ -6335,7 +6266,6 @@ LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const } else { -// return LLColor4( .5f, .5f, .5f, .5f ); return LLColor4( 0.f, 1.f, 1.f, 1.f ); // good debugging color } } @@ -7067,10 +6997,6 @@ LLBBox LLVOAvatar::getHUDBBox() const return bbox; } -void LLVOAvatar::rebuildHUD() -{ -} - //----------------------------------------------------------------------------- // onFirstTEMessageReceived() //----------------------------------------------------------------------------- @@ -7192,7 +7118,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && baked_index != BAKED_SKIRT) { setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, + TRUE, + LLViewerTexture::BOOST_NONE, + LLViewerTexture::LOD_TEXTURE)); } } @@ -7483,11 +7412,6 @@ void LLVOAvatar::onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_ // Called when baked texture is loaded and also when we start up with a baked texture void LLVOAvatar::useBakedTexture( const LLUUID& id ) { - /* if(id == head_baked->getID()) - mHeadBakedLoaded = TRUE; - mLastHeadBakedID = id; - mHeadMesh0.setTexture( head_baked ); - mHeadMesh1.setTexture( head_baked ); */ for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { LLViewerTexture* image_baked = getImage( mBakedTextureDatas[i].mTextureIndex, 0 ); @@ -7718,111 +7642,111 @@ LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() std::for_each(mMorphMaskInfoList.begin(), mMorphMaskInfoList.end(), DeletePointer()); } -//----------------------------------------------------------------------------- -// LLVOAvatarBoneInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node) -{ - if (node->hasName("bone")) - { - mIsJoint = TRUE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - llwarns << "Bone without name" << llendl; - return FALSE; - } - } - else if (node->hasName("collision_volume")) - { - mIsJoint = FALSE; - static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); - if (!node->getFastAttributeString(name_string, mName)) - { - mName = "Collision Volume"; - } - } - else - { - llwarns << "Invalid node " << node->getName() << llendl; - return FALSE; - } - - static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); - if (!node->getFastAttributeVector3(pos_string, mPos)) - { - llwarns << "Bone without position" << llendl; - return FALSE; - } - - static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); - if (!node->getFastAttributeVector3(rot_string, mRot)) - { - llwarns << "Bone without rotation" << llendl; - return FALSE; - } - - static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); - if (!node->getFastAttributeVector3(scale_string, mScale)) - { - llwarns << "Bone without scale" << llendl; - return FALSE; - } - - if (mIsJoint) - { - static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); - if (!node->getFastAttributeVector3(pivot_string, mPivot)) - { - llwarns << "Bone without pivot" << llendl; - return FALSE; - } - } - - // parse children - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *child_info = new LLVOAvatarBoneInfo; - if (!child_info->parseXml(child)) - { - delete child_info; - return FALSE; - } - mChildList.push_back(child_info); - } - return TRUE; -} - -//----------------------------------------------------------------------------- -// LLVOAvatarSkeletonInfo::parseXml() -//----------------------------------------------------------------------------- -BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) -{ - static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); - if (!node->getFastAttributeS32(num_bones_string, mNumBones)) - { - llwarns << "Couldn't find number of bones." << llendl; - return FALSE; - } - - static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); - node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes); - - LLXmlTreeNode* child; - for( child = node->getFirstChild(); child; child = node->getNextChild() ) - { - LLVOAvatarBoneInfo *info = new LLVOAvatarBoneInfo; - if (!info->parseXml(child)) - { - delete info; - llwarns << "Error parsing bone in skeleton file" << llendl; - return FALSE; - } - mBoneInfoList.push_back(info); - } - return TRUE; -} +////----------------------------------------------------------------------------- +//// LLVOAvatarBoneInfo::parseXml() +////----------------------------------------------------------------------------- +//BOOL LLVOAvatarBoneInfo::parseXml(LLXmlTreeNode* node) +//{ +// if (node->hasName("bone")) +// { +// mIsJoint = TRUE; +// static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); +// if (!node->getFastAttributeString(name_string, mName)) +// { +// llwarns << "Bone without name" << llendl; +// return FALSE; +// } +// } +// else if (node->hasName("collision_volume")) +// { +// mIsJoint = FALSE; +// static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); +// if (!node->getFastAttributeString(name_string, mName)) +// { +// mName = "Collision Volume"; +// } +// } +// else +// { +// llwarns << "Invalid node " << node->getName() << llendl; +// return FALSE; +// } +// +// static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); +// if (!node->getFastAttributeVector3(pos_string, mPos)) +// { +// llwarns << "Bone without position" << llendl; +// return FALSE; +// } +// +// static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); +// if (!node->getFastAttributeVector3(rot_string, mRot)) +// { +// llwarns << "Bone without rotation" << llendl; +// return FALSE; +// } +// +// static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); +// if (!node->getFastAttributeVector3(scale_string, mScale)) +// { +// llwarns << "Bone without scale" << llendl; +// return FALSE; +// } +// +// if (mIsJoint) +// { +// static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); +// if (!node->getFastAttributeVector3(pivot_string, mPivot)) +// { +// llwarns << "Bone without pivot" << llendl; +// return FALSE; +// } +// } +// +// // parse children +// LLXmlTreeNode* child; +// for( child = node->getFirstChild(); child; child = node->getNextChild() ) +// { +// LLVOAvatarBoneInfo *child_info = new LLVOAvatarBoneInfo; +// if (!child_info->parseXml(child)) +// { +// delete child_info; +// return FALSE; +// } +// mChildList.push_back(child_info); +// } +// return TRUE; +//} +// +////----------------------------------------------------------------------------- +//// LLVOAvatarSkeletonInfo::parseXml() +////----------------------------------------------------------------------------- +//BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) +//{ +// static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); +// if (!node->getFastAttributeS32(num_bones_string, mNumBones)) +// { +// llwarns << "Couldn't find number of bones." << llendl; +// return FALSE; +// } +// +// static LLStdStringHandle num_collision_volumes_string = LLXmlTree::addAttributeString("num_collision_volumes"); +// node->getFastAttributeS32(num_collision_volumes_string, mNumCollisionVolumes); +// +// LLXmlTreeNode* child; +// for( child = node->getFirstChild(); child; child = node->getNextChild() ) +// { +// LLVOAvatarBoneInfo *info = new LLVOAvatarBoneInfo; +// if (!info->parseXml(child)) +// { +// delete info; +// llwarns << "Error parsing bone in skeleton file" << llendl; +// return FALSE; +// } +// mBoneInfoList.push_back(info); +// } +// return TRUE; +//} //----------------------------------------------------------------------------- // parseXmlSkeletonNode(): parses nodes from XML tree diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index dd0317f555..e84acd51ff 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -66,8 +66,9 @@ class LLVoiceVisualizer; class LLHUDNameTag; class LLHUDEffectSpiral; class LLTexGlobalColor; -class LLVOAvatarBoneInfo; -class LLVOAvatarSkeletonInfo; +struct LLVOAvatarBoneInfo; +struct LLVOAvatarChildJoint; +struct LLVOAvatarSkeletonInfo; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar @@ -232,7 +233,7 @@ public: void idleUpdateWindEffect(); void idleUpdateNameTag(const LLVector3& root_pos_last); void idleUpdateNameTagText(BOOL new_name); - LLVector3 idleUpdateNameTagPosition(const LLVector3& root_pos_last); + void idleUpdateNameTagPosition(const LLVector3& root_pos_last); void idleUpdateNameTagAlpha(BOOL new_name, F32 alpha); LLColor4 getNameTagColor(bool is_friend); void clearNameTag(); @@ -317,6 +318,8 @@ public: F32 mLastPelvisToFoot; F32 mPelvisFixup; F32 mLastPelvisFixup; + LLVector3 mCurRootToHeadOffset; + LLVector3 mTargetRootToHeadOffset; LLVector3 mHeadOffset; // current head position LLViewerJoint mRoot; @@ -325,7 +328,7 @@ protected: void buildCharacter(); virtual BOOL loadAvatar(); - BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); + BOOL setupBone(const LLVOAvatarChildJoint& info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); private: BOOL mIsBuilt; // state of deferred character building @@ -369,7 +372,7 @@ public: //-------------------------------------------------------------------- private: static LLXmlTree sXMLTree; // avatar config file - static LLXmlTree sSkeletonXMLTree; // avatar skeleton file + static LLXMLNodePtr sSkeletonXMLTree; // avatar skeleton file /** Skeleton ** ** @@ -387,7 +390,6 @@ public: U32 renderRigid(); U32 renderSkinned(EAvatarRenderPass pass); F32 getLastSkinTime() { return mLastSkinTime; } - U32 renderSkinnedAttachments(); U32 renderTransparent(BOOL first_pass); void renderCollisionVolumes(); static void deleteCachedImages(bool clearAll=true); @@ -735,7 +737,6 @@ public: public: BOOL hasHUDAttachment() const; LLBBox getHUDBBox() const; - void rebuildHUD(); void resetHUDAttachments(); BOOL canAttachMoreObjects() const; BOOL canAttachMoreObjects(U32 n) const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c523a78b22..fc499bfe9c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4678,11 +4678,6 @@ void LLPipeline::rebuildPools() } max_count--; } - - if (isAgentAvatarValid()) - { - gAgentAvatarp->rebuildHUD(); - } } void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) -- cgit v1.2.3 From 2eb0096dd7f173debc27c155c57969ae5cb67682 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Apr 2012 17:50:22 -0700 Subject: added support for LLInitParam::Lazy to support lazy-initialized non-param-block values --- indra/llxuixml/llinitparam.h | 94 +++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 6fffb73acd..6c054b934b 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -369,11 +369,30 @@ namespace LLInitParam class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed }; + struct IS_BLOCK {}; + struct NOT_BLOCK {}; + + // these templates allow us to distinguish between template parameters + // that derive from BaseBlock and those that don't + template + struct IsBlock + { + static const bool value = false; + typedef NOT_BLOCK value_t; + }; + + template + struct IsBlock + { + static const bool value = true; + typedef IS_BLOCK value_t; + }; + class BaseBlock { public: //TODO: implement in terms of owned_ptr - template + template class Lazy { public: @@ -404,7 +423,7 @@ namespace LLInitParam } } - Lazy& operator = (const Lazy& other) + Lazy& operator = (const Lazy& other) { if (other.mPtr) { @@ -462,6 +481,7 @@ namespace LLInitParam mutable T* mPtr; }; + // "Multiple" constraint types, put here in root class to avoid ambiguity during use struct AnyAmount { @@ -611,19 +631,6 @@ namespace LLInitParam }; - // these templates allow us to distinguish between template parameters - // that derive from BaseBlock and those that don't - template - struct IsBlock - { - static const bool value = false; - }; - - template - struct IsBlock - { - static const bool value = true; - }; template::value> class ParamValue : public NAME_VALUE_LOOKUP @@ -805,7 +812,7 @@ namespace LLInitParam template, bool HAS_MULTIPLE_VALUES = false, - bool VALUE_IS_BLOCK = IsBlock >::value> + bool VALUE_IS_BLOCK = IsBlock::value> class TypedParam : public Param, public ParamValue @@ -1034,7 +1041,7 @@ namespace LLInitParam } else { - typed_param.serializeBlock(parser, name_stack, &static_cast(*static_cast(diff_param))); + typed_param.serializeBlock(parser, name_stack, static_cast(diff_param)); } } @@ -1582,7 +1589,7 @@ namespace LLInitParam friend class ChoiceBlock; typedef Alternative self_t; - typedef TypedParam >::value> super_t; + typedef TypedParam::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator =; @@ -1700,7 +1707,7 @@ namespace LLInitParam class Optional : public TypedParam { public: - typedef TypedParam >::value> super_t; + typedef TypedParam::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; using super_t::operator(); @@ -1729,7 +1736,7 @@ namespace LLInitParam class Mandatory : public TypedParam { public: - typedef TypedParam >::value> super_t; + typedef TypedParam::value> super_t; typedef Mandatory self_t; typedef typename super_t::value_assignment_t value_assignment_t; @@ -1765,7 +1772,7 @@ namespace LLInitParam class Multiple : public TypedParam { public: - typedef TypedParam >::value> super_t; + typedef TypedParam::value> super_t; typedef Multiple self_t; typedef typename super_t::container_t container_t; typedef typename super_t::value_assignment_t value_assignment_t; @@ -1948,20 +1955,21 @@ namespace LLInitParam }; template - struct IsBlock, TypeValues > > , BLOCK_IDENTIFIER> + struct IsBlock, BLOCK_IDENTIFIER> { - static const bool value = true;//IsBlock::value; + static const bool value = true; }; - template - struct ParamCompare, false> + template + struct IsBlock, BLOCK_IDENTIFIER> { - static bool equals(const T&a, const T &b) - { - return a == b; - } + static const bool value = false; + }; - static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) + template + struct ParamCompare, false> + { + static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) { if (a.empty() || b.empty()) return false; return a.get() == b.get(); @@ -1969,14 +1977,14 @@ namespace LLInitParam }; - template - class ParamValue , - TypeValues >, - VALUE_IS_BLOCK> + template + class ParamValue , + TypeValues >, + true> : public TypeValues { public: - typedef ParamValue , TypeValues >, false> self_t; + typedef ParamValue , TypeValues >, true> self_t; typedef const T& value_assignment_t; typedef T value_t; @@ -1985,7 +1993,7 @@ namespace LLInitParam mValidated(false) {} - ParamValue(const BaseBlock::Lazy& other) + ParamValue(const BaseBlock::Lazy& other) : mValue(other), mValidated(false) {} @@ -2010,11 +2018,6 @@ namespace LLInitParam return mValue.get(); } - operator const BaseBlock&() const - { - return mValue.get(); - } - operator value_assignment_t() const { return mValue.get(); @@ -2030,11 +2033,14 @@ namespace LLInitParam return mValue.get().deserializeBlock(p, name_stack_range, new_name); } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const + void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const { if (mValue.empty()) return; - mValue.get().serializeBlock(p, name_stack, diff_block); + const BaseBlock* base_block = (diff_block && !diff_block->mValue.empty()) + ? &(diff_block->mValue.get()) + : NULL; + mValue.get().serializeBlock(p, name_stack, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2063,7 +2069,7 @@ namespace LLInitParam mutable bool mValidated; // lazy validation flag private: - BaseBlock::Lazy mValue; + BaseBlock::Lazy mValue; }; template <> -- cgit v1.2.3 From 6dd7029942dcc381d670657e0c4bb7d8dcd24594 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Apr 2012 18:11:45 -0700 Subject: optimized Lazy params - don't generate block when checking validity or merging --- indra/llxuixml/llinitparam.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 6c054b934b..1f0dec5d94 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -436,6 +436,12 @@ namespace LLInitParam return *this; } + bool operator==(const Lazy& other) const + { + if (empty() || other.empty()) return false; + return *mPtr == *other.mPtr; + } + bool empty() const { return mPtr == NULL; @@ -1966,17 +1972,6 @@ namespace LLInitParam static const bool value = false; }; - template - struct ParamCompare, false> - { - static bool equals(const BaseBlock::Lazy& a, const BaseBlock::Lazy& b) - { - if (a.empty() || b.empty()) return false; - return a.get() == b.get(); - } - }; - - template class ParamValue , TypeValues >, @@ -2045,19 +2040,17 @@ namespace LLInitParam bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { - if (mValue.empty()) return false; - return mValue.get().inspectBlock(p, name_stack, min_count, max_count); } bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) { - return mValue.get().mergeBlock(block_data, source.getValue(), overwrite); + return source.mValue.empty() || mValue.get().mergeBlock(block_data, source.getValue(), overwrite); } bool validateBlock(bool emit_errors = true) const { - return mValue.get().validateBlock(emit_errors); + return mValue.empty() || mValue.get().validateBlock(emit_errors); } static BlockDescriptor& getBlockDescriptor() -- cgit v1.2.3 From 7996857500004ed9b717e049423c52be96db9191 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 12 Apr 2012 00:43:37 +0300 Subject: CHUI-80 FIXED Implemented volume indicator pop-up. It is invoked by clicking on any speaking indicator except yours. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llavataractions.cpp | 26 +++ indra/newview/llavataractions.h | 10 + indra/newview/llfloatervoicevolume.cpp | 209 +++++++++++++++++++++ indra/newview/llfloatervoicevolume.h | 35 ++++ indra/newview/llinspectavatar.cpp | 3 +- indra/newview/lloutputmonitorctrl.cpp | 12 ++ indra/newview/lloutputmonitorctrl.h | 1 + indra/newview/llviewerfloaterreg.cpp | 2 + .../skins/default/xui/en/floater_voice_volume.xml | 59 ++++++ 10 files changed, 357 insertions(+), 2 deletions(-) create mode 100644 indra/newview/llfloatervoicevolume.cpp create mode 100644 indra/newview/llfloatervoicevolume.h create mode 100644 indra/newview/skins/default/xui/en/floater_voice_volume.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f85b943c70..6197856512 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -244,6 +244,7 @@ set(viewer_SOURCE_FILES llfloateruipreview.cpp llfloaterurlentry.cpp llfloatervoiceeffect.cpp + llfloatervoicevolume.cpp llfloaterwebcontent.cpp llfloaterwebprofile.cpp llfloaterwhitelistentry.cpp @@ -800,6 +801,7 @@ set(viewer_HEADER_FILES llfloateruipreview.h llfloaterurlentry.h llfloatervoiceeffect.h + llfloatervoicevolume.h llfloaterwebcontent.h llfloaterwebprofile.h llfloaterwhitelistentry.h diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 9a7cdcfa21..ac14ec2cc0 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -808,6 +808,26 @@ void LLAvatarActions::toggleBlock(const LLUUID& id) } } +// static +void LLAvatarActions::toggleMuteVoice(const LLUUID& id) +{ + std::string name; + gCacheName->getFullName(id, name); // needed for mute + + LLMuteList* mute_list = LLMuteList::getInstance(); + bool is_muted = mute_list->isMuted(id, LLMute::flagVoiceChat); + + LLMute mute(id, name, LLMute::AGENT); + if (!is_muted) + { + mute_list->add(mute, LLMute::flagVoiceChat); + } + else + { + mute_list->remove(mute, LLMute::flagVoiceChat); + } +} + // static bool LLAvatarActions::canOfferTeleport(const LLUUID& id) { @@ -1022,6 +1042,12 @@ bool LLAvatarActions::isBlocked(const LLUUID& id) return LLMuteList::getInstance()->isMuted(id, name); } +// static +bool LLAvatarActions::isVoiceMuted(const LLUUID& id) +{ + return LLMuteList::getInstance()->isMuted(id, LLMute::flagVoiceChat); +} + // static bool LLAvatarActions::canBlock(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 748b7cb3d1..e5dad74fc8 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -123,6 +123,11 @@ public: */ static void toggleBlock(const LLUUID& id); + /** + * Block/unblock the avatar voice. + */ + static void toggleMuteVoice(const LLUUID& id); + /** * Return true if avatar with "id" is a friend */ @@ -133,6 +138,11 @@ public: */ static bool isBlocked(const LLUUID& id); + /** + * @return true if the avatar voice is blocked + */ + static bool isVoiceMuted(const LLUUID& id); + /** * @return true if you can block the avatar */ diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp new file mode 100644 index 0000000000..87b388b30a --- /dev/null +++ b/indra/newview/llfloatervoicevolume.cpp @@ -0,0 +1,209 @@ +/** + * @file llfloatervoicevolume.cpp + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llfloatervoicevolume.h" + +// Linden libraries +#include "llavatarname.h" +#include "llavatarnamecache.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "lltextbox.h" + +// viewer files +#include "llagent.h" +#include "llavataractions.h" +#include "llinspect.h" +#include "lltransientfloatermgr.h" +#include "llvoiceclient.h" + +class LLAvatarName; + +////////////////////////////////////////////////////////////////////////////// +// LLFloaterVoiceVolume +////////////////////////////////////////////////////////////////////////////// + +// Avatar Inspector, a small information window used when clicking +// on avatar names in the 2D UI and in the ambient inspector widget for +// the 3D world. +class LLFloaterVoiceVolume : public LLInspect, LLTransientFloater +{ + friend class LLFloaterReg; + +public: + // avatar_id - Avatar ID for which to show information + // Inspector will be positioned relative to current mouse position + LLFloaterVoiceVolume(const LLSD& avatar_id); + virtual ~LLFloaterVoiceVolume(); + + /*virtual*/ BOOL postBuild(void); + + // Because floater is single instance, need to re-parse data on each spawn + // (for example, inspector about same avatar but in different position) + /*virtual*/ void onOpen(const LLSD& avatar_id); + + /*virtual*/ LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::GLOBAL; } + +private: + // Set the volume slider to this user's current client-side volume setting, + // hiding/disabling if the user is not nearby. + void updateVolumeControls(); + + void onClickMuteVolume(); + void onVolumeChange(const LLSD& data); + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + +private: + LLUUID mAvatarID; + // Need avatar name information to spawn friend add request + LLAvatarName mAvatarName; +}; + +LLFloaterVoiceVolume::LLFloaterVoiceVolume(const LLSD& sd) +: LLInspect(LLSD()) // single_instance, doesn't really need key +, mAvatarID() // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec* +, mAvatarName() +{ + LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this); + LLTransientFloater::init(this); +} + +LLFloaterVoiceVolume::~LLFloaterVoiceVolume() +{ + LLTransientFloaterMgr::getInstance()->removeControlView(this); +} + +/*virtual*/ +BOOL LLFloaterVoiceVolume::postBuild(void) +{ + getChild("mute_btn")->setCommitCallback( + boost::bind(&LLFloaterVoiceVolume::onClickMuteVolume, this) ); + + getChild("volume_slider")->setCommitCallback( + boost::bind(&LLFloaterVoiceVolume::onVolumeChange, this, _2)); + + return TRUE; +} + + +// Multiple calls to showInstance("floater_voice_volume", foo) will provide different +// LLSD for foo, which we will catch here. +//virtual +void LLFloaterVoiceVolume::onOpen(const LLSD& data) +{ + // Start open animation + LLInspect::onOpen(data); + + // Extract appropriate avatar id + mAvatarID = data["avatar_id"]; + + LLUI::positionViewNearMouse(this); + + getChild("avatar_name")->setValue(""); + updateVolumeControls(); + + LLAvatarNameCache::get(mAvatarID, + boost::bind(&LLFloaterVoiceVolume::onAvatarNameCache, this, _1, _2)); +} + +void LLFloaterVoiceVolume::updateVolumeControls() +{ + bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID); + + LLUICtrl* mute_btn = getChild("mute_btn"); + LLUICtrl* volume_slider = getChild("volume_slider"); + + // Do not display volume slider and mute button if it + // is ourself or we are not in a voice channel together + if (!voice_enabled || (mAvatarID == gAgent.getID())) + { + mute_btn->setVisible(false); + volume_slider->setVisible(false); + } + else + { + mute_btn->setVisible(true); + volume_slider->setVisible(true); + + // By convention, we only display and toggle voice mutes, not all mutes + bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID); + bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden"); + + mute_btn->setEnabled(!is_linden); + mute_btn->setValue(is_muted); + + volume_slider->setEnabled(!is_muted); + + F32 volume; + if (is_muted) + { + // it's clearer to display their volume as zero + volume = 0.f; + } + else + { + // actual volume + volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID); + } + volume_slider->setValue((F64)volume); + } + +} + +void LLFloaterVoiceVolume::onClickMuteVolume() +{ + LLAvatarActions::toggleMuteVoice(mAvatarID); + updateVolumeControls(); +} + +void LLFloaterVoiceVolume::onVolumeChange(const LLSD& data) +{ + F32 volume = (F32)data.asReal(); + LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume); +} + +void LLFloaterVoiceVolume::onAvatarNameCache( + const LLUUID& agent_id, + const LLAvatarName& av_name) +{ + if (agent_id != mAvatarID) + { + return; + } + + getChild("avatar_name")->setValue(av_name.getCompleteName()); + mAvatarName = av_name; +} + +////////////////////////////////////////////////////////////////////////////// +// LLFloaterVoiceVolumeUtil +////////////////////////////////////////////////////////////////////////////// +void LLFloaterVoiceVolumeUtil::registerFloater() +{ + LLFloaterReg::add("floater_voice_volume", "floater_voice_volume.xml", + &LLFloaterReg::build); +} diff --git a/indra/newview/llfloatervoicevolume.h b/indra/newview/llfloatervoicevolume.h new file mode 100644 index 0000000000..8fcf7f250b --- /dev/null +++ b/indra/newview/llfloatervoicevolume.h @@ -0,0 +1,35 @@ +/** + * @file llfloatervoicevolume.h + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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_LLFLOATERVOICEVOLUME_H +#define LL_LLFLOATERVOICEVOLUME_H + +namespace LLFloaterVoiceVolumeUtil +{ + // Register with LLFloaterReg + void registerFloater(); +} + +#endif // LL_LLFLOATERVOICEVOLUME_H diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 17d0b0ffbb..b2a8c6e3e6 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -558,8 +558,7 @@ void LLInspectAvatar::updateVolumeSlider() getChild("volume_slider")->setVisible(true); // By convention, we only display and toggle voice mutes, not all mutes - bool is_muted = LLMuteList::getInstance()-> - isMuted(mAvatarID, LLMute::flagVoiceChat); + bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID); LLUICtrl* mute_btn = getChild("mute_btn"); diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 85626d8783..096e714981 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -28,6 +28,7 @@ #include "lloutputmonitorctrl.h" // library includes +#include "llfloaterreg.h" #include "llui.h" // viewer includes @@ -241,6 +242,17 @@ void LLOutputMonitorCtrl::draw() gl_rect_2d(0, monh, monw, 0, sColorBound, FALSE); } +// virtual +BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if (mSpeakerId != gAgentID) + { + LLFloaterReg::showInstance("floater_voice_volume", LLSD().with("avatar_id", mSpeakerId)); + } + + return TRUE; +} + void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/) { if (speaker_id.isNull() && mSpeakerId.notNull()) diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index 2d23753d46..7b02e84744 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -68,6 +68,7 @@ public: // llview overrides virtual void draw(); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); void setPower(F32 val); F32 getPower(F32 val) const { return mPower; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index bb870f7651..685ef44921 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -110,6 +110,7 @@ #include "llfloatertranslationsettings.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" +#include "llfloatervoicevolume.h" #include "llfloaterwhitelistentry.h" #include "llfloaterwindowsize.h" #include "llfloaterworldmap.h" @@ -220,6 +221,7 @@ void LLViewerFloaterReg::registerFloaters() LLInspectGroupUtil::registerFloater(); LLInspectObjectUtil::registerFloater(); LLInspectRemoteObjectUtil::registerFloater(); + LLFloaterVoiceVolumeUtil::registerFloater(); LLNotificationsUI::registerFloater(); LLFloaterDisplayNameUtil::registerFloater(); diff --git a/indra/newview/skins/default/xui/en/floater_voice_volume.xml b/indra/newview/skins/default/xui/en/floater_voice_volume.xml new file mode 100644 index 0000000000..9346295d5b --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_voice_volume.xml @@ -0,0 +1,59 @@ + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 33e78bfe64240f71bcc40ca34950770ce549dc69 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Sat, 14 Apr 2012 02:04:37 +0300 Subject: CHUI-78 WIP Re-combined view and sort menus in the People panel. --- .../default/xui/en/menu_people_friends_sort.xml | 26 ---------------- .../default/xui/en/menu_people_friends_view.xml | 21 +++++++++++++ .../skins/default/xui/en/menu_people_groups.xml | 4 +-- .../default/xui/en/menu_people_nearby_sort.xml | 36 ---------------------- .../default/xui/en/menu_people_nearby_view.xml | 31 +++++++++++++++++++ .../default/xui/en/menu_people_recent_sort.xml | 26 ---------------- .../default/xui/en/menu_people_recent_view.xml | 21 +++++++++++++ .../newview/skins/default/xui/en/panel_people.xml | 35 +++++++++++---------- 8 files changed, 93 insertions(+), 107 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en/menu_people_friends_sort.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_people_recent_sort.xml diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml deleted file mode 100644 index 532e295386..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_friends_sort.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml index 14a3e1f13d..eab7b8c085 100644 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view.xml @@ -3,6 +3,27 @@ name="menu_group_plus" left="0" bottom="0" visible="false" mouse_opaque="false"> + + + + + + + + + - - + diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml deleted file mode 100644 index cf7f4f4fce..0000000000 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_sort.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml index 4c94cf53af..da88ca9f4d 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view.xml @@ -3,6 +3,37 @@ name="menu_group_plus" left="0" bottom="0" visible="false" mouse_opaque="false"> + + + + + + + + + + + + + - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view.xml index 0eaca47d9a..1dbc90dd2b 100644 --- a/indra/newview/skins/default/xui/en/menu_people_recent_view.xml +++ b/indra/newview/skins/default/xui/en/menu_people_recent_view.xml @@ -3,6 +3,27 @@ name="menu_group_plus" left="0" bottom="0" visible="false" mouse_opaque="false"> + + + + + + + + + + + + - + + + + + - + + width="384" /> + diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml index d683116eb8..b415ba780d 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -1,20 +1,21 @@ + width="394"> + width="394"> + width="387"> + width="374" /> + width="394"> + width="384" /> -- cgit v1.2.3 From fe252836ebfb8a1247b0ae3222056d0543203a44 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 30 May 2012 22:58:22 +0300 Subject: Build fix --- indra/newview/llimconversation.cpp | 2 ++ indra/newview/llnearbychatbar.cpp | 7 ------- indra/newview/llnearbychatbar.h | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 7220ab6a82..f5d84e80c1 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -25,6 +25,8 @@ * $/LicenseInfo$ */ +#include "llviewerprecompiledheaders.h" + #include "llpanelimcontrolpanel.h" #include "lldraghandle.h" diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 82c00253e8..68934be11a 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -116,8 +116,6 @@ BOOL LLNearbyChatBar::postBuild() // Register for font change notifications LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1)); - // childSetAction("voice_call_btn", boost::bind(&LLNearbyChatBar::onCallButtonClicked, this)); - enableResizeCtrls(true, true, false); addToHost(); @@ -125,11 +123,6 @@ BOOL LLNearbyChatBar::postBuild() return LLIMConversation::postBuild();; } -void LLNearbyChatBar::onCallButtonClicked() -{ - LLAgent::toggleMicrophone(NULL); -} - void LLNearbyChatBar::enableDisableCallBtn() { // bool btn_enabled = LLAgent::isActionAllowed("speak"); diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index e714c04498..b7c4c993c6 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -88,8 +88,6 @@ protected: void displaySpeakingIndicator(); - void onCallButtonClicked(); - // set the enable/disable state for the Call button virtual void enableDisableCallBtn(); -- cgit v1.2.3 From bba0f4f74e56d911df8fc534d83cd4a84993bc8b Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 31 May 2012 16:37:22 +0300 Subject: CHUI-119 WIP --- indra/newview/CMakeLists.txt | 4 - indra/newview/llagent.cpp | 6 +- indra/newview/llchatitemscontainerctrl.cpp | 6 +- indra/newview/llfloatertranslationsettings.cpp | 4 +- indra/newview/llgesturemgr.cpp | 4 +- indra/newview/llimconversation.cpp | 97 ++- indra/newview/llimconversation.h | 12 +- indra/newview/llimfloater.cpp | 67 +- indra/newview/llimfloater.h | 9 +- indra/newview/llimfloatercontainer.cpp | 2 +- indra/newview/llimview.cpp | 5 +- indra/newview/llnearbychat.cpp | 840 ++++++++++++++++++--- indra/newview/llnearbychat.h | 107 ++- indra/newview/llnearbychatbar.cpp | 709 ----------------- indra/newview/llnearbychatbar.h | 105 --- indra/newview/llnearbychatbarlistener.cpp | 4 +- indra/newview/llnearbychatbarlistener.h | 6 +- indra/newview/llnearbychathandler.cpp | 9 +- indra/newview/llnotificationtiphandler.cpp | 5 +- indra/newview/llpanelimcontrolpanel.cpp | 81 -- indra/newview/llviewerfloaterreg.cpp | 4 +- indra/newview/llviewergesture.cpp | 4 +- indra/newview/llviewerkeyboard.cpp | 10 +- indra/newview/llviewerwindow.cpp | 8 +- .../skins/default/xui/en/floater_chat_bar.xml | 202 ----- .../skins/default/xui/en/floater_im_session.xml | 119 ++- .../default/xui/en/panel_adhoc_control_panel.xml | 95 --- .../default/xui/en/panel_group_control_panel.xml | 60 -- .../skins/default/xui/en/panel_nearby_chat.xml | 19 +- 29 files changed, 1037 insertions(+), 1566 deletions(-) delete mode 100644 indra/newview/llnearbychatbar.cpp delete mode 100644 indra/newview/llnearbychatbar.h delete mode 100644 indra/newview/skins/default/xui/en/floater_chat_bar.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_group_control_panel.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 86d30c239f..509f9581d6 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -332,7 +332,6 @@ set(viewer_SOURCE_FILES llnamelistctrl.cpp llnavigationbar.cpp llnearbychat.cpp - llnearbychatbar.cpp llnearbychathandler.cpp llnearbychatbarlistener.cpp llnetmap.cpp @@ -364,7 +363,6 @@ set(viewer_SOURCE_FILES llpanelgroupnotices.cpp llpanelgrouproles.cpp llpanelhome.cpp - llpanelimcontrolpanel.cpp llpanelland.cpp llpanellandaudio.cpp llpanellandmarkinfo.cpp @@ -890,7 +888,6 @@ set(viewer_HEADER_FILES llnamelistctrl.h llnavigationbar.h llnearbychat.h - llnearbychatbar.h llnearbychathandler.h llnearbychatbarlistener.h llnetmap.h @@ -916,7 +913,6 @@ set(viewer_HEADER_FILES llpanelgroupnotices.h llpanelgrouproles.h llpanelhome.h - llpanelimcontrolpanel.h llpanelland.h llpanellandaudio.h llpanellandmarkinfo.h diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3870a3be2e..0db03289d8 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -54,7 +54,7 @@ #include "llmorphview.h" #include "llmoveview.h" #include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llnotificationsutil.h" #include "llpaneltopinfobar.h" #include "llparcel.h" @@ -1778,7 +1778,7 @@ void LLAgent::startTyping() { sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } - LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE); + LLNearbyChat::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE); } //----------------------------------------------------------------------------- @@ -1790,7 +1790,7 @@ void LLAgent::stopTyping() { clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); - LLNearbyChatBar::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + LLNearbyChat::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); } } diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 7477fbd656..477bdb3967 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -35,7 +35,7 @@ #include "llfloaterreg.h" #include "lllocalcliprect.h" #include "lltrans.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llviewercontrol.h" #include "llagentdata.h" @@ -316,12 +316,12 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) return TRUE; else { - LLNearbyChatBar::getInstance()->showHistory(); + LLNearbyChat::getInstance()->showHistory(); return FALSE; } } - LLNearbyChatBar::getInstance()->showHistory(); + LLNearbyChat::getInstance()->showHistory(); return LLPanel::handleMouseUp(x,y,mask); } diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 1a17183efd..bb01ce5a7e 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -29,7 +29,7 @@ #include "llfloatertranslationsettings.h" // Viewer includes -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "lltranslate.h" #include "llviewercontrol.h" // for gSavedSettings @@ -293,6 +293,6 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey()); gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey()); - LLNearbyChatBar::getInstance()->showTranslationCheckbox(LLTranslate::isTranslationConfigured()); + LLNearbyChat::getInstance()->showTranslationCheckbox(LLTranslate::isTranslationConfigured()); closeFloater(false); } diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 66ca76bfb0..26b63bdacb 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -51,7 +51,7 @@ #include "llviewermessage.h" #include "llvoavatarself.h" #include "llviewerstats.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llappearancemgr.h" #include "llgesturelistener.h" @@ -997,7 +997,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) const BOOL animate = FALSE; - LLNearbyChatBar::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + LLNearbyChat::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); gesture->mCurrentStep++; break; diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index f5d84e80c1..893d8dc83f 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -27,25 +27,27 @@ #include "llviewerprecompiledheaders.h" -#include "llpanelimcontrolpanel.h" +#include "llimconversation.h" #include "lldraghandle.h" #include "llfloaterreg.h" -#include "llimconversation.h" #include "llimfloater.h" #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container #include "lllayoutstack.h" #include "llnearbychat.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" + +const F32 REFRESH_INTERVAL = 0.2; LLIMConversation::LLIMConversation(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id) - , mControlPanel(NULL) + , LLEventTimer(REFRESH_INTERVAL) , mIsP2PChat(false) , mExpandCollapseBtn(NULL) , mTearOffBtn(NULL) , mCloseBtn(NULL) , mSessionID(session_id) + , mParticipantList(NULL) { mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2)); @@ -63,6 +65,15 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) boost::bind(&LLIMConversation::onIMShowModesMenuItemEnable, this, _2)); } +LLIMConversation::~LLIMConversation() +{ + if (mParticipantList) + { + delete mParticipantList; + mParticipantList = NULL; + } +} + BOOL LLIMConversation::postBuild() { mCloseBtn = getChild("close_btn"); @@ -71,19 +82,12 @@ BOOL LLIMConversation::postBuild() mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMConversation::onSlide, this)); - if (mControlPanel) - { - mControlPanel->setSessionId(mSessionID); - mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); - - mExpandCollapseBtn->setImageOverlay( - getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); - } - else - { - mExpandCollapseBtn->setEnabled(false); - getChild("im_control_panel_holder")->setVisible(false); - } + mParticipantListPanel = getChild("speakers_list_panel"); + mParticipantListPanel->setVisible( + mIsNearbyChat? false : gSavedSettings.getBOOL("IMShowControlPanel")); + mExpandCollapseBtn->setImageOverlay( + getString(mParticipantListPanel->getVisible() ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setEnabled(!mIsP2PChat); mTearOffBtn = getChild("tear_off_btn"); mTearOffBtn->setCommitCallback(boost::bind(&LLIMConversation::onTearOffClicked, this)); @@ -93,6 +97,8 @@ BOOL LLIMConversation::postBuild() setOpenPositioning(LLFloaterEnums::OPEN_POSITIONING_NONE); } + buildParticipantList(); + if (isChatMultiTab()) { return LLFloater::postBuild(); @@ -104,6 +110,47 @@ BOOL LLIMConversation::postBuild() } +BOOL LLIMConversation::tick() +{ + // Need to resort the participant list if it's in sort by recent speaker order. + if (mParticipantList) + { + mParticipantList->update(); + } + + return false; +} + +void LLIMConversation::buildParticipantList() +{ if (mIsNearbyChat) + { + } + else + { + // for group and Ad-hoc chat we need to include agent into list + if(!mIsP2PChat && !mParticipantList && mSessionID.notNull()) + { + LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + mParticipantList = new LLParticipantList(speaker_manager, getChild("speakers_list"), true, false); + } + } +} + +void LLIMConversation::onSortMenuItemClicked(const LLSD& userdata) +{ + // TODO: Check this code when when sort order menu will be added. (EM) + if (true || !mParticipantList) + return; + + std::string chosen_item = userdata.asString(); + + if (chosen_item == "sort_name") + { + mParticipantList->setSortOrder(LLParticipantList::E_SORT_BY_NAME); + } + +} + void LLIMConversation::onIMSessionMenuItemClicked(const LLSD& userdata) { std::string item = userdata.asString(); @@ -162,11 +209,11 @@ void LLIMConversation::updateHeaderAndToolbar() } bool is_control_panel_visible = false; - if (mControlPanel) + if (!mIsP2PChat) { // Control panel should be visible only in torn off floaters. is_control_panel_visible = !is_hosted && gSavedSettings.getBOOL("IMShowControlPanel"); - mControlPanel->getParent()->setVisible(is_control_panel_visible); + mParticipantListPanel->setVisible(is_control_panel_visible); } // Display collapse image (<<) if the floater is hosted @@ -215,10 +262,10 @@ void LLIMConversation::processChatHistoryStyleUpdate() } } - LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); - if (nearby_chat_bar) + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); + if (nearby_chat) { - nearby_chat_bar->reloadMessages(); + nearby_chat->reloadMessages(); } } @@ -240,12 +287,12 @@ void LLIMConversation::onSlide(LLIMConversation* self) } else ///< floater is torn off { - if (self->mControlPanel) + if (!self->mIsP2PChat) { - bool expand = !self->mControlPanel->getParent()->getVisible(); + bool expand = !self->mParticipantListPanel->getVisible(); // Expand/collapse the IM control panel - self->mControlPanel->getParent()->setVisible(expand); + self->mParticipantListPanel->setVisible(expand); gSavedSettings.setBOOL("IMShowControlPanel", expand); diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 501977e061..d31ae0808a 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -28,19 +28,24 @@ #ifndef LL_IMCONVERSATION_H #define LL_IMCONVERSATION_H +#include "lllayoutstack.h" +#include "llparticipantlist.h" #include "lltransientdockablefloater.h" #include "llviewercontrol.h" +#include "lleventtimer.h" class LLPanelChatControlPanel; class LLIMConversation : public LLTransientDockableFloater + , public LLEventTimer { public: LOG_CLASS(LLIMConversation); LLIMConversation(const LLUUID& session_id); + ~LLIMConversation(); // reload all message with new settings of visual modes static void processChatHistoryStyleUpdate(); @@ -75,13 +80,16 @@ protected: // set the enable/disable state for the Call button virtual void enableDisableCallBtn() = 0; -// /* virtual */ void updateTitleButtons(); + void buildParticipantList(); + void onSortMenuItemClicked(const LLSD& userdata); + /*virtual*/ BOOL tick(); - LLPanelChatControlPanel* mControlPanel; bool mIsNearbyChat; bool mIsP2PChat; + LLLayoutPanel* mParticipantListPanel; + LLParticipantList* mParticipantList; LLUUID mSessionID; LLButton* mExpandCollapseBtn; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 5339bcb936..c99da9e9c1 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -44,7 +44,6 @@ //#include "lllayoutstack.h" #include "lllineeditor.h" #include "lllogchat.h" -#include "llpanelimcontrolpanel.h" #include "llscreenchannel.h" #include "llsyswellwindow.h" #include "lltrans.h" @@ -82,29 +81,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) { mIsP2PChat = mSession->isP2PSessionType(); mSessionInitialized = mSession->mSessionInitialized; - mDialog = mSession->mType; - switch (mDialog) - { - case IM_SESSION_CONFERENCE_START: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); - break; - case IM_SESSION_GROUP_START: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); - break; - case IM_SESSION_INVITE: - if (gAgent.isInGroup(mSessionID)) - { - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelGroupControl, this); - } - else - { - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); - } - break; - default: - break; - } } setOverlapsScreenChannel(true); @@ -113,24 +90,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) setDocked(true); } -// static -void* LLIMFloater::createPanelGroupControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*) userdata; - self->mControlPanel = new LLPanelGroupControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_group_control_panel.xml"); - return self->mControlPanel; -} - -// static -void* LLIMFloater::createPanelAdHocControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*) userdata; - self->mControlPanel = new LLPanelAdHocControlPanel(self->mSessionID); - self->mControlPanel->setXMLFilename("panel_adhoc_control_panel.xml"); - return self->mControlPanel; -} - void LLIMFloater::onFocusLost() { LLIMModel::getInstance()->resetActiveSessionID(); @@ -409,8 +368,10 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, } // virtual -void LLIMFloater::draw() +BOOL LLIMFloater::tick() { + BOOL parents_retcode = LLIMConversation::tick(); + if ( mMeTyping ) { // Time out if user hasn't typed for a while. @@ -420,7 +381,7 @@ void LLIMFloater::draw() } } - LLTransientDockableFloater::draw(); + return parents_retcode; } //static @@ -643,16 +604,14 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) if (mSessionID != im_session_id) { mSessionID = im_session_id; - setKey(im_session_id); - if (mControlPanel) - { - mControlPanel->setSessionId(im_session_id); - } + boundVoiceChannel(); mSession = LLIMModel::getInstance()->findIMSession(mSessionID); mIsP2PChat = mSession && mSession->isP2PSessionType(); + + buildParticipantList(); } //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) @@ -841,10 +800,14 @@ void LLIMFloater::setTyping(bool typing) } } - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if (speaker_mgr) - speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); - + if (!mIsNearbyChat) + { + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) + { + speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE); + } + } } void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index c7793f73eb..24f28c8aee 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -61,15 +61,15 @@ public: /*virtual*/ void setVisible(BOOL visible); /*virtual*/ BOOL getVisible(); // Check typing timeout timer. - /*virtual*/ void draw(); - - static void* createPanelGroupControl(void* userdata); - static void* createPanelAdHocControl(void* userdata); + /*virtual*/ BOOL tick(); static LLIMFloater* findInstance(const LLUUID& session_id); static LLIMFloater* getInstance(const LLUUID& session_id); static void addToHost(const LLUUID& session_id); + static void* createPanelGroupControl(void* userdata); + static void* createPanelAdHocControl(void* userdata); + // LLFloater overrides /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); @@ -147,7 +147,6 @@ private: static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); void setTyping(bool typing); - void onCallButtonClicked(); // set the enable/disable state for the Call button diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f72ddef412..3b6240de44 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -31,7 +31,7 @@ #include "llfloaterreg.h" #include "lllayoutstack.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llagent.h" #include "llavatariconctrl.h" diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index c3ac1d32cb..46b1cb5f18 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -907,7 +907,7 @@ const LLUUID& LLIMModel::getOtherParticipantID(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + llwarns << "session " << session_id << " does not exist " << llendl; return LLUUID::null; } @@ -2483,8 +2483,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); - LLNearbyChat* nearby_chat = chat_bar->findChild("nearby_chat"); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if(nearby_chat) { diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 497690d656..2d7095957e 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -1,8 +1,8 @@ /** * @file LLNearbyChat.cpp - * @brief Nearby chat history scrolling panel implementation + * @brief LLNearbyChat class implementation * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * @@ -25,34 +25,50 @@ */ #include "llviewerprecompiledheaders.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llrootview.h" -//#include "llchatitemscontainerctrl.h" + +#include "message.h" + #include "lliconctrl.h" +#include "llappviewer.h" +#include "llfloaterreg.h" +#include "lltrans.h" +#include "llimfloatercontainer.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "lllogchat.h" #include "llresizebar.h" #include "llresizehandle.h" +#include "lldraghandle.h" #include "llmenugl.h" -#include "llviewermenu.h"//for gMenuHolder - +#include "llviewermenu.h" // for gMenuHolder #include "llnearbychathandler.h" #include "llchannelmanager.h" - -#include "llagent.h" // gAgent #include "llchathistory.h" #include "llstylemap.h" - #include "llavatarnamecache.h" - -#include "lldraghandle.h" - -#include "llnearbychatbar.h" #include "llfloaterreg.h" #include "lltrans.h" +#include "llfirstuse.h" +#include "llnearbychat.h" +#include "llagent.h" // gAgent +#include "llgesturemgr.h" +#include "llmultigesture.h" +#include "llkeyboard.h" +#include "llanimationstates.h" +#include "llviewerstats.h" +#include "llcommandhandler.h" +#include "llviewercontrol.h" +#include "llnavigationbar.h" +#include "llwindow.h" +#include "llviewerwindow.h" +#include "llrootview.h" +#include "llviewerchat.h" +#include "lltranslate.h" + +S32 LLNearbyChat::sLastSpecialChatChannel = 0; + + // --- 2 functions in the global namespace :( --- bool isWordsName(const std::string& name) { @@ -88,90 +104,83 @@ std::string appendTime() return timeStr; } -static const S32 RESIZE_BAR_THICKNESS = 3; -static LLRegisterPanelClassWrapper t_panel_nearby_chat("panel_nearby_chat"); +const S32 EXPANDED_HEIGHT = 266; +const S32 COLLAPSED_HEIGHT = 60; +const S32 EXPANDED_MIN_HEIGHT = 150; -LLNearbyChat::LLNearbyChat(const LLNearbyChat::Params& p) - : LLPanel(p), - mChatHistory(NULL) -{ -} +// legacy callback glue +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); -BOOL LLNearbyChat::postBuild() -{ - //menu - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; +struct LLChatTypeTrigger { + std::string name; + EChatType type; +}; - enable_registrar.add("NearbyChat.Check", boost::bind(&LLNearbyChat::onNearbyChatCheckContextMenuItem, this, _2)); - registrar.add("NearbyChat.Action", boost::bind(&LLNearbyChat::onNearbyChatContextMenuItemClicked, this, _2)); +static LLChatTypeTrigger sChatTypeTriggers[] = { + { "/whisper" , CHAT_TYPE_WHISPER}, + { "/shout" , CHAT_TYPE_SHOUT} +}; - - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if(menu) - mPopupMenuHandle = menu->getHandle(); - gSavedSettings.declareS32("nearbychat_showicons_and_names",2,"NearByChat header settings",true); +LLNearbyChat::LLNearbyChat(const LLSD& key) +: LLIMConversation(key), + mChatBox(NULL), + mChatHistory(NULL), + mOutputMonitor(NULL), + mSpeakerMgr(NULL), + mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) +{ + mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); +} - mChatHistory = getChild("chat_history"); +//virtual +BOOL LLNearbyChat::postBuild() +{ + mChatBox = getChild("chat_editor"); - return LLPanel::postBuild(); -} + mChatBox->setCommitCallback(boost::bind(&LLNearbyChat::onChatBoxCommit, this)); + mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); + mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this)); + mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChat::onChatBoxFocusReceived, this)); + mChatBox->setIgnoreArrowKeys( FALSE ); + mChatBox->setCommitOnFocusLost( FALSE ); + mChatBox->setRevertOnEsc( FALSE ); + mChatBox->setIgnoreTab(TRUE); + mChatBox->setPassDelete(TRUE); + mChatBox->setReplaceNewlinesWithSpaces(FALSE); + mChatBox->setEnableLineHistory(TRUE); + mChatBox->setFont(LLViewerChat::getChatFont()); + mOutputMonitor = getChild("chat_zone_indicator"); + mOutputMonitor->setVisible(FALSE); -void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args) -{ - LLChat& tmp_chat = const_cast(chat); + // Register for font change notifications + LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChat::onChatFontChange, this, _1)); - if(tmp_chat.mTimeStr.empty()) - tmp_chat.mTimeStr = appendTime(); + enableResizeCtrls(true, true, false); - if (!chat.mMuted) - { - tmp_chat.mFromName = chat.mFromName; - LLSD chat_args; - if (args) chat_args = args; - chat_args["use_plain_text_chat_history"] = - gSavedSettings.getBOOL("PlainTextChatHistory"); - chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = true; + addToHost(); - mChatHistory->appendMessage(chat, chat_args); - } -} + //for menu + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; -void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) -{ - appendMessage(chat, args); + enable_registrar.add("NearbyChat.Check", boost::bind(&LLNearbyChat::onNearbyChatCheckContextMenuItem, this, _2)); + registrar.add("NearbyChat.Action", boost::bind(&LLNearbyChat::onNearbyChatContextMenuItemClicked, this, _2)); - if(archive) + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_nearby_chat.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + if(menu) { - mMessageArchive.push_back(chat); - if(mMessageArchive.size()>200) - mMessageArchive.erase(mMessageArchive.begin()); + mPopupMenuHandle = menu->getHandle(); } - // logging - if (!args["do_not_log"].asBoolean() - && gSavedPerAccountSettings.getBOOL("LogNearbyChat")) - { - std::string from_name = chat.mFromName; - - if (chat.mSourceType == CHAT_SOURCE_AGENT) - { - // if the chat is coming from an agent, log the complete name - LLAvatarName av_name; - LLAvatarNameCache::get(chat.mFromID, &av_name); + // obsolete, but may be needed for backward compatibility? + gSavedSettings.declareS32("nearbychat_showicons_and_names", 2, "NearByChat header settings", true); - if (!av_name.mIsDisplayNameDefault) - { - from_name = av_name.getCompleteName(); - } - } + mChatHistory = getChild("chat_history"); - LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText); - } + return LLIMConversation::postBuild();; } void LLNearbyChat::onNearbySpeakers() @@ -189,33 +198,40 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata) { std::string str = userdata.asString(); if(str == "nearby_people") - onNearbySpeakers(); + onNearbySpeakers(); return false; } -void LLNearbyChat::removeScreenChat() +void LLNearbyChat::getAllowedRect(LLRect& rect) { - LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))); - if(chat_channel) - { - chat_channel->removeToastsFromChannel(); - } + rect = gViewerWindow->getWorldViewRectScaled(); } - -void LLNearbyChat::setVisible(BOOL visible) +//////////////////////////////////////////////////////////////////////////////// +// +void LLNearbyChat::onFocusReceived() { - if(visible) - { - removeScreenChat(); - } - - LLPanel::setVisible(visible); + setBackgroundOpaque(true); + LLIMConversation::onFocusReceived(); } +//////////////////////////////////////////////////////////////////////////////// +// +void LLNearbyChat::onFocusLost() +{ + setBackgroundOpaque(false); + LLIMConversation::onFocusLost(); +} -void LLNearbyChat::getAllowedRect(LLRect& rect) +BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) { - rect = gViewerWindow->getWorldViewRectScaled(); + //fix for EXT-6625 + //highlight NearbyChat history whenever mouseclick happen in NearbyChat + //setting focus to eidtor will force onFocusLost() call that in its turn will change + //background opaque. This all happenn since NearByChat is "chrome" and didn't process focus change. + + if(mChatHistory) + mChatHistory->setFocus(TRUE); + return LLPanel::handleMouseDown(x, y, mask); } void LLNearbyChat::reloadMessages() @@ -265,9 +281,9 @@ void LLNearbyChat::loadHistory() chat.mSourceType = CHAT_SOURCE_AGENT; if (from_id.isNull() && SYSTEM_FROM == from) - { + { chat.mSourceType = CHAT_SOURCE_SYSTEM; - + } else if (from_id.isNull()) { @@ -280,43 +296,117 @@ void LLNearbyChat::loadHistory() } } -//static -LLNearbyChat* LLNearbyChat::getInstance() +void LLNearbyChat::removeScreenChat() { - LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); - return chat_bar->findChild("nearby_chat"); + LLNotificationsUI::LLScreenChannelBase* chat_channel = LLNotificationsUI::LLChannelManager::getInstance()->findChannelByID(LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))); + if(chat_channel) + { + chat_channel->removeToastsFromChannel(); + } } -//////////////////////////////////////////////////////////////////////////////// -// -void LLNearbyChat::onFocusReceived() +void LLNearbyChat::setVisible(BOOL visible) { - setBackgroundOpaque(true); - LLPanel::onFocusReceived(); + if(visible) + { + removeScreenChat(); + } + + LLIMConversation::setVisible(visible); } -//////////////////////////////////////////////////////////////////////////////// -// -void LLNearbyChat::onFocusLost() +void LLNearbyChat::onCallButtonClicked() { - setBackgroundOpaque(false); - LLPanel::onFocusLost(); + LLAgent::toggleMicrophone(NULL); } -BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) +void LLNearbyChat::enableDisableCallBtn() { - //fix for EXT-6625 - //highlight NearbyChat history whenever mouseclick happen in NearbyChat - //setting focus to eidtor will force onFocusLost() call that in its turn will change - //background opaque. This all happenn since NearByChat is "chrome" and didn't process focus change. + // bool btn_enabled = LLAgent::isActionAllowed("speak"); + + getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/); +} + +void LLNearbyChat::addToHost() +{ + if (LLIMConversation::isChatMultiTab()) + { + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + + if (im_box) + { + im_box->addFloater(this, FALSE, LLTabContainer::END); + } + } +} + +// virtual +void LLNearbyChat::onOpen(const LLSD& key) +{ + LLIMConversation::onOpen(key); + showTranslationCheckbox(LLTranslate::isTranslationConfigured()); +} + +bool LLNearbyChat::applyRectControl() +{ + bool rect_controlled = LLFloater::applyRectControl(); + +/* if (!mNearbyChat->getVisible()) + { + reshape(getRect().getWidth(), getMinHeight()); + enableResizeCtrls(true, true, false); + } + else + {*/ + enableResizeCtrls(true); + setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); +// } - if(mChatHistory) - mChatHistory->setFocus(TRUE); - return LLPanel::handleMouseDown(x, y, mask); + return rect_controlled; +} + +void LLNearbyChat::onChatFontChange(LLFontGL* fontp) +{ + // Update things with the new font whohoo + if (mChatBox) + { + mChatBox->setFont(fontp); + } +} + +//static +LLNearbyChat* LLNearbyChat::getInstance() +{ + return LLFloaterReg::getTypedInstance("chat_bar"); +} + +//static +//LLNearbyChat* LLNearbyChat::findInstance() +//{ +// return LLFloaterReg::findTypedInstance("chat_bar"); +//} + +void LLNearbyChat::showHistory() +{ + openFloater(); + setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); + reshape(getRect().getWidth(), mExpandedHeight); + enableResizeCtrls(true); + storeRectControl(); } -void LLNearbyChat::draw() +void LLNearbyChat::showTranslationCheckbox(BOOL show) { + getChild("translate_chat_checkbox_lp")->setVisible(show); +} + +BOOL LLNearbyChat::tick() +{ + BOOL parents_retcode = LLIMConversation::tick(); + + displaySpeakingIndicator(); + updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); + // *HACK: Update transparency type depending on whether our children have focus. // This is needed because this floater is chrome and thus cannot accept focus, so // the transparency type setting code from LLFloater::setFocus() isn't reached. @@ -325,5 +415,511 @@ void LLNearbyChat::draw() setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); } - LLPanel::draw(); + return parents_retcode; } + +std::string LLNearbyChat::getCurrentChat() +{ + return mChatBox ? mChatBox->getText() : LLStringUtil::null; +} + +// virtual +BOOL LLNearbyChat::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + + if( KEY_RETURN == key && mask == MASK_CONTROL) + { + // shout + sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; + } + + return handled; +} + +BOOL LLNearbyChat::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) +{ + U32 in_len = in_str.length(); + S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); + + bool string_was_found = false; + + for (S32 n = 0; n < cnt && !string_was_found; n++) + { + if (in_len <= sChatTypeTriggers[n].name.length()) + { + std::string trigger_trunc = sChatTypeTriggers[n].name; + LLStringUtil::truncate(trigger_trunc, in_len); + + if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) + { + *out_str = sChatTypeTriggers[n].name; + string_was_found = true; + } + } + } + + return string_was_found; +} + +void LLNearbyChat::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) +{ + LLFirstUse::otherAvatarChatFirst(false); + + LLNearbyChat* self = (LLNearbyChat *)userdata; + + LLWString raw_text = self->mChatBox->getWText(); + + // Can't trim the end, because that will cause autocompletion + // to eat trailing spaces that might be part of a gesture. + LLWStringUtil::trimHead(raw_text); + + S32 length = raw_text.length(); + + if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences + { + gAgent.startTyping(); + } + else + { + gAgent.stopTyping(); + } + + /* Doesn't work -- can't tell the difference between a backspace + that killed the selection vs. backspace at the end of line. + if (length > 1 + && text[0] == '/' + && key == KEY_BACKSPACE) + { + // the selection will already be deleted, but we need to trim + // off the character before + std::string new_text = raw_text.substr(0, length-1); + self->mInputEditor->setText( new_text ); + self->mInputEditor->setCursorToEnd(); + length = length - 1; + } + */ + + KEY key = gKeyboard->currentKey(); + + // Ignore "special" keys, like backspace, arrows, etc. + if (length > 1 + && raw_text[0] == '/' + && key < KEY_SPECIAL) + { + // we're starting a gesture, attempt to autocomplete + + std::string utf8_trigger = wstring_to_utf8str(raw_text); + std::string utf8_out_str(utf8_trigger); + + if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) + { + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part + S32 outlength = self->mChatBox->getLength(); // in characters + + // Select to end of line, starting from the character + // after the last one the user typed. + self->mChatBox->setSelection(length, outlength); + } + else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str)) + { + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part + self->mChatBox->setCursorToEnd(); + } + + //llinfos << "GESTUREDEBUG " << trigger + // << " len " << length + // << " outlen " << out_str.getLength() + // << llendl; + } +} + +// static +void LLNearbyChat::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata) +{ + // stop typing animation + gAgent.stopTyping(); +} + +void LLNearbyChat::onChatBoxFocusReceived() +{ + mChatBox->setEnabled(!gDisconnected); +} + +EChatType LLNearbyChat::processChatTypeTriggers(EChatType type, std::string &str) +{ + U32 length = str.length(); + S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); + + for (S32 n = 0; n < cnt; n++) + { + if (length >= sChatTypeTriggers[n].name.length()) + { + std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length()); + + if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) + { + U32 trigger_length = sChatTypeTriggers[n].name.length(); + + // It's to remove space after trigger name + if (length > trigger_length && str[trigger_length] == ' ') + trigger_length++; + + str = str.substr(trigger_length, length); + + if (CHAT_TYPE_NORMAL == type) + return sChatTypeTriggers[n].type; + else + break; + } + } + } + + return type; +} + +void LLNearbyChat::sendChat( EChatType type ) +{ + if (mChatBox) + { + LLWString text = mChatBox->getConvertedText(); + if (!text.empty()) + { + // store sent line in history, duplicates will get filtered + mChatBox->updateHistory(); + // Check if this is destined for another channel + S32 channel = 0; + stripChannelNumber(text, &channel); + + std::string utf8text = wstring_to_utf8str(text); + // Try to trigger a gesture, if not chat to a script. + std::string utf8_revised_text; + if (0 == channel) + { + // discard returned "found" boolean + LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); + } + else + { + utf8_revised_text = utf8text; + } + + utf8_revised_text = utf8str_trim(utf8_revised_text); + + type = processChatTypeTriggers(type, utf8_revised_text); + + if (!utf8_revised_text.empty()) + { + // Chat with animation + sendChatFromViewer(utf8_revised_text, type, TRUE); + } + } + + mChatBox->setText(LLStringExplicit("")); + } + + gAgent.stopTyping(); + + // If the user wants to stop chatting on hitting return, lose focus + // and go out of chat mode. + if (gSavedSettings.getBOOL("CloseChatOnReturn")) + { + stopChat(); + } +} + + +void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args) +{ + LLChat& tmp_chat = const_cast(chat); + + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); + + if (!chat.mMuted) + { + tmp_chat.mFromName = chat.mFromName; + LLSD chat_args; + if (args) chat_args = args; + chat_args["use_plain_text_chat_history"] = + gSavedSettings.getBOOL("PlainTextChatHistory"); + chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); + chat_args["show_names_for_p2p_conv"] = true; + + mChatHistory->appendMessage(chat, chat_args); + } +} + +void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) +{ + appendMessage(chat, args); + + if(archive) + { + mMessageArchive.push_back(chat); + if(mMessageArchive.size()>200) + mMessageArchive.erase(mMessageArchive.begin()); + } + + // logging + if (!args["do_not_log"].asBoolean() + && gSavedPerAccountSettings.getBOOL("LogNearbyChat")) + { + std::string from_name = chat.mFromName; + + if (chat.mSourceType == CHAT_SOURCE_AGENT) + { + // if the chat is coming from an agent, log the complete name + LLAvatarName av_name; + LLAvatarNameCache::get(chat.mFromID, &av_name); + + if (!av_name.mIsDisplayNameDefault) + { + from_name = av_name.getCompleteName(); + } + } + + LLLogChat::saveHistory("chat", from_name, chat.mFromID, chat.mText); + } +} + + +void LLNearbyChat::onChatBoxCommit() +{ + if (mChatBox->getText().length() > 0) + { + sendChat(CHAT_TYPE_NORMAL); + } + + gAgent.stopTyping(); +} + +void LLNearbyChat::displaySpeakingIndicator() +{ + LLSpeakerMgr::speaker_list_t speaker_list; + LLUUID id; + + id.setNull(); + mSpeakerMgr->update(TRUE); + mSpeakerMgr->getSpeakerList(&speaker_list, FALSE); + + for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) + { + LLPointer s = *i; + if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING) + { + id = s->mID; + break; + } + } + + if (!id.isNull()) + { + mOutputMonitor->setVisible(TRUE); + mOutputMonitor->setSpeakerId(id); + } + else + { + mOutputMonitor->setVisible(FALSE); + } +} + +void LLNearbyChat::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) +{ + sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); +} + +void LLNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) +{ + // Look for "/20 foo" channel chats. + S32 channel = 0; + LLWString out_text = stripChannelNumber(wtext, &channel); + std::string utf8_out_text = wstring_to_utf8str(out_text); + std::string utf8_text = wstring_to_utf8str(wtext); + + utf8_text = utf8str_trim(utf8_text); + if (!utf8_text.empty()) + { + utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); + } + + // Don't animate for chats people can't hear (chat to scripts) + if (animate && (channel == 0)) + { + if (type == CHAT_TYPE_WHISPER) + { + lldebugs << "You whisper " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_NORMAL) + { + lldebugs << "You say " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_SHOUT) + { + lldebugs << "You shout " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); + } + else + { + llinfos << "send_chat_from_viewer() - invalid volume" << llendl; + return; + } + } + else + { + if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) + { + lldebugs << "Channel chat: " << utf8_text << llendl; + } + } + + send_chat_from_viewer(utf8_out_text, type, channel); +} + +// static +void LLNearbyChat::startChat(const char* line) +{ + LLNearbyChat* cb = LLNearbyChat::getInstance(); + + if (cb ) + { + cb->setVisible(TRUE); + cb->setFocus(TRUE); + cb->mChatBox->setFocus(TRUE); + + if (line) + { + std::string line_string(line); + cb->mChatBox->setText(line_string); + } + + cb->mChatBox->setCursorToEnd(); + } +} + +// Exit "chat mode" and do the appropriate focus changes +// static +void LLNearbyChat::stopChat() +{ + LLNearbyChat* cb = LLNearbyChat::getInstance(); + + if (cb) + { + cb->mChatBox->setFocus(FALSE); + + // stop typing animation + gAgent.stopTyping(); + } +} + +// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. +// Otherwise returns input and channel 0. +LLWString LLNearbyChat::stripChannelNumber(const LLWString &mesg, S32* channel) +{ + if (mesg[0] == '/' + && mesg[1] == '/') + { + // This is a "repeat channel send" + *channel = sLastSpecialChatChannel; + return mesg.substr(2, mesg.length() - 2); + } + else if (mesg[0] == '/' + && mesg[1] + && LLStringOps::isDigit(mesg[1])) + { + // This a special "/20" speak on a channel + S32 pos = 0; + + // Copy the channel number into a string + LLWString channel_string; + llwchar c; + do + { + c = mesg[pos+1]; + channel_string.push_back(c); + pos++; + } + while(c && pos < 64 && LLStringOps::isDigit(c)); + + // Move the pointer forward to the first non-whitespace char + // Check isspace before looping, so we can handle "/33foo" + // as well as "/33 foo" + while(c && iswspace(c)) + { + c = mesg[pos+1]; + pos++; + } + + sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + *channel = sLastSpecialChatChannel; + return mesg.substr(pos, mesg.length() - pos); + } + else + { + // This is normal chat. + *channel = 0; + return mesg; + } +} + +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ChatFromViewer); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ChatData); + msg->addStringFast(_PREHASH_Message, utf8_out_text); + msg->addU8Fast(_PREHASH_Type, type); + msg->addS32("Channel", channel); + + gAgent.sendReliableMessage(); + + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); +} + +class LLChatCommandHandler : public LLCommandHandler +{ +public: + // not allowed from outside the app + LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { } + + // Your code here + bool handle(const LLSD& tokens, const LLSD& query_map, + LLMediaCtrl* web) + { + bool retval = false; + // Need at least 2 tokens to have a valid message. + if (tokens.size() < 2) + { + retval = false; + } + else + { + S32 channel = tokens[0].asInteger(); + // VWR-19499 Restrict function to chat channels greater than 0. + if ((channel > 0) && (channel < CHAT_CHANNEL_DEBUG)) + { + retval = true; + // Send unescaped message, see EXT-6353. + std::string unescaped_mesg (LLURI::unescape(tokens[1].asString())); + send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel); + } + else + { + retval = false; + // Tell us this is an unsupported SLurl. + } + } + return retval; + } +}; + +// Creating the object registers with the dispatcher. +LLChatCommandHandler gChatHandler; diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 62a41c17cb..b38111defa 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -1,8 +1,8 @@ - /** +/** * @file llnearbychat.h - * @brief nearby chat history scrolling panel implementation + * @brief LLNearbyChat class definition * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * @@ -24,9 +24,16 @@ * $/LicenseInfo$ */ -#ifndef LL_LLNEARBYCHAT_H_ -#define LL_LLNEARBYCHAT_H_ +#ifndef LL_LLNEARBYCHAT_H +#define LL_LLNEARBYCHAT_H +#include "llimconversation.h" +#include "llcombobox.h" +#include "llgesturemgr.h" +#include "llchat.h" +#include "llvoiceclient.h" +#include "lloutputmonitorctrl.h" +#include "llspeakers.h" #include "llscrollbar.h" #include "llviewerchat.h" #include "llpanel.h" @@ -35,32 +42,88 @@ class LLResizeBar; class LLChatHistory; class LLNearbyChat - : public LLPanel + : public LLIMConversation { public: - LLNearbyChat(const Params& p = LLPanel::getDefaultParams()); + // constructor for inline chat-bars (e.g. hosted in chat history window) + LLNearbyChat(const LLSD& key); + ~LLNearbyChat() {} - BOOL postBuild (); - - /** @param archive true - to save a message to the chat history log */ - void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); - void onNearbyChatContextMenuItemClicked(const LLSD& userdata); - bool onNearbyChatCheckContextMenuItem(const LLSD& userdata); - - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual void draw(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); // focus overrides /*virtual*/ void onFocusLost(); /*virtual*/ void onFocusReceived(); - + /*virtual*/ void setVisible(BOOL visible); - + void loadHistory(); void reloadMessages(); - static LLNearbyChat* getInstance(); void removeScreenChat(); + static LLNearbyChat* getInstance(); + + void addToHost(); + + /** @param archive true - to save a message to the chat history log */ + void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); + void onNearbyChatContextMenuItemClicked(const LLSD& userdata); + bool onNearbyChatCheckContextMenuItem(const LLSD& userdata); + + LLLineEditor* getChatBox() { return mChatBox; } + + //virtual void draw(); + + std::string getCurrentChat(); + + virtual BOOL handleKeyHere( KEY key, MASK mask ); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + static void startChat(const char* line); + static void stopChat(); + + static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); + static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); + + void showHistory(); + void showTranslationCheckbox(BOOL show); + +protected: + static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); + static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); + static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata); + void onChatBoxFocusReceived(); + + void sendChat( EChatType type ); + void onChatBoxCommit(); + void onChatFontChange(LLFontGL* fontp); + + /* virtual */ bool applyRectControl(); + + void onToggleNearbyChatPanel(); + + static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); + EChatType processChatTypeTriggers(EChatType type, std::string &str); + + void displaySpeakingIndicator(); + + void onCallButtonClicked(); + + // set the enable/disable state for the Call button + virtual void enableDisableCallBtn(); + + // Which non-zero channel did we last chat on? + static S32 sLastSpecialChatChannel; + + LLLineEditor* mChatBox; + LLOutputMonitorCtrl* mOutputMonitor; + LLLocalSpeakerMgr* mSpeakerMgr; + + S32 mExpandedHeight; + + /*virtual*/ BOOL tick(); + private: void getAllowedRect (LLRect& rect); @@ -68,14 +131,10 @@ private: void appendMessage(const LLChat& chat, const LLSD &args = 0); void onNearbySpeakers (); - -private: LLHandle mPopupMenuHandle; + std::vector mMessageArchive; LLChatHistory* mChatHistory; - std::vector mMessageArchive; }; #endif - - diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp deleted file mode 100644 index 68934be11a..0000000000 --- a/indra/newview/llnearbychatbar.cpp +++ /dev/null @@ -1,709 +0,0 @@ -/** - * @file llnearbychatbar.cpp - * @brief LLNearbyChatBar class implementation - * - * $LicenseInfo:firstyear=2002&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 "message.h" - -#include "llappviewer.h" -#include "llfloaterreg.h" -#include "lltrans.h" -#include "llimfloatercontainer.h" -#include "llfirstuse.h" -#include "llnearbychatbar.h" -#include "llagent.h" -#include "llgesturemgr.h" -#include "llmultigesture.h" -#include "llkeyboard.h" -#include "llanimationstates.h" -#include "llviewerstats.h" -#include "llcommandhandler.h" -#include "llviewercontrol.h" -#include "llnavigationbar.h" -#include "llwindow.h" -#include "llviewerwindow.h" -#include "llrootview.h" -#include "llviewerchat.h" -#include "llnearbychat.h" -#include "lltranslate.h" - -#include "llresizehandle.h" - -S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; - -const S32 EXPANDED_HEIGHT = 266; -const S32 COLLAPSED_HEIGHT = 60; -const S32 EXPANDED_MIN_HEIGHT = 150; - -// legacy callback glue -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); - -struct LLChatTypeTrigger { - std::string name; - EChatType type; -}; - -static LLChatTypeTrigger sChatTypeTriggers[] = { - { "/whisper" , CHAT_TYPE_WHISPER}, - { "/shout" , CHAT_TYPE_SHOUT} -}; - -LLNearbyChatBar::LLNearbyChatBar(const LLSD& key) -: LLIMConversation(key), - mChatBox(NULL), - mNearbyChat(NULL), - mOutputMonitor(NULL), - mSpeakerMgr(NULL), - mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) -{ - mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); -} - -//virtual -BOOL LLNearbyChatBar::postBuild() -{ - mChatBox = getChild("chat_box"); - - mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this)); - mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); - mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this)); - mChatBox->setFocusReceivedCallback(boost::bind(&LLNearbyChatBar::onChatBoxFocusReceived, this)); - - mChatBox->setIgnoreArrowKeys( FALSE ); - mChatBox->setCommitOnFocusLost( FALSE ); - mChatBox->setRevertOnEsc( FALSE ); - mChatBox->setIgnoreTab(TRUE); - mChatBox->setPassDelete(TRUE); - mChatBox->setReplaceNewlinesWithSpaces(FALSE); - mChatBox->setEnableLineHistory(TRUE); - mChatBox->setFont(LLViewerChat::getChatFont()); - - mNearbyChat = getChildView("nearby_chat"); - - LLUICtrl* show_btn = getChild("show_nearby_chat"); - show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this)); - - mOutputMonitor = getChild("chat_zone_indicator"); - mOutputMonitor->setVisible(FALSE); - - gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE); - - mNearbyChat->setVisible(gSavedSettings.getBOOL("nearbychat_history_visibility")); - - // Register for font change notifications - LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1)); - - enableResizeCtrls(true, true, false); - - addToHost(); - - return LLIMConversation::postBuild();; -} - -void LLNearbyChatBar::enableDisableCallBtn() -{ - // bool btn_enabled = LLAgent::isActionAllowed("speak"); - - getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/); -} - -void LLNearbyChatBar::addToHost() -{ - if (LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - - if (im_box) - { - im_box->addFloater(this, FALSE, LLTabContainer::END); - } - } -} - -// virtual -void LLNearbyChatBar::onOpen(const LLSD& key) -{ - LLIMConversation::onOpen(key); - showTranslationCheckbox(LLTranslate::isTranslationConfigured()); -} - -bool LLNearbyChatBar::applyRectControl() -{ - bool rect_controlled = LLFloater::applyRectControl(); - - if (!mNearbyChat->getVisible()) - { - reshape(getRect().getWidth(), getMinHeight()); - enableResizeCtrls(true, true, false); - } - else - { - enableResizeCtrls(true); - setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); - } - - return rect_controlled; -} - -void LLNearbyChatBar::onChatFontChange(LLFontGL* fontp) -{ - // Update things with the new font whohoo - if (mChatBox) - { - mChatBox->setFont(fontp); - } -} - -//static -LLNearbyChatBar* LLNearbyChatBar::getInstance() -{ - return LLFloaterReg::getTypedInstance("chat_bar"); -} - -//static -//LLNearbyChatBar* LLNearbyChatBar::findInstance() -//{ -// return LLFloaterReg::findTypedInstance("chat_bar"); -//} - -void LLNearbyChatBar::showHistory() -{ - openFloater(); - - if (!getChildView("nearby_chat")->getVisible()) - { - onToggleNearbyChatPanel(); - } -} - -void LLNearbyChatBar::showTranslationCheckbox(BOOL show) -{ - getChild("translate_chat_checkbox_lp")->setVisible(show); -} - -void LLNearbyChatBar::draw() -{ - displaySpeakingIndicator(); - updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); - LLIMConversation::draw(); -} - -std::string LLNearbyChatBar::getCurrentChat() -{ - return mChatBox ? mChatBox->getText() : LLStringUtil::null; -} - -// virtual -BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask ) -{ - BOOL handled = FALSE; - - if( KEY_RETURN == key && mask == MASK_CONTROL) - { - // shout - sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; - } - - return handled; -} - -BOOL LLNearbyChatBar::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) -{ - U32 in_len = in_str.length(); - S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); - - bool string_was_found = false; - - for (S32 n = 0; n < cnt && !string_was_found; n++) - { - if (in_len <= sChatTypeTriggers[n].name.length()) - { - std::string trigger_trunc = sChatTypeTriggers[n].name; - LLStringUtil::truncate(trigger_trunc, in_len); - - if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) - { - *out_str = sChatTypeTriggers[n].name; - string_was_found = true; - } - } - } - - return string_was_found; -} - -void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) -{ - LLFirstUse::otherAvatarChatFirst(false); - - LLNearbyChatBar* self = (LLNearbyChatBar *)userdata; - - LLWString raw_text = self->mChatBox->getWText(); - - // Can't trim the end, because that will cause autocompletion - // to eat trailing spaces that might be part of a gesture. - LLWStringUtil::trimHead(raw_text); - - S32 length = raw_text.length(); - - if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences - { - gAgent.startTyping(); - } - else - { - gAgent.stopTyping(); - } - - /* Doesn't work -- can't tell the difference between a backspace - that killed the selection vs. backspace at the end of line. - if (length > 1 - && text[0] == '/' - && key == KEY_BACKSPACE) - { - // the selection will already be deleted, but we need to trim - // off the character before - std::string new_text = raw_text.substr(0, length-1); - self->mInputEditor->setText( new_text ); - self->mInputEditor->setCursorToEnd(); - length = length - 1; - } - */ - - KEY key = gKeyboard->currentKey(); - - // Ignore "special" keys, like backspace, arrows, etc. - if (length > 1 - && raw_text[0] == '/' - && key < KEY_SPECIAL) - { - // we're starting a gesture, attempt to autocomplete - - std::string utf8_trigger = wstring_to_utf8str(raw_text); - std::string utf8_out_str(utf8_trigger); - - if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str)) - { - std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); - self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part - S32 outlength = self->mChatBox->getLength(); // in characters - - // Select to end of line, starting from the character - // after the last one the user typed. - self->mChatBox->setSelection(length, outlength); - } - else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str)) - { - std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); - self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part - self->mChatBox->setCursorToEnd(); - } - - //llinfos << "GESTUREDEBUG " << trigger - // << " len " << length - // << " outlen " << out_str.getLength() - // << llendl; - } -} - -// static -void LLNearbyChatBar::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata) -{ - // stop typing animation - gAgent.stopTyping(); -} - -void LLNearbyChatBar::onChatBoxFocusReceived() -{ - mChatBox->setEnabled(!gDisconnected); -} - -EChatType LLNearbyChatBar::processChatTypeTriggers(EChatType type, std::string &str) -{ - U32 length = str.length(); - S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); - - for (S32 n = 0; n < cnt; n++) - { - if (length >= sChatTypeTriggers[n].name.length()) - { - std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length()); - - if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) - { - U32 trigger_length = sChatTypeTriggers[n].name.length(); - - // It's to remove space after trigger name - if (length > trigger_length && str[trigger_length] == ' ') - trigger_length++; - - str = str.substr(trigger_length, length); - - if (CHAT_TYPE_NORMAL == type) - return sChatTypeTriggers[n].type; - else - break; - } - } - } - - return type; -} - -void LLNearbyChatBar::sendChat( EChatType type ) -{ - if (mChatBox) - { - LLWString text = mChatBox->getConvertedText(); - if (!text.empty()) - { - // store sent line in history, duplicates will get filtered - mChatBox->updateHistory(); - // Check if this is destined for another channel - S32 channel = 0; - stripChannelNumber(text, &channel); - - std::string utf8text = wstring_to_utf8str(text); - // Try to trigger a gesture, if not chat to a script. - std::string utf8_revised_text; - if (0 == channel) - { - // discard returned "found" boolean - LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text); - } - else - { - utf8_revised_text = utf8text; - } - - utf8_revised_text = utf8str_trim(utf8_revised_text); - - type = processChatTypeTriggers(type, utf8_revised_text); - - if (!utf8_revised_text.empty()) - { - // Chat with animation - sendChatFromViewer(utf8_revised_text, type, TRUE); - } - } - - mChatBox->setText(LLStringExplicit("")); - } - - gAgent.stopTyping(); - - // If the user wants to stop chatting on hitting return, lose focus - // and go out of chat mode. - if (gSavedSettings.getBOOL("CloseChatOnReturn")) - { - stopChat(); - } -} - - -void LLNearbyChatBar::onToggleNearbyChatPanel() -{ - LLView* nearby_chat = getChildView("nearby_chat"); - - if (nearby_chat->getVisible()) - { - if (!isMinimized()) - { - mExpandedHeight = getRect().getHeight(); - } - setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT); - nearby_chat->setVisible(FALSE); - reshape(getRect().getWidth(), COLLAPSED_HEIGHT); - enableResizeCtrls(true, true, false); - storeRectControl(); - } - else - { - nearby_chat->setVisible(TRUE); - setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); - reshape(getRect().getWidth(), mExpandedHeight); - enableResizeCtrls(true); - storeRectControl(); - } - - gSavedSettings.setBOOL("nearbychat_history_visibility", mNearbyChat->getVisible()); -} - -void LLNearbyChatBar::reloadMessages() -{ - LLNearbyChat::getInstance()->reloadMessages(); -} - -void LLNearbyChatBar::setMinimized(BOOL b) -{ - LLNearbyChat* nearby_chat = getChild("nearby_chat"); - // when unminimizing with nearby chat visible, go ahead and kill off screen chats - if (!b && nearby_chat->getVisible()) - { - nearby_chat->removeScreenChat(); - } - LLFloater::setMinimized(b); -} - -void LLNearbyChatBar::onChatBoxCommit() -{ - if (mChatBox->getText().length() > 0) - { - sendChat(CHAT_TYPE_NORMAL); - } - - gAgent.stopTyping(); -} - -void LLNearbyChatBar::displaySpeakingIndicator() -{ - LLSpeakerMgr::speaker_list_t speaker_list; - LLUUID id; - - id.setNull(); - mSpeakerMgr->update(TRUE); - mSpeakerMgr->getSpeakerList(&speaker_list, FALSE); - - for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) - { - LLPointer s = *i; - if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING) - { - id = s->mID; - break; - } - } - - if (!id.isNull()) - { - mOutputMonitor->setVisible(TRUE); - mOutputMonitor->setSpeakerId(id); - } - else - { - mOutputMonitor->setVisible(FALSE); - } -} - -void LLNearbyChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) -{ - sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); -} - -void LLNearbyChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) -{ - // Look for "/20 foo" channel chats. - S32 channel = 0; - LLWString out_text = stripChannelNumber(wtext, &channel); - std::string utf8_out_text = wstring_to_utf8str(out_text); - std::string utf8_text = wstring_to_utf8str(wtext); - - utf8_text = utf8str_trim(utf8_text); - if (!utf8_text.empty()) - { - utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); - } - - // Don't animate for chats people can't hear (chat to scripts) - if (animate && (channel == 0)) - { - if (type == CHAT_TYPE_WHISPER) - { - lldebugs << "You whisper " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_NORMAL) - { - lldebugs << "You say " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_SHOUT) - { - lldebugs << "You shout " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); - } - else - { - llinfos << "send_chat_from_viewer() - invalid volume" << llendl; - return; - } - } - else - { - if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) - { - lldebugs << "Channel chat: " << utf8_text << llendl; - } - } - - send_chat_from_viewer(utf8_out_text, type, channel); -} - -// static -void LLNearbyChatBar::startChat(const char* line) -{ - LLNearbyChatBar* cb = LLNearbyChatBar::getInstance(); - - if (cb ) - { - cb->setVisible(TRUE); - cb->setFocus(TRUE); - cb->mChatBox->setFocus(TRUE); - - if (line) - { - std::string line_string(line); - cb->mChatBox->setText(line_string); - } - - cb->mChatBox->setCursorToEnd(); - } -} - -// Exit "chat mode" and do the appropriate focus changes -// static -void LLNearbyChatBar::stopChat() -{ - LLNearbyChatBar* cb = LLNearbyChatBar::getInstance(); - - if (cb) - { - cb->mChatBox->setFocus(FALSE); - - // stop typing animation - gAgent.stopTyping(); - } -} - -// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. -// Otherwise returns input and channel 0. -LLWString LLNearbyChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) -{ - if (mesg[0] == '/' - && mesg[1] == '/') - { - // This is a "repeat channel send" - *channel = sLastSpecialChatChannel; - return mesg.substr(2, mesg.length() - 2); - } - else if (mesg[0] == '/' - && mesg[1] - && LLStringOps::isDigit(mesg[1])) - { - // This a special "/20" speak on a channel - S32 pos = 0; - - // Copy the channel number into a string - LLWString channel_string; - llwchar c; - do - { - c = mesg[pos+1]; - channel_string.push_back(c); - pos++; - } - while(c && pos < 64 && LLStringOps::isDigit(c)); - - // Move the pointer forward to the first non-whitespace char - // Check isspace before looping, so we can handle "/33foo" - // as well as "/33 foo" - while(c && iswspace(c)) - { - c = mesg[pos+1]; - pos++; - } - - sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); - *channel = sLastSpecialChatChannel; - return mesg.substr(pos, mesg.length() - pos); - } - else - { - // This is normal chat. - *channel = 0; - return mesg; - } -} - -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) -{ - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - - gAgent.sendReliableMessage(); - - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); -} - -class LLChatCommandHandler : public LLCommandHandler -{ -public: - // not allowed from outside the app - LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { } - - // Your code here - bool handle(const LLSD& tokens, const LLSD& query_map, - LLMediaCtrl* web) - { - bool retval = false; - // Need at least 2 tokens to have a valid message. - if (tokens.size() < 2) - { - retval = false; - } - else - { - S32 channel = tokens[0].asInteger(); - // VWR-19499 Restrict function to chat channels greater than 0. - if ((channel > 0) && (channel < CHAT_CHANNEL_DEBUG)) - { - retval = true; - // Send unescaped message, see EXT-6353. - std::string unescaped_mesg (LLURI::unescape(tokens[1].asString())); - send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel); - } - else - { - retval = false; - // Tell us this is an unsupported SLurl. - } - } - return retval; - } -}; - -// Creating the object registers with the dispatcher. -LLChatCommandHandler gChatHandler; - - diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h deleted file mode 100644 index b7c4c993c6..0000000000 --- a/indra/newview/llnearbychatbar.h +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file llnearbychatbar.h - * @brief LLNearbyChatBar class definition - * - * $LicenseInfo:firstyear=2002&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_LLNEARBYCHATBAR_H -#define LL_LLNEARBYCHATBAR_H - -#include "llimconversation.h" -#include "llcombobox.h" -#include "llgesturemgr.h" -#include "llchat.h" -#include "llnearbychat.h" -#include "llvoiceclient.h" -#include "lloutputmonitorctrl.h" -#include "llspeakers.h" - -class LLNearbyChatBar : public LLIMConversation -{ -public: - // constructor for inline chat-bars (e.g. hosted in chat history window) - LLNearbyChatBar(const LLSD& key); - ~LLNearbyChatBar() {} - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - - static LLNearbyChatBar* getInstance(); -// static LLNearbyChatBar* findInstance(); - - void addToHost(); - - void reloadMessages(); - LLLineEditor* getChatBox() { return mChatBox; } - - virtual void draw(); - - std::string getCurrentChat(); - virtual BOOL handleKeyHere( KEY key, MASK mask ); - - static void startChat(const char* line); - static void stopChat(); - - static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); - static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); - - void showHistory(); - void showTranslationCheckbox(BOOL show); - /*virtual*/void setMinimized(BOOL b); - -protected: - static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); - static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); - static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata); - void onChatBoxFocusReceived(); - - void sendChat( EChatType type ); - void onChatBoxCommit(); - void onChatFontChange(LLFontGL* fontp); - - /* virtual */ bool applyRectControl(); - - void onToggleNearbyChatPanel(); - - static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); - EChatType processChatTypeTriggers(EChatType type, std::string &str); - - void displaySpeakingIndicator(); - - // set the enable/disable state for the Call button - virtual void enableDisableCallBtn(); - - // Which non-zero channel did we last chat on? - static S32 sLastSpecialChatChannel; - - LLLineEditor* mChatBox; - LLView* mNearbyChat; - LLOutputMonitorCtrl* mOutputMonitor; - LLLocalSpeakerMgr* mSpeakerMgr; - - S32 mExpandedHeight; -}; - -#endif diff --git a/indra/newview/llnearbychatbarlistener.cpp b/indra/newview/llnearbychatbarlistener.cpp index a63e1fb76e..61815d1864 100644 --- a/indra/newview/llnearbychatbarlistener.cpp +++ b/indra/newview/llnearbychatbarlistener.cpp @@ -29,14 +29,14 @@ #include "llviewerprecompiledheaders.h" #include "llnearbychatbarlistener.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llagent.h" #include "llchat.h" -LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChatBar & chatbar) +LLNearbyChatBarListener::LLNearbyChatBarListener(LLNearbyChat & chatbar) : LLEventAPI("LLChatBar", "LLChatBar listener to (e.g.) sendChat, etc."), mChatbar(chatbar) diff --git a/indra/newview/llnearbychatbarlistener.h b/indra/newview/llnearbychatbarlistener.h index 9af9bc1f7b..0537275424 100644 --- a/indra/newview/llnearbychatbarlistener.h +++ b/indra/newview/llnearbychatbarlistener.h @@ -33,17 +33,17 @@ #include "lleventapi.h" class LLSD; -class LLNearbyChatBar; +class LLNearbyChat; class LLNearbyChatBarListener : public LLEventAPI { public: - LLNearbyChatBarListener(LLNearbyChatBar & chatbar); + LLNearbyChatBarListener(LLNearbyChat & chatbar); private: void sendChat(LLSD const & chat_data) const; - LLNearbyChatBar & mChatbar; + LLNearbyChat & mChatbar; }; #endif // LL_LLNEARBYCHATBARLISTENER_H diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index f26cc85019..e91a3fc334 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -40,7 +40,7 @@ #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance #include "llviewerwindow.h"//for screen channel position -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llrootview.h" #include "lllayoutstack.h" @@ -487,9 +487,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, if(chat_msg.mText.empty()) return;//don't process empty messages - LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); - - LLNearbyChat* nearby_chat = chat_bar->findChild("nearby_chat"); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); // Build notification data LLSD chat; @@ -558,8 +556,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, sChatWatcher->post(chat); - if( !chat_bar->isMinimized() - && nearby_chat->isInVisibleChain() + if( nearby_chat->isInVisibleChain() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || mChannel.isDead() diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index a1d5db2e27..507c6686fd 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -29,7 +29,7 @@ #include "llfloaterreg.h" #include "llnearbychat.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llnotificationhandler.h" #include "llnotifications.h" #include "lltoastnotifypanel.h" @@ -86,8 +86,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification) // don't show toast if Nearby Chat is opened LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance(); - if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible()) + if (!nearby_chat->isMinimized() && nearby_chat->getVisible()) { return false; } diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index bc4097cd93..389baa86cd 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -41,85 +41,4 @@ #include "llspeakers.h" #include "lltrans.h" -LLPanelChatControlPanel::~LLPanelChatControlPanel() -{ -} -BOOL LLPanelChatControlPanel::postBuild() -{ - return TRUE; -} - -void LLPanelChatControlPanel::setSessionId(const LLUUID& session_id) -{ - //Method is called twice for AdHoc and Group chat. Second time when server init reply received - mSessionId = session_id; -} - - -LLPanelGroupControlPanel::LLPanelGroupControlPanel(const LLUUID& session_id): -mParticipantList(NULL) -{ -} - -BOOL LLPanelGroupControlPanel::postBuild() -{ - - return LLPanelChatControlPanel::postBuild(); -} - -LLPanelGroupControlPanel::~LLPanelGroupControlPanel() -{ - delete mParticipantList; - mParticipantList = NULL; -} - -// virtual -void LLPanelGroupControlPanel::draw() -{ - // Need to resort the participant list if it's in sort by recent speaker order. - if (mParticipantList) - mParticipantList->update(); - LLPanelChatControlPanel::draw(); -} - - -void LLPanelGroupControlPanel::onSortMenuItemClicked(const LLSD& userdata) -{ - // TODO: Check this code when when sort order menu will be added. (EM) - if (false && !mParticipantList) - return; - - std::string chosen_item = userdata.asString(); - - if (chosen_item == "sort_name") - { - mParticipantList->setSortOrder(LLParticipantList::E_SORT_BY_NAME); - } - -} - -void LLPanelGroupControlPanel::setSessionId(const LLUUID& session_id) -{ - LLPanelChatControlPanel::setSessionId(session_id); - - mGroupID = session_id; - - // for group and Ad-hoc chat we need to include agent into list - if(!mParticipantList) - { - LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(session_id); - mParticipantList = new LLParticipantList(speaker_manager, getChild("speakers_list"), true, false); - } -} - - -LLPanelAdHocControlPanel::LLPanelAdHocControlPanel(const LLUUID& session_id):LLPanelGroupControlPanel(session_id) -{ -} - -BOOL LLPanelAdHocControlPanel::postBuild() -{ - //We don't need LLPanelGroupControlPanel::postBuild() to be executed as there is no group_info_btn at AdHoc chat - return LLPanelChatControlPanel::postBuild(); -} diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 5ced32a9ab..df1962f5fe 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -134,7 +134,6 @@ #include "llscriptfloater.h" #include "llfloatermodelpreview.h" #include "llcommandhandler.h" -#include "llnearbychatbar.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -187,8 +186,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("chat_bar", "floater_chat_bar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -211,6 +208,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("help_browser", "floater_help_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("chat_bar", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("im_well_window", "floater_sys_well.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index a32a78cbf9..c7d37e102e 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -40,7 +40,7 @@ #include "llviewermessage.h" // send_guid_sound_trigger #include "llviewernetwork.h" #include "llagent.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" // Globals LLViewerGestureList gGestureList; @@ -130,7 +130,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) { // Don't play nodding animation, since that might not blend // with the gesture animation. - LLNearbyChatBar::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); + LLNearbyChat::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); } } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 1aa9fd8a45..385d3cd29a 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -31,7 +31,7 @@ #include "llmath.h" #include "llagent.h" #include "llagentcamera.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llviewercontrol.h" #include "llfocusmgr.h" #include "llmorphview.h" @@ -534,7 +534,7 @@ void stop_moving( EKeystate s ) void start_chat( EKeystate s ) { // start chat - LLNearbyChatBar::startChat(NULL); + LLNearbyChat::startChat(NULL); } void start_gesture( EKeystate s ) @@ -543,15 +543,15 @@ void start_gesture( EKeystate s ) if (KEYSTATE_UP == s && ! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) { - if (LLNearbyChatBar::getInstance()->getCurrentChat().empty()) + if (LLNearbyChat::getInstance()->getCurrentChat().empty()) { // No existing chat in chat editor, insert '/' - LLNearbyChatBar::startChat("/"); + LLNearbyChat::startChat("/"); } else { // Don't overwrite existing text in chat editor - LLNearbyChatBar::startChat(NULL); + LLNearbyChat::startChat(NULL); } } } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 32f693b009..5b8cf52298 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -185,7 +185,7 @@ #include "llviewerjoystick.h" #include "llviewernetwork.h" #include "llpostprocess.h" -#include "llnearbychatbar.h" +#include "llnearbychat.h" #include "llagentui.h" #include "llwearablelist.h" @@ -2482,7 +2482,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Traverses up the hierarchy if( keyboard_focus ) { - LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance("chat_bar"); + LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("chat_bar"); if (nearby_chat) { @@ -2549,11 +2549,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { - LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance("chat_bar")->getChatBox(); + LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance("chat_bar")->getChatBox(); if (chat_editor) { // passing NULL here, character will be added later when it is handled by character handler. - LLNearbyChatBar::getInstance()->startChat(NULL); + LLNearbyChat::getInstance()->startChat(NULL); return TRUE; } } diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml deleted file mode 100644 index 7688525e13..0000000000 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ /dev/null @@ -1,202 +0,0 @@ - - - VoicePTT_Off - VoicePTT_On - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index a332bb5b12..c5cacab9f4 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -138,18 +138,24 @@ top_pad="0" left="0"> - - + + - - - - + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml deleted file mode 100644 index d68fa6ca6c..0000000000 --- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - + width="31"/> + width="31"/> - - + top="31" + right="-1"/> diff --git a/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml new file mode 100644 index 0000000000..a63a14ca69 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml @@ -0,0 +1,62 @@ + + + + + + + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index ceb03d03a9..38a996547c 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -611,6 +611,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M filename="panel_block_list_sidetray.xml" follows="all" label="Blocked Residents & Objects" + layout="topleft" left="0" font="SansSerifBold" top="0" -- cgit v1.2.3 From afc6a7e6baeb9b568feb31cfd8eb978bb485c0c6 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 22 Jun 2012 20:05:35 +0300 Subject: CHUI-136 ADDITIONAL FIX (Implement new design for blocked list on the people floater) - If mute item type is LLMute::BY_NAME it means that it's an object and we should show corresponding icon - Also added icon for blocked groups --- indra/newview/llblockedlistitem.cpp | 11 ++++++++++- .../newview/skins/default/xui/en/panel_blocked_list_item.xml | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/indra/newview/llblockedlistitem.cpp b/indra/newview/llblockedlistitem.cpp index 14da35c85a..d9afd2b629 100644 --- a/indra/newview/llblockedlistitem.cpp +++ b/indra/newview/llblockedlistitem.cpp @@ -38,6 +38,7 @@ // newview #include "llavatariconctrl.h" +#include "llgroupiconctrl.h" #include "llinventoryicon.h" #include "llviewerobject.h" @@ -58,14 +59,22 @@ BOOL LLBlockedListItem::postBuild() switch (mMuteType) { case LLMute::AGENT: + case LLMute::EXTERNAL: { LLAvatarIconCtrl* avatar_icon = getChild("avatar_icon"); avatar_icon->setVisible(TRUE); avatar_icon->setValue(mItemID); } break; - + case LLMute::GROUP: + { + LLGroupIconCtrl* group_icon = getChild("group_icon"); + group_icon->setVisible(TRUE); + group_icon->setValue(mItemID); + } + break; case LLMute::OBJECT: + case LLMute::BY_NAME: getChild("object_icon")->setVisible(TRUE); break; diff --git a/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml index a63a14ca69..84e7e467b1 100644 --- a/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml @@ -37,6 +37,16 @@ top="2" visible="false" width="20" /> + Date: Fri, 22 Jun 2012 19:28:11 +0100 Subject: CHUI-136 : Fix compilation issue showing up when warning treated as errors --- indra/newview/llblocklist.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 521add4bdc..cb68f677eb 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -24,8 +24,11 @@ * $/LicenseInfo$ */ -#include "llavataractions.h" +#include "llviewerprecompiledheaders.h" + #include "llblocklist.h" + +#include "llavataractions.h" #include "llblockedlistitem.h" #include "llfloatersidepanelcontainer.h" #include "llviewermenu.h" -- cgit v1.2.3 From 74092930afdc294ef4d204830173d4750a310616 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 22 Jun 2012 14:13:20 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose build fix for gcc added detection of duplicate widget registration --- indra/llui/lluictrlfactory.cpp | 15 ++++++++------- indra/llui/lluictrlfactory.h | 4 ++-- indra/llxuixml/llregistry.h | 4 ++++ indra/newview/llfolderviewmodel.h | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 25e7a31e90..f64f33bc5e 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -278,13 +278,13 @@ const LLInitParam::BaseBlock& get_empty_param_block() // adds a widget and its param block to various registries //static -void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, const std::string& tag) +void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const std::type_info* param_block_type, const std::string& name) { // associate parameter block type with template .xml file - std::string* existing_tag = LLWidgetNameRegistry::instance().getValue(param_block_type); - if (existing_tag != NULL) + std::string* existing_name = LLWidgetNameRegistry::instance().getValue(param_block_type); + if (existing_name != NULL) { - if(*existing_tag != tag) + if(*existing_name != name) { std::cerr << "Duplicate entry for T::Params, try creating empty param block in derived classes that inherit T::Params" << std::endl; // forcing crash here @@ -293,18 +293,19 @@ void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const st } else { - // widget already registered + // widget already registered this name return; } } - LLWidgetNameRegistry::instance().defaultRegistrar().add(param_block_type, tag); + + LLWidgetNameRegistry::instance().defaultRegistrar().add(param_block_type, name); //FIXME: comment this in when working on schema generation //LLWidgetTypeRegistry::instance().defaultRegistrar().add(tag, widget_type); //LLDefaultParamBlockRegistry::instance().defaultRegistrar().add(widget_type, &get_empty_param_block); } //static -const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_type) +const std::string* LLUICtrlFactory::getWidgetName(const std::type_info* widget_type) { return LLWidgetNameRegistry::instance().getValue(widget_type); } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index d612ad5005..b441cb0c9d 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -105,7 +105,7 @@ private: ParamDefaults() { // look up template file for this param block... - const std::string* param_block_tag = getWidgetTag(&typeid(PARAM_BLOCK)); + const std::string* param_block_tag = getWidgetName(&typeid(PARAM_BLOCK)); if (param_block_tag) { // ...and if it exists, back fill values using the most specific template first PARAM_BLOCK params; @@ -303,7 +303,7 @@ private: } - static const std::string* getWidgetTag(const std::type_info* widget_type); + static const std::string* getWidgetName(const std::type_info* widget_type); // this exists to get around dependency on llview static void setCtrlParent(LLView* view, LLView* parent, S32 tab_group); diff --git a/indra/llxuixml/llregistry.h b/indra/llxuixml/llregistry.h index 36ce6a97b7..3e8d9267cc 100644 --- a/indra/llxuixml/llregistry.h +++ b/indra/llxuixml/llregistry.h @@ -302,6 +302,10 @@ public: virtual ~StaticRegistrar() {} StaticRegistrar(ref_const_key_t key, ref_const_value_t value) { + if (singleton_t::instance().exists(key)) + { + llerrs << "Duplicate registry entry under key \"" << key << "\"" << llendl; + } singleton_t::instance().mStaticScope->add(key, value); } }; diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index c3dcfed97c..74c8bb92ef 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -218,7 +218,7 @@ public: virtual S32 getSortVersion() = 0; virtual void setSortVersion(S32 version) = 0; protected: - friend LLFolderViewItem; + friend class LLFolderViewItem; void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} LLFolderViewItem* mFolderViewItem; -- cgit v1.2.3 From 9fc77dec8788944f93eda14567f9235f97637097 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Mon, 25 Jun 2012 15:49:49 +0300 Subject: CHUI-175 FIXED (Cannot use scroll bar on chat entry field when multi line chat is added) - This change also fixes: CHUI-176 (Only bottom 2 lines of multi line chat allow for selecting in text chat entry) CHUI-177 (Text entry field in chat only accepts 256 characters) --- .../skins/default/xui/en/floater_im_session.xml | 39 +++++++++------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 0720a4b011..56e591e2bb 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -235,29 +235,22 @@ - - - - + + -- cgit v1.2.3 From 9353a9e6ef071bd980c319d038b1dedb649d2db0 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 25 Jun 2012 23:55:25 +0300 Subject: CHUI-167 FIXED Move onClose() from LLIMFloater to it's basic class (LLIMConversation) for correct using add/remove conversation list items also for LLNearbyChat --- indra/newview/llimconversation.cpp | 14 +++++++ indra/newview/llimconversation.h | 1 + indra/newview/llimfloater.cpp | 84 ++++++++++++++++++-------------------- 3 files changed, 54 insertions(+), 45 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index cbebf3edd3..f304997abf 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -339,6 +339,20 @@ void LLIMConversation::onOpen(const LLSD& key) updateHeaderAndToolbar(); } +// virtual +void LLIMConversation::onClose(bool app_quitting) +{ + // Always suppress the IM from the conversations list on close if present for any reason + if (LLIMConversation::isChatMultiTab()) + { + LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); + if (im_box) + { + im_box->removeConversationListItem(mSessionID); + } + } +} + void LLIMConversation::onTearOffClicked() { onClickTearOff(this); diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index f4b8a38242..47c98d6f8b 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -63,6 +63,7 @@ public: // LLFloater overrides /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); protected: diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 98ebc82f99..37ee7b8a7c 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -105,51 +105,6 @@ void LLIMFloater::onFocusReceived() } } -// virtual -void LLIMFloater::onClose(bool app_quitting) -{ - // Always suppress the IM from the conversations list on close if present for any reason - if (LLIMConversation::isChatMultiTab()) - { - LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); - if (im_box) - { - im_box->removeConversationListItem(mSessionID); - } - } - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); - - if (session == NULL) - { - llwarns << "Empty session." << llendl; - return; - } - - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - - setTyping(false); - - // The source of much argument and design thrashing - // Should the window hide or the session close when the X is clicked? - // - // Last change: - // EXT-3516 X Button should end IM session, _ button should hide - gIMMgr->leaveSession(mSessionID); -} /* static */ void LLIMFloater::newIMCallback(const LLSD& data) @@ -611,6 +566,45 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) return conversation; } +void LLIMFloater::onClose(bool app_quitting) +{ + LLIMConversation::onClose(app_quitting); + + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + mSessionID); + + if (session == NULL) + { + llwarns << "Empty session." << llendl; + return; + } + + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + + setTyping(false); + + // The source of much argument and design thrashing + // Should the window hide or the session close when the X is clicked? + // + // Last change: + // EXT-3516 X Button should end IM session, _ button should hide + gIMMgr->leaveSession(mSessionID); + +} + void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { // update notification channel state -- cgit v1.2.3 From 7f3b27289da2478381dcb4d7e9f05e082e37eaa2 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 25 Jun 2012 21:59:13 +0300 Subject: CHUI-168 FIXED Added call of updateHeaderAndToolbar from postBuild for correct floater's title and standard buttons showing at start --- indra/newview/llimconversation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index f304997abf..d3f3e41a29 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -103,6 +103,7 @@ BOOL LLIMConversation::postBuild() } buildParticipantList(); + updateHeaderAndToolbar(); if (isChatMultiTab()) { -- cgit v1.2.3 From 5b6db72c5b7c5c3c4cfde671480ec1fc56bbd859 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 25 Jun 2012 13:04:09 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose all inventory names are correctly initialized now --- indra/newview/llinventorybridge.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c0670b71d4..70a174a140 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1844,14 +1844,17 @@ void LLFolderBridge::buildDisplayName() const //"Accessories" inventory category has folder type FT_NONE. So, this folder //can not be detected as protected with LLFolderType::lookupIsProtectedType + mDisplayName.assign(getName()); if (accessories || LLFolderType::lookupIsProtectedType(preferred_type)) { LLTrans::findString(mDisplayName, std::string("InvFolder ") + getName(), LLSD()); } - else - { - mDisplayName.assign(getName()); - } + + //if (mDisplayName.empty()) + //{ + // S32 foo; + // foo = 0; + //} } -- cgit v1.2.3 From 41e965c12e29136d2b81a9b67d6b6c9af4fb2092 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 25 Jun 2012 15:20:52 -0700 Subject: CHUI-139 : Hide torn off floaters when hiding conversation list; make nearby chat always present; leave conversation list around when all torn off --- indra/llui/llmultifloater.h | 4 +-- indra/newview/llimconversation.cpp | 6 +++- indra/newview/llimfloatercontainer.cpp | 51 ++++++++++++++++++++++++++++++++-- indra/newview/llimfloatercontainer.h | 6 ++++ 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index f299ae5dd3..44514a6246 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -45,8 +45,8 @@ public: virtual BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void draw(); - /*virtual*/ void setVisible(BOOL visible); + virtual void draw(); + virtual void setVisible(BOOL visible); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index bbbc9fcffd..cbebf3edd3 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -106,6 +106,10 @@ BOOL LLIMConversation::postBuild() if (isChatMultiTab()) { + if (mIsNearbyChat) + { + setCanClose(FALSE); + } return LLFloater::postBuild(); } else @@ -246,7 +250,7 @@ void LLIMConversation::updateHeaderAndToolbar() mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); - mCloseBtn->setVisible(is_hosted); + mCloseBtn->setVisible(is_hosted && !mIsNearbyChat); enableDisableCallBtn(); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a2a54bf02c..33b96b20f3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -103,14 +103,14 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { - LLMultiFloater::onOpen(key); if (getFloaterCount() == 0) { - // If there's *no* conversation open so far, we force the opening of the nearby chat conversation + // We always force the opening of the nearby chat conversation when we open for the first time // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("chat_bar"); LLFloaterReg::toggleInstanceOrBringToFront(name); } + LLMultiFloater::onOpen(key); /* if (key.isDefined()) { @@ -284,6 +284,44 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +void LLIMFloaterContainer::draw() +{ + if (mTabContainer->getTabCount() == 0) + { + // Do not close the container when every conversation is torn off because the user + // still needs the conversation list. Simply collapse the message pane in that case. + collapseMessagesPane(true); + } + LLFloater::draw(); +} + +void LLIMFloaterContainer::tabClose() +{ + if (mTabContainer->getTabCount() == 0) + { + // Do not close the container when every conversation is torn off because the user + // still needs the conversation list. Simply collapse the message pane in that case. + collapseMessagesPane(true); + } +} + +void LLIMFloaterContainer::setVisible(BOOL visible) +{ + // We need to show/hide all the associated conversations that have been torn off + // (and therefore, are not longer managed by the multifloater), + // so that they show/hide with the conversations manager. + conversations_items_map::iterator item_it = mConversationsItems.begin(); + for (;item_it != mConversationsItems.end(); ++item_it) + { + LLConversationItem* item = item_it->second; + item->setVisibleIfDetached(visible); + } + + // Now, do the normal multifloater show/hide + LLMultiFloater::setVisible(visible); + +} + void LLIMFloaterContainer::collapseMessagesPane(bool collapse) { if (mMessagesPane->isCollapsed() == collapse) @@ -485,6 +523,15 @@ void LLConversationItem::selectItem(void) mFloater->setFocus(TRUE); } +void LLConversationItem::setVisibleIfDetached(BOOL visible) +{ + // Do this only if the conversation floater has been torn off (i.e. no multi floater host) + if (!mFloater->getHost()) + { + mFloater->setVisible(visible); + } +} + void LLConversationItem::performAction(LLInventoryModel* model, std::string action) { } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 3d1324c2fb..c6e7c6a3d9 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -97,6 +97,8 @@ public: virtual void previewItem( void ); virtual void selectItem(void); virtual void showProperties(void); + + void setVisibleIfDetached(BOOL visible); // This method should be called when a drag begins. // Returns TRUE if the drag can begin, FALSE otherwise. @@ -128,6 +130,8 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void draw(); + /*virtual*/ void setVisible(BOOL visible); void onCloseFloater(LLUUID& id); /*virtual*/ void addFloater(LLFloater* floaterp, @@ -135,6 +139,8 @@ public: LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); /*virtual*/ void removeFloater(LLFloater* floaterp); + /*virtual*/ void tabClose(); + static LLFloater* getCurrentVoiceFloater(); static LLIMFloaterContainer* findInstance(); -- cgit v1.2.3 From 9c11a6b206f2455e37cf3ba8719bf6b51bc994e8 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 26 Jun 2012 18:58:57 +0300 Subject: CHUI-177 ADDITIONAL FIX (Text entry field in chat only accepts 256 characters) - Limited text entry field to 1024 instead of 1025 characters should take into account zero (0 ... 1023) --- indra/newview/skins/default/xui/en/floater_im_session.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 56e591e2bb..08bc46a506 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -246,7 +246,7 @@ label="To" layout="bottomleft" name="chat_editor" - max_length="1024" + max_length="1023" tab_group="3" width="240" wrap="true"> -- cgit v1.2.3 From 677c205131e695eb5a3b2a190799330b49d636d8 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 26 Jun 2012 19:08:27 +0300 Subject: CHUI-182 FIXED (Vertical scrollbar flashes on and off when chat entry text area expands) - To avoid unnecessary appearing of scrollbar, first chat entry must be expanded and only then decision should be taken in the base class whether scrollbar should be shown or not. --- indra/llui/llchatentry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index a6ba125406..2a6ccc3dc9 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -57,12 +57,12 @@ LLChatEntry::~LLChatEntry() void LLChatEntry::draw() { - LLTextEditor::draw(); - if(mIsExpandable) { expandText(); } + + LLTextEditor::draw(); } void LLChatEntry::onCommit() -- cgit v1.2.3 From abe106bd9c33fef12dcf4eacca228d5d669d9e34 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 26 Jun 2012 19:27:19 +0300 Subject: - CHUI-178 (Right click context menu not present in chat entry field) - Set parameter to true to show context menu --- indra/newview/skins/default/xui/en/widgets/chat_editor.xml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/widgets/chat_editor.xml diff --git a/indra/newview/skins/default/xui/en/widgets/chat_editor.xml b/indra/newview/skins/default/xui/en/widgets/chat_editor.xml new file mode 100644 index 0000000000..f9facb593a --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/chat_editor.xml @@ -0,0 +1,4 @@ + + -- cgit v1.2.3 From c233f0c9494d7dddbd8baab0f87b0ad54f42b0f9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 26 Jun 2012 17:05:16 -0700 Subject: CHUI-164 : Fix crash when closing ad-hoc conversations; insure consistency of the conversation list when adding and removing items from it --- indra/newview/llimfloater.cpp | 9 ++++-- indra/newview/llimfloatercontainer.cpp | 56 +++++++++++++++++++++++++++------- indra/newview/llimfloatercontainer.h | 8 +++-- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 98ebc82f99..f89bafc7ea 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -540,8 +540,10 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } + // Test the existence of the floater before we try to create it bool exist = findInstance(session_id); + // Get the floater: this will create the instance if it didn't exist LLIMFloater* floater = getInstance(session_id); if (!floater) return NULL; @@ -550,18 +552,21 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - // do not add existed floaters to avoid adding torn off instances + // Do not add again existing floaters if (!exist) { // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; - if (floater_container) { floater_container->addFloater(floater, TRUE, i_pt); } } + + // Add a conversation list item in the left pane: nothing will be done if already in there + // but relevant clean up will be done to ensure consistency of the conversation list + floater_container->addConversationListItem(floater->getTitle(), session_id, floater); floater->openFloater(floater->getKey()); } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 33b96b20f3..f6bcf8bbe9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -146,7 +146,7 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLUUID session_id = floaterp->getKey(); // Add a conversation list item in the left pane - addConversationListItem(floaterp->getTitle(), session_id, floaterp, this); + addConversationListItem(floaterp->getTitle(), session_id, floaterp); LLView* floater_contents = floaterp->getChild("contents_view"); @@ -408,18 +408,33 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } // CHUI-137 : Temporary implementation of conversations list -void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) +void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { - // Check if the item is not already in the list, exit if it is (nothing to do) + // Check if the item is not already in the list, exit if it is and has the same name and points to the same floater (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - return; + LLConversationItem* item = item_it->second; + // Check if the item has changed + if (item->hasSameValues(name,floaterp)) + { + // If it hasn't, nothing to do -> exit + return; + } + // If it has, remove it: it'll be recreated anew further down + removeConversationListItem(uuid,false); + } + + // Reverse find and clean up: we need to make sure that no other uuid is pointing to that same floater + LLUUID found_id = LLUUID::null; + if (findConversationItem(floaterp,found_id)) + { + removeConversationListItem(found_id,false); } // Create a conversation item - LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, containerp); + LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); mConversationsItems[uuid] = item; // Create a widget from it @@ -439,7 +454,7 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, bool change_focus) { // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting @@ -469,16 +484,35 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id) } // Don't let the focus fall IW, select and refocus on the first conversation in the list - setFocus(TRUE); - conversations_items_map::iterator item_it = mConversationsItems.begin(); - if (item_it != mConversationsItems.end()) + if (change_focus) { - LLConversationItem* item = item_it->second; - item->selectItem(); + setFocus(TRUE); + conversations_items_map::iterator item_it = mConversationsItems.begin(); + if (item_it != mConversationsItems.end()) + { + LLConversationItem* item = item_it->second; + item->selectItem(); + } } return; } +bool LLIMFloaterContainer::findConversationItem(LLFloater* floaterp, LLUUID& uuid) +{ + bool found = false; + for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) + { + LLConversationItem* item = item_it->second; + uuid = item_it->first; + if (item->hasSameValue(floaterp)) + { + found = true; + break; + } + } + return found; +} + LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index c6e7c6a3d9..2a8cbf3e1c 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -112,6 +112,9 @@ public: EDragAndDropType cargo_type, void* cargo_data, std::string& tooltip_msg) { return FALSE; } + + bool hasSameValues(std::string name, LLFloater* floaterp) { return ((name == mName) && (floaterp == mFloater)); } + bool hasSameValue(LLFloater* floaterp) { return (floaterp == mFloater); } private: std::string mName; const LLUUID mUUID; @@ -183,9 +186,10 @@ private: // CHUI-137 : Temporary implementation of conversations list public: - void removeConversationListItem(const LLUUID& session_id); + void removeConversationListItem(const LLUUID& session_id, bool change_focus = true); + void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); + bool findConversationItem(LLFloater* floaterp, LLUUID& uuid); private: - void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); // Conversation list data LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) -- cgit v1.2.3 From a7831406abfe87e9bd1da8091e008edcd65b402c Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 27 Jun 2012 18:52:08 +0300 Subject: CHUI-180 FIXED (Started an ad hoc IM spams log with drawtext warning) - Don't draw TextBase context if it's empty and in focus --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c112a7e477..3b3bc64c5b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -508,7 +508,7 @@ void LLTextBase::drawText() { return; } - else if (text_len <= 0 && !mLabel.empty()) + else if (text_len <= 0 && !mLabel.empty() && !hasFocus()) { text_len = mLabel.length(); } -- cgit v1.2.3 From 0cfea7b406c87bf593d2f7cf6040d92ef99b64cf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 26 Jun 2012 01:38:59 +0300 Subject: CHUI-147 FIX Added updating conference participants in IM floater title - The title is updated with the data from participants list widget in IM floater. - Creating the participants list is fixed for the case of starting the ad hoc session when the session id changes upon initialization (see LLIMConversation::buildParticipantList()). - LLEventTimer replaced with simple LLTimer to avoid crashes in LLEventTimer::tick(). - Moved the build_residents_string() code to LLAvatarActions::buildResidentsString() to use it in LLIMFloater::onParticipantsListChanged(). --- indra/newview/llavataractions.cpp | 35 +++++++------- indra/newview/llavataractions.h | 9 ++++ indra/newview/llimconversation.cpp | 34 +++++++++----- indra/newview/llimconversation.h | 10 ++-- indra/newview/llimfloater.cpp | 93 ++++++++++++++++++++++++++++--------- indra/newview/llimfloater.h | 9 +++- indra/newview/llnearbychat.cpp | 36 ++++++-------- indra/newview/llnearbychat.h | 6 +-- indra/newview/llparticipantlist.cpp | 1 + 9 files changed, 151 insertions(+), 82 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index c9031dd26a..21367c224d 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -529,23 +529,6 @@ namespace action_give_inventory return acceptable; } - static void build_residents_string(const std::vector avatar_names, std::string& residents_string) - { - llassert(avatar_names.size() > 0); - - const std::string& separator = LLTrans::getString("words_separator"); - for (std::vector::const_iterator it = avatar_names.begin(); ; ) - { - LLAvatarName av_name = *it; - residents_string.append(av_name.mDisplayName); - if (++it == avatar_names.end()) - { - break; - } - residents_string.append(separator); - } - } - static void build_items_string(const std::set& inventory_selected_uuids , std::string& items_string) { llassert(inventory_selected_uuids.size() > 0); @@ -675,7 +658,7 @@ namespace action_give_inventory } std::string residents; - build_residents_string(avatar_names, residents); + LLAvatarActions::buildResidentsString(avatar_names, residents); std::string items; build_items_string(inventory_selected_uuids, items); @@ -706,7 +689,23 @@ namespace action_give_inventory } } +// static +void LLAvatarActions::buildResidentsString(const std::vector avatar_names, std::string& residents_string) +{ + llassert(avatar_names.size() > 0); + const std::string& separator = LLTrans::getString("words_separator"); + for (std::vector::const_iterator it = avatar_names.begin(); ; ) + { + LLAvatarName av_name = *it; + residents_string.append(av_name.mDisplayName); + if (++it == avatar_names.end()) + { + break; + } + residents_string.append(separator); + } +} //static std::set LLAvatarActions::getInventorySelectedUUIDs() diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 0a69ad86a3..46830eb22c 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -34,6 +34,7 @@ #include #include +class LLAvatarName; class LLInventoryPanel; class LLFloater; @@ -208,6 +209,14 @@ public: */ static bool canShareSelectedItems(LLInventoryPanel* inv_panel = NULL); + /** + * Builds a string of residents' display names separated by "words_separator" string. + * + * @param avatar_names - a vector of given avatar names from which resulting string is built + * @param residents_string - the resulting string + */ + static void buildResidentsString(const std::vector avatar_names, std::string& residents_string); + static std::set getInventorySelectedUUIDs(); private: diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index d3f3e41a29..c734c3edd2 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -42,7 +42,6 @@ const F32 REFRESH_INTERVAL = 0.2f; LLIMConversation::LLIMConversation(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id) - , LLEventTimer(REFRESH_INTERVAL) , mIsP2PChat(false) , mExpandCollapseBtn(NULL) , mTearOffBtn(NULL) @@ -52,6 +51,7 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) , mChatHistory(NULL) , mInputEditor(NULL) , mInputEditorTopPad(0) + , mRefreshTimer(new LLTimer()) { mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2)); @@ -67,6 +67,10 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) boost::bind(&LLIMConversation::onIMShowModesMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", boost::bind(&LLIMConversation::onIMShowModesMenuItemEnable, this, _2)); + + // Zero expiry time is set only once to allow initial update. + mRefreshTimer->setTimerExpirySec(0); + mRefreshTimer->start(); } LLIMConversation::~LLIMConversation() @@ -76,6 +80,8 @@ LLIMConversation::~LLIMConversation() delete mParticipantList; mParticipantList = NULL; } + + delete mRefreshTimer; } BOOL LLIMConversation::postBuild() @@ -120,19 +126,22 @@ BOOL LLIMConversation::postBuild() } -BOOL LLIMConversation::tick() +void LLIMConversation::draw() { - // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater - // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). - if (isDead()) return false; + LLTransientDockableFloater::draw(); - // Need to resort the participant list if it's in sort by recent speaker order. - if (mParticipantList) + if (mRefreshTimer->hasExpired()) { - mParticipantList->update(); - } + if (mParticipantList) + { + mParticipantList->update(); + } - return false; + refresh(); + + // Restart the refresh timer + mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL); + } } void LLIMConversation::buildParticipantList() @@ -144,10 +153,11 @@ void LLIMConversation::buildParticipantList() } else { + LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(mSessionID); // for group and ad-hoc chat we need to include agent into list - if(!mIsP2PChat && !mParticipantList && mSessionID.notNull()) + if(!mIsP2PChat && mSessionID.notNull() && speaker_manager) { - LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + delete mParticipantList; // remove the old list and create a new one if the session id has changed mParticipantList = new LLParticipantList(speaker_manager, getChild("speakers_list"), true, false); } } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 47c98d6f8b..50663137ac 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -40,7 +40,6 @@ class LLChatHistory; class LLIMConversation : public LLTransientDockableFloater - , public LLEventTimer { public: @@ -65,6 +64,7 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); protected: @@ -89,8 +89,6 @@ protected: void buildParticipantList(); void onSortMenuItemClicked(const LLSD& userdata); - /*virtual*/ BOOL tick(); - bool mIsNearbyChat; bool mIsP2PChat; @@ -103,6 +101,9 @@ protected: LLButton* mCloseBtn; private: + /// Refreshes the floater at a constant rate. + virtual void refresh() = 0; + /// Update floater header and toolbar buttons when hosted/torn off state is toggled. void updateHeaderAndToolbar(); @@ -113,10 +114,11 @@ private: */ void reshapeChatHistory(); - LLChatHistory* mChatHistory; LLChatEntry* mInputEditor; int mInputEditorTopPad; // padding between input field and chat history + + LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called. }; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9ea4bec069..6a5bf153d4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -105,6 +105,18 @@ void LLIMFloater::onFocusReceived() } } +// virtual +void LLIMFloater::refresh() +{ + if (mMeTyping) + { + // Time out if user hasn't typed for a while. + if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) + { + setTyping(false); + } + } +} /* static */ void LLIMFloater::newIMCallback(const LLSD& data) @@ -188,6 +200,7 @@ void LLIMFloater::sendMsg() LLIMFloater::~LLIMFloater() { + mParticipantsListRefreshConnection.disconnect(); mVoiceChannelStateChangeConnection.disconnect(); if(LLVoiceClient::instanceExists()) { @@ -225,6 +238,8 @@ void LLIMFloater::initIMFloater() boundVoiceChannel(); + mTypingStart = LLTrans::getString("IM_typing_start_string"); + // Show control panel in torn off floaters only. mParticipantListPanel->setVisible(!getHost() && gSavedSettings.getBOOL("IMShowControlPanel")); @@ -246,6 +261,20 @@ void LLIMFloater::initIMFloater() { std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name, session_name); + + // For ad hoc conferences we should update the title with participants names. + if ((IM_SESSION_INVITE == mDialog && !gAgent.isInGroup(mSessionID)) + || mDialog == IM_SESSION_CONFERENCE_START) + { + if (mParticipantsListRefreshConnection.connected()) + { + mParticipantsListRefreshConnection.disconnect(); + } + + LLAvatarList* avatar_list = getChild("speakers_list"); + mParticipantsListRefreshConnection = avatar_list->setRefreshCompleteCallback( + boost::bind(&LLIMFloater::onParticipantsListChanged, this, _1)); + } } } @@ -273,8 +302,6 @@ BOOL LLIMFloater::postBuild() setDocked(true); - mTypingStart = LLTrans::getString("IM_typing_start_string"); - LLButton* add_btn = getChild("add_btn"); // Allow to add chat participants depending on the session type @@ -341,7 +368,9 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) for (uuid_vec_t::const_iterator id = uuids.begin(); id != uuids.end(); ++id) { - if (*id == mOtherParticipantUUID) + // Skip this check for ad hoc conferences, + // conference participants should be listed in mSession->mInitialTargetIDs. + if (mIsP2PChat && *id == mOtherParticipantUUID) { return false; } @@ -411,11 +440,6 @@ void LLIMFloater::onCallButtonClicked() } } -/*void LLIMFloater::onOpenVoiceControlsClicked() -{ - LLFloaterReg::showInstance("voice_controls"); -}*/ - void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) { if(status != STATUS_JOINING && status != STATUS_LEFT_CHANNEL) @@ -448,28 +472,55 @@ void LLIMFloater::onAvatarNameCache(const LLUUID& agent_id, mTypingStart.setArg("[NAME]", ui_title); } -// virtual -BOOL LLIMFloater::tick() +void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) { - // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater - // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). - if (isDead()) + LLAvatarList* avatar_list = dynamic_cast(ctrl); + if (!avatar_list) { - return false; + return; } - BOOL parents_retcode = LLIMConversation::tick(); + bool all_names_resolved = true; + std::vector participants_uuids; - if ( mMeTyping ) + avatar_list->getValues(participants_uuids); + + // Check whether we have all participants names in LLAvatarNameCache + for (std::vector::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) { - // Time out if user hasn't typed for a while. - if ( mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS ) + const LLUUID& id = it->asUUID(); + LLAvatarName av_name; + if (!LLAvatarNameCache::get(id, &av_name)) { - setTyping(false); + all_names_resolved = false; + + // If a name is not found in cache, request it and continue the process recursively + // until all ids are resolved into names. + LLAvatarNameCache::get(id, + boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); + break; } } - return parents_retcode; + if (all_names_resolved) + { + std::vector avatar_names; + std::vector::const_iterator it = participants_uuids.begin(); + for (; it != participants_uuids.end(); ++it) + { + const LLUUID& id = it->asUUID(); + LLAvatarName av_name; + if (LLAvatarNameCache::get(id, &av_name)) + { + avatar_names.push_back(av_name); + } + } + + std::string ui_title; + LLAvatarActions::buildResidentsString(avatar_names, ui_title); + + updateSessionName(ui_title, ui_title); + } } //static @@ -737,8 +788,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) { initIMSession(im_session_id); - boundVoiceChannel(); - buildParticipantList(); } diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 6847efedf1..23f9e75e21 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -66,7 +66,6 @@ public: /*virtual*/ void setVisible(BOOL visible); /*virtual*/ BOOL getVisible(); // Check typing timeout timer. - /*virtual*/ BOOL tick(); static LLIMFloater* findInstance(const LLUUID& session_id); static LLIMFloater* getInstance(const LLUUID& session_id); @@ -131,12 +130,18 @@ private: /* virtual */ void onFocusLost(); /* virtual */ void onFocusReceived(); + /*virtual*/ void refresh(); + // Update the window title, input field help text, etc. void updateSessionName(const std::string& ui_title, const std::string& ui_label); // For display name lookups for IM window titles void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); + /// Updates the list of ad hoc conference participants + /// in an IM floater title. + void onParticipantsListChanged(LLUICtrl* ctrl); + bool dropPerson(LLUUID* person_id, bool drop); BOOL isInviteAllowed() const; @@ -193,6 +198,8 @@ private: // connection to voice channel state change signal boost::signals2::connection mVoiceChannelStateChangeConnection; + + boost::signals2::connection mParticipantsListRefreshConnection; }; #endif // LL_IMFLOATER_H diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 29ab4384cb..369ca699c5 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -186,6 +186,21 @@ BOOL LLNearbyChat::postBuild() return LLIMConversation::postBuild(); } +// virtual +void LLNearbyChat::refresh() +{ + displaySpeakingIndicator(); + updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); + + // *HACK: Update transparency type depending on whether our children have focus. + // This is needed because this floater is chrome and thus cannot accept focus, so + // the transparency type setting code from LLFloater::setFocus() isn't reached. + if (getTransparencyType() != TT_DEFAULT) + { + setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); + } +} + void LLNearbyChat::onNearbySpeakers() { LLSD param; @@ -389,27 +404,6 @@ void LLNearbyChat::showHistory() storeRectControl(); } - -BOOL LLNearbyChat::tick() -{ - // This check is needed until LLFloaterReg::removeInstance() is synchronized with deleting the floater - // via LLMortician::updateClass(), to avoid calling dead instances. See LLFloater::destroy(). - if (isDead()) return false; - - displaySpeakingIndicator(); - updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); - - // *HACK: Update transparency type depending on whether our children have focus. - // This is needed because this floater is chrome and thus cannot accept focus, so - // the transparency type setting code from LLFloater::setFocus() isn't reached. - if (getTransparencyType() != TT_DEFAULT) - { - setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); - } - - return LLIMConversation::tick(); -} - std::string LLNearbyChat::getCurrentChat() { return mChatBox ? mChatBox->getText() : LLStringUtil::null; diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index c9aa69a912..db367f0b59 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -73,8 +73,6 @@ public: LLChatEntry* getChatBox() { return mChatBox; } - //virtual void draw(); - std::string getCurrentChat(); virtual BOOL handleKeyHere( KEY key, MASK mask ); @@ -119,8 +117,6 @@ protected: S32 mExpandedHeight; - /*virtual*/ BOOL tick(); - private: void getAllowedRect (LLRect& rect); @@ -128,6 +124,8 @@ private: void appendMessage(const LLChat& chat, const LLSD &args = 0); void onNearbySpeakers (); + /*virtual*/ void refresh(); + LLHandle mPopupMenuHandle; std::vector mMessageArchive; LLChatHistory* mChatHistory; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 59d26edff2..47518a365f 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -475,6 +475,7 @@ void LLParticipantList::update() { mSpeakerMgr->update(true); + // Need to resort the participant list if it's in sort by recent speaker order. if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder() && !isHovered()) { // Resort avatar list -- cgit v1.2.3 From 3385a6398951bc94b3dc5da6224e285d85e606ab Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 27 Jun 2012 16:11:04 +0300 Subject: CHUI-162 FIXED Opening a nearby chat when text entered --- indra/newview/llnearbychat.cpp | 22 ++++++++++++++++++++++ indra/newview/llnearbychat.h | 1 + 2 files changed, 23 insertions(+) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 369ca699c5..ee7169b1c3 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -131,6 +131,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& key) mSpeakerMgr(NULL), mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) { + setIsChrome(TRUE); mKey = LLSD(); mIsNearbyChat = true; mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); @@ -394,6 +395,26 @@ LLNearbyChat* LLNearbyChat::getInstance() return LLFloaterReg::getTypedInstance("chat_bar"); } +void LLNearbyChat::show() +{ + // Get the floater + LLNearbyChat* floater = LLNearbyChat::getInstance(); + if (floater) + { + if(isChatMultiTab()) + { + LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); + + // Add a conversation list item in the left pane: nothing will be done if already in there + // but relevant clean up will be done to ensure consistency of the conversation list + floater_container->addConversationListItem(floater->getTitle(), LLUUID(), floater); + + floater->openFloater(floater->getKey()); + } + + floater->setVisible(TRUE); + } +} void LLNearbyChat::showHistory() { @@ -773,6 +794,7 @@ void LLNearbyChat::startChat(const char* line) if (cb ) { + cb->show(); cb->setVisible(TRUE); cb->setFocus(TRUE); cb->mChatBox->setFocus(TRUE); diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index db367f0b59..61404df942 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -65,6 +65,7 @@ public: static LLNearbyChat* getInstance(); void addToHost(); + void show(); /** @param archive true - to save a message to the chat history log */ void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD()); -- cgit v1.2.3 From 9091986c698af6d008a12f1944724609d649b63e Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 27 Jun 2012 19:33:22 +0300 Subject: CHUI-147 FIX Added check against empty participants names array to pass the assertion in LLAvatarActions::buildResidentsString. --- indra/newview/llimfloater.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 6a5bf153d4..1bbf6cc320 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -516,10 +516,14 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) } } - std::string ui_title; - LLAvatarActions::buildResidentsString(avatar_names, ui_title); - - updateSessionName(ui_title, ui_title); + // We should check whether the vector is not empty to pass the assertion + // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. + if (!avatar_names.empty()) + { + std::string ui_title; + LLAvatarActions::buildResidentsString(avatar_names, ui_title); + updateSessionName(ui_title, ui_title); + } } } -- cgit v1.2.3 From 0eda1f9a4d909870b15c6d7243e47838540598e8 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 27 Jun 2012 19:33:27 +0300 Subject: CHUI-169 FIX Restored inventory sharing functionality via IM floater drag and drop. --- indra/newview/llimfloater.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1bbf6cc320..b94a4048d4 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -1077,6 +1077,12 @@ BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_NO; } } + else if (mDialog == IM_NOTHING_SPECIAL) + { + LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, + cargo_type, cargo_data, accept); + } + return TRUE; } -- cgit v1.2.3 From 0e316a1510d5051088a62b86e4b0e05702786d9a Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 27 Jun 2012 21:30:05 +0300 Subject: CHUI-125 FIXED Supressed of a commented out code --- indra/newview/llchicletbar.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index 0e58008cd2..39f5d0b8f6 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -57,24 +57,11 @@ LLChicletBar::LLChicletBar(const LLSD&) : mChicletPanel(NULL), mToolbarStack(NULL) { - // IM floaters are from now managed by LLIMFloaterContainer. - // See LLIMFloaterContainer::sessionVoiceOrIMStarted() and CHUI-125 - -// // Firstly add our self to IMSession observers, so we catch session events -// // before chiclets do that. -// LLIMMgr::getInstance()->addSessionObserver(this); - buildFromFile("panel_chiclet_bar.xml"); } LLChicletBar::~LLChicletBar() { - // IM floaters are from now managed by LLIMFloaterContainer. - // See LLIMFloaterContainer::sessionVoiceOrIMStarted() and CHUI-125 -// if (!LLSingleton::destroyed()) -// { -// LLIMMgr::getInstance()->removeSessionObserver(this); -// } } LLIMChiclet* LLChicletBar::createIMChiclet(const LLUUID& session_id) -- cgit v1.2.3 From 1eb6b4509d9ae79f8313e1e68351028794093a53 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 14:03:16 -0700 Subject: CHUI-139 : Make sure the Nearby Chat shows up in the conversations floater in every situation --- indra/newview/llimfloatercontainer.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f6bcf8bbe9..52bacf15e4 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -103,24 +103,7 @@ BOOL LLIMFloaterContainer::postBuild() void LLIMFloaterContainer::onOpen(const LLSD& key) { - if (getFloaterCount() == 0) - { - // We always force the opening of the nearby chat conversation when we open for the first time - // *TODO: find a way to move this to XML as a default panel or something like that - LLSD name("chat_bar"); - LLFloaterReg::toggleInstanceOrBringToFront(name); - } LLMultiFloater::onOpen(key); - /* - if (key.isDefined()) - { - LLIMFloater* im_floater = LLIMFloater::findInstance(key.asUUID()); - if (im_floater) - { - im_floater->openFloater(); - } - } - */ } // virtual @@ -307,6 +290,20 @@ void LLIMFloaterContainer::tabClose() void LLIMFloaterContainer::setVisible(BOOL visible) { + if (visible) + { + // Make sure we have the Nearby Chat present when showing the conversation container + LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is null + conversations_items_map::iterator item_it = mConversationsItems.find(nearbychat_uuid); + if (item_it == mConversationsItems.end()) + { + // If not found, force the creation of the nearby chat conversation panel + // *TODO: find a way to move this to XML as a default panel or something like that + LLSD name("chat_bar"); + LLFloaterReg::toggleInstanceOrBringToFront(name); + } + } + // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. -- cgit v1.2.3 From d470632799dfdea723d15d91aa5783bdd1700257 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 15:32:08 -0700 Subject: CHUI-130 : Leave minimized torn off IM untouched when showing hiding the whole set of conversations --- indra/newview/llimfloatercontainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 52bacf15e4..34a9758c52 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -556,8 +556,9 @@ void LLConversationItem::selectItem(void) void LLConversationItem::setVisibleIfDetached(BOOL visible) { - // Do this only if the conversation floater has been torn off (i.e. no multi floater host) - if (!mFloater->getHost()) + // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized + // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here + if (!mFloater->getHost() && !mFloater->isMinimized()) { mFloater->setVisible(visible); } -- cgit v1.2.3 From c9da4d0a6dccbdcff228a5841d224463bc45297c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 15:55:09 -0700 Subject: CHUI-162 : Simplified the nearby chat show method following CHUI-139 fixes --- indra/newview/llnearbychat.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index ee7169b1c3..a81d6b4025 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -397,23 +397,11 @@ LLNearbyChat* LLNearbyChat::getInstance() void LLNearbyChat::show() { - // Get the floater - LLNearbyChat* floater = LLNearbyChat::getInstance(); - if (floater) + if (isChatMultiTab()) { - if(isChatMultiTab()) - { - LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance(); - - // Add a conversation list item in the left pane: nothing will be done if already in there - // but relevant clean up will be done to ensure consistency of the conversation list - floater_container->addConversationListItem(floater->getTitle(), LLUUID(), floater); - - floater->openFloater(floater->getKey()); - } - - floater->setVisible(TRUE); + openFloater(getKey()); } + setVisible(TRUE); } void LLNearbyChat::showHistory() -- cgit v1.2.3 From 7a147c1de99a7d03008d2921f091aa3de03a559f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 17:08:19 -0700 Subject: CHUI-146 : Fixed. Focus goes to first conversation in list when a conversation is dismissed. --- indra/newview/llimfloater.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b94a4048d4..9d3c0f98ce 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -628,9 +628,6 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) void LLIMFloater::onClose(bool app_quitting) { - LLIMConversation::onClose(app_quitting); - - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( mSessionID); @@ -663,6 +660,8 @@ void LLIMFloater::onClose(bool app_quitting) // EXT-3516 X Button should end IM session, _ button should hide gIMMgr->leaveSession(mSessionID); + // Clean up the conversation *after* the session has been ended + LLIMConversation::onClose(app_quitting); } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) -- cgit v1.2.3 From cbe3c3ae95c0850cd0ecba893ddabe0200bbc0ac Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Jun 2012 17:16:15 -0700 Subject: CHUI-184 : Change default pref LetterKeysFocusChatBar from 1 (chat) to 0 (WASD movements) --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index fe6829a712..4a586b02af 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1538,7 +1538,7 @@ Type S32 Value - 1 + 0 ChatBubbleOpacity -- cgit v1.2.3 From cb865a7e1300d4ce0bedae7c856fb210b68a43f8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 27 Jun 2012 18:56:10 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose moved filtering logic to viewmodel --- indra/llui/llnotifications.cpp | 24 +- indra/newview/llfolderview.cpp | 106 ++--- indra/newview/llfolderview.h | 12 +- indra/newview/llfolderviewitem.cpp | 787 +++++++------------------------ indra/newview/llfolderviewitem.h | 82 +--- indra/newview/llfolderviewmodel.h | 194 ++++---- indra/newview/llinventorybridge.cpp | 20 +- indra/newview/llinventorybridge.h | 3 + indra/newview/llinventoryfilter.cpp | 97 ++-- indra/newview/llinventoryfilter.h | 20 +- indra/newview/llinventoryfunctions.cpp | 10 +- indra/newview/llinventorypanel.cpp | 128 ++++- indra/newview/llinventorypanel.h | 6 + indra/newview/llpanellandmarks.cpp | 2 +- indra/newview/llpanelmaininventory.cpp | 2 +- indra/newview/llpanelobjectinventory.cpp | 11 + indra/newview/llsidepanelappearance.cpp | 2 +- indra/newview/lltexturectrl.cpp | 10 +- 18 files changed, 557 insertions(+), 959 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 487a2e5fe7..48128e0b40 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1542,34 +1542,32 @@ void LLNotifications::addFromCallback(const LLSD& name) add(name.asString(), LLSD(), LLSD()); } -LLNotificationPtr LLNotifications::add(const std::string& name, - const LLSD& substitutions, - const LLSD& payload) +LLNotificationPtr LLNotifications::add(const std::string& name, const LLSD& substitutions, const LLSD& payload) { LLNotification::Params::Functor functor_p; functor_p.name = name; return add(LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p)); } -LLNotificationPtr LLNotifications::add(const std::string& name, - const LLSD& substitutions, - const LLSD& payload, - const std::string& functor_name) +LLNotificationPtr LLNotifications::add(const std::string& name, const LLSD& substitutions, const LLSD& payload, const std::string& functor_name) { LLNotification::Params::Functor functor_p; functor_p.name = functor_name; - return add(LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p)); + return add(LLNotification::Params().name(name) + .substitutions(substitutions) + .payload(payload) + .functor(functor_p)); } //virtual -LLNotificationPtr LLNotifications::add(const std::string& name, - const LLSD& substitutions, - const LLSD& payload, - LLNotificationFunctorRegistry::ResponseFunctor functor) +LLNotificationPtr LLNotifications::add(const std::string& name, const LLSD& substitutions, const LLSD& payload, LLNotificationFunctorRegistry::ResponseFunctor functor) { LLNotification::Params::Functor functor_p; functor_p.function = functor; - return add(LLNotification::Params().name(name).substitutions(substitutions).payload(payload).functor(functor_p)); + return add(LLNotification::Params().name(name) + .substitutions(substitutions) + .payload(payload) + .functor(functor_p)); } // generalized add function that takes a parameter block object for more complex instantiations diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index ee8c94a2dd..a37fc7714b 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -181,7 +181,6 @@ LLFolderView::LLFolderView(const Params& p) mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), mNeedsAutoRename(FALSE), - mDebugFilters(FALSE), mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately mFilter(new LLInventoryFilter(LLInventoryFilter::Params().name(p.title))), mShowSelectionContext(FALSE), @@ -316,7 +315,7 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); addChild( folder ); - folder->dirtyFilter(); + folder->getViewModelItem()->dirtyFilter(); folder->requestArrange(); return TRUE; } @@ -339,15 +338,14 @@ void LLFolderView::openTopLevelFolders() } // This view grows and shrinks to enclose all of its children items and folders. -// mItemHeight = mDebugFilters ? LLFontGL::getFontMonospace()->getLineHeight() : 0; // *width should be 0 // conform show folder state works -S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_generation ) +S32 LLFolderView::arrange( S32* unused_width, S32* unused_height ) { mMinWidth = 0; S32 target_height; - LLFolderViewFolder::arrange(&mMinWidth, &target_height, mFilter->getFirstSuccessGeneration()); + LLFolderViewFolder::arrange(&mMinWidth, &target_height); LLRect scroll_rect = mScrollContainer->getContentWindowRect(); reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); @@ -371,15 +369,10 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000)); - if (getCompletedFilterGeneration() < filter.getCurrentGeneration()) + if (getLastFilterGeneration() < filter.getCurrentGeneration()) { - mPassedFilter = FALSE; mMinWidth = 0; - LLFolderViewFolder::filter(filter); - } - else - { - mPassedFilter = TRUE; + getViewModelItem()->filter(filter); } } @@ -548,15 +541,15 @@ void LLFolderView::sanitizeSelection() LLFolderViewItem* item = *item_iter; // ensure that each ancestor is open and potentially passes filtering - BOOL visible = item->potentiallyVisible(); // initialize from filter state for this item + BOOL visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item // modify with parent open and filters states LLFolderViewFolder* parent_folder = item->getParentFolder(); // Move up through parent folders and see what's visible - while(parent_folder) - { - visible = visible && parent_folder->isOpen() && parent_folder->potentiallyVisible(); - parent_folder = parent_folder->getParentFolder(); - } + while(parent_folder) + { + visible = visible && parent_folder->isOpen() && parent_folder->getViewModelItem()->potentiallyVisible(); + parent_folder = parent_folder->getParentFolder(); + } // deselect item if any ancestor is closed or didn't pass filter requirements. if (!visible) @@ -606,7 +599,7 @@ void LLFolderView::sanitizeSelection() parent_folder; parent_folder = parent_folder->getParentFolder()) { - if (parent_folder->potentiallyVisible()) + if (parent_folder->getViewModelItem()->potentiallyVisible()) { // give initial selection to first ancestor folder that potentially passes the filter if (!new_selection) @@ -684,16 +677,6 @@ void LLFolderView::commitRename( const LLSD& data ) void LLFolderView::draw() { - static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", LLColor4::white); - if (mDebugFilters) - { - std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d", - mFilter->getCurrentGeneration(), mFilter->getFirstSuccessGeneration(), mFilter->getFirstRequiredGeneration()); - LLFontGL::getFontMonospace()->renderUTF8(current_filter_string, 0, 2, - getRect().getHeight() - LLFontGL::getFontMonospace()->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE ); - } - //LLFontGL* font = getLabelFontForStyle(mLabelStyle); // if cursor has moved off of me during drag and drop @@ -734,17 +717,14 @@ void LLFolderView::draw() } else if (mShowEmptyMessage) { - if (!mViewModel->contentsReady() || mCompletedFilterGeneration < mFilter->getFirstSuccessGeneration()) + if (!mViewModel->contentsReady() || getLastFilterGeneration() < mFilter->getFirstSuccessGeneration()) { // TODO RN: Get this from filter mStatusText = LLTrans::getString("Searching"); } else { - if (getFilter()) - { - mStatusText = getFilter()->getEmptyLookupMessage(); - } + mStatusText = getFolderViewModel()->getFilter()->getEmptyLookupMessage(); } mStatusTextBox->setValue(mStatusText); mStatusTextBox->setVisible( TRUE ); @@ -763,7 +743,11 @@ void LLFolderView::draw() // This will indirectly call ::arrange and reshape of the status textbox. // We should call this method to also notify parent about required rect. // See EXT-7564, EXT-7047. - arrangeFromRoot(); + S32 height = 0; + S32 width = 0; + S32 total_height = arrange( &width, &height ); + notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); + LLUI::popMatrix(); LLUI::pushMatrix(); LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom); @@ -902,16 +886,16 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL } if(parent) { - if (parent->removeItem(item_to_delete)) + if (item_to_delete->remove()) { // change selection on successful delete if (new_selection) { - setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); + getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); } else { - setSelectionFromRoot(NULL, mParentPanel->hasFocus()); + getRoot()->setSelection(NULL, mParentPanel->hasFocus()); } } } @@ -937,11 +921,11 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL } if (new_selection) { - setSelectionFromRoot(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); + getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); } else { - setSelectionFromRoot(NULL, mParentPanel->hasFocus()); + getRoot()->setSelection(NULL, mParentPanel->hasFocus()); } for(S32 i = 0; i < count; ++i) @@ -1386,12 +1370,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (next->isSelected()) { // shrink selection - changeSelectionFromRoot(last_selected, FALSE); + getRoot()->changeSelection(last_selected, FALSE); } else if (last_selected->getParentFolder() == next->getParentFolder()) { // grow selection - changeSelectionFromRoot(next, TRUE); + getRoot()->changeSelection(next, TRUE); } } } @@ -1450,12 +1434,12 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) if (prev->isSelected()) { // shrink selection - changeSelectionFromRoot(last_selected, FALSE); + getRoot()->changeSelection(last_selected, FALSE); } else if (last_selected->getParentFolder() == prev->getParentFolder()) { // grow selection - changeSelectionFromRoot(prev, TRUE); + getRoot()->changeSelection(prev, TRUE); } } } @@ -1649,7 +1633,7 @@ BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &searc } } - const std::string current_item_label(search_item->getSearchableLabel()); + const std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); if (!current_item_label.compare(0, search_string_length, upper_case_string)) { @@ -1959,13 +1943,6 @@ void LLFolderView::doIdle() LLFastTimer t2(FTM_INVENTORY); - BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters"); - if (debug_filters != getDebugFilters()) - { - mDebugFilters = debug_filters; - arrangeAll(); - } - if (mFilter->isModified() && mFilter->isNotDefault()) { mNeedsAutoSelect = TRUE; @@ -1973,7 +1950,7 @@ void LLFolderView::doIdle() mFilter->clearModified(); // filter to determine visibility before arranging - filterFromRoot(); + filter(*(getFolderViewModel()->getFilter())); // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) @@ -1981,7 +1958,7 @@ void LLFolderView::doIdle() LLFastTimer t3(FTM_AUTO_SELECT); // select new item only if a filtered item not currently selected LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); - if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->potentiallyHidden())) + if (!mAutoSelectOverride && (!selected_itemp || selected_itemp->passedFilter())) { // these are named variables to get around gcc not binding non-const references to rvalues // and functor application is inherently non-const to allow for stateful functors @@ -1991,7 +1968,7 @@ void LLFolderView::doIdle() // Open filtered folders for folder views with mAutoSelectOverride=TRUE. // Used by LLPlacesFolderView. - if (mAutoSelectOverride && mFilter->showAllResults()) + if (mFilter->showAllResults()) { // these are named variables to get around gcc not binding non-const references to rvalues // and functor application is inherently non-const to allow for stateful functors @@ -2002,7 +1979,7 @@ void LLFolderView::doIdle() scrollToShowSelection(); } - BOOL filter_finished = mCompletedFilterGeneration >= mFilter->getCurrentGeneration() + BOOL filter_finished = getLastFilterGeneration() >= mFilter->getCurrentGeneration() && mViewModel->contentsReady(); if (filter_finished || gFocusMgr.childHasKeyboardFocus(inventory_panel) @@ -2073,7 +2050,10 @@ void LLFolderView::doIdle() sanitizeSelection(); if( needsArrange() ) { - arrangeFromRoot(); + S32 height = 0; + S32 width = 0; + S32 total_height = arrange( &width, &height ); + notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); } } @@ -2278,25 +2258,19 @@ void LLFolderView::onRenamerLost() if( mRenameItem ) { - setSelectionFromRoot( mRenameItem, TRUE ); + setSelection( mRenameItem, TRUE ); mRenameItem = NULL; } } -LLFolderViewFilter* LLFolderView::getFilter() -{ - return mFilter; -} - S32 LLFolderView::getItemHeight() { - S32 debug_height = mDebugFilters ? LLFontGL::getFontMonospace()->getLineHeight() : 0; if(!hasVisibleChildren()) { //We need to display status textbox, let's reserve some place for it - return llmax(debug_height, mStatusTextBox->getTextPixelHeight()); + return llmax(0, mStatusTextBox->getTextPixelHeight()); } - return debug_height; + return 0; } //TODO RN: move to llfolderviewmodel.cpp file diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 8b58da9f45..d261a5967d 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -110,9 +110,11 @@ public: virtual BOOL canFocusChildren() const; + virtual const LLFolderView* getRoot() const { return this; } virtual LLFolderView* getRoot() { return this; } LLFolderViewModelInterface* getFolderViewModel() { return mViewModel; } + const LLFolderViewModelInterface* getFolderViewModel() const { return mViewModel; } void setFilterPermMask(PermissionMask filter_perm_mask); @@ -120,9 +122,6 @@ public: void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } - // filter is never null - LLFolderViewFilter* getFilter(); - bool getAllowMultiSelect() { return mAllowMultiSelect; } // Close all folders in the view @@ -133,7 +132,7 @@ public: // Find width and height of this object and its children. Also // makes sure that this view and its children are the right size. - virtual S32 arrange( S32* width, S32* height, S32 filter_generation ); + virtual S32 arrange( S32* width, S32* height ); virtual S32 getItemHeight(); void arrangeAll() { mArrangeGeneration++; } @@ -147,7 +146,7 @@ public: // Record the selected item and pass it down the hierarchy. virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus); + BOOL take_keyboard_focus = TRUE); // This method is used to toggle the selection of an item. Walks // children, and keeps track of selected objects. @@ -244,8 +243,6 @@ public: void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } - BOOL getDebugFilters() { return mDebugFilters; } - LLPanel* getParentPanel() { return mParentPanel; } // DEBUG only void dumpSelectionInformation(); @@ -299,7 +296,6 @@ protected: bool mUseLabelSuffix; bool mShowItemLinkOverlays; - BOOL mDebugFilters; U32 mSortOrder; LLDepthStack mAutoOpenItems; LLFolderViewFolder* mAutoOpenCandidate; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 3f0b493986..f65a13be1e 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -114,8 +114,6 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mHasVisibleChildren(FALSE), mIndentation(0), mItemHeight(p.item_height), - mPassedFilter(FALSE), - mLastFilterGeneration(-1), //TODO RN: create interface for string highlighting //mStringMatchOffset(std::string::npos), mControlLabelRotation(0.f), @@ -146,6 +144,10 @@ LLFolderView* LLFolderViewItem::getRoot() return mRoot; } +const LLFolderView* LLFolderViewItem::getRoot() const +{ + return mRoot; +} // Returns true if this object is a child (or grandchild, etc.) of potential_ancestor. BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) { @@ -207,99 +209,47 @@ LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) return itemp; } -// is this item something we think we should be showing? -// for example, if we haven't gotten around to filtering it yet, then the answer is yes -// until we find out otherwise -BOOL LLFolderViewItem::potentiallyVisible() -{ - return getFiltered() // we've passed the filter - || getLastFilterGeneration() < getRoot()->getFilter()->getFirstSuccessGeneration(); // or we don't know yet -} - -BOOL LLFolderViewItem::potentiallyHidden() +BOOL LLFolderViewItem::passedFilter(S32 filter_generation) { - return !mPassedFilter // didn't pass the filter - || getLastFilterGeneration() < getRoot()->getFilter()->getFirstSuccessGeneration(); // or we don't know yet -} - -BOOL LLFolderViewItem::getFiltered() -{ - return mPassedFilter && mLastFilterGeneration >= getRoot()->getFilter()->getFirstSuccessGeneration(); -} - -BOOL LLFolderViewItem::getFiltered(S32 filter_generation) -{ - return mPassedFilter && mLastFilterGeneration >= filter_generation; -} - -void LLFolderViewItem::setFiltered(BOOL filtered, S32 filter_generation) -{ - mPassedFilter = filtered; - mLastFilterGeneration = filter_generation; + return getViewModelItem()->passedFilter(filter_generation); } void LLFolderViewItem::refresh() { - if(!getViewModelItem()) return; + LLFolderViewModelItem& vmi = *getViewModelItem(); - mLabel = getViewModelItem()->getDisplayName(); + mLabel = vmi.getDisplayName(); setToolTip(mLabel); - mIcon = getViewModelItem()->getIcon(); - mIconOpen = getViewModelItem()->getIconOpen(); - mIconOverlay = getViewModelItem()->getIconOverlay(); + mIcon = vmi.getIcon(); + mIconOpen = vmi.getIconOpen(); + mIconOverlay = vmi.getIconOverlay(); if (mRoot->useLabelSuffix()) { - mLabelStyle = getViewModelItem()->getLabelStyle(); - mLabelSuffix = getViewModelItem()->getLabelSuffix(); + mLabelStyle = vmi.getLabelStyle(); + mLabelSuffix = vmi.getLabelSuffix(); } - std::string searchable_label(mLabel); - searchable_label.append(mLabelSuffix); - LLStringUtil::toUpper(searchable_label); + //TODO RN: make sure this logic still fires + //std::string searchable_label(mLabel); + //searchable_label.append(mLabelSuffix); + //LLStringUtil::toUpper(searchable_label); - if (mSearchableLabel.compare(searchable_label)) - { - mSearchableLabel.assign(searchable_label); - dirtyFilter(); - // some part of label has changed, so overall width has potentially changed, and sort order too - if (mParentFolder) - { - mParentFolder->requestSort(); - mParentFolder->requestArrange(); - } - } + //if (mSearchableLabel.compare(searchable_label)) + //{ + // mSearchableLabel.assign(searchable_label); + // vmi.dirtyFilter(); + // // some part of label has changed, so overall width has potentially changed, and sort order too + // if (mParentFolder) + // { + // mParentFolder->requestSort(); + // mParentFolder->requestArrange(); + // } + //} mLabelWidthDirty = true; - dirtyFilter(); -} - -// This function is called when items are added or view filters change. It's -// implemented here but called by derived classes when folding the -// views. -void LLFolderViewItem::filterFromRoot( void ) -{ - LLFolderViewItem* root = getRoot(); - - root->filter(*((LLFolderView*)root)->getFilter()); -} - -// This function is called when the folder view is dirty. It's -// implemented here but called by derived classes when folding the -// views. -void LLFolderViewItem::arrangeFromRoot() -{ - LLFolderViewItem* root = getRoot(); - - S32 height = 0; - S32 width = 0; - S32 total_height = root->arrange( &width, &height, 0 ); - - LLSD params; - params["action"] = "size_changes"; - params["height"] = total_height; - getParent()->notifyParent(params); + vmi.dirtyFilter(); } // Utility function for LLFolderView @@ -313,7 +263,7 @@ void LLFolderViewItem::arrangeAndSet(BOOL set_selection, } if(set_selection) { - setSelectionFromRoot(this, TRUE, take_keyboard_focus); + getRoot()->setSelection(this, TRUE, take_keyboard_focus); if(root) { root->scrollToShowSelection(); @@ -321,22 +271,6 @@ void LLFolderViewItem::arrangeAndSet(BOOL set_selection, } } -// This function clears the currently selected item, and records the -// specified selected item appropriately for display and use in the -// UI. If open is TRUE, then folders are opened up along the way to -// the selection. -void LLFolderViewItem::setSelectionFromRoot(LLFolderViewItem* selection, - BOOL openitem, - BOOL take_keyboard_focus) -{ - getRoot()->setSelection(selection, openitem, take_keyboard_focus); -} - -// helper function to change the selection from the root. -void LLFolderViewItem::changeSelectionFromRoot(LLFolderViewItem* selection, BOOL selected) -{ - getRoot()->changeSelection(selection, selected); -} std::set LLFolderViewItem::getSelectionList() const { @@ -347,18 +281,13 @@ std::set LLFolderViewItem::getSelectionList() const // addToFolder() returns TRUE if it succeeds. FALSE otherwise BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder) { - if (!folder) - { - return FALSE; - } - mParentFolder = folder; return folder->addItem(this); } // Finds width and height of this object and its children. Also // makes sure that this view and its children are the right size. -S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation) +S32 LLFolderViewItem::arrange( S32* width, S32* height ) { const Params& p = LLUICtrlFactory::getDefaultParams(); S32 indentation = p.folder_indentation(); @@ -390,41 +319,6 @@ S32 LLFolderViewItem::getItemHeight() return mItemHeight; } -void LLFolderViewItem::filter( LLFolderViewFilter& filter) -{ - const BOOL previous_passed_filter = mPassedFilter; - const BOOL passed_filter = filter.check(this); - - // If our visibility will change as a result of this filter, then - // we need to be rearranged in our parent folder - if (mParentFolder) - { - if (getVisible() != passed_filter - || previous_passed_filter != passed_filter ) - mParentFolder->requestArrange(); - } - - setFiltered(passed_filter, filter.getCurrentGeneration()); - //TODO RN: create interface for string highlighting - //mStringMatchOffset = filter.getStringMatchOffset(this); - filter.decrementFilterCount(); - - if (getRoot()->getDebugFilters()) - { - mStatusText = llformat("%d", mLastFilterGeneration); - } -} - -void LLFolderViewItem::dirtyFilter() -{ - mLastFilterGeneration = -1; - // bubble up dirty flag all the way to root - if (getParentFolder()) - { - getParentFolder()->setCompletedFilterGeneration(-1, TRUE); - } -} - // *TODO: This can be optimized a lot by simply recording that it is // selected in the appropriate places, and assuming that set selection // means 'deselect' for a leaf item. Do this optimization after @@ -469,45 +363,31 @@ void LLFolderViewItem::selectItem(void) { if (mIsSelected == FALSE) { - if (getViewModelItem()) - { - getViewModelItem()->selectItem(); - } + getViewModelItem()->selectItem(); mIsSelected = TRUE; } } BOOL LLFolderViewItem::isMovable() { - if( getViewModelItem() ) - { - return getViewModelItem()->isItemMovable(); - } - else - { - return TRUE; - } + return getViewModelItem()->isItemMovable(); } BOOL LLFolderViewItem::isRemovable() { - if( getViewModelItem() ) - { - return getViewModelItem()->isItemRemovable(); - } - else - { - return TRUE; - } + return getViewModelItem()->isItemRemovable(); } void LLFolderViewItem::destroyView() { + getRoot()->removeFromSelectionList(this); + if (mParentFolder) { // removeView deletes me - mParentFolder->removeView(this); + mParentFolder->extractItem(this); } + delete this; } // Call through to the viewed object and return true if it can be @@ -519,58 +399,36 @@ BOOL LLFolderViewItem::remove() { return FALSE; } - if(getViewModelItem()) - { - return getViewModelItem()->removeItem(); - } - return TRUE; + return getViewModelItem()->removeItem(); } // Build an appropriate context menu for the item. void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags) { - if(getViewModelItem()) - { - getViewModelItem()->buildContextMenu(menu, flags); - } + getViewModelItem()->buildContextMenu(menu, flags); } void LLFolderViewItem::openItem( void ) { - if( getViewModelItem() ) - { - getViewModelItem()->openItem(); - } + getViewModelItem()->openItem(); } void LLFolderViewItem::rename(const std::string& new_name) { if( !new_name.empty() ) { - if( getViewModelItem() ) - { - getViewModelItem()->renameItem(new_name); + getViewModelItem()->renameItem(new_name); - if(mParentFolder) - { - mParentFolder->requestSort(); - } + if(mParentFolder) + { + mParentFolder->requestSort(); } } } -const std::string& LLFolderViewItem::getSearchableLabel() const -{ - return mSearchableLabel; -} - const std::string& LLFolderViewItem::getName( void ) const { - if(getViewModelItem()) - { - return getViewModelItem()->getName(); - } - return LLStringUtil::null; + return getViewModelItem()->getName(); } // LLView functionality @@ -578,7 +436,7 @@ BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) { if(!mIsSelected) { - setSelectionFromRoot(this, FALSE); + getRoot()->setSelection(this, FALSE); } make_ui_sound("UISndClick"); return TRUE; @@ -599,7 +457,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) { if(mask & MASK_CONTROL) { - changeSelectionFromRoot(this, !mIsSelected); + getRoot()->changeSelection(this, !mIsSelected); } else if (mask & MASK_SHIFT) { @@ -607,7 +465,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) } else { - setSelectionFromRoot(this, FALSE); + getRoot()->setSelection(this, FALSE); } make_ui_sound("UISndClick"); } @@ -646,14 +504,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) // *TODO: push this into listener and remove // dependency on llagent - if (getViewModelItem()) - { - src = getViewModelItem()->getDragSource(); - } - else - { - src = LLToolDragAndDrop::SOURCE_VIEWER; - } + src = getViewModelItem()->getDragSource(); can_drag = root->startDrag(src); if (can_drag) @@ -695,10 +546,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) { - if (getViewModelItem()) - { - getViewModelItem()->openItem(); - } + getViewModelItem()->openItem(); return TRUE; } @@ -715,7 +563,7 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) //...then select if(mask & MASK_CONTROL) { - changeSelectionFromRoot(this, !mIsSelected); + getRoot()->changeSelection(this, !mIsSelected); } else if (mask & MASK_SHIFT) { @@ -723,7 +571,7 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) } else { - setSelectionFromRoot(this, FALSE); + getRoot()->setSelection(this, FALSE); } } @@ -748,21 +596,17 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = FALSE; BOOL handled = FALSE; - if(getViewModelItem()) + BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + handled = accepted; + if (accepted) { - accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); - handled = accepted; - if (accepted) - { - mDragAndDropTarget = TRUE; - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; - } + mDragAndDropTarget = TRUE; + *accept = ACCEPT_YES_MULTI; + } + else + { + *accept = ACCEPT_NO; } if(mParentFolder && !handled) { @@ -781,17 +625,17 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, void LLFolderViewItem::draw() { - static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); - static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); - static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); + static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); + static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); + static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); - static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); - static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); - static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); - static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); - static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); + static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); + static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); + static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); + static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); + static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); - static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); const Params& default_params = LLUICtrlFactory::getDefaultParams(); const S32 TOP_PAD = default_params.item_top_pad; @@ -929,29 +773,12 @@ void LLFolderViewItem::draw() LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; //TODO RN: implement this in terms of getColor() //if (highlight_link) color = sLinkColor; - //if (getViewModelItem() && gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor; + //if (gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation); - //--------------------------------------------------------------------------------// - // Highlight filtered text - // - if (getRoot()->getDebugFilters()) - { - if (!getFiltered() && !getViewModelItem()->hasChildren()) - { - color.mV[VALPHA] *= 0.5f; - } - LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? - LLColor4(0.5f, 0.8f, 0.5f, 1.f) : - LLColor4(0.8f, 0.5f, 0.5f, 1.f); - LLFontGL::getFontMonospace()->renderUTF8(mStatusText, 0, text_left, y, filter_color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, S32_MAX, &right_x, FALSE ); - text_left = right_x; - } //--------------------------------------------------------------------------------// // Draw the actual label text // @@ -997,6 +824,22 @@ void LLFolderViewItem::draw() //} } +const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const +{ + return getRoot()->getFolderViewModel(); +} + +LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) +{ + return getRoot()->getFolderViewModel(); +} + +S32 LLFolderViewItem::getLastFilterGeneration() const +{ + return getViewModelItem()->getLastFilterGeneration(); +} + + ///---------------------------------------------------------------------------- /// Class LLFolderViewFolder @@ -1010,10 +853,7 @@ LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): mTargetHeight(0.f), mAutoOpenCountdown(0.f), mLastArrangeGeneration( -1 ), - mLastCalculatedWidth(0), - mCompletedFilterGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mPassedFolderFilter(FALSE) + mLastCalculatedWidth(0) { } @@ -1025,25 +865,9 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() } -void LLFolderViewFolder::setFilteredFolder(bool filtered, S32 filter_generation) -{ - mPassedFolderFilter = filtered; - mLastFilterGeneration = filter_generation; -} - -bool LLFolderViewFolder::getFilteredFolder(S32 filter_generation) -{ - return mPassedFolderFilter && mLastFilterGeneration >= getRoot()->getFilter()->getFirstSuccessGeneration(); -} - // addToFolder() returns TRUE if it succeeds. FALSE otherwise BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) { - if (!folder) - { - return FALSE; - } - mParentFolder = folder; return folder->addFolder(this); } @@ -1051,7 +875,7 @@ static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); // Finds width and height of this object and its children. Also // makes sure that this view and its children are the right size. -S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) +S32 LLFolderViewFolder::arrange( S32* width, S32* height ) { // sort before laying out contents getRoot()->getFolderViewModel()->sort(this); @@ -1060,7 +884,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) // evaluate mHasVisibleChildren mHasVisibleChildren = false; - if (hasFilteredDescendants(filter_generation)) + if (getViewModelItem()->descendantsPassedFilter()) { // We have to verify that there's at least one child that's not filtered out bool found = false; @@ -1068,7 +892,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - found = (itemp->getFiltered(filter_generation)); + found = itemp->passedFilter(); if (found) break; } @@ -1078,9 +902,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - found = ( (folderp->getFiltered(filter_generation) - || (folderp->getFilteredFolder(filter_generation) - && folderp->hasFilteredDescendants(filter_generation)))); + found = folderp->passedFilter(); if (found) break; } @@ -1090,7 +912,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) } // calculate height as a single item (without any children), and reshapes rectangle to match - LLFolderViewItem::arrange( width, height, filter_generation ); + LLFolderViewItem::arrange( width, height ); // clamp existing animated height so as to never get smaller than a single item mCurHeight = llmax((F32)*height, mCurHeight); @@ -1113,16 +935,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) { LLFolderViewFolder* folderp = (*fit); - if (getRoot()->getDebugFilters()) - { - folderp->setVisible(TRUE); - } - else - { - folderp->setVisible( folderp->getFiltered(filter_generation) - || (folderp->getFilteredFolder(filter_generation) - && folderp->hasFilteredDescendants(filter_generation))); // passed filter or has descendants that passed filter - } + folderp->setVisible(folderp->passedFilter()); // passed filter or has descendants that passed filter if (folderp->getVisible()) { @@ -1130,7 +943,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) S32 child_height = 0; S32 child_top = parent_item_height - llround(running_height); - target_height += folderp->arrange( &child_width, &child_height, filter_generation ); + target_height += folderp->arrange( &child_width, &child_height ); running_height += (F32)child_height; *width = llmax(*width, child_width); @@ -1141,14 +954,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) iit != mItems.end(); ++iit) { LLFolderViewItem* itemp = (*iit); - if (getRoot()->getDebugFilters()) - { - itemp->setVisible(TRUE); - } - else - { - itemp->setVisible(itemp->getFiltered(filter_generation)); - } + itemp->setVisible(itemp->passedFilter()); if (itemp->getVisible()) { @@ -1156,7 +962,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) S32 child_height = 0; S32 child_top = parent_item_height - llround(running_height); - target_height += itemp->arrange( &child_width, &child_height, filter_generation ); + target_height += itemp->arrange( &child_width, &child_height ); // don't change width, as this item is as wide as its parent folder by construction itemp->reshape( itemp->getRect().getWidth(), child_height); @@ -1234,234 +1040,21 @@ void LLFolderViewFolder::requestSort() getViewModelItem()->requestSort(); } -void LLFolderViewFolder::setCompletedFilterGeneration(S32 generation, BOOL recurse_up) -{ - //mMostFilteredDescendantGeneration = llmin(mMostFilteredDescendantGeneration, generation); - mCompletedFilterGeneration = generation; - // only aggregate up if we are a lower (older) value - if (recurse_up - && mParentFolder - && generation < mParentFolder->getCompletedFilterGeneration()) - { - mParentFolder->setCompletedFilterGeneration(generation, TRUE); - } -} +//TODO RN: get height resetting working +//void LLFolderViewFolder::setPassedFilter(BOOL passed, BOOL passed_folder, S32 filter_generation) +//{ +// // if this folder is now filtered, but wasn't before +// // (it just passed) +// if (passed && !passedFilter(filter_generation)) +// { +// // reset current height, because last time we drew it +// // it might have had more visible items than now +// mCurHeight = 0.f; +// } +// +// LLFolderViewItem::setPassedFilter(passed, passed_folder, filter_generation); +//} -void LLFolderViewFolder::filter( LLFolderViewFilter& filter) -{ - S32 filter_generation = filter.getCurrentGeneration(); - // if failed to pass filter newer than must_pass_generation - // you will automatically fail this time, so we only - // check against items that have passed the filter - S32 must_pass_generation = filter.getFirstRequiredGeneration(); - - bool autoopen_folders = filter.showAllResults(); - - // if we have already been filtered against this generation, skip out - if (getCompletedFilterGeneration() >= filter_generation) - { - return; - } - - // filter folder itself - if (getLastFilterGeneration() < filter_generation) - { - if (getLastFilterGeneration() >= must_pass_generation // folder has been compared to a valid precursor filter - && !mPassedFilter) // and did not pass the filter - { - // go ahead and flag this folder as done - mLastFilterGeneration = filter_generation; - //TODO RN: create interface for string highlighting - //mStringMatchOffset = std::string::npos; - } - else // filter self only on first pass through - { - // filter against folder rules - filterFolder(filter); - // and then item rules - LLFolderViewItem::filter( filter ); - } - } - - if (getRoot()->getDebugFilters()) - { - mStatusText = llformat("%d", mLastFilterGeneration); - mStatusText += llformat("(%d)", mCompletedFilterGeneration); - mStatusText += llformat("+%d", mMostFilteredDescendantGeneration); - } - - // all descendants have been filtered later than must pass generation - // but none passed - if(getCompletedFilterGeneration() >= must_pass_generation && !hasFilteredDescendants(must_pass_generation)) - { - // don't traverse children if we've already filtered them since must_pass_generation - // and came back with nothing - return; - } - - // we entered here with at least one filter iteration left - // check to see if we have any more before continuing on to children - if (filter.getFilterCount() < 0) - { - return; - } - - // now query children - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end(); - ++iter) - { - LLFolderViewFolder* folder = (*iter); - // have we run out of iterations this frame? - if (filter.getFilterCount() < 0) - { - break; - } - - // mMostFilteredDescendantGeneration might have been reset - // in which case we need to update it even for folders that - // don't need to be filtered anymore - if (folder->getCompletedFilterGeneration() >= filter_generation) - { - // track latest generation to pass any child items - if (folder->getFiltered() || folder->hasFilteredDescendants(filter.getFirstSuccessGeneration())) - { - mMostFilteredDescendantGeneration = filter_generation; - requestArrange(); - } - // just skip it, it has already been filtered - continue; - } - - // update this folders filter status (and children) - folder->filter( filter ); - - // track latest generation to pass any child items - if (folder->getFiltered() || folder->hasFilteredDescendants(filter_generation)) - { - mMostFilteredDescendantGeneration = filter_generation; - requestArrange(); - if (getRoot()->needsAutoSelect() && autoopen_folders) - { - folder->setOpenArrangeRecursively(TRUE); - } - } - } - - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end(); - ++iter) - { - LLFolderViewItem* item = (*iter); - if (filter.getFilterCount() < 0) - { - break; - } - if (item->getLastFilterGeneration() >= filter_generation) - { - if (item->getFiltered()) - { - mMostFilteredDescendantGeneration = filter_generation; - requestArrange(); - } - continue; - } - - if (item->getLastFilterGeneration() >= must_pass_generation && - !item->getFiltered(must_pass_generation)) - { - // failed to pass an earlier filter that was a subset of the current one - // go ahead and flag this item as done - item->setFiltered(FALSE, filter_generation); - continue; - } - - item->filter( filter ); - - if (item->getFiltered(filter.getFirstSuccessGeneration())) - { - mMostFilteredDescendantGeneration = filter_generation; - requestArrange(); - } - } - - // if we didn't use all filter iterations - // that means we filtered all of our descendants - // instead of exhausting the filter count for this frame - if (filter.getFilterCount() > 0) - { - // flag this folder as having completed filter pass for all descendants - setCompletedFilterGeneration(filter_generation, FALSE/*dont recurse up to root*/); - } -} - -void LLFolderViewFolder::filterFolder(LLFolderViewFilter& filter) -{ - const BOOL previous_passed_filter = mPassedFolderFilter; - const BOOL passed_filter = filter.checkFolder(this); - - // If our visibility will change as a result of this filter, then - // we need to be rearranged in our parent folder - if (mParentFolder) - { - if (getVisible() != passed_filter - || previous_passed_filter != passed_filter ) - { - mParentFolder->requestArrange(); - } - } - - setFilteredFolder(passed_filter, filter.getCurrentGeneration()); - filter.decrementFilterCount(); - - if (getRoot()->getDebugFilters()) - { - mStatusText = llformat("%d", mLastFilterGeneration); - } -} - -void LLFolderViewFolder::setFiltered(BOOL filtered, S32 filter_generation) -{ - // if this folder is now filtered, but wasn't before - // (it just passed) - if (filtered && !mPassedFilter) - { - // reset current height, because last time we drew it - // it might have had more visible items than now - mCurHeight = 0.f; - } - - LLFolderViewItem::setFiltered(filtered, filter_generation); -} - -void LLFolderViewFolder::dirtyFilter() -{ - // we're a folder, so invalidate our completed generation - setCompletedFilterGeneration(-1, FALSE); - LLFolderViewItem::dirtyFilter(); -} - -BOOL LLFolderViewFolder::getFiltered() -{ - return getFilteredFolder(getRoot()->getFilter()->getFirstSuccessGeneration()) - && LLFolderViewItem::getFiltered(); -} - -BOOL LLFolderViewFolder::getFiltered(S32 filter_generation) -{ - return getFilteredFolder(filter_generation) && LLFolderViewItem::getFiltered(filter_generation); -} - -BOOL LLFolderViewFolder::hasFilteredDescendants(S32 filter_generation) -{ - return mMostFilteredDescendantGeneration >= filter_generation; -} - - -BOOL LLFolderViewFolder::hasFilteredDescendants() -{ - return mMostFilteredDescendantGeneration >= getRoot()->getFilter()->getFirstSuccessGeneration(); -} // Passes selection information on to children and record selection // information if necessary. @@ -1824,39 +1417,7 @@ void LLFolderViewFolder::destroyView() folderp->destroyView(); // removes entry from mFolders } - if (mParentFolder) - { - mParentFolder->removeView(this); - } -} - -// remove the specified item (and any children) if possible. Return -// TRUE if the item was deleted. -BOOL LLFolderViewFolder::removeItem(LLFolderViewItem* item) -{ - if(item->remove()) - { - return TRUE; - } - return FALSE; -} - -// simply remove the view (and any children) Don't bother telling the -// listeners. -void LLFolderViewFolder::removeView(LLFolderViewItem* item) -{ - if (!item || item->getParentFolder() != this) - { - return; - } - // deselect without traversing hierarchy - if (item->isSelected()) - { - item->deselectItem(); - } - getRoot()->removeFromSelectionList(item); - extractItem(item); - delete item; + LLFolderViewItem::destroyView(); } // extractItem() removes the specified item from the folder, but @@ -1882,7 +1443,7 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) mItems.erase(it); } //item has been removed, need to update filter - dirtyFilter(); + getViewModelItem()->dirtyFilter(); //because an item is going away regardless of filter status, force rearrange requestArrange(); removeChild(item); @@ -1890,31 +1451,28 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) BOOL LLFolderViewFolder::isMovable() { - if( getViewModelItem() ) + if( !(getViewModelItem()->isItemMovable()) ) { - if( !(getViewModelItem()->isItemMovable()) ) - { - return FALSE; - } + return FALSE; + } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if(!(*iit)->isMovable()) { - items_t::iterator iit = iter++; - if(!(*iit)->isMovable()) - { - return FALSE; - } + return FALSE; } + } - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if(!(*fit)->isMovable()) { - folders_t::iterator fit = iter++; - if(!(*fit)->isMovable()) - { - return FALSE; - } + return FALSE; } } return TRUE; @@ -1923,31 +1481,28 @@ BOOL LLFolderViewFolder::isMovable() BOOL LLFolderViewFolder::isRemovable() { - if( getViewModelItem() ) + if( !(getViewModelItem()->isItemRemovable()) ) { - if( !(getViewModelItem()->isItemRemovable()) ) - { - return FALSE; - } + return FALSE; + } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if(!(*iit)->isRemovable()) { - items_t::iterator iit = iter++; - if(!(*iit)->isRemovable()) - { - return FALSE; - } + return FALSE; } + } - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if(!(*fit)->isRemovable()) { - folders_t::iterator fit = iter++; - if(!(*fit)->isRemovable()) - { - return FALSE; - } + return FALSE; } } return TRUE; @@ -1956,6 +1511,12 @@ BOOL LLFolderViewFolder::isRemovable() // this is an internal method used for adding items to folders. BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) { + if (item->getParentFolder()) + { + item->getParentFolder()->extractItem(item); + } + item->setParentFolder(this); + mItems.push_back(item); item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); @@ -1963,12 +1524,14 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) addChild(item); - item->dirtyFilter(); + item->getViewModelItem()->dirtyFilter(); // Handle sorting requestArrange(); requestSort(); + getViewModelItem()->addChild(item->getViewModelItem()); + //TODO RN - make sort bubble up as long as parent Folder doesn't have anything matching sort criteria //// Traverse parent folders and update creation date and resort, if necessary //LLFolderViewFolder* parentp = this; @@ -1989,16 +1552,23 @@ BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) // this is an internal method used for adding items to folders. BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) { + if (folder->mParentFolder) + { + folder->mParentFolder->extractItem(folder); + } + folder->mParentFolder = this; mFolders.push_back(folder); folder->setOrigin(0, 0); folder->reshape(getRect().getWidth(), 0); folder->setVisible(FALSE); addChild( folder ); - folder->dirtyFilter(); + folder->getViewModelItem()->dirtyFilter(); // rearrange all descendants too, as our indentation level might have changed folder->requestArrange(); requestSort(); + getViewModelItem()->addChild(folder->getViewModelItem()); + return TRUE; } @@ -2027,16 +1597,13 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType r { BOOL was_open = isOpen(); mIsOpen = openitem; - if (getViewModelItem()) + if(!was_open && openitem) { - if(!was_open && openitem) - { - getViewModelItem()->openItem(); - } - else if(was_open && !openitem) - { - getViewModelItem()->closeItem(); - } + getViewModelItem()->openItem(); + } + else if(was_open && !openitem) + { + getViewModelItem()->closeItem(); } if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) @@ -2068,7 +1635,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = mListener && mListener->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); + BOOL accepted = mListener->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); if (accepted) { mDragAndDropTarget = TRUE; @@ -2156,7 +1723,7 @@ BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = getViewModelItem() && getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); if (accepted) { @@ -2259,7 +1826,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } else { - setSelectionFromRoot(this, FALSE); + getRoot()->setSelection(this, FALSE); toggleOpen(); } handled = TRUE; @@ -2293,16 +1860,6 @@ void LLFolderViewFolder::draw() mExpanderHighlighted = FALSE; } -BOOL LLFolderViewFolder::potentiallyVisible() -{ - // folder should be visible by it's own filter status - return LLFolderViewItem::potentiallyVisible() - // or one or more of its descendants have passed the minimum filter requirement - || hasFilteredDescendants() - // or not all of its descendants have been checked against minimum filter requirement - || getCompletedFilterGeneration() < getRoot()->getFilter()->getFirstSuccessGeneration(); -} - // this does prefix traversal, as folders are listed above their contents LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children ) { diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index fd2948f34e..7e48969826 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -35,6 +35,7 @@ class LLFolderViewModelItem; class LLFolderViewFolder; class LLFolderViewFunctor; class LLFolderViewFilter; +class LLFolderViewModelInterface; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFolderViewItem @@ -78,8 +79,6 @@ public: static const F32 FOLDER_CLOSE_TIME_CONSTANT; static const F32 FOLDER_OPEN_TIME_CONSTANT; - const std::string& getSearchableLabel() { return mSearchableLabel; } - private: BOOL mIsSelected; @@ -90,7 +89,6 @@ protected: LLFolderViewItem(const Params& p); std::string mLabel; - std::string mSearchableLabel; S32 mLabelWidth; bool mLabelWidthDirty; LLFolderViewFolder* mParentFolder; @@ -106,8 +104,7 @@ protected: BOOL mHasVisibleChildren; S32 mIndentation; S32 mItemHeight; - BOOL mPassedFilter; - S32 mLastFilterGeneration; + //TODO RN: create interface for string highlighting //std::string::size_type mStringMatchOffset; F32 mControlLabelRotation; @@ -115,9 +112,6 @@ protected: BOOL mDragAndDropTarget; bool mIsMouseOverTitle; - // helper function to change the selection from the root. - void changeSelectionFromRoot(LLFolderViewItem* selection, BOOL selected); - // this is an internal method used for adding items to folders. A // no-op at this level, but reimplemented in derived classes. virtual BOOL addItem(LLFolderViewItem*) { return FALSE; } @@ -130,39 +124,20 @@ public: virtual void openItem( void ); - // This function clears the currently selected item, and records - // the specified selected item appropriately for display and use - // in the UI. If open is TRUE, then folders are opened up along - // the way to the selection. - void setSelectionFromRoot(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus = TRUE); - - // This function is called when the folder view is dirty. It's - // implemented here but called by derived classes when folding the - // views. - void arrangeFromRoot(); - void filterFromRoot( void ); - void arrangeAndSet(BOOL set_selection, BOOL take_keyboard_focus); virtual ~LLFolderViewItem( void ); // addToFolder() returns TRUE if it succeeds. FALSE otherwise - enum { ARRANGE = TRUE, DO_NOT_ARRANGE = FALSE }; virtual BOOL addToFolder(LLFolderViewFolder* folder); // Finds width and height of this object and it's children. Also // makes sure that this view and it's children are the right size. - virtual S32 arrange( S32* width, S32* height, S32 filter_generation ); + virtual S32 arrange( S32* width, S32* height ); virtual S32 getItemHeight(); - // applies filters to control visibility of items - virtual void filter( LLFolderViewFilter& filter); - // updates filter serial number and optionally propagated value up to root - S32 getLastFilterGeneration() { return mLastFilterGeneration; } - - virtual void dirtyFilter(); + S32 getLastFilterGeneration() const; // If 'selection' is 'this' then note that otherwise ignore. // Returns TRUE if this item ends up being selected. @@ -213,8 +188,6 @@ public: // viewed. This method will ask the viewed object itself. const std::string& getName( void ) const; - const std::string& getSearchableLabel( void ) const; - // This method returns the label displayed on the view. This // method was primarily added to allow sorting on the folder // contents possible before the entire view has been constructed. @@ -224,12 +197,17 @@ public: LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } + void setParentFolder(LLFolderViewFolder* parent) { mParentFolder = parent; } + LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); const LLFolderViewModelItem* getViewModelItem( void ) const { return mListener; } LLFolderViewModelItem* getViewModelItem( void ) { return mListener; } + const LLFolderViewModelInterface* getFolderViewModel( void ) const; + LLFolderViewModelInterface* getFolderViewModel( void ); + // just rename the object. void rename(const std::string& new_name); @@ -239,15 +217,11 @@ public: virtual BOOL isOpen() const { return FALSE; } virtual LLFolderView* getRoot(); + virtual const LLFolderView* getRoot() const; BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); S32 getIndentation() { return mIndentation; } - virtual BOOL potentiallyVisible(); // is the item definitely visible or we haven't made up our minds yet? - virtual BOOL potentiallyHidden(); // did this item not pass the filter or do we not know yet? - - virtual BOOL getFiltered(); - virtual BOOL getFiltered(S32 filter_generation); - virtual void setFiltered(BOOL filtered, S32 filter_generation); + virtual BOOL passedFilter(S32 filter_generation = -1); // refresh information from the object being viewed. virtual void refresh(); @@ -305,7 +279,6 @@ protected: F32 mAutoOpenCountdown; S32 mLastArrangeGeneration; S32 mLastCalculatedWidth; - S32 mCompletedFilterGeneration; S32 mMostFilteredDescendantGeneration; bool mNeedsSort; bool mPassedFolderFilter; @@ -322,8 +295,6 @@ public: virtual ~LLFolderViewFolder( void ); - virtual BOOL potentiallyVisible(); - LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); @@ -332,34 +303,17 @@ public: // Finds width and height of this object and it's children. Also // makes sure that this view and it's children are the right size. - virtual S32 arrange( S32* width, S32* height, S32 filter_generation ); + virtual S32 arrange( S32* width, S32* height ); BOOL needsArrange(); - virtual void setCompletedFilterGeneration(S32 generation, BOOL recurse_up); - virtual S32 getCompletedFilterGeneration() { return mCompletedFilterGeneration; } - - BOOL hasFilteredDescendants(S32 filter_generation); - BOOL hasFilteredDescendants(); - - // applies filters to control visibility of items - virtual void filter( LLFolderViewFilter& filter); - virtual void setFiltered(BOOL filtered, S32 filter_generation); - virtual BOOL getFiltered(); - virtual BOOL getFiltered(S32 filter_generation); - - virtual void dirtyFilter(); - - // folder-specific filtering (filter status propagates top down instead of bottom up) - void filterFolder(LLFolderViewFilter& filter); - void setFilteredFolder(bool filtered, S32 filter_generation); - bool getFilteredFolder(S32 filter_generation); + bool descendantsPassedFilter(S32 filter_generation = -1); // Passes selection information on to children and record // selection information if necessary. // Returns TRUE if this object (or a child) ends up being selected. // If 'openitem' is TRUE then folders are opened up along the way to the selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus = TRUE); // This method is used to change the selection of an item. // Recursively traverse all children; if 'selection' is 'this' then change @@ -385,14 +339,6 @@ public: //virtual BOOL removeRecursively(BOOL single_item); //virtual BOOL remove(); - // remove the specified item (and any children) if - // possible. Return TRUE if the item was deleted. - BOOL removeItem(LLFolderViewItem* item); - - // simply remove the view (and any children) Don't bother telling - // the listeners. - void removeView(LLFolderViewItem* item); - // extractItem() removes the specified item from the folder, but // doesn't delete it. virtual void extractItem( LLFolderViewItem* item ); diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index 74c8bb92ef..0216ba2a07 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -72,9 +72,9 @@ public: // +-------------------------------------------------------------------+ // + Execution And Results // +-------------------------------------------------------------------+ - virtual bool check(const LLFolderViewItem* item) = 0; + virtual bool check(const LLFolderViewModelItem* item) = 0; virtual bool check(const LLInventoryItem* item) = 0; - virtual bool checkFolder(const LLFolderViewFolder* folder) const = 0; + virtual bool checkFolder(const LLFolderViewModelItem* folder) const = 0; virtual bool checkFolder(const LLUUID& folder_id) const = 0; virtual void setEmptyLookupMessage(const std::string& message) = 0; @@ -126,6 +126,8 @@ public: virtual bool contentsReady() = 0; virtual void setFolderView(LLFolderView* folder_view) = 0; + virtual LLFolderViewFilter* getFilter() = 0; + virtual const LLFolderViewFilter* getFilter() const = 0; }; class LLFolderViewModelCommon : public LLFolderViewModelInterface @@ -152,20 +154,82 @@ protected: }; +template +class LLFolderViewModel : public LLFolderViewModelCommon +{ +public: + LLFolderViewModel(){} + virtual ~LLFolderViewModel() {} + + typedef SORT_TYPE SortType; + typedef ITEM_TYPE ItemType; + typedef FOLDER_TYPE FolderType; + typedef FILTER_TYPE FilterType; + + virtual SortType& getSorter() { return mSorter; } + virtual const SortType& getSorter() const { return mSorter; } + virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } + + virtual FilterType* getFilter() { return &mFilter; } + virtual const FilterType* getFilter() const { return &mFilter; } + virtual void setFilter(const FilterType& filter) { mFilter = filter; } + + // TODO RN: remove this and put all filtering logic in view model + // add getStatusText and isFiltering() + virtual bool contentsReady() { return true; } + + struct ViewModelCompare + { + ViewModelCompare(const SortType& sorter) + : mSorter(sorter) + {} + + bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + const SortType& mSorter; + }; + + void sort(LLFolderViewFolder* folder) + { + if (needsSort(folder->getViewModelItem())) + { + folder->sortFolders(ViewModelCompare(getSorter())); + folder->sortItems(ViewModelCompare(getSorter())); + folder->getViewModelItem()->setSortVersion(mTargetSortVersion); + folder->requestArrange(); + } + } + + //TODO RN: fix this + void filter(LLFolderViewFolder* folder) + { + + } + +protected: + SortType mSorter; + FilterType mFilter; +}; + // This is am abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data class LLFolderViewModelItem { public: - LLFolderViewModelItem() - : mFolderViewItem(NULL) - {} - virtual ~LLFolderViewModelItem( void ) {}; virtual void update() {} //called when drawing virtual const std::string& getName() const = 0; virtual const std::string& getDisplayName() const = 0; + virtual const std::string& getSearchableName() const = 0; virtual LLPointer getIcon() const = 0; virtual LLPointer getIconOpen() const { return getIcon(); } @@ -198,12 +262,23 @@ public: virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; + virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? + + virtual void filter( LLFolderViewFilter& filter) = 0; + virtual bool passedFilter(S32 filter_generation = -1) = 0; + virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; + virtual void dirtyFilter() = 0; + + virtual S32 getLastFilterGeneration() const = 0; + // This method should be called when a drag begins. returns TRUE // if the drag can begin, otherwise FALSE. virtual LLToolDragAndDrop::ESource getDragSource() const = 0; virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; virtual bool hasChildren() const = 0; + virtual void addChild(LLFolderViewModelItem* child) = 0; // This method will be called to determine if a drop can be // performed, and will set drop to TRUE if a drop is @@ -217,10 +292,12 @@ public: virtual void requestSort() = 0; virtual S32 getSortVersion() = 0; virtual void setSortVersion(S32 version) = 0; + virtual void setParent(LLFolderViewModelItem* parent) = 0; + protected: + friend class LLFolderViewItem; - void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} - LLFolderViewItem* mFolderViewItem; + virtual void setFolderViewItem(LLFolderViewItem* folder_view_item) = 0; }; @@ -228,95 +305,48 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: LLFolderViewModelItemCommon() - : mSortVersion(-1) + : mSortVersion(-1), + mPassedFilter(false), + mPassedFolderFilter(false), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mMostFilteredDescendantGeneration(-1) {} void requestSort() { mSortVersion = -1; } S32 getSortVersion() { return mSortVersion; } void setSortVersion(S32 version) { mSortVersion = version;} -protected: - - S32 mSortVersion; -}; - -template -class LLFolderViewModel : public LLFolderViewModelCommon -{ -public: - LLFolderViewModel(){} - virtual ~LLFolderViewModel() {} - - typedef SORT_TYPE SortType; - typedef ITEM_TYPE ItemType; - typedef FOLDER_TYPE FolderType; - typedef FILTER_TYPE FilterType; - - virtual SortType& getSorter() { return mSorter; } - virtual const SortType& getSorter() const { return mSorter; } - virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } - virtual FilterType& getFilter() { return mFilter; } - virtual const FilterType& getFilter() const { return mFilter; } - virtual void setFilter(const FilterType& filter) { mFilter = filter; } - - // TODO RN: remove this and put all filtering logic in view model - // add getStatusText and isFiltering() - virtual bool contentsReady() { return true; } - - struct ViewModelCompare + S32 getLastFilterGeneration() const { return mLastFilterGeneration; } + void dirtyFilter() { - ViewModelCompare(const SortType& sorter) - : mSorter(sorter) - {} - - bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const + mLastFilterGeneration = -1; + // bubble up dirty flag all the way to root + if (mParent) { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + mParent->dirtyFilter(); } + } + virtual void addChild(LLFolderViewModelItem* child) { mChildren.push_back(child); child->setParent(this); } - bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const - { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); - } +protected: + virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } - const SortType& mSorter; - }; + S32 mSortVersion; + bool mPassedFilter; + bool mPassedFolderFilter; - void sort(LLFolderViewFolder* folder) - { - if (needsSort(folder->getViewModelItem())) - { - folder->sortFolders(ViewModelCompare(getSorter())); - folder->sortItems(ViewModelCompare(getSorter())); - folder->getViewModelItem()->setSortVersion(mTargetSortVersion); - folder->requestArrange(); - } - } + S32 mLastFilterGeneration; + S32 mMostFilteredDescendantGeneration; - //TODO RN: fix this - void filter(LLFolderViewFolder* folder) - { - /*FilterType& filter = getFilter(); - for (std::list::const_iterator it = folder->getItemsBegin(), end_it = folder->getItemsEnd(); - it != end_it; - ++it) - { - LLFolderViewItem* child_item = *it; - child_item->setFiltered(filter.checkFolder(static_cast(child_item->getViewModelItem())), filter.getCurrentGeneration()); - } - for (std::list::const_iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd(); - it != end_it; - ++it) - { - LLFolderViewItem* child_folder = *it; - child_folder->setFiltered(filter.check(static_cast(child_folder->getViewModelItem())), filter.getCurrentGeneration()); - }*/ - } + typedef std::list child_list_t; + child_list_t mChildren; + LLFolderViewModelItem* mParent; -protected: - SortType mSorter; - FilterType mFilter; + void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} + LLFolderViewItem* mFolderViewItem; }; + #endif diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 70a174a140..45a2bffa6b 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1545,6 +1545,10 @@ void LLItemBridge::buildDisplayName() const { mDisplayName.assign(LLStringUtil::null); } + + mSearchableName.assign(mDisplayName); + mSearchableName.append(getLabelSuffix()); + LLStringUtil::toUpper(mSearchableName); } LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const @@ -1850,11 +1854,9 @@ void LLFolderBridge::buildDisplayName() const LLTrans::findString(mDisplayName, std::string("InvFolder ") + getName(), LLSD()); } - //if (mDisplayName.empty()) - //{ - // S32 foo; - // foo = 0; - //} + mSearchableName.assign(mDisplayName); + mSearchableName.append(getLabelSuffix()); + LLStringUtil::toUpper(mSearchableName); } @@ -4000,7 +4002,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID()); if (!fv_item) return false; - accept = filter->check(fv_item); + accept = filter->check(fv_item->getViewModelItem()); } if (accept && drop) @@ -4222,7 +4224,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, LLFolderViewItem* fv_item = active_panel->getItemByID(inv_item->getUUID()); if (!fv_item) return false; - accept = filter->check(fv_item); + accept = filter->check(fv_item->getViewModelItem()); } if (accept && drop) @@ -4319,7 +4321,7 @@ bool check_item(const LLUUID& item_id, LLFolderViewItem* fv_item = active_panel->getItemByID(item_id); if (!fv_item) return false; - return filter->check(fv_item); + return filter->check(fv_item->getViewModelItem()); } // +=================================================+ @@ -6126,7 +6128,7 @@ void LLLinkFolderBridge::gotoItem() model->fetchDescendentsOf(cat_uuid); } base_folder->setOpen(TRUE); - mRoot->setSelectionFromRoot(base_folder,TRUE); + mRoot->setSelection(base_folder,TRUE); mRoot->scrollToShowSelection(); } } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 26789627f7..b0582d003d 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -88,6 +88,8 @@ public: //-------------------------------------------------------------------- virtual const std::string& getName() const; virtual const std::string& getDisplayName() const; + const std::string& getSearchableName() const { return mSearchableName; } + virtual PermissionMask getPermissionMask() const; virtual LLFolderType::EType getPreferredType() const; virtual time_t getCreationDate() const; @@ -174,6 +176,7 @@ protected: bool mIsLink; LLTimer mTimeSinceRequestStart; mutable std::string mDisplayName; + mutable std::string mSearchableName; void purgeItem(LLInventoryModel *model, const LLUUID &uuid); virtual void buildDisplayName() const {} diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c13bb5123e..c7e0136368 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -71,35 +71,35 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) mFilterOps(p.filter_ops), mOrder(p.sort_order), mFilterSubString(p.substring), - mLastSuccessGeneration(0), - mLastFailGeneration(S32_MAX), + mCurrentGeneration(0), + mFirstRequiredGeneration(0), mFirstSuccessGeneration(0), mFilterCount(0) { - mNextFilterGeneration = mLastSuccessGeneration + 1; + mNextFilterGeneration = mCurrentGeneration + 1; // copy mFilterOps into mDefaultFilterOps markDefault(); } -bool LLInventoryFilter::check(const LLFolderViewItem* item) +bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { + const LLFolderViewModelItemInventory* listener = static_cast(item); // Clipboard cut items are *always* filtered so we need this value upfront - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. - const BOOL is_folder = (dynamic_cast(item) != NULL); + const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; - const BOOL passed_filtertype = checkAgainstFilterType(item); - const BOOL passed_permissions = checkAgainstPermissions(item); - const BOOL passed_filterlink = checkAgainstFilterLinks(item); + const BOOL passed_filtertype = checkAgainstFilterType(listener); + const BOOL passed_permissions = checkAgainstPermissions(listener); + const BOOL passed_filterlink = checkAgainstFilterLinks(listener); const BOOL passed = (passed_filtertype && passed_permissions && passed_filterlink && @@ -117,27 +117,19 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) const bool passed_permissions = checkAgainstPermissions(item); const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID()); const bool passed = (passed_filtertype - && passed_permissions - && passed_clipboard - && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + && passed_permissions + && passed_clipboard + && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } -bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const +bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const { - if (!folder) - { - llwarns << "The filter can not be checked on an invalid folder." << llendl; - llassert(false); // crash in development builds - return false; - } - - const LLFolderViewModelItemInventory* listener = static_cast(folder->getViewModelItem()); + const LLFolderViewModelItemInventory* listener = static_cast(item); if (!listener) { - llwarns << "Folder view event listener not found." << llendl; - llassert(false); // crash in development builds + llerrs << "Folder view event listener not found." << llendl; return false; } @@ -179,9 +171,8 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return passed_clipboard; } -bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; LLInventoryType::EType object_type = listener->getInventoryType(); @@ -347,13 +338,12 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const return true; } -bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return FALSE; PermissionMask perm = listener->getPermissionMask(); - const LLInvFVBridge *bridge = dynamic_cast(item->getViewModelItem()); + const LLInvFVBridge *bridge = dynamic_cast(listener); if (bridge && bridge->isLink()) { const LLUUID& linked_uuid = gInventory.getLinkedItemID(bridge->getUUID()); @@ -375,9 +365,8 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions; } -bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const +bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInventory* listener) const { - const LLFolderViewModelItemInventory* listener = static_cast(item->getViewModelItem()); if (!listener) return TRUE; const LLUUID object_id = listener->getUUID(); @@ -740,7 +729,7 @@ void LLInventoryFilter::resetDefault() void LLInventoryFilter::setModified(EFilterModified behavior) { mFilterText.clear(); - mLastSuccessGeneration = mNextFilterGeneration++; + mCurrentGeneration = mNextFilterGeneration++; if (mFilterModified == FILTER_NONE) { @@ -753,33 +742,21 @@ void LLInventoryFilter::setModified(EFilterModified behavior) mFilterModified = FILTER_RESTART; } - if (isNotDefault()) - { - // if not keeping current filter results, update last valid as well - switch(mFilterModified) - { - case FILTER_RESTART: - mLastFailGeneration = mLastSuccessGeneration; - mFirstSuccessGeneration = mLastSuccessGeneration; - break; - case FILTER_LESS_RESTRICTIVE: - mLastFailGeneration = mLastSuccessGeneration; - break; - case FILTER_MORE_RESTRICTIVE: - mFirstSuccessGeneration = mLastSuccessGeneration; - // must have passed either current filter generation (meaningless, as it hasn't been run yet) - // or some older generation, so keep the value - mLastFailGeneration = llmin(mLastFailGeneration, mLastSuccessGeneration); - break; - default: - llerrs << "Bad filter behavior specified" << llendl; - } - } - else + // if not keeping current filter results, update last valid as well + switch(mFilterModified) { - // shortcut disabled filters to show everything immediately - mLastFailGeneration = 0; - mFirstSuccessGeneration = S32_MAX; + case FILTER_RESTART: + mFirstRequiredGeneration = mCurrentGeneration; + mFirstSuccessGeneration = mCurrentGeneration; + break; + case FILTER_LESS_RESTRICTIVE: + mFirstRequiredGeneration = mCurrentGeneration; + break; + case FILTER_MORE_RESTRICTIVE: + mFirstSuccessGeneration = mCurrentGeneration; + break; + default: + llerrs << "Bad filter behavior specified" << llendl; } } @@ -1101,7 +1078,7 @@ void LLInventoryFilter::decrementFilterCount() S32 LLInventoryFilter::getCurrentGeneration() const { - return mLastSuccessGeneration; + return mCurrentGeneration; } S32 LLInventoryFilter::getFirstSuccessGeneration() const { @@ -1109,7 +1086,7 @@ S32 LLInventoryFilter::getFirstSuccessGeneration() const } S32 LLInventoryFilter::getFirstRequiredGeneration() const { - return mLastFailGeneration; + return mFirstRequiredGeneration; } void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 5b92c21a85..af245a9c3b 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -186,16 +186,10 @@ public: // +-------------------------------------------------------------------+ // + Execution And Results // +-------------------------------------------------------------------+ - bool check(const LLFolderViewItem* item); + bool check(const LLFolderViewModelItem* listener); bool check(const LLInventoryItem* item); - bool checkFolder(const LLFolderViewFolder* folder) const; + bool checkFolder(const LLFolderViewModelItem* listener) const; bool checkFolder(const LLUUID& folder_id) const; - bool checkAgainstFilterType(const LLFolderViewItem* item) const; - bool checkAgainstFilterType(const LLInventoryItem* item) const; - bool checkAgainstPermissions(const LLFolderViewItem* item) const; - bool checkAgainstPermissions(const LLInventoryItem* item) const; - bool checkAgainstFilterLinks(const LLFolderViewItem* item) const; - bool checkAgainstClipboard(const LLUUID& object_id) const; bool showAllResults() const; @@ -260,6 +254,12 @@ public: private: bool areDateLimitsSet(); + bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const; + bool checkAgainstFilterType(const LLInventoryItem* item) const; + bool checkAgainstPermissions(const class LLFolderViewModelItemInventory* listener) const; + bool checkAgainstPermissions(const LLInventoryItem* item) const; + bool checkAgainstFilterLinks(const class LLFolderViewModelItemInventory* listener) const; + bool checkAgainstClipboard(const LLUUID& object_id) const; U32 mOrder; @@ -270,8 +270,8 @@ private: std::string mFilterSubStringOrig; const std::string mName; - S32 mLastSuccessGeneration; - S32 mLastFailGeneration; + S32 mCurrentGeneration; + S32 mFirstRequiredGeneration; S32 mFirstSuccessGeneration; S32 mNextFilterGeneration; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 1e494c3ef1..ff461236a2 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -983,7 +983,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) void LLOpenFilteredFolders::doItem(LLFolderViewItem *item) { - if (item->getFiltered()) + if (item->passedFilter()) { item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); } @@ -991,12 +991,12 @@ void LLOpenFilteredFolders::doItem(LLFolderViewItem *item) void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder) { - if (folder->getFiltered() && folder->getParentFolder()) + if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder()) { folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); } // if this folder didn't pass the filter, and none of its descendants did - else if (!folder->getFiltered() && !folder->hasFilteredDescendants()) + else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter()) { folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO); } @@ -1004,7 +1004,7 @@ void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder) void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item) { - if (item->getFiltered() && !mItemSelected) + if (item->passedFilter() && !mItemSelected) { item->getRoot()->setSelection(item, FALSE, FALSE); if (item->getParentFolder()) @@ -1017,7 +1017,7 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item) void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder) { - if (folder->getFiltered() && !mItemSelected) + if (folder->LLFolderViewItem::passedFilter() && !mItemSelected) { folder->getRoot()->setSelection(folder, FALSE, FALSE); if (folder->getParentFolder()) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 74492e0005..aba4c088ab 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -254,18 +254,16 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); // Scroller - { - LLRect scroller_view_rect = getRect(); - scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); - LLScrollContainer::Params scroller_params(params.scroll()); - scroller_params.rect(scroller_view_rect); - mScroller = LLUICtrlFactory::create(scroller_params); - addChild(mScroller); - mScroller->addChild(mFolderRoot); - mFolderRoot->setScrollContainer(mScroller); - mFolderRoot->setFollowsAll(); - mFolderRoot->addChild(mFolderRoot->mStatusTextBox); - } + LLRect scroller_view_rect = getRect(); + scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); + LLScrollContainer::Params scroller_params(params.scroll()); + scroller_params.rect(scroller_view_rect); + mScroller = LLUICtrlFactory::create(scroller_params); + addChild(mScroller); + mScroller->addChild(mFolderRoot); + mFolderRoot->setScrollContainer(mScroller); + mFolderRoot->setFollowsAll(); + mFolderRoot->addChild(mFolderRoot->mStatusTextBox); // Set up the callbacks from the inventory we're viewing, and then build everything. mInventoryObserver = new LLInventoryPanelObserver(this); @@ -344,12 +342,12 @@ void LLInventoryPanel::draw() const LLInventoryFilter* LLInventoryPanel::getFilter() const { - return &getFolderViewModel()->getFilter(); + return getFolderViewModel()->getFilter(); } LLInventoryFilter* LLInventoryPanel::getFilter() { - return &getFolderViewModel()->getFilter(); + return getFolderViewModel()->getFilter(); } void LLInventoryPanel::setFilterTypes(U64 types, LLInventoryFilter::EFilterType filter_type) @@ -561,7 +559,6 @@ void LLInventoryPanel::modelChanged(U32 mask) if (new_parent != NULL) { // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI. - view_item->getParentFolder()->extractItem(view_item); view_item->addToFolder(new_parent); addItemID(viewmodel_item->getUUID(), view_item); } @@ -1358,3 +1355,104 @@ void LLFolderViewModelItemInventory::requestSort() mFolderViewItem->getParentFolder()->getViewModelItem()->requestSort(); } } + +bool LLFolderViewModelItemInventory::potentiallyVisible() +{ + return passedFilter() // we've passed the filter + || getLastFilterGeneration() < mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration() // or we don't know yet + || descendantsPassedFilter(); +} + +bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) +{ + if (filter_generation < 0) filter_generation = mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration(); + return mPassedFolderFilter + && mLastFilterGeneration >= filter_generation + && (mPassedFilter || descendantsPassedFilter(filter_generation)); +} + +bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) +{ + if (filter_generation < 0) filter_generation = mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration(); + return mMostFilteredDescendantGeneration >= filter_generation; +} + +void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) +{ + mPassedFilter = passed; + mPassedFolderFilter = passed_folder; + mLastFilterGeneration = filter_generation; +} + +void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +{ + S32 filter_generation = filter.getCurrentGeneration(); + S32 must_pass_generation = filter.getFirstRequiredGeneration(); + + // mMostFilteredDescendantGeneration might have been reset + // in which case we need to update it even for folders that + // don't need to be filtered anymore + if (item->getLastFilterGeneration() < filter_generation) + { + if (item->getLastFilterGeneration() >= must_pass_generation && + !item->passedFilter(must_pass_generation)) + { + // failed to pass an earlier filter that was a subset of the current one + // go ahead and flag this item as done + item->setPassedFilter(false, false, filter_generation); + } + else + { + //TODO RN: + item->filter( filter ); + } + } + + // track latest generation to pass any child items + if (item->passedFilter()) + { + mMostFilteredDescendantGeneration = filter_generation; + //TODO RN: ensure this still happens + //requestArrange(); + } +} + +void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +{ + if(getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass + || descendantsPassedFilter(filter.getFirstRequiredGeneration())) // or at least one descendant has passed the minimum requirement + { + // now query children + for (child_list_t::iterator iter = mChildren.begin(); + iter != mChildren.end() && filter.getFilterCount() > 0; + ++iter) + { + filterChildItem((*iter), filter); + } + } + + // if we didn't use all filter iterations + // that means we filtered all of our descendants + // so filter ourselves now + if (filter.getFilterCount() > 0) + { + const BOOL previous_passed_filter = mPassedFilter; + const BOOL passed_filter = filter.check(this); + const BOOL passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) + ? filter.checkFolder(this) + : true; + + // If our visibility will change as a result of this filter, then + // we need to be rearranged in our parent folder + LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); + if (parent_folder && passed_filter != previous_passed_filter) + { + parent_folder->requestArrange(); + } + + setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration()); + //TODO RN: create interface for string highlighting + //mStringMatchOffset = filter.getStringMatchOffset(this); + filter.decrementFilterCount(); + } +} diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 645e2f6d76..35a3f9b5e1 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -62,6 +62,12 @@ public: virtual EInventorySortGroup getSortGroup() const = 0; virtual LLInventoryObject* getInventoryObject() const = 0; virtual void requestSort(); + virtual bool potentiallyVisible(); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool descendantsPassedFilter(S32 filter_generation = -1); + virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); + virtual void filter( LLFolderViewFilter& filter); + virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); }; class LLInventorySort diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 901c6379de..0b899d34f4 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -102,7 +102,7 @@ void LLCheckFolderState::doFolder(LLFolderViewFolder* folder) // Counting only folders that pass the filter. // The listener check allow us to avoid counting the folder view // object itself because it has no listener assigned. - if (folder->hasFilteredDescendants() && folder->getViewModelItem()) + if (folder->getViewModelItem()->descendantsPassedFilter()) { if (folder->isOpen()) { diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index e3446fdb3a..33581160fd 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -227,7 +227,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) } } - LLInventoryFilter* filter = getChild("Recent Items")->getFilter(); + LLInventoryFilter* filter = findChild("Recent Items")->getFilter(); if (filter) { LLSD filterState; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index da82d70f22..6a232a26f7 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -77,6 +77,7 @@ protected: LLUUID mUUID; std::string mName; mutable std::string mDisplayName; + mutable std::string mSearchableName; LLPanelObjectInventory* mPanel; U32 mFlags; LLAssetType::EType mAssetType; @@ -105,6 +106,8 @@ public: // LLFolderViewModelItemInventory functionality virtual const std::string& getName() const; virtual const std::string& getDisplayName() const; + virtual const std::string& getSearchableName() const; + virtual PermissionMask getPermissionMask() const { return PERM_NONE; } /*virtual*/ LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; } virtual const LLUUID& getUUID() const { return mUUID; } @@ -335,9 +338,17 @@ const std::string& LLTaskInvFVBridge::getDisplayName() const } } + mSearchableName.assign(mDisplayName + getLabelSuffix()); + return mDisplayName; } +const std::string& LLTaskInvFVBridge::getSearchableName() const +{ + return mSearchableName; +} + + // BUG: No creation dates for task inventory time_t LLTaskInvFVBridge::getCreationDate() const { diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 194aa7f71b..b143240187 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -271,7 +271,7 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked() if (outfit_folder) { outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelectionFromRoot(outfit_folder,TRUE); + root->setSelection(outfit_folder,TRUE); root->scrollToShowSelection(); } } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 50d63911ad..654b18614a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -623,10 +623,9 @@ void LLFloaterTexturePicker::draw() LLFolderView* folder_view = mInventoryPanel->getRootFolder(); if (!folder_view) return; - LLInventoryFilter* filter = static_cast(folder_view->getFilter()); - if (!filter) return; + LLInventoryFilter* filter = static_cast(folder_view->getFolderViewModel())->getFilter(); - bool is_filter_active = folder_view->getCompletedFilterGeneration() < filter->getCurrentGeneration() && + bool is_filter_active = folder_view->getLastFilterGeneration() < filter->getCurrentGeneration() && filter->isNotDefault(); // After inventory panel filter is applied we have to update @@ -637,8 +636,9 @@ void LLFloaterTexturePicker::draw() if (!is_filter_active && !mSelectedItemPinned) { folder_view->setPinningSelectedItem(mSelectedItemPinned); - folder_view->dirtyFilter(); - folder_view->arrangeFromRoot(); + folder_view->getViewModelItem()->dirtyFilter(); + //TODO RN: test + //folder_view->arrangeFromRoot(); mSelectedItemPinned = TRUE; } -- cgit v1.2.3 From 569c004057ef5da03e05bedf77d39159e5782458 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 27 Jun 2012 19:17:49 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose fixed crash on startup --- indra/newview/llfolderviewmodel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index 0216ba2a07..c5079712f5 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -310,7 +310,8 @@ public: mPassedFolderFilter(false), mFolderViewItem(NULL), mLastFilterGeneration(-1), - mMostFilteredDescendantGeneration(-1) + mMostFilteredDescendantGeneration(-1), + mParent(NULL) {} void requestSort() { mSortVersion = -1; } -- cgit v1.2.3 From e8fa07d6384c9eb2a0fb42b0e06abb6a0d5fdea9 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 28 Jun 2012 16:47:37 -0700 Subject: CHUI-82 : Fixed all icons to use the new Conv_*.png icons; please use those in the new UIs moving forward --- .../textures/icons/Conv_toolbar_add_person.png | Bin 0 -> 322 bytes .../textures/icons/Conv_toolbar_arrow_ne.png | Bin 0 -> 301 bytes .../textures/icons/Conv_toolbar_arrow_sw.png | Bin 0 -> 293 bytes .../textures/icons/Conv_toolbar_call_log.png | Bin 0 -> 546 bytes .../default/textures/icons/Conv_toolbar_close.png | Bin 0 -> 262 bytes .../textures/icons/Conv_toolbar_collapse.png | Bin 0 -> 663 bytes .../default/textures/icons/Conv_toolbar_expand.png | Bin 0 -> 662 bytes .../textures/icons/Conv_toolbar_hang_up.png | Bin 0 -> 460 bytes .../textures/icons/Conv_toolbar_open_call.png | Bin 0 -> 485 bytes .../default/textures/icons/Conv_toolbar_plus.png | Bin 0 -> 195 bytes .../default/textures/icons/Conv_toolbar_sort.png | Bin 0 -> 196 bytes indra/newview/skins/default/textures/textures.xml | 14 ++++++++ .../skins/default/xui/en/floater_im_container.xml | 10 +++--- .../skins/default/xui/en/floater_im_session.xml | 36 ++++++++++----------- .../default/xui/en/panel_block_list_sidetray.xml | 2 +- .../newview/skins/default/xui/en/panel_people.xml | 8 ++--- 16 files changed, 42 insertions(+), 28 deletions(-) create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_close.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png create mode 100755 indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png new file mode 100755 index 0000000000..f024c733f3 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_add_person.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png new file mode 100755 index 0000000000..a19e720d42 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_ne.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png new file mode 100755 index 0000000000..7f3f42639d Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_arrow_sw.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png new file mode 100755 index 0000000000..2880eb766a Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_call_log.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png new file mode 100755 index 0000000000..25a939d7f5 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_close.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png new file mode 100755 index 0000000000..82baabde47 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_collapse.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png new file mode 100755 index 0000000000..7d64abb042 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_expand.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png new file mode 100755 index 0000000000..f0da962c2d Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_hang_up.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png new file mode 100755 index 0000000000..0db001dcdb Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_open_call.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png new file mode 100755 index 0000000000..0cf7edc2d4 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_plus.png differ diff --git a/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png b/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png new file mode 100755 index 0000000000..a0c15a6d3e Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Conv_toolbar_sort.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index eabcc68916..ce9474d5e5 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -160,7 +160,21 @@ with the same filename but different name + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index ce40f44a64..8e434b5848 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -15,10 +15,10 @@ width="680"> + value="Conv_toolbar_collapse"/> + value="Conv_toolbar_expand"/> - VoicePTT_Off - VoicePTT_On + Conv_toolbar_open_call + Conv_toolbar_hang_up + value="Conv_toolbar_collapse"/> + value="Conv_toolbar_expand"/> + value="Conv_toolbar_arrow_ne"/> + value="Conv_toolbar_arrow_sw"/> Date: Fri, 29 Jun 2012 11:59:14 -0700 Subject: CHUI-164 : Fix crash when removing ad-hoc conversation. Turns out that sessions uuids are not constant so I shouldn't use them as index in the conversation list. More complete fix to follow. --- indra/newview/llimconversation.cpp | 2 +- indra/newview/llimfloatercontainer.cpp | 34 ++++++++++++++++++++-------------- indra/newview/llimfloatercontainer.h | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index c734c3edd2..d7ef65edb6 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -359,7 +359,7 @@ void LLIMConversation::onClose(bool app_quitting) LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); if (im_box) { - im_box->removeConversationListItem(mSessionID); + im_box->removeConversationListItem(mSessionID,this); } } } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 34a9758c52..85cc8cf38b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -416,19 +416,14 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Check if the item has changed if (item->hasSameValues(name,floaterp)) { - // If it hasn't, nothing to do -> exit + // If it hasn't changed, nothing to do -> exit return; } - // If it has, remove it: it'll be recreated anew further down - removeConversationListItem(uuid,false); } - // Reverse find and clean up: we need to make sure that no other uuid is pointing to that same floater - LLUUID found_id = LLUUID::null; - if (findConversationItem(floaterp,found_id)) - { - removeConversationListItem(found_id,false); - } + // Remove the conversation item that might exist already: it'll be recreated anew further down anyway + // and nothing wrong will happen removing it if it doesn't exist + removeConversationListItem(uuid,floaterp,false); // Create a conversation item LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); @@ -451,21 +446,32 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus) { + // Reverse find : we need to find the item that point to that floater + // Note : the session UUID actually might change so we cannot really use it here + // *TODO : Change the structure so that we use the floaterp and not the uuid as a map index + LLUUID found_id = LLUUID::null; + if (!findConversationItem(floaterp,found_id)) + { + // If the floater wasn't found, we trust the passed id + // Note: in most cases, the id doesn't correspond to any conversation either + found_id = session_id; + } + // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(session_id); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(found_id); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; delete widget; } - + // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(session_id); - mConversationsWidgets.erase(session_id); + mConversationsItems.erase(found_id); + mConversationsWidgets.erase(found_id); // Reposition the leftover conversation items LLRect panel_rect = mConversationsListPanel->getRect(); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 2a8cbf3e1c..181aaa38a8 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -186,7 +186,7 @@ private: // CHUI-137 : Temporary implementation of conversations list public: - void removeConversationListItem(const LLUUID& session_id, bool change_focus = true); + void removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus = true); void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); bool findConversationItem(LLFloater* floaterp, LLUUID& uuid); private: -- cgit v1.2.3 From 5eab95955fec4d3dcb8b2f98c6c084d227e70b8c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 29 Jun 2012 14:29:56 -0700 Subject: CHUI-164 : Fix conversation list index using handle to floater rather than uuid. Simplify the code accordingly (suppress hacks). --- indra/newview/llimconversation.cpp | 2 +- indra/newview/llimfloatercontainer.cpp | 48 +++++++++++++--------------------- indra/newview/llimfloatercontainer.h | 12 ++++----- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index d7ef65edb6..dc68c5cea1 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -359,7 +359,7 @@ void LLIMConversation::onClose(bool app_quitting) LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); if (im_box) { - im_box->removeConversationListItem(mSessionID,this); + im_box->removeConversationListItem(this); } } } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 85cc8cf38b..261b5f33a2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -293,9 +293,9 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is null - conversations_items_map::iterator item_it = mConversationsItems.find(nearbychat_uuid); - if (item_it == mConversationsItems.end()) + LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is always null + LLFloater* floaterp = findConversationItem(nearbychat_uuid); + if (floaterp == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that @@ -407,14 +407,14 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { - // Check if the item is not already in the list, exit if it is and has the same name and points to the same floater (nothing to do) + // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance - conversations_items_map::iterator item_it = mConversationsItems.find(uuid); + conversations_items_map::iterator item_it = mConversationsItems.find(floaterp); if (item_it != mConversationsItems.end()) { LLConversationItem* item = item_it->second; // Check if the item has changed - if (item->hasSameValues(name,floaterp)) + if (item->hasSameValues(name,uuid)) { // If it hasn't changed, nothing to do -> exit return; @@ -423,15 +423,15 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Remove the conversation item that might exist already: it'll be recreated anew further down anyway // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(uuid,floaterp,false); + removeConversationListItem(floaterp,false); // Create a conversation item LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); - mConversationsItems[uuid] = item; + mConversationsItems[floaterp] = item; // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets[uuid] = widget; + mConversationsWidgets[floaterp] = widget; // Add it to the UI widget->setVisible(TRUE); @@ -446,23 +446,12 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool change_focus) { - // Reverse find : we need to find the item that point to that floater - // Note : the session UUID actually might change so we cannot really use it here - // *TODO : Change the structure so that we use the floaterp and not the uuid as a map index - LLUUID found_id = LLUUID::null; - if (!findConversationItem(floaterp,found_id)) - { - // If the floater wasn't found, we trust the passed id - // Note: in most cases, the id doesn't correspond to any conversation either - found_id = session_id; - } - // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(found_id); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(floaterp); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; @@ -470,8 +459,8 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, } // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(found_id); - mConversationsWidgets.erase(found_id); + mConversationsItems.erase(floaterp); + mConversationsWidgets.erase(floaterp); // Reposition the leftover conversation items LLRect panel_rect = mConversationsListPanel->getRect(); @@ -500,20 +489,19 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& session_id, return; } -bool LLIMFloaterContainer::findConversationItem(LLFloater* floaterp, LLUUID& uuid) +LLFloater* LLIMFloaterContainer::findConversationItem(LLUUID& uuid) { - bool found = false; + LLFloater* floaterp = NULL; for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) { LLConversationItem* item = item_it->second; - uuid = item_it->first; - if (item->hasSameValue(floaterp)) + if (item->hasSameValue(uuid)) { - found = true; + floaterp = item_it->first; break; } } - return found; + return floaterp; } LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 181aaa38a8..2bbd371e8f 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -48,8 +48,8 @@ class LLIMFloaterContainer; // CHUI-137 : Temporary implementation of conversations list class LLConversationItem; -typedef std::map conversations_items_map; -typedef std::map conversations_widgets_map; +typedef std::map conversations_items_map; +typedef std::map conversations_widgets_map; // Conversation items: we hold a list of those and create an LLFolderViewItem widget for each // that we tuck into the mConversationsListPanel. @@ -113,8 +113,8 @@ public: void* cargo_data, std::string& tooltip_msg) { return FALSE; } - bool hasSameValues(std::string name, LLFloater* floaterp) { return ((name == mName) && (floaterp == mFloater)); } - bool hasSameValue(LLFloater* floaterp) { return (floaterp == mFloater); } + bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } + bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } private: std::string mName; const LLUUID mUUID; @@ -186,9 +186,9 @@ private: // CHUI-137 : Temporary implementation of conversations list public: - void removeConversationListItem(const LLUUID& session_id, LLFloater* floaterp, bool change_focus = true); + void removeConversationListItem(LLFloater* floaterp, bool change_focus = true); void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); - bool findConversationItem(LLFloater* floaterp, LLUUID& uuid); + LLFloater* findConversationItem(LLUUID& uuid); private: LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); // Conversation list data -- cgit v1.2.3 From cd7d499ea779178d49be65d37e852712f82c3c90 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 28 Jun 2012 17:22:00 +0300 Subject: CHUI-168 FIXED, CHUI-183 FIXED Supress of a resizable and dragging and hide a title for the docked floater --- indra/newview/llimconversation.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index dc68c5cea1..acdd7ba46a 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -250,14 +250,16 @@ void LLIMConversation::updateHeaderAndToolbar() bool is_expanded = is_hosted || is_participant_list_visible; mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); - // The button (>>) should be disabled for torn off P2P conversations. - mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat); - + // toggle floater's drag handle and title visibility if (mDragHandle) { - // toggle floater's drag handle and title visibility - mDragHandle->setVisible(!is_hosted); + mDragHandle->setTitleVisible(!is_hosted); + setCanDrag(!is_hosted); } + setCanResize(!is_hosted); + + // The button (>>) should be disabled for torn off P2P conversations. + mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat); mTearOffBtn->setImageOverlay(getString(is_hosted ? "tear_off_icon" : "return_icon")); @@ -347,6 +349,8 @@ void LLIMConversation::onOpen(const LLSD& key) host_floater->collapseMessagesPane(false); } + setCanResize(TRUE); + updateHeaderAndToolbar(); } -- cgit v1.2.3 From ed7173c987cf4a5de2f3c9b9d792e5ac4006e833 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 28 Jun 2012 23:29:58 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose filtering mostly working --- indra/newview/llfolderview.cpp | 124 ++++++++++----------- indra/newview/llfolderviewitem.cpp | 5 +- indra/newview/llinventorybridge.cpp | 47 ++++---- indra/newview/llinventorybridge.h | 3 + indra/newview/llinventorypanel.cpp | 37 ++++-- indra/newview/llinventorypanel.h | 18 ++- indra/newview/llpanelmarketplaceinboxinventory.cpp | 1 + .../newview/llpanelmarketplaceoutboxinventory.cpp | 1 + indra/newview/llplacesinventorybridge.cpp | 5 + indra/newview/llplacesinventorybridge.h | 1 + indra/newview/llplacesinventorypanel.cpp | 1 + 11 files changed, 135 insertions(+), 108 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index a37fc7714b..0f7809d4b4 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -182,7 +182,6 @@ LLFolderView::LLFolderView(const Params& p) mAutoSelectOverride(FALSE), mNeedsAutoRename(FALSE), mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately - mFilter(new LLInventoryFilter(LLInventoryFilter::Params().name(p.title))), mShowSelectionContext(FALSE), mShowSingleSelection(FALSE), mArrangeGeneration(0), @@ -288,9 +287,6 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); - delete mFilter; - mFilter = NULL; - delete mViewModel; mViewModel = NULL; } @@ -302,6 +298,9 @@ BOOL LLFolderView::canFocusChildren() const BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) { + LLFolderViewFolder::addFolder(folder); + + mFolders.remove(folder); // enforce sort order of My Inventory followed by Library if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) { @@ -311,12 +310,7 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) { mFolders.insert(mFolders.begin(), folder); } - folder->setOrigin(0, 0); - folder->reshape(getRect().getWidth(), 0); - folder->setVisible(FALSE); - addChild( folder ); - folder->getViewModelItem()->dirtyFilter(); - folder->requestArrange(); + return TRUE; } @@ -717,7 +711,7 @@ void LLFolderView::draw() } else if (mShowEmptyMessage) { - if (!mViewModel->contentsReady() || getLastFilterGeneration() < mFilter->getFirstSuccessGeneration()) + if (!mViewModel->contentsReady() || getLastFilterGeneration() < getFolderViewModel()->getFilter()->getFirstSuccessGeneration()) { // TODO RN: Get this from filter mStatusText = LLTrans::getString("Searching"); @@ -952,37 +946,36 @@ void LLFolderView::openSelectedItems( void ) { if(getVisible() && getEnabled()) { - // TODO RN: move to LLFolderViewModelInventory - //if (mSelectedItems.size() == 1) - //{ - // mSelectedItems.front()->openItem(); - //} - //else - //{ - // LLMultiPreview* multi_previewp = new LLMultiPreview(); - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // // IT_{OBJECT,ATTACHMENT} creates LLProperties - // // floaters; others create LLPreviews. Put - // // each one in the right type of container. - // LLFolderViewModelItemInventory* listener = (*item_it)->getViewModelItem(); - // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); - // if (is_prop) - // LLFloater::setFloaterHost(multi_propertiesp); - // else - // LLFloater::setFloaterHost(multi_previewp); - // (*item_it)->openItem(); - // } - - // LLFloater::setFloaterHost(NULL); - // // *NOTE: LLMulti* will safely auto-delete when open'd - // // without any children. - // multi_previewp->openFloater(LLSD()); - // multi_propertiesp->openFloater(LLSD()); - //} + if (mSelectedItems.size() == 1) + { + mSelectedItems.front()->openItem(); + } + else + { + LLMultiPreview* multi_previewp = new LLMultiPreview(); + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + // IT_{OBJECT,ATTACHMENT} creates LLProperties + // floaters; others create LLPreviews. Put + // each one in the right type of container. + LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); + bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); + if (is_prop) + LLFloater::setFloaterHost(multi_propertiesp); + else + LLFloater::setFloaterHost(multi_previewp); + listener->openItem(); + } + + LLFloater::setFloaterHost(NULL); + // *NOTE: LLMulti* will safely auto-delete when open'd + // without any children. + multi_previewp->openFloater(LLSD()); + multi_propertiesp->openFloater(LLSD()); + } } } @@ -990,28 +983,27 @@ void LLFolderView::propertiesSelectedItems( void ) { if(getVisible() && getEnabled()) { - // TODO RN: move to LLFolderViewModelInventory - //if (mSelectedItems.size() == 1) - //{ - // LLFolderViewItem* folder_item = mSelectedItems.front(); - // if(!folder_item) return; - // folder_item->getViewModelItem()->showProperties(); - //} - //else - //{ - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + if (mSelectedItems.size() == 1) + { + LLFolderViewItem* folder_item = mSelectedItems.front(); + if(!folder_item) return; + folder_item->getViewModelItem()->showProperties(); + } + else + { + LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - // LLFloater::setFloaterHost(multi_propertiesp); + LLFloater::setFloaterHost(multi_propertiesp); - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // (*item_it)->getViewModelItem()->showProperties(); - // } + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + (*item_it)->getViewModelItem()->showProperties(); + } - // LLFloater::setFloaterHost(NULL); - // multi_propertiesp->openFloater(LLSD()); - //} + LLFloater::setFloaterHost(NULL); + multi_propertiesp->openFloater(LLSD()); + } } } @@ -1943,11 +1935,11 @@ void LLFolderView::doIdle() LLFastTimer t2(FTM_INVENTORY); - if (mFilter->isModified() && mFilter->isNotDefault()) + if (getFolderViewModel()->getFilter()->isModified() && getFolderViewModel()->getFilter()->isNotDefault()) { mNeedsAutoSelect = TRUE; } - mFilter->clearModified(); + getFolderViewModel()->getFilter()->clearModified(); // filter to determine visibility before arranging filter(*(getFolderViewModel()->getFilter())); @@ -1958,7 +1950,7 @@ void LLFolderView::doIdle() LLFastTimer t3(FTM_AUTO_SELECT); // select new item only if a filtered item not currently selected LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); - if (!mAutoSelectOverride && (!selected_itemp || selected_itemp->passedFilter())) + if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getViewModelItem()->potentiallyVisible())) { // these are named variables to get around gcc not binding non-const references to rvalues // and functor application is inherently non-const to allow for stateful functors @@ -1968,7 +1960,7 @@ void LLFolderView::doIdle() // Open filtered folders for folder views with mAutoSelectOverride=TRUE. // Used by LLPlacesFolderView. - if (mFilter->showAllResults()) + if (getFolderViewModel()->getFilter()->showAllResults()) { // these are named variables to get around gcc not binding non-const references to rvalues // and functor application is inherently non-const to allow for stateful functors @@ -1979,7 +1971,7 @@ void LLFolderView::doIdle() scrollToShowSelection(); } - BOOL filter_finished = getLastFilterGeneration() >= mFilter->getCurrentGeneration() + BOOL filter_finished = getLastFilterGeneration() >= getFolderViewModel()->getFilter()->getCurrentGeneration() && mViewModel->contentsReady(); if (filter_finished || gFocusMgr.childHasKeyboardFocus(inventory_panel) diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index f65a13be1e..685a4cbf49 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -123,7 +123,10 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mListener(p.listener), mIsMouseOverTitle(false) { - mListener->setFolderViewItem(this); + if (mListener) + { + mListener->setFolderViewItem(this); + } } BOOL LLFolderViewItem::postBuild() diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 45a2bffa6b..002278601a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1026,6 +1026,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags) @@ -1151,12 +1152,13 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, default: llinfos << "Unhandled asset type (llassetstorage.h): " << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << llendl; - break; + break; } if (new_listener) { new_listener->mInvType = inv_type; + new_listener->setRootViewModel(view_model); } return new_listener; @@ -1332,6 +1334,7 @@ LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags /* = 0x00 */) const @@ -1340,6 +1343,7 @@ LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset actual_asset_type, inv_type, inventory, + view_model, root, uuid, flags); @@ -6472,41 +6476,30 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags /*= 0x00*/ ) const { LLInvFVBridge* new_listener = NULL; - switch(asset_type) + if (asset_type == LLAssetType::AT_CATEGORY + && actual_asset_type != LLAssetType::AT_LINK_FOLDER) { - case LLAssetType::AT_CATEGORY: - if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) - { - // *TODO: Create a link folder handler instead if it is necessary - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, - actual_asset_type, - inv_type, - inventory, - root, - uuid, - flags); - break; - } new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); - break; - default: - new_listener = LLInventoryFVBridgeBuilder::createBridge( - asset_type, - actual_asset_type, - inv_type, - inventory, - root, - uuid, - flags); + new_listener->setRootViewModel(view_model); + } + else + { + new_listener = LLInventoryFVBridgeBuilder::createBridge(asset_type, + actual_asset_type, + inv_type, + inventory, + view_model, + root, + uuid, + flags); } return new_listener; - } // EOF diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index b0582d003d..e235d9cf5f 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -66,6 +66,7 @@ public: LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags = 0x00); @@ -196,6 +197,7 @@ public: LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags = 0x00) const; @@ -645,6 +647,7 @@ public: LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags = 0x00) const; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index aba4c088ab..73e20fc684 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -234,6 +234,7 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) LLAssetType::AT_CATEGORY, LLInventoryType::IT_CATEGORY, this, + &mInventoryViewModel, NULL, root_id); @@ -672,7 +673,7 @@ LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool u p.parent_panel = this; p.tool_tip = p.name; p.listener = bridge; - p.view_model = new LLFolderViewModelInventory(); + p.view_model = &mInventoryViewModel; p.use_label_suffix = useLabelSuffix; p.allow_multiselect = mAllowMultiSelect; p.show_empty_message = mShowEmptyMessage; @@ -736,6 +737,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) objectp->getType(), LLInventoryType::IT_CATEGORY, this, + &mInventoryViewModel, mFolderRoot, objectp->getUUID()); if (new_listener) @@ -751,6 +753,7 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) item->getActualType(), item->getInventoryType(), this, + &mInventoryViewModel, mFolderRoot, item->getUUID(), item->getFlags()); @@ -1130,7 +1133,6 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) if (!floater_inventory) { llwarns << "Could not find My Inventory floater" << llendl; - return FALSE; } @@ -1347,25 +1349,27 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) void LLFolderViewModelItemInventory::requestSort() { LLFolderViewModelItemCommon::requestSort(); - //TODO RN: need better way to get to root viewmodel, also consider reflecting hierarchy in viewmodel space as well - if (static_cast(mFolderViewItem->getRoot()->getFolderViewModel())->getSorter().isByDate()) + if (mRootViewModel->getSorter().isByDate()) { // sort by date potentially affects parent folders which use a date // derived from newest item in them - mFolderViewItem->getParentFolder()->getViewModelItem()->requestSort(); + if (mParent) + { + mParent->requestSort(); + } } } bool LLFolderViewModelItemInventory::potentiallyVisible() { return passedFilter() // we've passed the filter - || getLastFilterGeneration() < mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration() // or we don't know yet + || getLastFilterGeneration() < mRootViewModel->getFilter()->getFirstSuccessGeneration() // or we don't know yet || descendantsPassedFilter(); } bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) { - if (filter_generation < 0) filter_generation = mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration(); + if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); return mPassedFolderFilter && mLastFilterGeneration >= filter_generation && (mPassedFilter || descendantsPassedFilter(filter_generation)); @@ -1373,7 +1377,7 @@ bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) { - if (filter_generation < 0) filter_generation = mFolderViewItem->getRoot()->getFolderViewModel()->getFilter()->getFirstSuccessGeneration(); + if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); return mMostFilteredDescendantGeneration >= filter_generation; } @@ -1419,8 +1423,9 @@ void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { - if(getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass - || descendantsPassedFilter(filter.getFirstRequiredGeneration())) // or at least one descendant has passed the minimum requirement + if(!mChildren.empty() + && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass + || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement { // now query children for (child_list_t::iterator iter = mChildren.begin(); @@ -1456,3 +1461,15 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) filter.decrementFilterCount(); } } + +LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() +{ + return &mInventoryViewModel; +} + + +const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const +{ + return &mInventoryViewModel; +} + diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 35a3f9b5e1..55edf386d5 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -42,11 +42,19 @@ class LLInvFVBridge; class LLInventoryFVBridgeBuilder; class LLInvPanelComplObserver; +class LLFolderViewModelInventory; class LLFolderViewModelItemInventory : public LLFolderViewModelItemCommon { public: + LLFolderViewModelItemInventory() + : mRootViewModel(NULL) + {} + void setRootViewModel(LLFolderViewModelInventory* root_view_model) + { + mRootViewModel = root_view_model; + } virtual const LLUUID& getUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual void setCreationDate(time_t creation_date_utc) = 0; @@ -68,6 +76,8 @@ public: virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); virtual void filter( LLFolderViewFilter& filter); virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); +protected: + LLFolderViewModelInventory* mRootViewModel; }; class LLInventorySort @@ -243,8 +253,8 @@ public: void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); void updateSelection(); - LLFolderViewModelInventory* getFolderViewModel() { return &mViewModel; } - const LLFolderViewModelInventory* getFolderViewModel() const { return &mViewModel; } + LLFolderViewModelInventory* getFolderViewModel(); + const LLFolderViewModelInventory* getFolderViewModel() const; protected: void openStartFolderOrMyInventory(); // open the first level of inventory @@ -262,8 +272,8 @@ protected: LLFolderView* mFolderRoot; LLScrollContainer* mScroller; - LLFolderViewModelInventory mViewModel; - + LLFolderViewModelInventory mInventoryViewModel; + std::map mItemMap; /** * Pointer to LLInventoryFVBridgeBuilder. diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index f3096e862d..6e5a522297 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -111,6 +111,7 @@ void LLInboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& para LLAssetType::AT_CATEGORY, LLInventoryType::IT_CATEGORY, this, + &mInventoryViewModel, NULL, root_id); diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.cpp b/indra/newview/llpanelmarketplaceoutboxinventory.cpp index 783eeb11b8..2885dd6266 100644 --- a/indra/newview/llpanelmarketplaceoutboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceoutboxinventory.cpp @@ -77,6 +77,7 @@ void LLOutboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& par LLAssetType::AT_CATEGORY, LLInventoryType::IT_CATEGORY, this, + &mInventoryViewModel, NULL, root_id); diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp index 97c5d531d2..af29ab7ea9 100644 --- a/indra/newview/llplacesinventorybridge.cpp +++ b/indra/newview/llplacesinventorybridge.cpp @@ -151,6 +151,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags/* = 0x00*/) const @@ -164,6 +165,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags); + new_listener->setRootViewModel(view_model); break; case LLAssetType::AT_CATEGORY: if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) @@ -174,12 +176,14 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( actual_asset_type, inv_type, inventory, + view_model, root, uuid, flags); break; } new_listener = new LLPlacesFolderBridge(inv_type, inventory, root, uuid); + new_listener->setRootViewModel(view_model); break; default: new_listener = LLInventoryFVBridgeBuilder::createBridge( @@ -187,6 +191,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( actual_asset_type, inv_type, inventory, + view_model, root, uuid, flags); diff --git a/indra/newview/llplacesinventorybridge.h b/indra/newview/llplacesinventorybridge.h index 52beacef9c..791502990b 100644 --- a/indra/newview/llplacesinventorybridge.h +++ b/indra/newview/llplacesinventorybridge.h @@ -89,6 +89,7 @@ public: LLAssetType::EType actual_asset_type, LLInventoryType::EType inv_type, LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, LLFolderView* root, const LLUUID& uuid, U32 flags = 0x00) const; diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 1c2d75d88c..d95d5eac19 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -87,6 +87,7 @@ void LLPlacesInventoryPanel::buildFolderView(const LLInventoryPanel::Params& par LLAssetType::AT_CATEGORY, LLInventoryType::IT_CATEGORY, this, + &mInventoryViewModel, NULL, root_id); p.parent_panel = this; -- cgit v1.2.3 From 604bbb22783d2460384e340592ca1781908f6dd8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 28 Jun 2012 23:30:36 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose cleaned up ownership of viewmodel more filtering fixes --- indra/newview/llfolderview.h | 1 - indra/newview/llfolderviewitem.h | 1 - indra/newview/llinventoryfilter.cpp | 17 +++++++---------- indra/newview/llpanelmaininventory.cpp | 24 ++++++++++++------------ indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/llpanelobjectinventory.h | 2 ++ 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index d261a5967d..8a0317f840 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -302,7 +302,6 @@ protected: LLFrameTimer mAutoOpenTimer; LLFrameTimer mSearchTimer; std::string mSearchString; - LLFolderViewFilter* mFilter; BOOL mShowSelectionContext; BOOL mShowSingleSelection; LLFrameTimer mMultiSelectionFadeTimer; diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 7e48969826..a3c92a55e8 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -281,7 +281,6 @@ protected: S32 mLastCalculatedWidth; S32 mMostFilteredDescendantGeneration; bool mNeedsSort; - bool mPassedFolderFilter; public: typedef enum e_recurse_type diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c7e0136368..08f1e541b5 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -95,16 +95,13 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : 0; - const BOOL passed_filtertype = checkAgainstFilterType(listener); - const BOOL passed_permissions = checkAgainstPermissions(listener); - const BOOL passed_filterlink = checkAgainstFilterLinks(listener); - const BOOL passed = (passed_filtertype && - passed_permissions && - passed_filterlink && - passed_clipboard && - (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + BOOL passed = string_offset != std::string::npos; + passed = passed && checkAgainstFilterType(listener); + passed = passed && checkAgainstPermissions(listener); + passed = passed && checkAgainstFilterLinks(listener); + passed = passed && passed_clipboard; return passed; } @@ -595,7 +592,7 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date) void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl) { - static LLCachedControl s_last_logoff(gSavedSettings, "LastLogoff", 0); + static LLCachedControl s_last_logoff(gSavedPerAccountSettings, "LastLogoff", 0); if (sl && !isSinceLogoff()) { setDateRange(s_last_logoff(), time_max()); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 33581160fd..6cef1f877b 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -222,21 +222,21 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) if (p.validateBlock(false)) { LLParamSDParser().writeSD(filterState, p); - filterRoot[filter->getName()] = filterState; + filterRoot[filter->getName()] = filterState; + } } } - } - LLInventoryFilter* filter = findChild("Recent Items")->getFilter(); - if (filter) - { - LLSD filterState; - LLInventoryFilter::Params p; - filter->toParams(p); - LLParamSDParser parser; - parser.writeSD(filterState, p); - filterRoot[filter->getName()] = filterState; - } + LLInventoryFilter* filter = findChild("Recent Items")->getFilter(); + if (filter) + { + LLSD filterState; + LLInventoryFilter::Params p; + filter->toParams(p); + LLParamSDParser parser; + parser.writeSD(filterState, p); + filterRoot[filter->getName()] = filterState; + } std::ostringstream filterSaveName; filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 6a232a26f7..d0b9072ade 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1562,7 +1562,7 @@ void LLPanelObjectInventory::reset() p.tool_tip= LLTrans::getString("PanelContentsTooltip"); p.listener = LLTaskInvFVBridge::createObjectBridge(this, NULL); p.folder_indentation = -14; // subtract space normally reserved for folder expanders - p.view_model = new LLFolderViewModelInventory(); + p.view_model = &mInventoryViewModel; mFolders = LLUICtrlFactory::create(p); // this ensures that we never say "searching..." or "no items found" //TODO RN: make this happen by manipulating filter object directly diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index 607b705f7f..7e857f8b31 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -29,6 +29,7 @@ #include "llvoinventorylistener.h" #include "llpanel.h" +#include "llinventorypanel.h" // for LLFolderViewModelInventory #include "llinventory.h" @@ -94,6 +95,7 @@ private: BOOL mHaveInventory; BOOL mIsInventoryEmpty; BOOL mInventoryNeedsUpdate; + LLFolderViewModelInventory mInventoryViewModel; }; #endif // LL_LLPANELOBJECTINVENTORY_H -- cgit v1.2.3 From 07afce2ac86c4c66e8b094ecf977ee5ec5566671 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 29 Jun 2012 09:44:22 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose fixed build --- indra/newview/llfolderview.cpp | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 0f7809d4b4..e007c58497 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -981,30 +981,30 @@ void LLFolderView::openSelectedItems( void ) void LLFolderView::propertiesSelectedItems( void ) { - if(getVisible() && getEnabled()) - { - if (mSelectedItems.size() == 1) - { - LLFolderViewItem* folder_item = mSelectedItems.front(); - if(!folder_item) return; - folder_item->getViewModelItem()->showProperties(); - } - else - { - LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - LLFloater::setFloaterHost(multi_propertiesp); - - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - (*item_it)->getViewModelItem()->showProperties(); - } - - LLFloater::setFloaterHost(NULL); - multi_propertiesp->openFloater(LLSD()); - } - } + //if(getVisible() && getEnabled()) + //{ + // if (mSelectedItems.size() == 1) + // { + // LLFolderViewItem* folder_item = mSelectedItems.front(); + // if(!folder_item) return; + // folder_item->getViewModelItem()->showProperties(); + // } + // else + // { + // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + + // LLFloater::setFloaterHost(multi_propertiesp); + + // selected_items_t::iterator item_it; + // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + // { + // (*item_it)->getViewModelItem()->showProperties(); + // } + + // LLFloater::setFloaterHost(NULL); + // multi_propertiesp->openFloater(LLSD()); + // } + //} } void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type) -- cgit v1.2.3 From 062cae9a4880f7672df7f6189e01b2bff15f42f1 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 29 Jun 2012 15:44:08 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose cleaned up some stale TODOs worked on getting initial inventory display to work consistently --- indra/newview/llfolderview.cpp | 2 +- indra/newview/llfolderviewmodel.h | 13 +++--------- indra/newview/llinventoryfilter.cpp | 3 +-- indra/newview/llinventorypanel.cpp | 34 ++++++++++++++++++++++++-------- indra/newview/llinventorypanel.h | 4 ++-- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/lltexturectrl.cpp | 2 +- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index e007c58497..5844c58e09 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -713,7 +713,6 @@ void LLFolderView::draw() { if (!mViewModel->contentsReady() || getLastFilterGeneration() < getFolderViewModel()->getFilter()->getFirstSuccessGeneration()) { - // TODO RN: Get this from filter mStatusText = LLTrans::getString("Searching"); } else @@ -981,6 +980,7 @@ void LLFolderView::openSelectedItems( void ) void LLFolderView::propertiesSelectedItems( void ) { + //TODO RN: get working again //if(getVisible() && getEnabled()) //{ // if (mSelectedItems.size() == 1) diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index c5079712f5..5304613219 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -122,7 +122,6 @@ public: virtual void requestSortAll() = 0; virtual void sort(class LLFolderViewFolder*) = 0; - virtual void filter(class LLFolderViewFolder*) = 0; virtual bool contentsReady() = 0; virtual void setFolderView(LLFolderView* folder_view) = 0; @@ -208,12 +207,6 @@ public: } } - //TODO RN: fix this - void filter(LLFolderViewFolder* folder) - { - - } - protected: SortType mSorter; FilterType mFilter; @@ -264,7 +257,7 @@ public: virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? - virtual void filter( LLFolderViewFilter& filter) = 0; + virtual bool filter( LLFolderViewFilter& filter) = 0; virtual bool passedFilter(S32 filter_generation = -1) = 0; virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; @@ -306,8 +299,8 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem public: LLFolderViewModelItemCommon() : mSortVersion(-1), - mPassedFilter(false), - mPassedFolderFilter(false), + mPassedFilter(true), + mPassedFolderFilter(true), mFolderViewItem(NULL), mLastFilterGeneration(-1), mMostFilteredDescendantGeneration(-1), diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 08f1e541b5..6a33130322 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -159,7 +159,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const // (e.g. versus in-world object contents). const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); if (!cat) - return false; + return folder_id.isNull(); LLFolderType::EType cat_type = cat->getPreferredType(); if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0)) return false; @@ -1091,7 +1091,6 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) mEmptyLookupMessage = message; } -// TODO RN: turn this into a param and move to llfolderviewmodelinterface std::string LLInventoryFilter::getEmptyLookupMessage() const { LLStringUtil::format_map_t args; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 73e20fc684..e4cabcc988 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1388,10 +1388,12 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo mLastFilterGeneration = filter_generation; } -void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) { + bool passed_filter_before = item->passedFilter(); S32 filter_generation = filter.getCurrentGeneration(); S32 must_pass_generation = filter.getFirstRequiredGeneration(); + bool changed = false; // mMostFilteredDescendantGeneration might have been reset // in which case we need to update it even for folders that @@ -1407,22 +1409,37 @@ void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } else { - //TODO RN: - item->filter( filter ); + changed |= item->filter( filter ); } } // track latest generation to pass any child items if (item->passedFilter()) { - mMostFilteredDescendantGeneration = filter_generation; - //TODO RN: ensure this still happens - //requestArrange(); + LLFolderViewModelItemInventory* view_model = this; + + while(view_model && view_model->mMostFilteredDescendantGeneration < filter_generation) + { + view_model->mMostFilteredDescendantGeneration = filter_generation; + view_model = static_cast(view_model->mParent); + } + } + + changed |= (item->passedFilter() != passed_filter_before); + if (changed) + { + //TODO RN: ensure this still happens, but without dependency on folderview + LLFolderViewFolder* parent = mFolderViewItem->getParentFolder(); + if (parent) parent->requestArrange(); } + + return changed; } -void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { + bool changed = false; + if(!mChildren.empty() && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement @@ -1432,7 +1449,7 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != mChildren.end() && filter.getFilterCount() > 0; ++iter) { - filterChildItem((*iter), filter); + changed |= filterChildItem((*iter), filter); } } @@ -1460,6 +1477,7 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) //mStringMatchOffset = filter.getStringMatchOffset(this); filter.decrementFilterCount(); } + return changed; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 55edf386d5..3195d9a369 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -74,8 +74,8 @@ public: virtual bool passedFilter(S32 filter_generation = -1); virtual bool descendantsPassedFilter(S32 filter_generation = -1); virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); - virtual void filter( LLFolderViewFilter& filter); - virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); + virtual bool filter( LLFolderViewFilter& filter); + virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); protected: LLFolderViewModelInventory* mRootViewModel; }; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index d0b9072ade..450e1f7ed0 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1566,7 +1566,7 @@ void LLPanelObjectInventory::reset() mFolders = LLUICtrlFactory::create(p); // this ensures that we never say "searching..." or "no items found" //TODO RN: make this happen by manipulating filter object directly - //mFolders->getFilter()->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); + static_cast(mFolders->getFolderViewModel()->getFilter())->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); if (hasFocus()) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 654b18614a..61a0331b72 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -637,7 +637,7 @@ void LLFloaterTexturePicker::draw() { folder_view->setPinningSelectedItem(mSelectedItemPinned); folder_view->getViewModelItem()->dirtyFilter(); - //TODO RN: test + //TODO RN: test..still works without this? //folder_view->arrangeFromRoot(); mSelectedItemPinned = TRUE; -- cgit v1.2.3 From 38eb726ca8ecbc52f9afe2181474074a8bc59211 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 2 Jul 2012 15:27:19 +0300 Subject: CHUI-103 FIXED (Implement changes to compact chat view) Change coloration --- indra/newview/llchathistory.cpp | 47 ++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index dcd6d25888..80be753d9e 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -734,17 +734,23 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL } LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); + LLColor4 name_color(txt_color); + LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); std::string font_name = LLFontGL::nameFromFont(fontp); std::string font_size = LLFontGL::sizeFromFont(fontp); - LLStyle::Params style_params; - style_params.color(txt_color); - style_params.readonly_color(txt_color); - style_params.font.name(font_name); - style_params.font.size(font_size); - style_params.font.style(input_append_params.font.style); + LLStyle::Params body_message_params; + body_message_params.color(txt_color); + body_message_params.readonly_color(txt_color); + body_message_params.font.name(font_name); + body_message_params.font.size(font_size); + body_message_params.font.style(input_append_params.font.style); + + LLStyle::Params name_params(body_message_params); + name_params.color(name_color); + name_params.readonly_color(name_color); std::string prefix = chat.mText.substr(0, 4); @@ -767,7 +773,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC) { delimiter = LLStringUtil::null; - style_params.font.style = "ITALIC"; + name_params.font.style = "ITALIC"; } bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY; @@ -775,18 +781,20 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (message_from_log) { txt_color = LLColor4::grey; - style_params.color(txt_color); - style_params.readonly_color(txt_color); + body_message_params.color(txt_color); + body_message_params.readonly_color(txt_color); + name_params.color(txt_color); + name_params.readonly_color(txt_color); } bool prependNewLineState = mEditor->getText().size() != 0; - // show timestamps and names in the compact mode + // compact mode: show a timestamp and name if (use_plain_text_chat_history) { square_brackets = chat.mFromName == SYSTEM_FROM; - LLStyle::Params timestamp_style(style_params); + LLStyle::Params timestamp_style(body_message_params); // out of the timestamp if (args["show_time"].asBoolean()) @@ -804,7 +812,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // out the opening square bracket (if need) if (square_brackets) { - mEditor->appendText("[", prependNewLineState, style_params); + mEditor->appendText("[", prependNewLineState, body_message_params); prependNewLineState = false; } @@ -819,7 +827,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL // set the link for the object name to be the objectim SLapp // (don't let object names with hyperlinks override our objectim Url) - LLStyle::Params link_params(style_params); + LLStyle::Params link_params(body_message_params); LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); link_params.color = link_color; link_params.readonly_color = link_color; @@ -831,7 +839,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL } else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { - LLStyle::Params link_params(style_params); + LLStyle::Params link_params(body_message_params); link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); if (from_me) @@ -852,7 +860,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL else { mEditor->appendText("" + chat.mFromName + "" + delimiter, - prependNewLineState, style_params); + prependNewLineState, body_message_params); prependNewLineState = false; } } @@ -880,7 +888,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL } else { - view = getHeader(chat, style_params, args); + view = getHeader(chat, name_params, args); if (mEditor->getText().size() == 0) p.top_pad = 0; else @@ -909,6 +917,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mIsLastMessageFromLog = message_from_log; } + // body of the message processing + + // notify processing if (chat.mNotifId.notNull()) { LLNotificationPtr notification = LLNotificationsUtil::find(chat.mNotifId); @@ -932,6 +943,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mEditor->appendWidget(params, "\n", false); } } + + // usual messages showing else { std::string message = irc_me ? chat.mText.substr(3) : chat.mText; @@ -959,7 +972,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL message += "]"; } - mEditor->appendText(message, prependNewLineState, style_params); + mEditor->appendText(message, prependNewLineState, body_message_params); prependNewLineState = false; } -- cgit v1.2.3 From f22e5df8b6890aab659916361d42479ca3825be9 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 2 Jul 2012 17:46:34 +0300 Subject: CHUI-172 WIP Fixed drawing the nearby chat toast contents. Fixed warnings when creating a nearby chat toast. --- indra/newview/llchatitemscontainerctrl.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 477bdb3967..61772b4bb7 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -96,8 +96,15 @@ void LLNearbyChatToastPanel::reshape (S32 width, S32 height, BOOL called_from_p { LLPanel::reshape(width, height,called_from_parent); - LLUICtrl* msg_text = getChild("msg_text", false); - LLUICtrl* icon = getChild("avatar_icon", false); + // reshape() may be called from LLView::initFromParams() before the children are created. + // We call findChild() instead of getChild() here to avoid creating dummy controls. + LLUICtrl* msg_text = findChild("msg_text", false); + LLUICtrl* icon = findChild("avatar_icon", false); + + if (!msg_text || !icon) + { + return; + } LLRect msg_text_rect = msg_text->getRect(); LLRect avatar_rect = icon->getRect(); @@ -355,6 +362,8 @@ BOOL LLNearbyChatToastPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) } void LLNearbyChatToastPanel::draw() { + LLPanel::draw(); + if(mIsDirty) { LLAvatarIconCtrl* icon = getChild("avatar_icon", false); -- cgit v1.2.3 From 1bd52dfbdc3607bbd9ea86c715ce63b17d5a557f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 2 Jul 2012 17:57:29 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose refactored source files, moving logic into llfolderviewmodel*.cpp filter logic tweaks purging and moving inventory now properly cleans up view model --- indra/newview/CMakeLists.txt | 3 + indra/newview/llfolderview.cpp | 27 +--- indra/newview/llfolderviewitem.cpp | 19 +-- indra/newview/llfolderviewitem.h | 10 +- indra/newview/llfolderviewmodel.cpp | 54 +++++++ indra/newview/llfolderviewmodel.h | 25 ++- indra/newview/llfolderviewmodelinventory.cpp | 225 +++++++++++++++++++++++++++ indra/newview/llfolderviewmodelinventory.h | 107 +++++++++++++ indra/newview/llinventoryfilter.cpp | 24 --- indra/newview/llinventorypanel.cpp | 201 +----------------------- indra/newview/llinventorypanel.h | 78 +--------- indra/newview/lltexturectrl.cpp | 4 +- 12 files changed, 429 insertions(+), 348 deletions(-) create mode 100644 indra/newview/llfolderviewmodel.cpp create mode 100644 indra/newview/llfolderviewmodelinventory.cpp create mode 100644 indra/newview/llfolderviewmodelinventory.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 4f447fd35b..dee37bd5e8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -253,6 +253,8 @@ set(viewer_SOURCE_FILES llfloaterworldmap.cpp llfolderview.cpp llfolderviewitem.cpp + llfolderviewmodel.cpp + llfolderviewmodelinventory.cpp llfollowcam.cpp llfriendcard.cpp llgesturelistener.cpp @@ -809,6 +811,7 @@ set(viewer_HEADER_FILES llfloaterworldmap.h llfolderview.h llfolderviewmodel.h + llfolderviewmodelinventory.h llfolderviewitem.h llfollowcam.h llfriendcard.h diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 5844c58e09..90c78d98b0 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -259,7 +259,7 @@ LLFolderView::LLFolderView(const Params& p) menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); mPopupMenuHandle = menu->getHandle(); - mListener->openItem(); + mViewModelItem->openItem(); } // Destroys the object @@ -363,11 +363,7 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000)); - if (getLastFilterGeneration() < filter.getCurrentGeneration()) - { - mMinWidth = 0; - getViewModelItem()->filter(filter); - } + getViewModelItem()->filter(filter); } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -706,20 +702,11 @@ void LLFolderView::draw() if (hasVisibleChildren()) { - mStatusText.clear(); mStatusTextBox->setVisible( FALSE ); } else if (mShowEmptyMessage) { - if (!mViewModel->contentsReady() || getLastFilterGeneration() < getFolderViewModel()->getFilter()->getFirstSuccessGeneration()) - { - mStatusText = LLTrans::getString("Searching"); - } - else - { - mStatusText = getFolderViewModel()->getFilter()->getEmptyLookupMessage(); - } - mStatusTextBox->setValue(mStatusText); + mStatusTextBox->setValue(getFolderViewModel()->getStatusText()); mStatusTextBox->setVisible( TRUE ); // firstly reshape message textbox with current size. This is necessary to @@ -1971,7 +1958,7 @@ void LLFolderView::doIdle() scrollToShowSelection(); } - BOOL filter_finished = getLastFilterGeneration() >= getFolderViewModel()->getFilter()->getCurrentGeneration() + BOOL filter_finished = getViewModelItem()->passedFilter() && mViewModel->contentsReady(); if (filter_finished || gFocusMgr.childHasKeyboardFocus(inventory_panel) @@ -2264,9 +2251,3 @@ S32 LLFolderView::getItemHeight() } return 0; } - -//TODO RN: move to llfolderviewmodel.cpp file -bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) -{ - return item->getSortVersion() < mTargetSortVersion; -} diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 685a4cbf49..ac389c9189 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -120,12 +120,12 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mDragAndDropTarget(FALSE), mLabel(p.name), mRoot(p.root), - mListener(p.listener), + mViewModelItem(p.listener), mIsMouseOverTitle(false) { - if (mListener) + if (mViewModelItem) { - mListener->setFolderViewItem(this); + mViewModelItem->setFolderViewItem(this); } } @@ -138,8 +138,8 @@ BOOL LLFolderViewItem::postBuild() // Destroys the object LLFolderViewItem::~LLFolderViewItem( void ) { - delete mListener; - mListener = NULL; + delete mViewModelItem; + mViewModelItem = NULL; } LLFolderView* LLFolderViewItem::getRoot() @@ -837,12 +837,6 @@ LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) return getRoot()->getFolderViewModel(); } -S32 LLFolderViewItem::getLastFilterGeneration() const -{ - return getViewModelItem()->getLastFilterGeneration(); -} - - ///---------------------------------------------------------------------------- /// Class LLFolderViewFolder @@ -1446,6 +1440,7 @@ void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) mItems.erase(it); } //item has been removed, need to update filter + getViewModelItem()->removeChild(item->getViewModelItem()); getViewModelItem()->dirtyFilter(); //because an item is going away regardless of filter status, force rearrange requestArrange(); @@ -1638,7 +1633,7 @@ BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, EAcceptance* accept, std::string& tooltip_msg) { - BOOL accepted = mListener->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); + BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); if (accepted) { mDragAndDropTarget = TRUE; diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index a3c92a55e8..581ec7239e 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -92,13 +92,12 @@ protected: S32 mLabelWidth; bool mLabelWidthDirty; LLFolderViewFolder* mParentFolder; - LLFolderViewModelItem* mListener; + LLFolderViewModelItem* mViewModelItem; BOOL mIsCurSelection; BOOL mSelectPending; LLFontGL::StyleFlags mLabelStyle; std::string mLabelSuffix; LLUIImagePtr mIcon; - std::string mStatusText; LLUIImagePtr mIconOpen; LLUIImagePtr mIconOverlay; BOOL mHasVisibleChildren; @@ -136,9 +135,6 @@ public: virtual S32 arrange( S32* width, S32* height ); virtual S32 getItemHeight(); - // updates filter serial number and optionally propagated value up to root - S32 getLastFilterGeneration() const; - // If 'selection' is 'this' then note that otherwise ignore. // Returns TRUE if this item ends up being selected. virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); @@ -202,8 +198,8 @@ public: LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); - const LLFolderViewModelItem* getViewModelItem( void ) const { return mListener; } - LLFolderViewModelItem* getViewModelItem( void ) { return mListener; } + const LLFolderViewModelItem* getViewModelItem( void ) const { return mViewModelItem; } + LLFolderViewModelItem* getViewModelItem( void ) { return mViewModelItem; } const LLFolderViewModelInterface* getFolderViewModel( void ) const; LLFolderViewModelInterface* getFolderViewModel( void ); diff --git a/indra/newview/llfolderviewmodel.cpp b/indra/newview/llfolderviewmodel.cpp new file mode 100644 index 0000000000..92db84156e --- /dev/null +++ b/indra/newview/llfolderviewmodel.cpp @@ -0,0 +1,54 @@ +/** + * @file llfolderviewmodel.cpp + * @brief Implementation of the view model collection of classes. + * + * $LicenseInfo:firstyear=2001&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 "llfolderviewmodel.h" +#include "lltrans.h" +#include "llviewercontrol.h" + +bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) +{ + return item->getSortVersion() < mTargetSortVersion; +} + +std::string LLFolderViewModelCommon::getStatusText() +{ + if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter()->getCurrentGeneration()) + { + return LLTrans::getString("Searching"); + } + else + { + return getFilter()->getEmptyLookupMessage(); + } +} + +void LLFolderViewModelCommon::filter() +{ + getFilter()->setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000)); + mFolderView->getViewModelItem()->filter(*getFilter()); +} diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index 5304613219..8a16ec3eff 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -28,6 +28,7 @@ #include "lldarray.h" // *TODO: convert to std::vector #include "llfoldertype.h" #include "llfontgl.h" // just for StyleFlags enum +#include "llfolderview.h" #include "llfolderviewitem.h" #include "llinventorytype.h" #include "llpermissionsflags.h" @@ -122,11 +123,13 @@ public: virtual void requestSortAll() = 0; virtual void sort(class LLFolderViewFolder*) = 0; + virtual void filter() = 0; virtual bool contentsReady() = 0; virtual void setFolderView(LLFolderView* folder_view) = 0; virtual LLFolderViewFilter* getFilter() = 0; virtual const LLFolderViewFilter* getFilter() const = 0; + virtual std::string getStatusText() = 0; }; class LLFolderViewModelCommon : public LLFolderViewModelInterface @@ -142,6 +145,8 @@ public: // sort everything mTargetSortVersion++; } + virtual std::string getStatusText(); + virtual void filter(); void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} @@ -177,6 +182,7 @@ public: // add getStatusText and isFiltering() virtual bool contentsReady() { return true; } + struct ViewModelCompare { ViewModelCompare(const SortType& sorter) @@ -272,6 +278,7 @@ public: virtual bool hasChildren() const = 0; virtual void addChild(LLFolderViewModelItem* child) = 0; + virtual void removeChild(LLFolderViewModelItem* child) = 0; // This method will be called to determine if a drop can be // performed, and will set drop to TRUE if a drop is @@ -305,7 +312,9 @@ public: mLastFilterGeneration(-1), mMostFilteredDescendantGeneration(-1), mParent(NULL) - {} + { + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + } void requestSort() { mSortVersion = -1; } S32 getSortVersion() { return mSortVersion; } @@ -315,13 +324,23 @@ public: void dirtyFilter() { mLastFilterGeneration = -1; + // bubble up dirty flag all the way to root if (mParent) { mParent->dirtyFilter(); - } + } + } + virtual void addChild(LLFolderViewModelItem* child) + { + mChildren.push_back(child); + child->setParent(this); + } + virtual void removeChild(LLFolderViewModelItem* child) + { + mChildren.remove(child); + child->setParent(NULL); } - virtual void addChild(LLFolderViewModelItem* child) { mChildren.push_back(child); child->setParent(this); } protected: virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp new file mode 100644 index 0000000000..7ee1a10b15 --- /dev/null +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -0,0 +1,225 @@ +/* + * @file llfolderviewmodelinventory.cpp + * @brief Implementation of the inventory-specific view model + * + * $LicenseInfo:firstyear=2001&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 "llfolderviewmodelinventory.h" +#include "llinventorymodelbackgroundfetch.h" +#include "llinventorypanel.h" + +// +// class LLFolderViewModelInventory +// +static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); + +void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) +{ + LLFastTimer _(FTM_INVENTORY_SORT); + + if (!needsSort(folder->getViewModelItem())) return; + + LLFolderViewModelItemInventory* modelp = static_cast(folder->getViewModelItem()); + if (modelp->getUUID().isNull()) return; + + for (std::list::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd(); + it != end_it; + ++it) + { + LLFolderViewFolder* child_folderp = *it; + sort(child_folderp); + + if (child_folderp->getFoldersCount() > 0) + { + time_t most_recent_folder_time = + static_cast((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate(); + LLFolderViewModelItemInventory* modelp = static_cast(child_folderp->getViewModelItem()); + if (most_recent_folder_time > modelp->getCreationDate()) + { + modelp->setCreationDate(most_recent_folder_time); + } + } + if (child_folderp->getItemsCount() > 0) + { + time_t most_recent_item_time = + static_cast((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate(); + + LLFolderViewModelItemInventory* modelp = static_cast(child_folderp->getViewModelItem()); + if (most_recent_item_time > modelp->getCreationDate()) + { + modelp->setCreationDate(most_recent_item_time); + } + } + } + base_t::sort(folder); +} + +bool LLFolderViewModelInventory::contentsReady() +{ + return !LLInventoryModelBackgroundFetch::instance().folderFetchActive(); +} + +void LLFolderViewModelItemInventory::requestSort() +{ + LLFolderViewModelItemCommon::requestSort(); + if (mRootViewModel->getSorter().isByDate()) + { + // sort by date potentially affects parent folders which use a date + // derived from newest item in them + if (mParent) + { + mParent->requestSort(); + } + } +} + +bool LLFolderViewModelItemInventory::potentiallyVisible() +{ + return passedFilter() // we've passed the filter + || getLastFilterGeneration() < mRootViewModel->getFilter()->getFirstSuccessGeneration() // or we don't know yet + || descendantsPassedFilter(); +} + +bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) +{ + if (filter_generation < 0 && mRootViewModel) + filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); + + return mPassedFolderFilter + && mLastFilterGeneration >= filter_generation + && (mPassedFilter || descendantsPassedFilter(filter_generation)); +} + +bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) +{ + if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); + return mMostFilteredDescendantGeneration >= filter_generation; +} + +void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) +{ + mPassedFilter = passed; + mPassedFolderFilter = passed_folder; + mLastFilterGeneration = filter_generation; +} + +bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +{ + bool passed_filter_before = item->passedFilter(); + S32 filter_generation = filter.getCurrentGeneration(); + S32 must_pass_generation = filter.getFirstRequiredGeneration(); + + if (item->getLastFilterGeneration() < filter_generation) + { + if (item->getLastFilterGeneration() >= must_pass_generation + && !item->passedFilter(must_pass_generation)) + { + // failed to pass an earlier filter that was a subset of the current one + // go ahead and flag this item as done + item->filter(filter); + if (item->passedFilter()) + { + llerrs << "Invalid shortcut in inventory filtering!" << llendl; + } + item->setPassedFilter(false, false, filter_generation); + } + else + { + item->filter( filter ); + } + } + + // track latest generation to pass any child items, for each folder up to root + if (item->passedFilter()) + { + LLFolderViewModelItemInventory* view_model = this; + + while(view_model && view_model->mMostFilteredDescendantGeneration < filter_generation) + { + view_model->mMostFilteredDescendantGeneration = filter_generation; + view_model = static_cast(view_model->mParent); + } + + return !passed_filter_before; + } + else // !item->passedfilter() + { + return passed_filter_before; + } +} + +bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +{ + bool changed = false; + + if(!mChildren.empty() + && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass + || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement + { + // now query children + for (child_list_t::iterator iter = mChildren.begin(); + iter != mChildren.end() && filter.getFilterCount() > 0; + ++iter) + { + changed |= filterChildItem((*iter), filter); + } + } + + if (changed) + { + //TODO RN: ensure this still happens, but without dependency on folderview + LLFolderViewFolder* folder = static_cast(mFolderViewItem); + folder->requestArrange(); + } + + // if we didn't use all filter iterations + // that means we filtered all of our descendants + // so filter ourselves now + if (filter.getFilterCount() > 0) + { + filter.decrementFilterCount(); + + const BOOL passed_filter = filter.check(this); + const BOOL passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) + ? filter.checkFolder(this) + : true; + + setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration()); + //TODO RN: create interface for string highlighting + //mStringMatchOffset = filter.getStringMatchOffset(this); + } + return changed; +} + +LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() +{ + return &mInventoryViewModel; +} + + +const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const +{ + return &mInventoryViewModel; +} + diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h new file mode 100644 index 0000000000..a8fe3f57ea --- /dev/null +++ b/indra/newview/llfolderviewmodelinventory.h @@ -0,0 +1,107 @@ +/** + * @file llfolderviewmodelinventory.h + * @brief view model implementation specific to inventory + * class definition + * + * $LicenseInfo:firstyear=2001&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_LLFOLDERVIEWMODELINVENTORY_H +#define LL_LLFOLDERVIEWMODELINVENTORY_H + +#include "llinventoryfilter.h" + +class LLFolderViewModelItemInventory + : public LLFolderViewModelItemCommon +{ +public: + LLFolderViewModelItemInventory() + : mRootViewModel(NULL) + {} + void setRootViewModel(class LLFolderViewModelInventory* root_view_model) + { + mRootViewModel = root_view_model; + } + virtual const LLUUID& getUUID() const = 0; + virtual time_t getCreationDate() const = 0; // UTC seconds + virtual void setCreationDate(time_t creation_date_utc) = 0; + virtual PermissionMask getPermissionMask() const = 0; + virtual LLFolderType::EType getPreferredType() const = 0; + virtual void showProperties(void) = 0; + virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual. + virtual BOOL isUpToDate() const = 0; + virtual bool hasChildren() const = 0; + virtual LLInventoryType::EType getInventoryType() const = 0; + virtual void performAction(LLInventoryModel* model, std::string action) = 0; + virtual LLWearableType::EType getWearableType() const = 0; + virtual EInventorySortGroup getSortGroup() const = 0; + virtual LLInventoryObject* getInventoryObject() const = 0; + virtual void requestSort(); + virtual bool potentiallyVisible(); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool descendantsPassedFilter(S32 filter_generation = -1); + virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); + virtual bool filter( LLFolderViewFilter& filter); + virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); +protected: + class LLFolderViewModelInventory* mRootViewModel; +}; + +class LLInventorySort +{ +public: + LLInventorySort(U32 order = 0) + : mSortOrder(order), + mByDate(false), + mSystemToTop(false), + mFoldersByName(false) + { + mByDate = (order & LLInventoryFilter::SO_DATE); + mSystemToTop = (order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP); + mFoldersByName = (order & LLInventoryFilter::SO_FOLDERS_BY_NAME); + } + + bool isByDate() const { return mByDate; } + U32 getSortOrder() const { return mSortOrder; } + + bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const; +private: + U32 mSortOrder; + bool mByDate; + bool mSystemToTop; + bool mFoldersByName; +}; + +class LLFolderViewModelInventory + : public LLFolderViewModel +{ +public: + typedef LLFolderViewModel base_t; + + virtual ~LLFolderViewModelInventory() {} + + void sort(LLFolderViewFolder* folder); + + bool contentsReady(); + +}; +#endif // LL_LLFOLDERVIEWMODELINVENTORY_H diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 6a33130322..3f38d80a39 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -779,14 +779,12 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_ANIMATION)) { - //filtered_types += " Animations,"; filtered_types += LLTrans::getString("Animations"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Animations,"; not_filtered_types += LLTrans::getString("Animations"); filtered_by_all_types = FALSE; @@ -794,140 +792,120 @@ const std::string& LLInventoryFilter::getFilterText() if (isFilterObjectTypesWith(LLInventoryType::IT_CALLINGCARD)) { - //filtered_types += " Calling Cards,"; filtered_types += LLTrans::getString("Calling Cards"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Calling Cards,"; not_filtered_types += LLTrans::getString("Calling Cards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_WEARABLE)) { - //filtered_types += " Clothing,"; filtered_types += LLTrans::getString("Clothing"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Clothing,"; not_filtered_types += LLTrans::getString("Clothing"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_GESTURE)) { - //filtered_types += " Gestures,"; filtered_types += LLTrans::getString("Gestures"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Gestures,"; not_filtered_types += LLTrans::getString("Gestures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LANDMARK)) { - //filtered_types += " Landmarks,"; filtered_types += LLTrans::getString("Landmarks"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Landmarks,"; not_filtered_types += LLTrans::getString("Landmarks"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD)) { - //filtered_types += " Notecards,"; filtered_types += LLTrans::getString("Notecards"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Notecards,"; not_filtered_types += LLTrans::getString("Notecards"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_OBJECT) && isFilterObjectTypesWith(LLInventoryType::IT_ATTACHMENT)) { - //filtered_types += " Objects,"; filtered_types += LLTrans::getString("Objects"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Objects,"; not_filtered_types += LLTrans::getString("Objects"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_LSL)) { - //filtered_types += " Scripts,"; filtered_types += LLTrans::getString("Scripts"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Scripts,"; not_filtered_types += LLTrans::getString("Scripts"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SOUND)) { - //filtered_types += " Sounds,"; filtered_types += LLTrans::getString("Sounds"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Sounds,"; not_filtered_types += LLTrans::getString("Sounds"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_TEXTURE)) { - //filtered_types += " Textures,"; filtered_types += LLTrans::getString("Textures"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Textures,"; not_filtered_types += LLTrans::getString("Textures"); filtered_by_all_types = FALSE; } if (isFilterObjectTypesWith(LLInventoryType::IT_SNAPSHOT)) { - //filtered_types += " Snapshots,"; filtered_types += LLTrans::getString("Snapshots"); filtered_by_type = TRUE; num_filter_types++; } else { - //not_filtered_types += " Snapshots,"; not_filtered_types += LLTrans::getString("Snapshots"); filtered_by_all_types = FALSE; } @@ -943,7 +921,6 @@ const std::string& LLInventoryFilter::getFilterText() } else { - //mFilterText += "No "; mFilterText += LLTrans::getString("No Filters"); mFilterText += not_filtered_types; } @@ -953,7 +930,6 @@ const std::string& LLInventoryFilter::getFilterText() if (isSinceLogoff()) { - //mFilterText += " - Since Logoff"; mFilterText += LLTrans::getString("Since Logoff"); } return mFilterText; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index e4cabcc988..b5fcf364dd 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -56,58 +56,6 @@ const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("Recent const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string(""); static const LLInventoryFVBridgeBuilder INVENTORY_BRIDGE_BUILDER; -// -// class LLFolderViewModelInventory -// -static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); - -void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) -{ - LLFastTimer _(FTM_INVENTORY_SORT); - - if (!needsSort(folder->getViewModelItem())) return; - - LLFolderViewModelItemInventory* modelp = static_cast(folder->getViewModelItem()); - if (modelp->getUUID().isNull()) return; - - for (std::list::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd(); - it != end_it; - ++it) - { - LLFolderViewFolder* child_folderp = *it; - sort(child_folderp); - - if (child_folderp->getFoldersCount() > 0) - { - time_t most_recent_folder_time = - static_cast((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate(); - LLFolderViewModelItemInventory* modelp = static_cast(child_folderp->getViewModelItem()); - if (most_recent_folder_time > modelp->getCreationDate()) - { - modelp->setCreationDate(most_recent_folder_time); - } - } - if (child_folderp->getItemsCount() > 0) - { - time_t most_recent_item_time = - static_cast((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate(); - - LLFolderViewModelItemInventory* modelp = static_cast(child_folderp->getViewModelItem()); - if (most_recent_item_time > modelp->getCreationDate()) - { - modelp->setCreationDate(most_recent_item_time); - } - } - } - base_t::sort(folder); -} - -bool LLFolderViewModelInventory::contentsReady() -{ - return !LLInventoryModelBackgroundFetch::instance().folderFetchActive(); -} - - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryPanelObserver // @@ -580,8 +528,8 @@ void LLInventoryPanel::modelChanged(U32 mask) else if (!model_item && view_item) { // Remove the item's UI. - view_item->destroyView(); removeItemID(viewmodel_item->getUUID()); + view_item->destroyView(); } } } @@ -1344,150 +1292,3 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) // replace bridge builder to have necessary View bridges. mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER; } - - -void LLFolderViewModelItemInventory::requestSort() -{ - LLFolderViewModelItemCommon::requestSort(); - if (mRootViewModel->getSorter().isByDate()) - { - // sort by date potentially affects parent folders which use a date - // derived from newest item in them - if (mParent) - { - mParent->requestSort(); - } - } -} - -bool LLFolderViewModelItemInventory::potentiallyVisible() -{ - return passedFilter() // we've passed the filter - || getLastFilterGeneration() < mRootViewModel->getFilter()->getFirstSuccessGeneration() // or we don't know yet - || descendantsPassedFilter(); -} - -bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) -{ - if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); - return mPassedFolderFilter - && mLastFilterGeneration >= filter_generation - && (mPassedFilter || descendantsPassedFilter(filter_generation)); -} - -bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) -{ - if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); - return mMostFilteredDescendantGeneration >= filter_generation; -} - -void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) -{ - mPassedFilter = passed; - mPassedFolderFilter = passed_folder; - mLastFilterGeneration = filter_generation; -} - -bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) -{ - bool passed_filter_before = item->passedFilter(); - S32 filter_generation = filter.getCurrentGeneration(); - S32 must_pass_generation = filter.getFirstRequiredGeneration(); - bool changed = false; - - // mMostFilteredDescendantGeneration might have been reset - // in which case we need to update it even for folders that - // don't need to be filtered anymore - if (item->getLastFilterGeneration() < filter_generation) - { - if (item->getLastFilterGeneration() >= must_pass_generation && - !item->passedFilter(must_pass_generation)) - { - // failed to pass an earlier filter that was a subset of the current one - // go ahead and flag this item as done - item->setPassedFilter(false, false, filter_generation); - } - else - { - changed |= item->filter( filter ); - } - } - - // track latest generation to pass any child items - if (item->passedFilter()) - { - LLFolderViewModelItemInventory* view_model = this; - - while(view_model && view_model->mMostFilteredDescendantGeneration < filter_generation) - { - view_model->mMostFilteredDescendantGeneration = filter_generation; - view_model = static_cast(view_model->mParent); - } - } - - changed |= (item->passedFilter() != passed_filter_before); - if (changed) - { - //TODO RN: ensure this still happens, but without dependency on folderview - LLFolderViewFolder* parent = mFolderViewItem->getParentFolder(); - if (parent) parent->requestArrange(); - } - - return changed; -} - -bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) -{ - bool changed = false; - - if(!mChildren.empty() - && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass - || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement - { - // now query children - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end() && filter.getFilterCount() > 0; - ++iter) - { - changed |= filterChildItem((*iter), filter); - } - } - - // if we didn't use all filter iterations - // that means we filtered all of our descendants - // so filter ourselves now - if (filter.getFilterCount() > 0) - { - const BOOL previous_passed_filter = mPassedFilter; - const BOOL passed_filter = filter.check(this); - const BOOL passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) - ? filter.checkFolder(this) - : true; - - // If our visibility will change as a result of this filter, then - // we need to be rearranged in our parent folder - LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); - if (parent_folder && passed_filter != previous_passed_filter) - { - parent_folder->requestArrange(); - } - - setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration()); - //TODO RN: create interface for string highlighting - //mStringMatchOffset = filter.getStringMatchOffset(this); - filter.decrementFilterCount(); - } - return changed; -} - -LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() -{ - return &mInventoryViewModel; -} - - -const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const -{ - return &mInventoryViewModel; -} - diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 3195d9a369..a62b97aa7d 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -31,6 +31,7 @@ #include "llassetstorage.h" #include "lldarray.h" #include "llfolderviewitem.h" +#include "llfolderviewmodelinventory.h" #include "llfloater.h" #include "llinventory.h" #include "llinventoryfilter.h" @@ -42,83 +43,6 @@ class LLInvFVBridge; class LLInventoryFVBridgeBuilder; class LLInvPanelComplObserver; -class LLFolderViewModelInventory; - -class LLFolderViewModelItemInventory - : public LLFolderViewModelItemCommon -{ -public: - LLFolderViewModelItemInventory() - : mRootViewModel(NULL) - {} - void setRootViewModel(LLFolderViewModelInventory* root_view_model) - { - mRootViewModel = root_view_model; - } - virtual const LLUUID& getUUID() const = 0; - virtual time_t getCreationDate() const = 0; // UTC seconds - virtual void setCreationDate(time_t creation_date_utc) = 0; - virtual PermissionMask getPermissionMask() const = 0; - virtual LLFolderType::EType getPreferredType() const = 0; - virtual void showProperties(void) = 0; - virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual. - virtual BOOL isUpToDate() const = 0; - virtual bool hasChildren() const = 0; - virtual LLInventoryType::EType getInventoryType() const = 0; - virtual void performAction(LLInventoryModel* model, std::string action) = 0; - virtual LLWearableType::EType getWearableType() const = 0; - virtual EInventorySortGroup getSortGroup() const = 0; - virtual LLInventoryObject* getInventoryObject() const = 0; - virtual void requestSort(); - virtual bool potentiallyVisible(); - virtual bool passedFilter(S32 filter_generation = -1); - virtual bool descendantsPassedFilter(S32 filter_generation = -1); - virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); - virtual bool filter( LLFolderViewFilter& filter); - virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); -protected: - LLFolderViewModelInventory* mRootViewModel; -}; - -class LLInventorySort -{ -public: - LLInventorySort(U32 order = 0) - : mSortOrder(order), - mByDate(false), - mSystemToTop(false), - mFoldersByName(false) - { - mByDate = (order & LLInventoryFilter::SO_DATE); - mSystemToTop = (order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP); - mFoldersByName = (order & LLInventoryFilter::SO_FOLDERS_BY_NAME); - } - - bool isByDate() const { return mByDate; } - U32 getSortOrder() const { return mSortOrder; } - - bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const; -private: - U32 mSortOrder; - bool mByDate; - bool mSystemToTop; - bool mFoldersByName; -}; - -class LLFolderViewModelInventory - : public LLFolderViewModel -{ -public: - typedef LLFolderViewModel base_t; - - virtual ~LLFolderViewModelInventory() {} - - void sort(LLFolderViewFolder* folder); - - bool contentsReady(); - -}; - class LLInventoryPanel : public LLPanel { diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 61a0331b72..4a9e106687 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -623,9 +623,9 @@ void LLFloaterTexturePicker::draw() LLFolderView* folder_view = mInventoryPanel->getRootFolder(); if (!folder_view) return; - LLInventoryFilter* filter = static_cast(folder_view->getFolderViewModel())->getFilter(); + LLFolderViewFilter* filter = static_cast(folder_view->getFolderViewModel())->getFilter(); - bool is_filter_active = folder_view->getLastFilterGeneration() < filter->getCurrentGeneration() && + bool is_filter_active = folder_view->getViewModelItem()->getLastFilterGeneration() < filter->getCurrentGeneration() && filter->isNotDefault(); // After inventory panel filter is applied we have to update -- cgit v1.2.3 From 7b4f24850b94aba41ee93c6f2901b012de2b7d30 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 2 Jul 2012 19:37:11 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose fixed build post merge --- indra/newview/llimfloatercontainer.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 2bbd371e8f..9615f3f44d 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -37,7 +37,7 @@ #include "llgroupmgr.h" #include "llfolderviewitem.h" -#include "llfoldervieweventlistener.h" +#include "llfolderviewmodel.h" class LLButton; class LLLayoutPanel; @@ -53,7 +53,7 @@ typedef std::map conversations_widgets_map; // Conversation items: we hold a list of those and create an LLFolderViewItem widget for each // that we tuck into the mConversationsListPanel. -class LLConversationItem : public LLFolderViewEventListener +class LLConversationItem : public LLFolderViewModelItemCommon { public: LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); @@ -62,6 +62,7 @@ public: // Stub those things we won't really be using in this conversation context virtual const std::string& getName() const { return mName; } virtual const std::string& getDisplayName() const { return mName; } + virtual const std::string& getSearchableName() const { return mName; } virtual const LLUUID& getUUID() const { return mUUID; } virtual time_t getCreationDate() const { return 0; } virtual PermissionMask getPermissionMask() const { return PERM_ALL; } @@ -76,8 +77,8 @@ public: virtual BOOL isItemRemovable( void ) const { return FALSE; } virtual BOOL isItemInTrash( void) const { return FALSE; } virtual BOOL removeItem() { return FALSE; } - virtual void removeBatch(LLDynamicArray& batch) { } - virtual void move( LLFolderViewEventListener* parent_listener ) { } + virtual void removeBatch(std::vector& batch) { } + virtual void move( LLFolderViewModelItem* parent_listener ) { } virtual BOOL isItemCopyable() const { return FALSE; } virtual BOOL copyToClipboard() const { return FALSE; } virtual BOOL cutToClipboard() const { return FALSE; } @@ -86,10 +87,16 @@ public: virtual void pasteLinkFromClipboard() { } virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { } virtual BOOL isUpToDate() const { return TRUE; } - virtual BOOL hasChildren() const { return FALSE; } + virtual bool hasChildren() const { return FALSE; } virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; } virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } + virtual bool potentiallyVisible() { return true; } + virtual bool filter( LLFolderViewFilter& filter) { return true; } + virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) { } + virtual bool passedFilter(S32 filter_generation = -1) { return true; } + // The action callbacks virtual void performAction(LLInventoryModel* model, std::string action); virtual void openItem( void ); @@ -102,6 +109,7 @@ public: // This method should be called when a drag begins. // Returns TRUE if the drag can begin, FALSE otherwise. + virtual LLToolDragAndDrop::ESource getDragSource() const { return LLToolDragAndDrop::SOURCE_PEOPLE; } virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const { return FALSE; } // This method will be called to determine if a drop can be -- cgit v1.2.3 From 7d0150f12d8edcbd078ef570f7c64e44194e4335 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 2 Jul 2012 19:37:28 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose started to remove newview dependencies from llfolder* --- indra/newview/llfolderview.cpp | 196 +++++++-------------------- indra/newview/llfolderview.h | 12 +- indra/newview/llfolderviewitem.cpp | 96 +------------ indra/newview/llfolderviewitem.h | 1 - indra/newview/llfolderviewmodel.h | 13 +- indra/newview/llfolderviewmodelinventory.cpp | 81 +++++++++++ indra/newview/llinventoryfunctions.cpp | 88 +++++++++++- indra/newview/llinventoryfunctions.h | 7 + indra/newview/llinventorypanel.cpp | 13 +- indra/newview/llinventorypanel.h | 2 +- indra/newview/llpanellandmarks.cpp | 4 +- indra/newview/llpanelmaininventory.cpp | 4 +- indra/newview/llpanelobjectinventory.cpp | 2 +- 13 files changed, 245 insertions(+), 274 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 90c78d98b0..6bc89cdbca 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -26,34 +26,25 @@ #include "llviewerprecompiledheaders.h" -#include "llfolderview.h" #include "llfolderview.h" -#include "llcallbacklist.h" -#include "llinventorybridge.h" #include "llclipboard.h" // *TODO: remove this once hack below gone. -#include "llinventorypanel.h" -#include "llfoldertype.h" #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" #include "llpanel.h" -#include "llpreview.h" #include "llscrollcontainer.h" // hack to allow scrolling -#include "lltooldraganddrop.h" #include "lltrans.h" #include "llui.h" -#include "llviewertexture.h" -#include "llviewertexturelist.h" -#include "llviewerjointattachment.h" -#include "llviewermenu.h" #include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llviewerfoldertype.h" -#include "llviewerwindow.h" -#include "llvoavatar.h" -#include "llfloaterproperties.h" -#include "llnotificationsutil.h" + +// TODO RN: kill these +// newview includes +#include "llcallbacklist.h" // per-frame on-idle +#include "llfloaterproperties.h" // showProperties +#include "llviewerwindow.h" // renamer popup handling +#include "llpreview.h" // openSelectedItems +#include "llinventorypanel.h" // idle loop for filtering, sort order declarations, etc. // Linden library includes #include "lldbstrings.h" @@ -251,7 +242,7 @@ LLFolderView::LLFolderView(const Params& p) // make the popup menu available - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { menu = LLUICtrlFactory::getDefaultWidget("inventory_menu"); @@ -361,7 +352,7 @@ static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { LLFastTimer t2(FTM_FILTER); - filter.setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000)); + filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); getViewModelItem()->filter(filter); } @@ -631,7 +622,7 @@ void LLFolderView::clearSelection() } std::set LLFolderView::getSelectionList() const - { +{ std::set selection; std::copy(mSelectedItems.begin(), mSelectedItems.end(), std::inserter(selection, selection.begin())); return selection; @@ -695,7 +686,7 @@ void LLFolderView::draw() } - if (mSearchTimer.getElapsedTimeF32() > gSavedSettings.getF32("TypeAheadTimeout") || !mSearchString.size()) + if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size()) { mSearchString.clear(); } @@ -767,14 +758,6 @@ void LLFolderView::closeRenamer( void ) } } -void LLFolderView::removeSelectedItems( void ) -{ - if (mSelectedItems.empty()) return; - LLSD args; - args["QUESTION"] = LLTrans::getString(mSelectedItems.size() > 1 ? "DeleteItems" : "DeleteItem"); - LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLFolderView::onItemsRemovalConfirmation, this, _1, _2)); -} - bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector& selectedItems) { LLFolderViewItem* item_parent = dynamic_cast(item->getParent()); @@ -820,11 +803,8 @@ void LLFolderView::removeCutItems() } } -void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response) +void LLFolderView::removeSelectedItems() { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return; // canceled - if(getVisible() && getEnabled()) { // just in case we're removing the renaming item. @@ -927,42 +907,44 @@ void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LL } } +// TODO RN: abstract // open the selected item. void LLFolderView::openSelectedItems( void ) { - if(getVisible() && getEnabled()) - { - if (mSelectedItems.size() == 1) - { - mSelectedItems.front()->openItem(); - } - else - { - LLMultiPreview* multi_previewp = new LLMultiPreview(); - LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + //TODO RN: get working again + //if(getVisible() && getEnabled()) + //{ + // if (mSelectedItems.size() == 1) + // { + // mSelectedItems.front()->openItem(); + // } + // else + // { + // LLMultiPreview* multi_previewp = new LLMultiPreview(); + // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - // IT_{OBJECT,ATTACHMENT} creates LLProperties - // floaters; others create LLPreviews. Put - // each one in the right type of container. - LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); - bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); - if (is_prop) - LLFloater::setFloaterHost(multi_propertiesp); - else - LLFloater::setFloaterHost(multi_previewp); - listener->openItem(); - } + // selected_items_t::iterator item_it; + // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + // { + // // IT_{OBJECT,ATTACHMENT} creates LLProperties + // // floaters; others create LLPreviews. Put + // // each one in the right type of container. + // LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); + // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); + // if (is_prop) + // LLFloater::setFloaterHost(multi_propertiesp); + // else + // LLFloater::setFloaterHost(multi_previewp); + // listener->openItem(); + // } - LLFloater::setFloaterHost(NULL); - // *NOTE: LLMulti* will safely auto-delete when open'd - // without any children. - multi_previewp->openFloater(LLSD()); - multi_propertiesp->openFloater(LLSD()); - } - } + // LLFloater::setFloaterHost(NULL); + // // *NOTE: LLMulti* will safely auto-delete when open'd + // // without any children. + // multi_previewp->openFloater(LLSD()); + // multi_propertiesp->openFloater(LLSD()); + // } + //} } void LLFolderView::propertiesSelectedItems( void ) @@ -994,15 +976,6 @@ void LLFolderView::propertiesSelectedItems( void ) //} } -void LLFolderView::changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type) -{ - LLFolderBridge *folder_bridge = LLFolderBridge::sSelf.get(); - - if (!folder_bridge) return; - LLViewerInventoryCategory *cat = folder_bridge->getCategory(); - if (!cat) return; - cat->changeType(new_folder_type); -} void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) { @@ -1521,7 +1494,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) } //do text search - if (mSearchTimer.getElapsedTimeF32() > gSavedSettings.getF32("TypeAheadTimeout")) + if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout")) { mSearchString.clear(); } @@ -1831,81 +1804,6 @@ void LLFolderView::setShowSingleSelection(BOOL show) } } -bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata) -{ - std::string action = userdata.asString(); - - if ("rename" == action) - { - startRenamingSelectedItem(); - return true; - } - if ("delete" == action) - { - removeSelectedItems(); - return true; - } - if (("copy" == action) || ("cut" == action)) - { - // Clear the clipboard before we start adding things on it - LLClipboard::instance().reset(); - } - - static const std::string change_folder_string = "change_folder_type_"; - if (action.length() > change_folder_string.length() && - (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0)) - { - LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length())); - changeType(model, new_folder_type); - return true; - } - - - std::set selected_items = getSelectionList(); - - LLMultiPreview* multi_previewp = NULL; - LLMultiProperties* multi_propertiesp = NULL; - - if (("task_open" == action || "open" == action) && selected_items.size() > 1) - { - multi_previewp = new LLMultiPreview(); - gFloaterView->addChild(multi_previewp); - - LLFloater::setFloaterHost(multi_previewp); - - } - else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1) - { - multi_propertiesp = new LLMultiProperties(); - gFloaterView->addChild(multi_propertiesp); - - LLFloater::setFloaterHost(multi_propertiesp); - } - - std::set::iterator set_iter; - - for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) - { - LLFolderViewItem* folder_item = *set_iter; - if(!folder_item) continue; - LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); - if(!bridge) continue; - bridge->performAction(model, action); - } - - LLFloater::setFloaterHost(NULL); - if (multi_previewp) - { - multi_previewp->openFloater(LLSD()); - } - else if (multi_propertiesp) - { - multi_propertiesp->openFloater(LLSD()); - } - - return true; -} - static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select"); static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 8a0317f840..e098119293 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -39,20 +39,17 @@ #include "lluictrl.h" #include "v4color.h" -#include "lldarray.h" #include "stdenums.h" #include "lldepthstack.h" #include "lleditmenuhandler.h" #include "llfontgl.h" #include "llscrollcontainer.h" #include "lltooldraganddrop.h" -#include "llviewertexture.h" class LLFolderViewModelInterface; class LLFolderViewFolder; class LLFolderViewItem; class LLFolderViewFilter; -class LLInventoryModel; class LLPanel; class LLLineEditor; class LLMenuGL; @@ -153,8 +150,9 @@ public: virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); virtual std::set getSelectionList() const; + S32 getNumSelectedItems() { return mSelectedItems.size(); } - // Make sure if ancestor is selected, descendents are not + // Make sure if ancestor is selected, descendants are not void sanitizeSelection(); virtual void clearSelection(); void addToSelectionList(LLFolderViewItem* item); @@ -173,9 +171,6 @@ public: void openSelectedItems( void ); void propertiesSelectedItems( void ); - // Change the folder type - void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type); - void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); BOOL autoOpenTest(LLFolderViewFolder* item); @@ -228,8 +223,6 @@ public: F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } - bool doToSelected(LLInventoryModel* model, const LLSD& userdata); - void doIdle(); // Real idle routine static void idle(void* user_data); // static glue to doIdle() @@ -270,7 +263,6 @@ protected: BOOL addNoOptions(LLMenuGL* menu) const; - void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response); protected: LLHandle mPopupMenuHandle; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 80893c3037..e84c765ac8 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -28,16 +28,9 @@ #include "llfolderviewitem.h" // viewer includes -#include "llfolderview.h" // Items depend extensively on LLFolderViews #include "llfolderview.h" #include "llfolderviewmodel.h" -#include "llviewerfoldertype.h" -#include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator() -#include "llinventoryfunctions.h" -#include "llinventorymodelbackgroundfetch.h" #include "llpanel.h" -#include "llviewercontrol.h" // gSavedSettings -#include "llviewerwindow.h" // Argh, only for setCursor() // linden library includes #include "llclipboard.h" @@ -529,11 +522,11 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) if (can_drag) { - gViewerWindow->setCursor(UI_CURSOR_ARROW); + getWindow()->setCursor(UI_CURSOR_ARROW); } else { - gViewerWindow->setCursor(UI_CURSOR_NOLOCKED); + getWindow()->setCursor(UI_CURSOR_NOLOCKED); } return TRUE; } @@ -541,9 +534,9 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) { if (getRoot()) { - getRoot()->setShowSelectionContext(FALSE); + getRoot()->setShowSelectionContext(FALSE); } - gViewerWindow->setCursor(UI_CURSOR_ARROW); + getWindow()->setCursor(UI_CURSOR_ARROW); // let parent handle this then... return FALSE; } @@ -2075,84 +2068,3 @@ LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* it return result; } -bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const -{ - // ignore sort order for landmarks in the Favorites folder. - // they should be always sorted as in Favorites bar. See EXT-719 - //TODO RN: fix sorting in favorites folder - //if (a->getSortGroup() == SG_ITEM - // && b->getSortGroup() == SG_ITEM - // && a->getInventoryType() == LLInventoryType::IT_LANDMARK - // && b->getInventoryType() == LLInventoryType::IT_LANDMARK) - //{ - - // static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); - - // LLUUID a_uuid = a->getParentFolder()->getUUID(); - // LLUUID b_uuid = b->getParentFolder()->getUUID(); - - // if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id)) - // { - // // *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem - // // or to LLInvFVBridge - // LLViewerInventoryItem* aitem = (static_cast(a))->getItem(); - // LLViewerInventoryItem* bitem = (static_cast(b))->getItem(); - // if (!aitem || !bitem) - // return false; - // S32 a_sort = aitem->getSortField(); - // S32 b_sort = bitem->getSortField(); - // return a_sort < b_sort; - // } - //} - - // We sort by name if we aren't sorting by date - // OR if these are folders and we are sorting folders by name. - bool by_name = (!mByDate - || (mFoldersByName - && (a->getSortGroup() != SG_ITEM))); - - if (a->getSortGroup() != b->getSortGroup()) - { - if (mSystemToTop) - { - // Group order is System Folders, Trash, Normal Folders, Items - return (a->getSortGroup() < b->getSortGroup()); - } - else if (mByDate) - { - // Trash needs to go to the bottom if we are sorting by date - if ( (a->getSortGroup() == SG_TRASH_FOLDER) - || (b->getSortGroup() == SG_TRASH_FOLDER)) - { - return (b->getSortGroup() == SG_TRASH_FOLDER); - } - } - } - - if (by_name) - { - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); - if (0 == compare) - { - return (a->getCreationDate() > b->getCreationDate()); - } - else - { - return (compare < 0); - } - } - else - { - time_t first_create = a->getCreationDate(); - time_t second_create = b->getCreationDate(); - if (first_create == second_create) - { - return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); - } - else - { - return (first_create > second_create); - } - } -} - diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 581ec7239e..92923e82da 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -27,7 +27,6 @@ #define LLFOLDERVIEWITEM_H #include "llview.h" -#include "lldarray.h" // *TODO: Eliminate, forward declare #include "lluiimage.h" class LLFolderView; diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index 8a16ec3eff..98b7255137 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -22,18 +22,11 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -#ifndef LLFOLDERVIEWEVENTLISTENER_H -#define LLFOLDERVIEWEVENTLISTENER_H +#ifndef LLFOLDERVIEWMODEL_H +#define LLFOLDERVIEWMODEL_H -#include "lldarray.h" // *TODO: convert to std::vector -#include "llfoldertype.h" #include "llfontgl.h" // just for StyleFlags enum #include "llfolderview.h" -#include "llfolderviewitem.h" -#include "llinventorytype.h" -#include "llpermissionsflags.h" -#include "llpointer.h" -#include "llwearabletype.h" #include "lltooldraganddrop.h" // These are grouping of inventory types. @@ -362,4 +355,4 @@ protected: }; -#endif +#endif // LLFOLDERVIEWMODEL_H diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 7ee1a10b15..99831c61bf 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -223,3 +223,84 @@ const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const return &mInventoryViewModel; } +bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const +{ + // ignore sort order for landmarks in the Favorites folder. + // they should be always sorted as in Favorites bar. See EXT-719 + //TODO RN: fix sorting in favorites folder + //if (a->getSortGroup() == SG_ITEM + // && b->getSortGroup() == SG_ITEM + // && a->getInventoryType() == LLInventoryType::IT_LANDMARK + // && b->getInventoryType() == LLInventoryType::IT_LANDMARK) + //{ + + // static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); + + // LLUUID a_uuid = a->getParentFolder()->getUUID(); + // LLUUID b_uuid = b->getParentFolder()->getUUID(); + + // if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id)) + // { + // // *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem + // // or to LLInvFVBridge + // LLViewerInventoryItem* aitem = (static_cast(a))->getItem(); + // LLViewerInventoryItem* bitem = (static_cast(b))->getItem(); + // if (!aitem || !bitem) + // return false; + // S32 a_sort = aitem->getSortField(); + // S32 b_sort = bitem->getSortField(); + // return a_sort < b_sort; + // } + //} + + // We sort by name if we aren't sorting by date + // OR if these are folders and we are sorting folders by name. + bool by_name = (!mByDate + || (mFoldersByName + && (a->getSortGroup() != SG_ITEM))); + + if (a->getSortGroup() != b->getSortGroup()) + { + if (mSystemToTop) + { + // Group order is System Folders, Trash, Normal Folders, Items + return (a->getSortGroup() < b->getSortGroup()); + } + else if (mByDate) + { + // Trash needs to go to the bottom if we are sorting by date + if ( (a->getSortGroup() == SG_TRASH_FOLDER) + || (b->getSortGroup() == SG_TRASH_FOLDER)) + { + return (b->getSortGroup() == SG_TRASH_FOLDER); + } + } + } + + if (by_name) + { + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + if (0 == compare) + { + return (a->getCreationDate() > b->getCreationDate()); + } + else + { + return (compare < 0); + } + } + else + { + time_t first_create = a->getCreationDate(); + time_t second_create = b->getCreationDate(); + if (first_create == second_create) + { + return (LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()) < 0); + } + else + { + return (first_create > second_create); + } + } +} + diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index ff461236a2..07f3dd8ffb 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -45,7 +45,7 @@ // newview includes #include "llappearancemgr.h" #include "llappviewer.h" -//#include "llfirstuse.h" +#include "llclipboard.h" #include "llfloaterinventory.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" @@ -74,8 +74,10 @@ #include "llsidepanelinventory.h" #include "lltabcontainer.h" #include "lltooldraganddrop.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llviewermessage.h" +#include "llviewerfoldertype.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" #include "llviewerwindow.h" @@ -1044,3 +1046,87 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder) } } +void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action) +{ + if ("rename" == action) + { + root->startRenamingSelectedItem(); + return; + } + if ("delete" == action) + { + LLSD args; + args["QUESTION"] = LLTrans::getString(root->getNumSelectedItems() > 1 ? "DeleteItems" : "DeleteItem"); + LLNotificationsUtil::add("DeleteItems", args, LLSD(), boost::bind(&LLInventoryAction::onItemsRemovalConfirmation, _1, _2, root)); + return; + } + if (("copy" == action) || ("cut" == action)) + { + // Clear the clipboard before we start adding things on it + LLClipboard::instance().reset(); + } + + static const std::string change_folder_string = "change_folder_type_"; + if (action.length() > change_folder_string.length() && + (action.compare(0,change_folder_string.length(),"change_folder_type_") == 0)) + { + LLFolderType::EType new_folder_type = LLViewerFolderType::lookupTypeFromXUIName(action.substr(change_folder_string.length())); + LLFolderViewModelItemInventory* inventory_item = static_cast(root->getViewModelItem()); + LLViewerInventoryCategory *cat = model->getCategory(inventory_item->getUUID()); + if (!cat) return; + cat->changeType(new_folder_type); + return; + } + + + std::set selected_items = root->getSelectionList(); + + LLMultiPreview* multi_previewp = NULL; + LLMultiProperties* multi_propertiesp = NULL; + + if (("task_open" == action || "open" == action) && selected_items.size() > 1) + { + multi_previewp = new LLMultiPreview(); + gFloaterView->addChild(multi_previewp); + + LLFloater::setFloaterHost(multi_previewp); + + } + else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1) + { + multi_propertiesp = new LLMultiProperties(); + gFloaterView->addChild(multi_propertiesp); + + LLFloater::setFloaterHost(multi_propertiesp); + } + + std::set::iterator set_iter; + + for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) + { + LLFolderViewItem* folder_item = *set_iter; + if(!folder_item) continue; + LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); + if(!bridge) continue; + bridge->performAction(model, action); + } + + LLFloater::setFloaterHost(NULL); + if (multi_previewp) + { + multi_previewp->openFloater(LLSD()); + } + else if (multi_propertiesp) + { + multi_propertiesp->openFloater(LLSD()); + } +} + +void LLInventoryAction::onItemsRemovalConfirmation( const LLSD& notification, const LLSD& response, LLFolderView* root ) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + root->removeSelectedItems(); + } +} diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index c6b1da0417..d8d3d9bbbb 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -427,6 +427,13 @@ public: static LLUUID sWearNewClothingTransactionID; // wear all clothing in this transaction }; +struct LLInventoryAction +{ + static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action); + + static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLFolderView* root); +}; + #endif // LL_LLINVENTORYFUNCTIONS_H diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index b5fcf364dd..ef8c5dc1cf 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -44,6 +44,7 @@ #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" +#include "llpreview.h" #include "llsidepanelinventory.h" #include "llviewerattachmenu.h" #include "llviewerfoldertype.h" @@ -926,11 +927,6 @@ void LLInventoryPanel::onSelectionChange(const std::deque& it } } -void LLInventoryPanel::doToSelected(const LLSD& userdata) -{ - mFolderRoot->doToSelected(&gInventory, userdata); -} - void LLInventoryPanel::doCreate(const LLSD& userdata) { menu_create_inventory_item(this, LLFolderBridge::sSelf.get(), userdata); @@ -1260,6 +1256,13 @@ void LLInventoryPanel::updateSelection() } } +void LLInventoryPanel::doToSelected(const LLSD& userdata) +{ + LLInventoryAction::doToSelected(mInventory, mFolderRoot, userdata.asString()); + + return; +} + /************************************************************************/ /* Recent Inventory Panel related class */ diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index a62b97aa7d..58c1201e54 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -176,7 +176,7 @@ public: LLFolderViewFolder* getFolderByID(const LLUUID& id); void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); void updateSelection(); - + LLFolderViewModelInventory* getFolderViewModel(); const LLFolderViewModelInventory* getFolderViewModel() const; diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 0b899d34f4..faef923338 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -851,7 +851,7 @@ void LLLandmarksPanel::onClipboardAction(const LLSD& userdata) const } else { - mCurrentSelectedList->getRootFolder()->doToSelected(mCurrentSelectedList->getModel(),command_name); + mCurrentSelectedList->doToSelected(command_name); } } @@ -896,7 +896,7 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) { if(mCurrentSelectedList) { - mCurrentSelectedList->getRootFolder()->doToSelected(&gInventory, userdata); + mCurrentSelectedList->doToSelected(userdata); } } } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 6cef1f877b..fea27b37d3 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -294,7 +294,7 @@ BOOL LLPanelMainInventory::handleKeyHere(KEY key, MASK mask) void LLPanelMainInventory::doToSelected(const LLSD& userdata) { - getPanel()->getRootFolder()->doToSelected(&gInventory, userdata); + getPanel()->doToSelected(userdata); } void LLPanelMainInventory::closeAllFolders() @@ -970,7 +970,7 @@ void LLPanelMainInventory::onTrashButtonClick() void LLPanelMainInventory::onClipboardAction(const LLSD& userdata) { std::string command_name = userdata.asString(); - getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name); + getActivePanel()->doToSelected(command_name); } void LLPanelMainInventory::saveTexture(const LLSD& userdata) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 450e1f7ed0..002c0c1113 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1522,7 +1522,7 @@ BOOL LLPanelObjectInventory::postBuild() void LLPanelObjectInventory::doToSelected(const LLSD& userdata) { - mFolders->doToSelected(&gInventory, userdata); + LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString()); } void LLPanelObjectInventory::clearContents() -- cgit v1.2.3 From ad1f2eb5106a9ba0217ff1080d029f912ecc25e5 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 3 Jul 2012 22:31:58 +0300 Subject: CHUI-186 CHUI-187 FIX Removing a P2P convrsation from converstaion widget in the upper right corner when a new participant is added. End call prompt removed when adding a new participant to a P2P voice call. After adding a participant to a P2P voice conversation the resulting conference call is restarted voice invites to all participants. --- indra/newview/llavataractions.cpp | 4 +- indra/newview/llavataractions.h | 4 +- indra/newview/llimfloater.cpp | 73 ++++++++++++++++++++---------------- indra/newview/llimfloater.h | 2 +- indra/newview/llpanelpeoplemenus.cpp | 2 +- 5 files changed, 46 insertions(+), 39 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 21367c224d..56c9533e11 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -235,7 +235,7 @@ void LLAvatarActions::startCall(const LLUUID& id) } // static -void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) +void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id) { if (ids.size() == 0) { @@ -252,7 +252,7 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) // create the new ad hoc voice session const std::string title = LLTrans::getString("conference-title"); LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, - ids[0], id_array, true); + ids[0], id_array, true, floater_id); if (session_id == LLUUID::null) { return; diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 46830eb22c..259e87c336 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -82,9 +82,9 @@ public: static void startCall(const LLUUID& id); /** - * Start an ad-hoc conference voice call with multiple users + * Start an ad-hoc conference voice call with multiple users in a specific IM floater. */ - static void startAdhocCall(const uuid_vec_t& ids); + static void startAdhocCall(const uuid_vec_t& ids, const LLUUID& floater_id = LLUUID::null); /** * Start conference chat with the given avatars in a specific IM floater. diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9d3c0f98ce..536d0b9a23 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -322,7 +322,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAvatarPicked, this, _1, _2), TRUE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); if (!picker) { return; @@ -337,25 +337,6 @@ void LLIMFloater::onAddButtonClicked() } } -void LLIMFloater::onAvatarPicked(const uuid_vec_t& ids, const std::vector names) -{ - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - uuid_vec_t temp_ids; - temp_ids.push_back(mOtherParticipantUUID); - temp_ids.insert(temp_ids.end(), ids.begin(), ids.end()); - - LLAvatarActions::startConference(temp_ids, mSessionID); - } - else - { - inviteToSession(ids); - } -} - bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { if (!mSession @@ -388,6 +369,44 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) return true; } +void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) +{ + if (mIsP2PChat) + { + mStartConferenceInSameFloater = true; + + uuid_vec_t temp_ids; + + // Add the initial participant of a P2P session + temp_ids.push_back(mOtherParticipantUUID); + temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end()); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + // first check whether this is a voice session + bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); + + // then we can close the current session + gIMMgr->leaveSession(mSessionID); + LLIMConversation::onClose(false); + + // Start a new ad hoc voice call if we invite new participants to a P2P call, + // or start a text chat otherwise. + if (is_voice_call) + { + LLAvatarActions::startAdhocCall(temp_ids, mSessionID); + } + else + { + LLAvatarActions::startConference(temp_ids, mSessionID); + } + } + else + { + inviteToSession(uuids); + } +} + void LLIMFloater::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); @@ -1096,19 +1115,7 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) res = canAddSelectedToChat(ids); if(res && drop) { - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - ids.push_back(mOtherParticipantUUID); - - LLAvatarActions::startConference(ids, mSessionID); - } - else - { - inviteToSession(ids); - } + addSessionParticipants(ids); } } diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 23f9e75e21..2e8fc84746 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -152,7 +152,7 @@ private: static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata); void setTyping(bool typing); void onAddButtonClicked(); - void onAvatarPicked(const uuid_vec_t& ids, const std::vector names); + void addSessionParticipants(const uuid_vec_t& uuids); bool canAddSelectedToChat(const uuid_vec_t& uuids); void onCallButtonClicked(); diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index ac2109dda4..c9eebe24d3 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -82,7 +82,7 @@ LLContextMenu* NearbyMenu::createMenu() // registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs)); // *TODO: unimplemented registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startConference, mUUIDs, LLUUID::null)); - registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs)); + registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs, LLUUID::null)); registrar.add("Avatar.OfferTeleport", boost::bind(&NearbyMenu::offerTeleport, this)); registrar.add("Avatar.RemoveFriend",boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs)); // registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented -- cgit v1.2.3 From ac0243a006fa28e872e4ee88f7c1588eaefeaecf Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 3 Jul 2012 22:32:21 +0300 Subject: CHUI-188 FIX for crash in adding chat participants. Modified the duplicated participants check procedure LLIMFloater::canAddSelectedToChat() to use the list, updated by LLSpeakerMgr instead of LLIMSession::mInitialTargetIDs list, which is initialized at session start and not updated afterwards. --- indra/newview/llimfloater.cpp | 72 +++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 536d0b9a23..a506f0f9f3 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -339,34 +339,54 @@ void LLIMFloater::onAddButtonClicked() bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { - if (!mSession - || mDialog == IM_SESSION_GROUP_START - || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) - { - return false; - } + if (!mSession + || mDialog == IM_SESSION_GROUP_START + || mDialog == IM_SESSION_INVITE && gAgent.isInGroup(mSessionID)) + { + return false; + } - for (uuid_vec_t::const_iterator id = uuids.begin(); - id != uuids.end(); ++id) - { - // Skip this check for ad hoc conferences, - // conference participants should be listed in mSession->mInitialTargetIDs. - if (mIsP2PChat && *id == mOtherParticipantUUID) - { - return false; - } - - for (uuid_vec_t::const_iterator target_id = mSession->mInitialTargetIDs.begin(); - target_id != mSession->mInitialTargetIDs.end(); ++target_id) - { - if (*id == *target_id) - { - return false; - } - } - } + if (mIsP2PChat) + { + // For a P2P session just check if we are not adding the other participant. + + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + if (*id == mOtherParticipantUUID) + { + return false; + } + } + } + else + { + // For a conference session we need to check against the list from LLSpeakerMgr, + // because this list may change when participants join or leave the session. + + LLSpeakerMgr::speaker_list_t speaker_list; + LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); + if (speaker_mgr) + { + speaker_mgr->getSpeakerList(&speaker_list, true); + } - return true; + for (uuid_vec_t::const_iterator id = uuids.begin(); + id != uuids.end(); ++id) + { + for (LLSpeakerMgr::speaker_list_t::const_iterator it = speaker_list.begin(); + it != speaker_list.end(); ++it) + { + const LLPointer& speaker = *it; + if (*id == speaker->mID) + { + return false; + } + } + } + } + + return true; } void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) -- cgit v1.2.3 From a8defa513c3b2b83f476a1de115fd0332566b483 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Jul 2012 17:05:28 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose removed viewer dependencies from folderview code --- indra/newview/llfolderview.cpp | 84 +++++++++---------------------------- indra/newview/llfolderview.h | 5 +-- indra/newview/llfolderviewitem.cpp | 10 ----- indra/newview/llfolderviewmodel.cpp | 3 +- indra/newview/llfolderviewmodel.h | 1 - indra/newview/llinventorybridge.cpp | 6 +-- indra/newview/llinventorypanel.cpp | 11 +++++ indra/newview/llinventorypanel.h | 79 +--------------------------------- 8 files changed, 36 insertions(+), 163 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 6bc89cdbca..10677db094 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -27,25 +27,18 @@ #include "llviewerprecompiledheaders.h" #include "llfolderview.h" - +#include "llfolderviewmodel.h" #include "llclipboard.h" // *TODO: remove this once hack below gone. #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" #include "llpanel.h" #include "llscrollcontainer.h" // hack to allow scrolling +#include "lltextbox.h" #include "lltrans.h" #include "llui.h" #include "lluictrlfactory.h" -// TODO RN: kill these -// newview includes -#include "llcallbacklist.h" // per-frame on-idle -#include "llfloaterproperties.h" // showProperties -#include "llviewerwindow.h" // renamer popup handling -#include "llpreview.h" // openSelectedItems -#include "llinventorypanel.h" // idle loop for filtering, sort order declarations, etc. - // Linden library includes #include "lldbstrings.h" #include "llfocusmgr.h" @@ -172,7 +165,6 @@ LLFolderView::LLFolderView(const Params& p) mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), mNeedsAutoRename(FALSE), - mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately mShowSelectionContext(FALSE), mShowSingleSelection(FALSE), mArrangeGeneration(0), @@ -199,7 +191,6 @@ LLFolderView::LLFolderView(const Params& p) mAutoOpenTimer.stop(); mKeyboardSelection = FALSE; mIndentation = p.folder_indentation; - gIdleCallbacks.addFunction(idle, this); //clear label // go ahead and render root folder as usual @@ -269,7 +260,6 @@ LLFolderView::~LLFolderView( void ) mStatusTextBox = NULL; mAutoOpenItems.removeAllNodes(); - gIdleCallbacks.deleteFunction(idle, this); if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); @@ -291,16 +281,16 @@ BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) { LLFolderViewFolder::addFolder(folder); - mFolders.remove(folder); - // enforce sort order of My Inventory followed by Library - if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) - { - mFolders.push_back(folder); - } - else - { - mFolders.insert(mFolders.begin(), folder); - } + // TODO RN: enforce sort order of My Inventory followed by Library + //mFolders.remove(folder); + //if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) + //{ + // mFolders.push_back(folder); + //} + //else + //{ + // mFolders.insert(mFolders.begin(), folder); + //} return TRUE; } @@ -754,7 +744,7 @@ void LLFolderView::closeRenamer( void ) if (mRenamer && mRenamer->getVisible()) { // Triggers onRenamerLost() that actually closes the renamer. - gViewerWindow->removePopup(mRenamer); + LLUI::removePopup(mRenamer); } } @@ -785,24 +775,6 @@ bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector exit - if (!LLClipboard::instance().isCutMode()) - return; - - // Get the list of clipboard item uuids and iterate through them - LLDynamicArray objects; - LLClipboard::instance().pasteFromClipboard(objects); - for (LLDynamicArray::const_iterator iter = objects.begin(); - iter != objects.end(); - ++iter) - { - gInventory.removeObject(*iter); - } -} - void LLFolderView::removeSelectedItems() { if(getVisible() && getEnabled()) @@ -1126,9 +1098,9 @@ void LLFolderView::cut() if(listener) { listener->cutToClipboard(); + listener->removeItem(); } } - LLFolderView::removeCutItems(); } mSearchString.clear(); } @@ -1222,7 +1194,7 @@ void LLFolderView::startRenamingSelectedItem( void ) // set focus will fail unless item is visible mRenamer->setFocus( TRUE ); mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this)); - gViewerWindow->addPopup(mRenamer); + LLUI::addPopup(mRenamer); } } @@ -1808,16 +1780,10 @@ static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select"); static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); // Main idle routine -void LLFolderView::doIdle() +void LLFolderView::update() { // If this is associated with the user's inventory, don't do anything // until that inventory is loaded up. - const LLInventoryPanel *inventory_panel = dynamic_cast(mParentPanel); - if (inventory_panel && !inventory_panel->getIsViewsInitialized()) - { - return; - } - LLFastTimer t2(FTM_INVENTORY); if (getFolderViewModel()->getFilter()->isModified() && getFolderViewModel()->getFilter()->isNotDefault()) @@ -1859,8 +1825,8 @@ void LLFolderView::doIdle() BOOL filter_finished = getViewModelItem()->passedFilter() && mViewModel->contentsReady(); if (filter_finished - || gFocusMgr.childHasKeyboardFocus(inventory_panel) - || gFocusMgr.childHasMouseCapture(inventory_panel)) + || gFocusMgr.childHasKeyboardFocus(getParent()) // assume we are inside a scroll container + || gFocusMgr.childHasMouseCapture(getParent())) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process mNeedsAutoSelect = FALSE; @@ -1919,7 +1885,6 @@ void LLFolderView::doIdle() constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); } - BOOL is_visible = isInVisibleChain(); if ( is_visible ) @@ -1954,17 +1919,6 @@ void LLFolderView::doIdle() mSignalSelectCallback = FALSE; } - -//static -void LLFolderView::idle(void* user_data) -{ - LLFolderView* self = (LLFolderView*)user_data; - if ( self ) - { // Do the real idle - self->doIdle(); - } -} - void LLFolderView::dumpSelectionInformation() { llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; @@ -1988,7 +1942,7 @@ void LLFolderView::updateRenamerPosition() screenPointToLocal( x, y, &x, &y ); mRenamer->setOrigin( x, y ); - LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidthScaled(), 0); + LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0); if (mScrollContainer) { scroller_rect = mScrollContainer->getContentWindowRect(); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index e098119293..78f1d8aff2 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -165,7 +165,6 @@ public: // Deletion functionality void removeSelectedItems(); - static void removeCutItems(); // Open the selected item void openSelectedItems( void ); @@ -223,8 +222,7 @@ public: F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } - void doIdle(); // Real idle routine - static void idle(void* user_data); // static glue to doIdle() + void update(); // needs to be called periodically (e.g. once per frame) BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } BOOL needsAutoRename() { return mNeedsAutoRename; } @@ -288,7 +286,6 @@ protected: bool mUseLabelSuffix; bool mShowItemLinkOverlays; - U32 mSortOrder; LLDepthStack mAutoOpenItems; LLFolderViewFolder* mAutoOpenCandidate; LLFrameTimer mAutoOpenTimer; diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 3937d4332b..dee3fe7218 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -1798,16 +1798,6 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) { - /* Disable outfit double click to wear - const LLUUID &cat_uuid = getViewModelItem()->getUUID(); - const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid); - if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT) - { - getViewModelItem()->performAction(NULL, NULL,"replaceoutfit"); - return TRUE; - } - */ - BOOL handled = FALSE; if( isOpen() ) { diff --git a/indra/newview/llfolderviewmodel.cpp b/indra/newview/llfolderviewmodel.cpp index 92db84156e..ca6225aca7 100644 --- a/indra/newview/llfolderviewmodel.cpp +++ b/indra/newview/llfolderviewmodel.cpp @@ -28,7 +28,6 @@ #include "llfolderviewmodel.h" #include "lltrans.h" -#include "llviewercontrol.h" bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { @@ -49,6 +48,6 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - getFilter()->setFilterCount(llclamp(gSavedSettings.getS32("FilterItemsPerFrame"), 1, 5000)); + getFilter()->setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); mFolderView->getViewModelItem()->filter(*getFilter()); } diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index 98b7255137..079409c2a4 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -27,7 +27,6 @@ #include "llfontgl.h" // just for StyleFlags enum #include "llfolderview.h" -#include "lltooldraganddrop.h" // These are grouping of inventory types. // Order matters when sorting system folders to the top. diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 002278601a..d17c25d9f3 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1400,7 +1400,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - LLFolderView::removeCutItems(); + gInventory.removeObject(mUUID); return; } else if ("copy" == action) @@ -1680,14 +1680,12 @@ BOOL LLItemBridge::renameItem(const std::string& new_name) return FALSE; } - BOOL LLItemBridge::removeItem() { if(!isItemRemovable()) { return FALSE; } - // move it to the trash LLPreview::hide(mUUID, TRUE); @@ -2870,7 +2868,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) else if ("cut" == action) { cutToClipboard(); - LLFolderView::removeCutItems(); + gInventory.removeObject(mUUID); return; } else if ("copy" == action) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index c1ffe89184..fed9893158 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -258,6 +258,8 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) LLInventoryPanel::~LLInventoryPanel() { + gIdleCallbacks.deleteFunction(idle, this); + U32 sort_order = getFolderViewModel()->getSorter().getSortOrder(); if (mSortOrderSetting != INHERIT_SORT_ORDER) { @@ -566,12 +568,21 @@ void LLInventoryPanel::onIdle(void *userdata) } } +void LLInventoryPanel::idle(void* user_data) +{ + LLInventoryPanel* panel = (LLInventoryPanel*)user_data; + panel->mFolderRoot->doIdle(); +} + + void LLInventoryPanel::initializeViews() { if (!gInventory.isInventoryUsable()) return; rebuildViewsFor(gInventory.getRootFolderID()); + gIdleCallbacks.addFunction(idle, this); + mViewsInitialized = true; openStartFolderOrMyInventory(); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 1061f12575..465ccdd582 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -45,82 +45,6 @@ class LLInventoryFVBridgeBuilder; class LLInvPanelComplObserver; class LLFolderViewModelInventory; -class LLFolderViewModelItemInventory - : public LLFolderViewModelItemCommon -{ -public: - LLFolderViewModelItemInventory() - : mRootViewModel(NULL) - {} - void setRootViewModel(LLFolderViewModelInventory* root_view_model) - { - mRootViewModel = root_view_model; - } - virtual const LLUUID& getUUID() const = 0; - virtual time_t getCreationDate() const = 0; // UTC seconds - virtual void setCreationDate(time_t creation_date_utc) = 0; - virtual PermissionMask getPermissionMask() const = 0; - virtual LLFolderType::EType getPreferredType() const = 0; - virtual void showProperties(void) = 0; - virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual. - virtual BOOL isUpToDate() const = 0; - virtual bool hasChildren() const = 0; - virtual LLInventoryType::EType getInventoryType() const = 0; - virtual void performAction(LLInventoryModel* model, std::string action) = 0; - virtual LLWearableType::EType getWearableType() const = 0; - virtual EInventorySortGroup getSortGroup() const = 0; - virtual LLInventoryObject* getInventoryObject() const = 0; - virtual void requestSort(); - virtual bool potentiallyVisible(); - virtual bool passedFilter(S32 filter_generation = -1); - virtual bool descendantsPassedFilter(S32 filter_generation = -1); - virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); - virtual bool filter( LLFolderViewFilter& filter); - virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); -protected: - LLFolderViewModelInventory* mRootViewModel; -}; - -class LLInventorySort -{ -public: - LLInventorySort(U32 order = 0) - : mSortOrder(order), - mByDate(false), - mSystemToTop(false), - mFoldersByName(false) - { - mByDate = (order & LLInventoryFilter::SO_DATE); - mSystemToTop = (order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP); - mFoldersByName = (order & LLInventoryFilter::SO_FOLDERS_BY_NAME); - } - - bool isByDate() const { return mByDate; } - U32 getSortOrder() const { return mSortOrder; } - - bool operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const; -private: - U32 mSortOrder; - bool mByDate; - bool mSystemToTop; - bool mFoldersByName; -}; - -class LLFolderViewModelInventory - : public LLFolderViewModel -{ -public: - typedef LLFolderViewModel base_t; - - virtual ~LLFolderViewModelInventory() {} - - void sort(LLFolderViewFolder* folder); - - bool contentsReady(); - -}; - - class LLInventoryPanel : public LLPanel { //-------------------------------------------------------------------- @@ -232,7 +156,8 @@ public: void doCreate(const LLSD& userdata); bool beginIMSession(); bool attachObject(const LLSD& userdata); - + static void idle(void* user_data); + // DEBUG ONLY: static void dumpSelectionInformation(void* user_data); -- cgit v1.2.3 From 52bf9e20454181d8acb0ac419a882cc1a0e3af9e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 3 Jul 2012 18:11:14 -0700 Subject: CHUI-174 : Fixed crash in forced response to notifications. Use an empty form in that case and allow the notification to not be in the notifications list. --- indra/newview/llviewermessage.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dd78bbd491..7e1f186769 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1481,7 +1481,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& } LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID()); - llassert(notification_ptr != NULL); // For muting, we need to add the mute, then decline the offer. // This must be done here because: @@ -1504,7 +1503,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& bool busy = gAgent.getBusy(); - LLNotificationFormPtr modified_form(new LLNotificationForm(*notification_ptr->getForm())); + LLNotificationFormPtr modified_form(notification_ptr ? new LLNotificationForm(*notification_ptr->getForm()) : new LLNotificationForm()); switch(button) { @@ -1550,7 +1549,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& break; } - modified_form->setElementEnabled("Show", false); + if (modified_form != NULL) + { + modified_form->setElementEnabled("Show", false); + } break; // end switch (mIM) @@ -1567,7 +1569,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& break; case IOR_MUTE: - modified_form->setElementEnabled("Mute", false); + if (modified_form != NULL) + { + modified_form->setElementEnabled("Mute", false); + } // MUTE falls through to decline case IOR_DECLINE: { @@ -1604,8 +1609,11 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& busy_message(gMessageSystem, mFromID); } - modified_form->setElementEnabled("Show", false); - modified_form->setElementEnabled("Discard", false); + if (modified_form != NULL) + { + modified_form->setElementEnabled("Show", false); + modified_form->setElementEnabled("Discard", false); + } break; } @@ -1627,8 +1635,11 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& delete this; } - notification_ptr->updateForm(modified_form); - notification_ptr->repost(); + if (notification_ptr != NULL) + { + notification_ptr->updateForm(modified_form); + notification_ptr->repost(); + } return false; } -- cgit v1.2.3 From cea3c37dcb09eb30cb986ecac4d29a4ff1cc0898 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 3 Jul 2012 19:58:49 -0700 Subject: CHUI-164 : Fix crash when closing conversations using the conversation widget. Populated the sessionRemoved() method with code to close the floater and clean up the list. --- indra/newview/llimfloatercontainer.cpp | 11 +++++++++-- indra/newview/llimfloatercontainer.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 261b5f33a2..08ace601a3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -73,8 +73,15 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - LLIMFloater::show(session_id); -}; + LLIMFloater::show(session_id); +} + +void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) +{ + LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); + LLFloater::onClickClose(floaterp); + removeConversationListItem(floaterp); +} BOOL LLIMFloaterContainer::postBuild() { diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 2bbd371e8f..c062127bee 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -158,7 +158,7 @@ public: // LLIMSessionObserver observe triggers /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id); - /*virtual*/ void sessionRemoved(const LLUUID& session_id) {}; + /*virtual*/ void sessionRemoved(const LLUUID& session_id); /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) {}; private: -- cgit v1.2.3 From 1494a1058f41c5aa00a8ed08fe71123f63e92e81 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Jul 2012 23:55:39 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose move llfolderview* into LLUI! --- indra/llui/CMakeLists.txt | 6 + indra/llui/llfolderview.cpp | 2078 +++++++++++++++++++++++++ indra/llui/llfolderview.h | 388 +++++ indra/llui/llfolderviewitem.cpp | 2032 +++++++++++++++++++++++++ indra/llui/llfolderviewitem.h | 420 +++++ indra/llui/llfolderviewmodel.cpp | 53 + indra/llui/llfolderviewmodel.h | 353 +++++ indra/newview/CMakeLists.txt | 6 - indra/newview/llfolderview.cpp | 2105 -------------------------- indra/newview/llfolderview.h | 393 ----- indra/newview/llfolderviewitem.cpp | 2060 ------------------------- indra/newview/llfolderviewitem.h | 418 ----- indra/newview/llfolderviewmodel.cpp | 53 - indra/newview/llfolderviewmodel.h | 357 ----- indra/newview/llfolderviewmodelinventory.cpp | 26 + indra/newview/llfolderviewmodelinventory.h | 13 +- indra/newview/llimfloatercontainer.h | 9 - indra/newview/llinventorybridge.h | 3 +- indra/newview/llinventorypanel.cpp | 19 +- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/lltexturectrl.cpp | 1 + 21 files changed, 5389 insertions(+), 5406 deletions(-) create mode 100644 indra/llui/llfolderview.cpp create mode 100644 indra/llui/llfolderview.h create mode 100644 indra/llui/llfolderviewitem.cpp create mode 100644 indra/llui/llfolderviewitem.h create mode 100644 indra/llui/llfolderviewmodel.cpp create mode 100644 indra/llui/llfolderviewmodel.h delete mode 100644 indra/newview/llfolderview.cpp delete mode 100644 indra/newview/llfolderview.h delete mode 100644 indra/newview/llfolderviewitem.cpp delete mode 100644 indra/newview/llfolderviewitem.h delete mode 100644 indra/newview/llfolderviewmodel.cpp delete mode 100644 indra/newview/llfolderviewmodel.h diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index b50ed2342d..a9ad0a3c0b 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -54,6 +54,9 @@ set(llui_SOURCE_FILES llfloaterreglistener.cpp llflyoutbutton.cpp llfocusmgr.cpp + llfolderview.cpp + llfolderviewitem.cpp + llfolderviewmodel.cpp llfunctorregistry.cpp lliconctrl.cpp llkeywords.cpp @@ -154,6 +157,9 @@ set(llui_HEADER_FILES llfloaterreglistener.h llflyoutbutton.h llfocusmgr.h + llfolderview.h + llfolderviewitem.h + llfolderviewmodel.h llfunctorregistry.h llhandle.h llhelp.h diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp new file mode 100644 index 0000000000..0d3bc44ae4 --- /dev/null +++ b/indra/llui/llfolderview.cpp @@ -0,0 +1,2078 @@ +/** + * @file llfolderview.cpp + * @brief Implementation of the folder view collection of classes. + * + * $LicenseInfo:firstyear=2001&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 "linden_common.h" + +#include "llfolderview.h" +#include "llfolderviewmodel.h" +#include "llclipboard.h" // *TODO: remove this once hack below gone. +#include "llkeyboard.h" +#include "lllineeditor.h" +#include "llmenugl.h" +#include "llpanel.h" +#include "llscrollcontainer.h" // hack to allow scrolling +#include "lltextbox.h" +#include "lltrans.h" +#include "llui.h" +#include "lluictrlfactory.h" + +// Linden library includes +#include "lldbstrings.h" +#include "llfocusmgr.h" +#include "llfontgl.h" +#include "llgl.h" +#include "llrender.h" + +// Third-party library includes +#include + +///---------------------------------------------------------------------------- +/// Local function declarations, constants, enums, and typedefs +///---------------------------------------------------------------------------- + +const S32 RENAME_WIDTH_PAD = 4; +const S32 RENAME_HEIGHT_PAD = 1; +const S32 AUTO_OPEN_STACK_DEPTH = 16; +const S32 MIN_ITEM_WIDTH_VISIBLE = LLFolderViewItem::ICON_WIDTH + + LLFolderViewItem::ICON_PAD + + LLFolderViewItem::ARROW_SIZE + + LLFolderViewItem::TEXT_PAD + + /*first few characters*/ 40; +const S32 MINIMUM_RENAMER_WIDTH = 80; + +// *TODO: move in params in xml if necessary. Requires modification of LLFolderView & LLInventoryPanel Params. +const S32 STATUS_TEXT_HPAD = 6; +const S32 STATUS_TEXT_VPAD = 8; + +enum { + SIGNAL_NO_KEYBOARD_FOCUS = 1, + SIGNAL_KEYBOARD_FOCUS = 2 +}; + +F32 LLFolderView::sAutoOpenTime = 1.f; + +//--------------------------------------------------------------------------- + +// Tells all folders in a folderview to close themselves +// For efficiency, calls setOpenArrangeRecursively(). +// The calling function must then call: +// LLFolderView* root = getRoot(); +// if( root ) +// { +// root->arrange( NULL, NULL ); +// root->scrollToShowSelection(); +// } +// to patch things up. +class LLCloseAllFoldersFunctor : public LLFolderViewFunctor +{ +public: + LLCloseAllFoldersFunctor(BOOL close) { mOpen = !close; } + virtual ~LLCloseAllFoldersFunctor() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item); + + BOOL mOpen; +}; + + +void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder) +{ + folder->setOpenArrangeRecursively(mOpen); +} + +// Do nothing. +void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) +{ } + +///---------------------------------------------------------------------------- +/// Class LLFolderViewScrollContainer +///---------------------------------------------------------------------------- + +// virtual +const LLRect LLFolderViewScrollContainer::getScrolledViewRect() const +{ + LLRect rect = LLRect::null; + if (mScrolledView) + { + LLFolderView* folder_view = dynamic_cast(mScrolledView); + if (folder_view) + { + S32 height = folder_view->getRect().getHeight(); + + rect = mScrolledView->getRect(); + rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height); + } + } + + return rect; +} + +LLFolderViewScrollContainer::LLFolderViewScrollContainer(const LLScrollContainer::Params& p) +: LLScrollContainer(p) +{} + +///---------------------------------------------------------------------------- +/// Class LLFolderView +///---------------------------------------------------------------------------- +LLFolderView::Params::Params() +: title("title"), + use_label_suffix("use_label_suffix"), + allow_multiselect("allow_multiselect", true), + show_empty_message("show_empty_message", true), + use_ellipses("use_ellipses", false) +{ + folder_indentation = -4; +} + + +// Default constructor +LLFolderView::LLFolderView(const Params& p) +: LLFolderViewFolder(p), + mScrollContainer( NULL ), + mPopupMenuHandle(), + mAllowMultiSelect(p.allow_multiselect), + mShowEmptyMessage(p.show_empty_message), + mShowFolderHierarchy(FALSE), + mRenameItem( NULL ), + mNeedsScroll( FALSE ), + mUseLabelSuffix(p.use_label_suffix), + mPinningSelectedItem(FALSE), + mNeedsAutoSelect( FALSE ), + mAutoSelectOverride(FALSE), + mNeedsAutoRename(FALSE), + mShowSelectionContext(FALSE), + mShowSingleSelection(FALSE), + mArrangeGeneration(0), + mSignalSelectCallback(0), + mMinWidth(0), + mDragAndDropThisFrame(FALSE), + mCallbackRegistrar(NULL), + mParentPanel(p.parent_panel), + mUseEllipses(p.use_ellipses), + mDraggingOverItem(NULL), + mStatusTextBox(NULL), + mShowItemLinkOverlays(p.show_item_link_overlays), + mViewModel(p.view_model) +{ + mViewModel->setFolderView(this); + mRoot = this; + + LLRect rect = p.rect; + LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); + setRect( rect ); + reshape(rect.getWidth(), rect.getHeight()); + mAutoOpenItems.setDepth(AUTO_OPEN_STACK_DEPTH); + mAutoOpenCandidate = NULL; + mAutoOpenTimer.stop(); + mKeyboardSelection = FALSE; + mIndentation = p.folder_indentation; + + //clear label + // go ahead and render root folder as usual + // just make sure the label ("Inventory Folder") never shows up + mLabel = LLStringUtil::null; + + // Escape is handled by reverting the rename, not commiting it (default behavior) + LLLineEditor::Params params; + params.name("ren"); + params.rect(rect); + params.font(getLabelFontForStyle(LLFontGL::NORMAL)); + params.max_length.bytes(DB_INV_ITEM_NAME_STR_LEN); + params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); + params.prevalidate_callback(&LLTextValidate::validateASCIIPrintableNoPipe); + params.commit_on_focus_lost(true); + params.visible(false); + mRenamer = LLUICtrlFactory::create (params); + addChild(mRenamer); + + // Textbox + LLTextBox::Params text_p; + LLFontGL* font = getLabelFontForStyle(mLabelStyle); + LLRect new_r = LLRect(rect.mLeft + ICON_PAD, + rect.mTop - TEXT_PAD, + rect.mRight, + rect.mTop - TEXT_PAD - font->getLineHeight()); + text_p.rect(new_r); + text_p.name(std::string(p.name)); + text_p.font(font); + text_p.visible(false); + text_p.parse_urls(true); + text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047 + // set text padding the same as in People panel. EXT-7047, EXT-4837 + text_p.h_pad(STATUS_TEXT_HPAD); + text_p.v_pad(STATUS_TEXT_VPAD); + mStatusTextBox = LLUICtrlFactory::create (text_p); + mStatusTextBox->setFollowsLeft(); + mStatusTextBox->setFollowsTop(); + //addChild(mStatusTextBox); + + + // make the popup menu available + LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + if (!menu) + { + menu = LLUICtrlFactory::getDefaultWidget("inventory_menu"); + } + menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); + mPopupMenuHandle = menu->getHandle(); + + mViewModelItem->openItem(); +} + +// Destroys the object +LLFolderView::~LLFolderView( void ) +{ + closeRenamer(); + + // The release focus call can potentially call the + // scrollcontainer, which can potentially be called with a partly + // destroyed scollcontainer. Just null it out here, and no worries + // about calling into the invalid scroll container. + // Same with the renamer. + mScrollContainer = NULL; + mRenameItem = NULL; + mRenamer = NULL; + mStatusTextBox = NULL; + + mAutoOpenItems.removeAllNodes(); + + if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); + + mAutoOpenItems.removeAllNodes(); + clearSelection(); + mItems.clear(); + mFolders.clear(); + + delete mViewModel; + mViewModel = NULL; +} + +BOOL LLFolderView::canFocusChildren() const +{ + return FALSE; +} + +BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) +{ + LLFolderViewFolder::addFolder(folder); + + // TODO RN: enforce sort order of My Inventory followed by Library + //mFolders.remove(folder); + //if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) + //{ + // mFolders.push_back(folder); + //} + //else + //{ + // mFolders.insert(mFolders.begin(), folder); + //} + + return TRUE; +} + +void LLFolderView::closeAllFolders() +{ + // Close all the folders + setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + arrangeAll(); +} + +void LLFolderView::openTopLevelFolders() +{ + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + (*fit)->setOpen(TRUE); + } +} + +// This view grows and shrinks to enclose all of its children items and folders. +// *width should be 0 +// conform show folder state works +S32 LLFolderView::arrange( S32* unused_width, S32* unused_height ) +{ + mMinWidth = 0; + S32 target_height; + + LLFolderViewFolder::arrange(&mMinWidth, &target_height); + + LLRect scroll_rect = mScrollContainer->getContentWindowRect(); + reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); + + LLRect new_scroll_rect = mScrollContainer->getContentWindowRect(); + if (new_scroll_rect.getWidth() != scroll_rect.getWidth()) + { + reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); + } + + // move item renamer text field to item's new position + updateRenamerPosition(); + + return llround(mTargetHeight); +} + +static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); + +void LLFolderView::filter( LLFolderViewFilter& filter ) +{ + LLFastTimer t2(FTM_FILTER); + filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + + getViewModelItem()->filter(filter); +} + +void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLRect scroll_rect; + if (mScrollContainer) + { + LLView::reshape(width, height, called_from_parent); + scroll_rect = mScrollContainer->getContentWindowRect(); + } + width = llmax(mMinWidth, scroll_rect.getWidth()); + height = llmax(llround(mCurHeight), scroll_rect.getHeight()); + + // Restrict width within scroll container's width + if (mUseEllipses && mScrollContainer) + { + width = scroll_rect.getWidth(); + } + + LLView::reshape(width, height, called_from_parent); + mReshapeSignal(mSelectedItems, FALSE); +} + +void LLFolderView::addToSelectionList(LLFolderViewItem* item) +{ + if (item->isSelected()) + { + removeFromSelectionList(item); + } + if (mSelectedItems.size()) + { + mSelectedItems.back()->setIsCurSelection(FALSE); + } + item->setIsCurSelection(TRUE); + mSelectedItems.push_back(item); +} + +void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) +{ + if (mSelectedItems.size()) + { + mSelectedItems.back()->setIsCurSelection(FALSE); + } + + selected_items_t::iterator item_iter; + for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end();) + { + if (*item_iter == item) + { + item_iter = mSelectedItems.erase(item_iter); + } + else + { + ++item_iter; + } + } + if (mSelectedItems.size()) + { + mSelectedItems.back()->setIsCurSelection(TRUE); + } +} + +LLFolderViewItem* LLFolderView::getCurSelectedItem( void ) +{ + if(mSelectedItems.size()) + { + LLFolderViewItem* itemp = mSelectedItems.back(); + llassert(itemp->getIsCurSelection()); + return itemp; + } + return NULL; +} + + +// Record the selected item and pass it down the hierachy. +BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, + BOOL take_keyboard_focus) +{ + mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; + + if( selection == this ) + { + return FALSE; + } + + if( selection && take_keyboard_focus) + { + mParentPanel->setFocus(TRUE); + } + + // clear selection down here because change of keyboard focus can potentially + // affect selection + clearSelection(); + + if(selection) + { + addToSelectionList(selection); + } + + BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); + if(openitem && selection) + { + selection->getParentFolder()->requestArrange(); + } + + llassert(mSelectedItems.size() <= 1); + + return rv; +} + +BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) +{ + BOOL rv = FALSE; + + // can't select root folder + if(!selection || selection == this) + { + return FALSE; + } + + if (!mAllowMultiSelect) + { + clearSelection(); + } + + selected_items_t::iterator item_iter; + for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) + { + if (*item_iter == selection) + { + break; + } + } + + BOOL on_list = (item_iter != mSelectedItems.end()); + + if(selected && !on_list) + { + addToSelectionList(selection); + } + if(!selected && on_list) + { + removeFromSelectionList(selection); + } + + rv = LLFolderViewFolder::changeSelection(selection, selected); + + mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; + + return rv; +} + +static LLFastTimer::DeclareTimer FTM_SANITIZE_SELECTION("Sanitize Selection"); +void LLFolderView::sanitizeSelection() +{ + LLFastTimer _(FTM_SANITIZE_SELECTION); + // store off current item in case it is automatically deselected + // and we want to preserve context + LLFolderViewItem* original_selected_item = getCurSelectedItem(); + + std::vector items_to_remove; + selected_items_t::iterator item_iter; + for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) + { + LLFolderViewItem* item = *item_iter; + + // ensure that each ancestor is open and potentially passes filtering + BOOL visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item + // modify with parent open and filters states + LLFolderViewFolder* parent_folder = item->getParentFolder(); + // Move up through parent folders and see what's visible + while(parent_folder) + { + visible = visible && parent_folder->isOpen() && parent_folder->getViewModelItem()->potentiallyVisible(); + parent_folder = parent_folder->getParentFolder(); + } + + // deselect item if any ancestor is closed or didn't pass filter requirements. + if (!visible) + { + items_to_remove.push_back(item); + } + + // disallow nested selections (i.e. folder items plus one or more ancestors) + // could check cached mum selections count and only iterate if there are any + // but that may be a premature optimization. + selected_items_t::iterator other_item_iter; + for (other_item_iter = mSelectedItems.begin(); other_item_iter != mSelectedItems.end(); ++other_item_iter) + { + LLFolderViewItem* other_item = *other_item_iter; + for( parent_folder = other_item->getParentFolder(); parent_folder; parent_folder = parent_folder->getParentFolder()) + { + if (parent_folder == item) + { + // this is a descendent of the current folder, remove from list + items_to_remove.push_back(other_item); + break; + } + } + } + + // Don't allow invisible items (such as root folders) to be selected. + if (item == getRoot()) + { + items_to_remove.push_back(item); + } + } + + std::vector::iterator item_it; + for (item_it = items_to_remove.begin(); item_it != items_to_remove.end(); ++item_it ) + { + changeSelection(*item_it, FALSE); // toggle selection (also removes from list) + } + + // if nothing selected after prior constraints... + if (mSelectedItems.empty()) + { + // ...select first available parent of original selection + LLFolderViewItem* new_selection = NULL; + if (original_selected_item) + { + for(LLFolderViewFolder* parent_folder = original_selected_item->getParentFolder(); + parent_folder; + parent_folder = parent_folder->getParentFolder()) + { + if (parent_folder->getViewModelItem()->potentiallyVisible()) + { + // give initial selection to first ancestor folder that potentially passes the filter + if (!new_selection) + { + new_selection = parent_folder; + } + + // if any ancestor folder of original item is closed, move the selection up + // to the highest closed + if (!parent_folder->isOpen()) + { + new_selection = parent_folder; + } + } + } + } + else + { + new_selection = NULL; + } + + if (new_selection) + { + setSelection(new_selection, FALSE, FALSE); + } + } +} + +void LLFolderView::clearSelection() +{ + for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); + item_it != mSelectedItems.end(); + ++item_it) + { + (*item_it)->setUnselected(); + } + + mSelectedItems.clear(); +} + +std::set LLFolderView::getSelectionList() const +{ + std::set selection; + std::copy(mSelectedItems.begin(), mSelectedItems.end(), std::inserter(selection, selection.begin())); + return selection; +} + +bool LLFolderView::startDrag() +{ + std::vector selected_items; + selected_items_t::iterator item_it; + + if (!mSelectedItems.empty()) + { + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + selected_items.push_back((*item_it)->getViewModelItem()); + } + + return getFolderViewModel()->startDrag(selected_items); + } + return false; +} + +void LLFolderView::commitRename( const LLSD& data ) +{ + finishRenamingItem(); +} + +void LLFolderView::draw() +{ + //LLFontGL* font = getLabelFontForStyle(mLabelStyle); + + // if cursor has moved off of me during drag and drop + // close all auto opened folders + if (!mDragAndDropThisFrame) + { + closeAutoOpenedFolders(); + } + + if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size()) + { + mSearchString.clear(); + } + + if (hasVisibleChildren()) + { + mStatusTextBox->setVisible( FALSE ); + } + else if (mShowEmptyMessage) + { + mStatusTextBox->setValue(getFolderViewModel()->getStatusText()); + mStatusTextBox->setVisible( TRUE ); + + // firstly reshape message textbox with current size. This is necessary to + // LLTextBox::getTextPixelHeight works properly + const LLRect local_rect = getLocalRect(); + mStatusTextBox->setShape(local_rect); + + // get preferable text height... + S32 pixel_height = mStatusTextBox->getTextPixelHeight(); + bool height_changed = local_rect.getHeight() != pixel_height; + if (height_changed) + { + // ... if it does not match current height, lets rearrange current view. + // This will indirectly call ::arrange and reshape of the status textbox. + // We should call this method to also notify parent about required rect. + // See EXT-7564, EXT-7047. + S32 height = 0; + S32 width = 0; + S32 total_height = arrange( &width, &height ); + notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); + + LLUI::popMatrix(); + LLUI::pushMatrix(); + LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom); + } + } + + // skip over LLFolderViewFolder::draw since we don't want the folder icon, label, + // and arrow for the root folder + LLView::draw(); + + mDragAndDropThisFrame = FALSE; +} + +void LLFolderView::finishRenamingItem( void ) +{ + if(!mRenamer) + { + return; + } + if( mRenameItem ) + { + mRenameItem->rename( mRenamer->getText() ); + } + + closeRenamer(); + + // List is re-sorted alphabetically, so scroll to make sure the selected item is visible. + scrollToShowSelection(); +} + +void LLFolderView::closeRenamer( void ) +{ + if (mRenamer && mRenamer->getVisible()) + { + // Triggers onRenamerLost() that actually closes the renamer. + LLUI::removePopup(mRenamer); + } +} + +bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector& selectedItems) +{ + LLFolderViewItem* item_parent = dynamic_cast(item->getParent()); + + if (item_parent) + { + for(std::vector::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it) + { + const LLFolderViewItem* const selected_item = (*it); + + LLFolderViewItem* parent = item_parent; + + while (parent) + { + if (selected_item == parent) + { + return true; + } + + parent = dynamic_cast(parent->getParent()); + } + } + } + + return false; +} + +void LLFolderView::removeSelectedItems() +{ + if(getVisible() && getEnabled()) + { + // just in case we're removing the renaming item. + mRenameItem = NULL; + + // create a temporary structure which we will use to remove + // items, since the removal will futz with internal data + // structures. + std::vector items; + S32 count = mSelectedItems.size(); + if(count == 0) return; + LLFolderViewItem* item = NULL; + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + item = *item_it; + if (item && item->isRemovable()) + { + items.push_back(item); + } + else + { + llinfos << "Cannot delete " << item->getName() << llendl; + return; + } + } + + // iterate through the new container. + count = items.size(); + LLUUID new_selection_id; + if(count == 1) + { + LLFolderViewItem* item_to_delete = items[0]; + LLFolderViewFolder* parent = item_to_delete->getParentFolder(); + LLFolderViewItem* new_selection = item_to_delete->getNextOpenNode(FALSE); + if (!new_selection) + { + new_selection = item_to_delete->getPreviousOpenNode(FALSE); + } + if(parent) + { + if (item_to_delete->remove()) + { + // change selection on successful delete + if (new_selection) + { + getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); + } + else + { + getRoot()->setSelection(NULL, mParentPanel->hasFocus()); + } + } + } + arrangeAll(); + } + else if (count > 1) + { + LLDynamicArray listeners; + LLFolderViewModelItem* listener; + LLFolderViewItem* last_item = items[count - 1]; + LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); + while(new_selection && new_selection->isSelected()) + { + new_selection = new_selection->getNextOpenNode(FALSE); + } + if (!new_selection) + { + new_selection = last_item->getPreviousOpenNode(FALSE); + while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items))) + { + new_selection = new_selection->getPreviousOpenNode(FALSE); + } + } + if (new_selection) + { + getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); + } + else + { + getRoot()->setSelection(NULL, mParentPanel->hasFocus()); + } + + for(S32 i = 0; i < count; ++i) + { + listener = items[i]->getViewModelItem(); + if(listener && (listeners.find(listener) == LLDynamicArray::FAIL)) + { + listeners.put(listener); + } + } + listener = static_cast(listeners.get(0)); + if(listener) + { + listener->removeBatch(listeners); + } + } + arrangeAll(); + scrollToShowSelection(); + } +} + +// TODO RN: abstract +// open the selected item. +void LLFolderView::openSelectedItems( void ) +{ + //TODO RN: get working again + //if(getVisible() && getEnabled()) + //{ + // if (mSelectedItems.size() == 1) + // { + // mSelectedItems.front()->openItem(); + // } + // else + // { + // LLMultiPreview* multi_previewp = new LLMultiPreview(); + // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + + // selected_items_t::iterator item_it; + // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + // { + // // IT_{OBJECT,ATTACHMENT} creates LLProperties + // // floaters; others create LLPreviews. Put + // // each one in the right type of container. + // LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); + // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); + // if (is_prop) + // LLFloater::setFloaterHost(multi_propertiesp); + // else + // LLFloater::setFloaterHost(multi_previewp); + // listener->openItem(); + // } + + // LLFloater::setFloaterHost(NULL); + // // *NOTE: LLMulti* will safely auto-delete when open'd + // // without any children. + // multi_previewp->openFloater(LLSD()); + // multi_propertiesp->openFloater(LLSD()); + // } + //} +} + +void LLFolderView::propertiesSelectedItems( void ) +{ + //TODO RN: get working again + //if(getVisible() && getEnabled()) + //{ + // if (mSelectedItems.size() == 1) + // { + // LLFolderViewItem* folder_item = mSelectedItems.front(); + // if(!folder_item) return; + // folder_item->getViewModelItem()->showProperties(); + // } + // else + // { + // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); + + // LLFloater::setFloaterHost(multi_propertiesp); + + // selected_items_t::iterator item_it; + // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + // { + // (*item_it)->getViewModelItem()->showProperties(); + // } + + // LLFloater::setFloaterHost(NULL); + // multi_propertiesp->openFloater(LLSD()); + // } + //} +} + + +void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) +{ + if ((mAutoOpenItems.check() == item) || + (mAutoOpenItems.getDepth() >= (U32)AUTO_OPEN_STACK_DEPTH) || + item->isOpen()) + { + return; + } + + // close auto-opened folders + LLFolderViewFolder* close_item = mAutoOpenItems.check(); + while (close_item && close_item != item->getParentFolder()) + { + mAutoOpenItems.pop(); + close_item->setOpenArrangeRecursively(FALSE); + close_item = mAutoOpenItems.check(); + } + + item->requestArrange(); + + mAutoOpenItems.push(item); + + item->setOpen(TRUE); + LLRect content_rect = mScrollContainer->getContentWindowRect(); + LLRect constraint_rect(0,content_rect.getHeight(), content_rect.getWidth(), 0); + scrollToShowItem(item, constraint_rect); +} + +void LLFolderView::closeAutoOpenedFolders() +{ + while (mAutoOpenItems.check()) + { + LLFolderViewFolder* close_item = mAutoOpenItems.pop(); + close_item->setOpen(FALSE); + } + + if (mAutoOpenCandidate) + { + mAutoOpenCandidate->setAutoOpenCountdown(0.f); + } + mAutoOpenCandidate = NULL; + mAutoOpenTimer.stop(); +} + +BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) +{ + if (folder && mAutoOpenCandidate == folder) + { + if (mAutoOpenTimer.getStarted()) + { + if (!mAutoOpenCandidate->isOpen()) + { + mAutoOpenCandidate->setAutoOpenCountdown(clamp_rescale(mAutoOpenTimer.getElapsedTimeF32(), 0.f, sAutoOpenTime, 0.f, 1.f)); + } + if (mAutoOpenTimer.getElapsedTimeF32() > sAutoOpenTime) + { + autoOpenItem(folder); + mAutoOpenTimer.stop(); + return TRUE; + } + } + return FALSE; + } + + // otherwise new candidate, restart timer + if (mAutoOpenCandidate) + { + mAutoOpenCandidate->setAutoOpenCountdown(0.f); + } + mAutoOpenCandidate = folder; + mAutoOpenTimer.start(); + return FALSE; +} + +BOOL LLFolderView::canCopy() const +{ + if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) + { + return FALSE; + } + + for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) + { + const LLFolderViewItem* item = *selected_it; + if (!item->getViewModelItem()->isItemCopyable()) + { + return FALSE; + } + } + return TRUE; +} + +// copy selected item +void LLFolderView::copy() +{ + // *NOTE: total hack to clear the inventory clipboard + LLClipboard::instance().reset(); + S32 count = mSelectedItems.size(); + if(getVisible() && getEnabled() && (count > 0)) + { + LLFolderViewModelItem* listener = NULL; + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + listener = (*item_it)->getViewModelItem(); + if(listener) + { + listener->copyToClipboard(); + } + } + } + mSearchString.clear(); +} + +BOOL LLFolderView::canCut() const +{ + if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) + { + return FALSE; + } + + for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) + { + const LLFolderViewItem* item = *selected_it; + const LLFolderViewModelItem* listener = item->getViewModelItem(); + + if (!listener || !listener->isItemRemovable()) + { + return FALSE; + } + } + return TRUE; +} + +void LLFolderView::cut() +{ + // clear the inventory clipboard + LLClipboard::instance().reset(); + S32 count = mSelectedItems.size(); + if(getVisible() && getEnabled() && (count > 0)) + { + LLFolderViewModelItem* listener = NULL; + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + listener = (*item_it)->getViewModelItem(); + if(listener) + { + listener->cutToClipboard(); + listener->removeItem(); + } + } + } + mSearchString.clear(); +} + +BOOL LLFolderView::canPaste() const +{ + if (mSelectedItems.empty()) + { + return FALSE; + } + + if(getVisible() && getEnabled()) + { + for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); + item_it != mSelectedItems.end(); ++item_it) + { + // *TODO: only check folders and parent folders of items + const LLFolderViewItem* item = (*item_it); + const LLFolderViewModelItem* listener = item->getViewModelItem(); + if(!listener || !listener->isClipboardPasteable()) + { + const LLFolderViewFolder* folderp = item->getParentFolder(); + listener = folderp->getViewModelItem(); + if (!listener || !listener->isClipboardPasteable()) + { + return FALSE; + } + } + } + return TRUE; + } + return FALSE; +} + +// paste selected item +void LLFolderView::paste() +{ + if(getVisible() && getEnabled()) + { + // find set of unique folders to paste into + std::set folder_set; + + selected_items_t::iterator selected_it; + for (selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) + { + LLFolderViewItem* item = *selected_it; + LLFolderViewFolder* folder = dynamic_cast(item); + if (folder == NULL) + { + item = item->getParentFolder(); + } + folder_set.insert(folder); + } + + std::set::iterator set_iter; + for(set_iter = folder_set.begin(); set_iter != folder_set.end(); ++set_iter) + { + LLFolderViewModelItem* listener = (*set_iter)->getViewModelItem(); + if(listener && listener->isClipboardPasteable()) + { + listener->pasteFromClipboard(); + } + } + } + mSearchString.clear(); +} + +// public rename functionality - can only start the process +void LLFolderView::startRenamingSelectedItem( void ) +{ + // make sure selection is visible + scrollToShowSelection(); + + S32 count = mSelectedItems.size(); + LLFolderViewItem* item = NULL; + if(count > 0) + { + item = mSelectedItems.front(); + } + if(getVisible() && getEnabled() && (count == 1) && item && item->getViewModelItem() && + item->getViewModelItem()->isItemRenameable()) + { + mRenameItem = item; + + updateRenamerPosition(); + + + mRenamer->setText(item->getName()); + mRenamer->selectAll(); + mRenamer->setVisible( TRUE ); + // set focus will fail unless item is visible + mRenamer->setFocus( TRUE ); + mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this)); + LLUI::addPopup(mRenamer); + } +} + +BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + + // SL-51858: Key presses are not being passed to the Popup menu. + // A proper fix is non-trivial so instead just close the menu. + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + if (menu && menu->isOpen()) + { + LLMenuGL::sMenuContainer->hideMenus(); + } + + LLView *item = NULL; + if (getChildCount() > 0) + { + item = *(getChildList()->begin()); + } + + switch( key ) + { + case KEY_F2: + mSearchString.clear(); + startRenamingSelectedItem(); + handled = TRUE; + break; + + case KEY_RETURN: + if (mask == MASK_NONE) + { + if( mRenameItem && mRenamer->getVisible() ) + { + finishRenamingItem(); + mSearchString.clear(); + handled = TRUE; + } + else + { + LLFolderView::openSelectedItems(); + handled = TRUE; + } + } + break; + + case KEY_ESCAPE: + if( mRenameItem && mRenamer->getVisible() ) + { + closeRenamer(); + handled = TRUE; + } + mSearchString.clear(); + break; + + case KEY_PAGE_UP: + mSearchString.clear(); + mScrollContainer->pageUp(30); + handled = TRUE; + break; + + case KEY_PAGE_DOWN: + mSearchString.clear(); + mScrollContainer->pageDown(30); + handled = TRUE; + break; + + case KEY_HOME: + mSearchString.clear(); + mScrollContainer->goToTop(); + handled = TRUE; + break; + + case KEY_END: + mSearchString.clear(); + mScrollContainer->goToBottom(); + break; + + case KEY_DOWN: + if((mSelectedItems.size() > 0) && mScrollContainer) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); + + if (!mKeyboardSelection) + { + setSelection(last_selected, FALSE, TRUE); + mKeyboardSelection = TRUE; + } + + LLFolderViewItem* next = NULL; + if (mask & MASK_SHIFT) + { + // don't shift select down to children of folders (they are implicitly selected through parent) + next = last_selected->getNextOpenNode(FALSE); + if (next) + { + if (next->isSelected()) + { + // shrink selection + getRoot()->changeSelection(last_selected, FALSE); + } + else if (last_selected->getParentFolder() == next->getParentFolder()) + { + // grow selection + getRoot()->changeSelection(next, TRUE); + } + } + } + else + { + next = last_selected->getNextOpenNode(); + if( next ) + { + if (next == last_selected) + { + //special case for LLAccordionCtrl + if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } + return FALSE; + } + setSelection( next, FALSE, TRUE ); + } + else + { + //special case for LLAccordionCtrl + if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } + return FALSE; + } + } + scrollToShowSelection(); + mSearchString.clear(); + handled = TRUE; + } + break; + + case KEY_UP: + if((mSelectedItems.size() > 0) && mScrollContainer) + { + LLFolderViewItem* last_selected = mSelectedItems.back(); + + if (!mKeyboardSelection) + { + setSelection(last_selected, FALSE, TRUE); + mKeyboardSelection = TRUE; + } + + LLFolderViewItem* prev = NULL; + if (mask & MASK_SHIFT) + { + // don't shift select down to children of folders (they are implicitly selected through parent) + prev = last_selected->getPreviousOpenNode(FALSE); + if (prev) + { + if (prev->isSelected()) + { + // shrink selection + getRoot()->changeSelection(last_selected, FALSE); + } + else if (last_selected->getParentFolder() == prev->getParentFolder()) + { + // grow selection + getRoot()->changeSelection(prev, TRUE); + } + } + } + else + { + prev = last_selected->getPreviousOpenNode(); + if( prev ) + { + if (prev == this) + { + // If case we are in accordion tab notify parent to go to the previous accordion + if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed + { + clearSelection(); + return TRUE; + } + + return FALSE; + } + setSelection( prev, FALSE, TRUE ); + } + } + scrollToShowSelection(); + mSearchString.clear(); + + handled = TRUE; + } + break; + + case KEY_RIGHT: + if(mSelectedItems.size()) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); + last_selected->setOpen( TRUE ); + mSearchString.clear(); + handled = TRUE; + } + break; + + case KEY_LEFT: + if(mSelectedItems.size()) + { + LLFolderViewItem* last_selected = getCurSelectedItem(); + LLFolderViewItem* parent_folder = last_selected->getParentFolder(); + if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) + { + setSelection(parent_folder, FALSE, TRUE); + } + else + { + last_selected->setOpen( FALSE ); + } + mSearchString.clear(); + scrollToShowSelection(); + handled = TRUE; + } + break; + } + + if (!handled && mParentPanel->hasFocus()) + { + if (key == KEY_BACKSPACE) + { + mSearchTimer.reset(); + if (mSearchString.size()) + { + mSearchString.erase(mSearchString.size() - 1, 1); + } + search(getCurSelectedItem(), mSearchString, FALSE); + handled = TRUE; + } + } + + return handled; +} + + +BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) +{ + if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL + { + return FALSE; + } + + if (uni_char > 0x7f) + { + llwarns << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << llendl; + return FALSE; + } + + BOOL handled = FALSE; + if (mParentPanel->hasFocus()) + { + // SL-51858: Key presses are not being passed to the Popup menu. + // A proper fix is non-trivial so instead just close the menu. + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + if (menu && menu->isOpen()) + { + LLMenuGL::sMenuContainer->hideMenus(); + } + + //do text search + if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout")) + { + mSearchString.clear(); + } + mSearchTimer.reset(); + if (mSearchString.size() < 128) + { + mSearchString += uni_char; + } + search(getCurSelectedItem(), mSearchString, FALSE); + + handled = TRUE; + } + + return handled; +} + + +BOOL LLFolderView::canDoDelete() const +{ + if (mSelectedItems.size() == 0) return FALSE; + + for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + if (!(*item_it)->getViewModelItem()->isItemRemovable()) + { + return FALSE; + } + } + return TRUE; +} + +void LLFolderView::doDelete() +{ + if(mSelectedItems.size() > 0) + { + removeSelectedItems(); + } +} + + +BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) +{ + mKeyboardSelection = FALSE; + mSearchString.clear(); + + mParentPanel->setFocus(TRUE); + + LLEditMenuHandler::gEditMenuHandler = this; + + return LLView::handleMouseDown( x, y, mask ); +} + +BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) +{ + // get first selected item + LLFolderViewItem* search_item = first_item; + + // make sure search string is upper case + std::string upper_case_string = search_string; + LLStringUtil::toUpper(upper_case_string); + + // if nothing selected, select first item in folder + if (!search_item) + { + // start from first item + search_item = getNextFromChild(NULL); + } + + // search over all open nodes for first substring match (with wrapping) + BOOL found = FALSE; + LLFolderViewItem* original_search_item = search_item; + do + { + // wrap at end + if (!search_item) + { + if (backward) + { + search_item = getPreviousFromChild(NULL); + } + else + { + search_item = getNextFromChild(NULL); + } + if (!search_item || search_item == original_search_item) + { + break; + } + } + + const std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); + S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); + if (!current_item_label.compare(0, search_string_length, upper_case_string)) + { + found = TRUE; + break; + } + if (backward) + { + search_item = search_item->getPreviousOpenNode(); + } + else + { + search_item = search_item->getNextOpenNode(); + } + + } while(search_item != original_search_item); + + + if (found) + { + setSelection(search_item, FALSE, TRUE); + scrollToShowSelection(); + } + + return found; +} + +BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) +{ + // skip LLFolderViewFolder::handleDoubleClick() + return LLView::handleDoubleClick( x, y, mask ); +} + +BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) +{ + // all user operations move keyboard focus to inventory + // this way, we know when to stop auto-updating a search + mParentPanel->setFocus(TRUE); + + BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; + S32 count = mSelectedItems.size(); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + if ( handled + && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible + && menu ) + { + if (mCallbackRegistrar) + mCallbackRegistrar->pushScope(); + + updateMenuOptions(menu); + + menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, menu, x, y); + if (mCallbackRegistrar) + mCallbackRegistrar->popScope(); + } + else + { + if (menu && menu->getVisible()) + { + menu->setVisible(FALSE); + } + setSelection(NULL, FALSE, TRUE); + } + return handled; +} + +// Add "--no options--" if the menu is completely blank. +BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const +{ + const std::string nooptions_str = "--no options--"; + LLView *nooptions_item = NULL; + + const LLView::child_list_t *list = menu->getChildList(); + for (LLView::child_list_t::const_iterator itor = list->begin(); + itor != list->end(); + ++itor) + { + LLView *menu_item = (*itor); + if (menu_item->getVisible()) + { + return FALSE; + } + std::string name = menu_item->getName(); + if (menu_item->getName() == nooptions_str) + { + nooptions_item = menu_item; + } + } + if (nooptions_item) + { + nooptions_item->setVisible(TRUE); + nooptions_item->setEnabled(FALSE); + return TRUE; + } + return FALSE; +} + +BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask ) +{ + return LLView::handleHover( x, y, mask ); +} + +BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + mDragAndDropThisFrame = TRUE; + // have children handle it first + BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, + accept, tooltip_msg); + + // when drop is not handled by child, it should be handled + // by the folder which is the hierarchy root. + if (!handled) + { + handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + + return handled; +} + +void LLFolderView::deleteAllChildren() +{ + closeRenamer(); + if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); + mPopupMenuHandle = LLHandle(); + mScrollContainer = NULL; + mRenameItem = NULL; + mRenamer = NULL; + mStatusTextBox = NULL; + + clearSelection(); + LLView::deleteAllChildren(); +} + +void LLFolderView::scrollToShowSelection() +{ + if ( mSelectedItems.size() ) + { + mNeedsScroll = TRUE; + } +} + +// If the parent is scroll container, scroll it to make the selection +// is maximally visible. +void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect) +{ + if (!mScrollContainer) return; + + // don't scroll to items when mouse is being used to scroll/drag and drop + if (gFocusMgr.childHasMouseCapture(mScrollContainer)) + { + mNeedsScroll = FALSE; + return; + } + + // if item exists and is in visible portion of parent folder... + if(item) + { + LLRect local_rect = item->getLocalRect(); + LLRect item_scrolled_rect; // item position relative to display area of scroller + LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect(); + + S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); + S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight(); + // when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder + S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); + + // get portion of item that we want to see... + LLRect item_local_rect = LLRect(item->getIndentation(), + local_rect.getHeight(), + llmin(MIN_ITEM_WIDTH_VISIBLE, local_rect.getWidth()), + llmax(0, local_rect.getHeight() - max_height_to_show)); + + LLRect item_doc_rect; + + item->localRectToOtherView(item_local_rect, &item_doc_rect, this); + + mScrollContainer->scrollToShowRect( item_doc_rect, constraint_rect ); + + } +} + +LLRect LLFolderView::getVisibleRect() +{ + S32 visible_height = mScrollContainer->getRect().getHeight(); + S32 visible_width = mScrollContainer->getRect().getWidth(); + LLRect visible_rect; + visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height); + return visible_rect; +} + +BOOL LLFolderView::getShowSelectionContext() +{ + if (mShowSelectionContext) + { + return TRUE; + } + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + if (menu && menu->getVisible()) + { + return TRUE; + } + return FALSE; +} + +void LLFolderView::setShowSingleSelection(BOOL show) +{ + if (show != mShowSingleSelection) + { + mMultiSelectionFadeTimer.reset(); + mShowSingleSelection = show; + } +} + +static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select"); +static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); + +// Main idle routine +void LLFolderView::update() +{ + // If this is associated with the user's inventory, don't do anything + // until that inventory is loaded up. + LLFastTimer t2(FTM_INVENTORY); + + if (getFolderViewModel()->getFilter()->isModified() && getFolderViewModel()->getFilter()->isNotDefault()) + { + mNeedsAutoSelect = TRUE; + } + getFolderViewModel()->getFilter()->clearModified(); + + // filter to determine visibility before arranging + filter(*(getFolderViewModel()->getFilter())); + + // automatically show matching items, and select first one if we had a selection + if (mNeedsAutoSelect) + { + LLFastTimer t3(FTM_AUTO_SELECT); + // select new item only if a filtered item not currently selected + LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); + if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getViewModelItem()->potentiallyVisible())) + { + // these are named variables to get around gcc not binding non-const references to rvalues + // and functor application is inherently non-const to allow for stateful functors + LLSelectFirstFilteredItem functor; + applyFunctorRecursively(functor); + } + + // Open filtered folders for folder views with mAutoSelectOverride=TRUE. + // Used by LLPlacesFolderView. + if (getFolderViewModel()->getFilter()->showAllResults()) + { + // these are named variables to get around gcc not binding non-const references to rvalues + // and functor application is inherently non-const to allow for stateful functors + LLOpenFilteredFolders functor; + applyFunctorRecursively(functor); + } + + scrollToShowSelection(); + } + + BOOL filter_finished = getViewModelItem()->passedFilter() + && mViewModel->contentsReady(); + if (filter_finished + || gFocusMgr.childHasKeyboardFocus(getParent()) // assume we are inside a scroll container + || gFocusMgr.childHasMouseCapture(getParent())) + { + // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process + mNeedsAutoSelect = FALSE; + } + + + // during filtering process, try to pin selected item's location on screen + // this will happen when searching your inventory and when new items arrive + if (!filter_finished) + { + // calculate rectangle to pin item to at start of animated rearrange + if (!mPinningSelectedItem && !mSelectedItems.empty()) + { + // lets pin it! + mPinningSelectedItem = TRUE; + + LLRect visible_content_rect = mScrollContainer->getVisibleContentRect(); + LLFolderViewItem* selected_item = mSelectedItems.back(); + + LLRect item_rect; + selected_item->localRectToOtherView(selected_item->getLocalRect(), &item_rect, this); + // if item is visible in scrolled region + if (visible_content_rect.overlaps(item_rect)) + { + // then attempt to keep it in same place on screen + mScrollConstraintRect = item_rect; + mScrollConstraintRect.translate(-visible_content_rect.mLeft, -visible_content_rect.mBottom); + } + else + { + // otherwise we just want it onscreen somewhere + LLRect content_rect = mScrollContainer->getContentWindowRect(); + mScrollConstraintRect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); + } + } + } + else + { + // stop pinning selected item after folders stop rearranging + if (!needsArrange()) + { + mPinningSelectedItem = FALSE; + } + } + + LLRect constraint_rect; + if (mPinningSelectedItem) + { + // use last known constraint rect for pinned item + constraint_rect = mScrollConstraintRect; + } + else + { + // during normal use (page up/page down, etc), just try to fit item on screen + LLRect content_rect = mScrollContainer->getContentWindowRect(); + constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); + } + + BOOL is_visible = isInVisibleChain(); + + if ( is_visible ) + { + sanitizeSelection(); + if( needsArrange() ) + { + S32 height = 0; + S32 width = 0; + S32 total_height = arrange( &width, &height ); + notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); + } + } + + if (mSelectedItems.size() && mNeedsScroll) + { + scrollToShowItem(mSelectedItems.back(), constraint_rect); + // continue scrolling until animated layout change is done + if (filter_finished + && (!needsArrange() || !is_visible)) + { + mNeedsScroll = FALSE; + } + } + + if (mSignalSelectCallback) + { + //RN: we use keyboard focus as a proxy for user-explicit actions + BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); + mSelectSignal(mSelectedItems, take_keyboard_focus); + } + mSignalSelectCallback = FALSE; +} + +void LLFolderView::dumpSelectionInformation() +{ + llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; + llinfos << "****************************************" << llendl; + selected_items_t::iterator item_it; + for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) + { + llinfos << " " << (*item_it)->getName() << llendl; + } + llinfos << "****************************************" << llendl; +} + +void LLFolderView::updateRenamerPosition() +{ + if(mRenameItem) + { + // See also LLFolderViewItem::draw() + S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mRenameItem->getIndentation(); + S32 y = mRenameItem->getRect().getHeight() - mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; + mRenameItem->localPointToScreen( x, y, &x, &y ); + screenPointToLocal( x, y, &x, &y ); + mRenamer->setOrigin( x, y ); + + LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0); + if (mScrollContainer) + { + scroller_rect = mScrollContainer->getContentWindowRect(); + } + + S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); + S32 height = mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; + mRenamer->reshape( width, height, TRUE ); + } +} + +// Update visibility and availability (i.e. enabled/disabled) of context menu items. +void LLFolderView::updateMenuOptions(LLMenuGL* menu) +{ + const LLView::child_list_t *list = menu->getChildList(); + + LLView::child_list_t::const_iterator menu_itor; + for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) + { + (*menu_itor)->setVisible(FALSE); + (*menu_itor)->pushVisible(TRUE); + (*menu_itor)->setEnabled(TRUE); + } + + // Successively filter out invalid options + + U32 flags = FIRST_SELECTED_ITEM; + for (selected_items_t::iterator item_itor = mSelectedItems.begin(); + item_itor != mSelectedItems.end(); + ++item_itor) + { + LLFolderViewItem* selected_item = (*item_itor); + selected_item->buildContextMenu(*menu, flags); + flags = 0x0; + } + + addNoOptions(menu); +} + +// Refresh the context menu (that is already shown). +void LLFolderView::updateMenu() +{ + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); + if (menu && menu->getVisible()) + { + updateMenuOptions(menu); + menu->needsArrange(); // update menu height if needed + } +} + +bool LLFolderView::selectFirstItem() +{ + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();++iter) + { + LLFolderViewFolder* folder = (*iter ); + if (folder->getVisible()) + { + LLFolderViewItem* itemp = folder->getNextFromChild(0,true); + if(itemp) + setSelection(itemp,FALSE,TRUE); + return true; + } + + } + for(items_t::iterator iit = mItems.begin(); + iit != mItems.end(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + if (itemp->getVisible()) + { + setSelection(itemp,FALSE,TRUE); + return true; + } + } + return false; +} +bool LLFolderView::selectLastItem() +{ + for(items_t::reverse_iterator iit = mItems.rbegin(); + iit != mItems.rend(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + if (itemp->getVisible()) + { + setSelection(itemp,FALSE,TRUE); + return true; + } + } + for (folders_t::reverse_iterator iter = mFolders.rbegin(); + iter != mFolders.rend();++iter) + { + LLFolderViewFolder* folder = (*iter); + if (folder->getVisible()) + { + LLFolderViewItem* itemp = folder->getPreviousFromChild(0,true); + if(itemp) + setSelection(itemp,FALSE,TRUE); + return true; + } + } + return false; +} + + +S32 LLFolderView::notify(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "select_first") + { + setFocus(true); + selectFirstItem(); + scrollToShowSelection(); + return 1; + + } + else if(str_action == "select_last") + { + setFocus(true); + selectLastItem(); + scrollToShowSelection(); + return 1; + } + } + return 0; +} + + +///---------------------------------------------------------------------------- +/// Local function definitions +///---------------------------------------------------------------------------- + +void LLFolderView::onRenamerLost() +{ + if (mRenamer && mRenamer->getVisible()) + { + mRenamer->setVisible(FALSE); + + // will commit current name (which could be same as original name) + mRenamer->setFocus(FALSE); + } + + if( mRenameItem ) + { + setSelection( mRenameItem, TRUE ); + mRenameItem = NULL; + } +} + +S32 LLFolderView::getItemHeight() +{ + if(!hasVisibleChildren()) + { + //We need to display status textbox, let's reserve some place for it + return llmax(0, mStatusTextBox->getTextPixelHeight()); + } + return 0; +} diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h new file mode 100644 index 0000000000..ba37a11bbe --- /dev/null +++ b/indra/llui/llfolderview.h @@ -0,0 +1,388 @@ +/** + * @file llfolderview.h + * @brief Definition of the folder view collection of classes. + * + * $LicenseInfo:firstyear=2001&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$ + */ + +/** + * + * The folder view collection of classes provides an interface for + * making a 'folder view' similar to the way the a single pane file + * folder interface works. + * + */ + +#ifndef LL_LLFOLDERVIEW_H +#define LL_LLFOLDERVIEW_H + +#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder + +#include "lluictrl.h" +#include "v4color.h" +#include "stdenums.h" +#include "lldepthstack.h" +#include "lleditmenuhandler.h" +#include "llfontgl.h" +#include "llscrollcontainer.h" + +class LLFolderViewModelInterface; +class LLFolderViewFolder; +class LLFolderViewItem; +class LLFolderViewFilter; +class LLPanel; +class LLLineEditor; +class LLMenuGL; +class LLUICtrl; +class LLTextBox; + +/** + * Class LLFolderViewScrollContainer + * + * A scroll container which provides the information about the height + * of currently displayed folder view contents. + * Used for updating vertical scroll bar visibility in inventory panel. + * See LLScrollContainer::calcVisibleSize(). + */ +class LLFolderViewScrollContainer : public LLScrollContainer +{ +public: + /*virtual*/ ~LLFolderViewScrollContainer() {}; + /*virtual*/ const LLRect getScrolledViewRect() const; + +protected: + LLFolderViewScrollContainer(const LLScrollContainer::Params& p); + friend class LLUICtrlFactory; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFolderView +// +// The LLFolderView represents the root level folder view object. +// It manages the screen region of the folder view. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler +{ +public: + struct Params : public LLInitParam::Block + { + Mandatory parent_panel; + Optional title; + Optional use_label_suffix, + allow_multiselect, + show_empty_message, + use_ellipses, + show_item_link_overlays; + Mandatory view_model; + + Params(); + }; + + friend class LLFolderViewScrollContainer; + + LLFolderView(const Params&); + virtual ~LLFolderView( void ); + + virtual BOOL canFocusChildren() const; + + virtual const LLFolderView* getRoot() const { return this; } + virtual LLFolderView* getRoot() { return this; } + + LLFolderViewModelInterface* getFolderViewModel() { return mViewModel; } + const LLFolderViewModelInterface* getFolderViewModel() const { return mViewModel; } + + typedef boost::signals2::signal& items, BOOL user_action)> signal_t; + void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } + void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } + + bool getAllowMultiSelect() { return mAllowMultiSelect; } + + // Close all folders in the view + void closeAllFolders(); + void openTopLevelFolders(); + + virtual BOOL addFolder( LLFolderViewFolder* folder); + + // Find width and height of this object and its children. Also + // makes sure that this view and its children are the right size. + virtual S32 arrange( S32* width, S32* height ); + virtual S32 getItemHeight(); + + void arrangeAll() { mArrangeGeneration++; } + S32 getArrangeGeneration() { return mArrangeGeneration; } + + // applies filters to control visibility of items + virtual void filter( LLFolderViewFilter& filter); + + // Get the last selected item + virtual LLFolderViewItem* getCurSelectedItem( void ); + + // Record the selected item and pass it down the hierarchy. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, + BOOL take_keyboard_focus = TRUE); + + // This method is used to toggle the selection of an item. Walks + // children, and keeps track of selected objects. + virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + + virtual std::set getSelectionList() const; + S32 getNumSelectedItems() { return mSelectedItems.size(); } + + // Make sure if ancestor is selected, descendants are not + void sanitizeSelection(); + virtual void clearSelection(); + void addToSelectionList(LLFolderViewItem* item); + void removeFromSelectionList(LLFolderViewItem* item); + + bool startDrag(); + void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; } + void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; } + LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; } + + // Deletion functionality + void removeSelectedItems(); + + // Open the selected item + void openSelectedItems( void ); + void propertiesSelectedItems( void ); + + void autoOpenItem(LLFolderViewFolder* item); + void closeAutoOpenedFolders(); + BOOL autoOpenTest(LLFolderViewFolder* item); + BOOL isOpen() const { return TRUE; } // root folder always open + + // Copy & paste + virtual void copy(); + virtual BOOL canCopy() const; + + virtual void cut(); + virtual BOOL canCut() const; + + virtual void paste(); + virtual BOOL canPaste() const; + + virtual void doDelete(); + virtual BOOL canDoDelete() const; + + // Public rename functionality - can only start the process + void startRenamingSelectedItem( void ); + + // LLView functionality + ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); + /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); + /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); + /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(FALSE); } + virtual void draw(); + virtual void deleteAllChildren(); + + void scrollToShowSelection(); + void scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect); + void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; } + LLRect getVisibleRect(); + + BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); + void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; } + BOOL getShowSelectionContext(); + void setShowSingleSelection(BOOL show); + BOOL getShowSingleSelection() { return mShowSingleSelection; } + F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } + bool getUseEllipses() { return mUseEllipses; } + + void update(); // needs to be called periodically (e.g. once per frame) + + BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } + BOOL needsAutoRename() { return mNeedsAutoRename; } + void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } + void setPinningSelectedItem(BOOL val) { mPinningSelectedItem = val; } + void setAutoSelectOverride(BOOL val) { mAutoSelectOverride = val; } + + bool showItemLinkOverlays() { return mShowItemLinkOverlays; } + + void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } + + LLPanel* getParentPanel() { return mParentPanel; } + // DEBUG only + void dumpSelectionInformation(); + + virtual S32 notify(const LLSD& info) ; + + bool useLabelSuffix() { return mUseLabelSuffix; } + void updateMenu(); + +private: + void updateMenuOptions(LLMenuGL* menu); + void updateRenamerPosition(); + +protected: + LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. + + void commitRename( const LLSD& data ); + void onRenamerLost(); + + void finishRenamingItem( void ); + void closeRenamer( void ); + + bool selectFirstItem(); + bool selectLastItem(); + + BOOL addNoOptions(LLMenuGL* menu) const; + + +protected: + LLHandle mPopupMenuHandle; + + typedef std::deque selected_items_t; + selected_items_t mSelectedItems; + BOOL mKeyboardSelection; + BOOL mAllowMultiSelect; + BOOL mShowEmptyMessage; + BOOL mShowFolderHierarchy; + + // Renaming variables and methods + LLFolderViewItem* mRenameItem; // The item currently being renamed + LLLineEditor* mRenamer; + + BOOL mNeedsScroll; + BOOL mPinningSelectedItem; + LLRect mScrollConstraintRect; + BOOL mNeedsAutoSelect; + BOOL mAutoSelectOverride; + BOOL mNeedsAutoRename; + bool mUseLabelSuffix; + bool mShowItemLinkOverlays; + + LLDepthStack mAutoOpenItems; + LLFolderViewFolder* mAutoOpenCandidate; + LLFrameTimer mAutoOpenTimer; + LLFrameTimer mSearchTimer; + std::string mSearchString; + BOOL mShowSelectionContext; + BOOL mShowSingleSelection; + LLFrameTimer mMultiSelectionFadeTimer; + S32 mArrangeGeneration; + + signal_t mSelectSignal; + signal_t mReshapeSignal; + S32 mSignalSelectCallback; + S32 mMinWidth; + BOOL mDragAndDropThisFrame; + + LLPanel* mParentPanel; + + LLFolderViewModelInterface* mViewModel; + + /** + * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll. + * NOTE: For now it's used only to cut LLFolderViewItem::mLabel text for Landmarks in Places Panel. + */ + bool mUseEllipses; // See EXT-719 + + /** + * Contains item under mouse pointer while dragging + */ + LLFolderViewItem* mDraggingOverItem; // See EXT-719 + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* mCallbackRegistrar; + +public: + static F32 sAutoOpenTime; + LLTextBox* mStatusTextBox; + +}; + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFolderViewFunctor +// +// Simple abstract base class for applying a functor to folders and +// items in a folder view hierarchy. This is suboptimal for algorithms +// that only work folders or only work on items, but I'll worry about +// that later when it's determined to be too slow. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLFolderViewFunctor +{ +public: + virtual ~LLFolderViewFunctor() {} + virtual void doFolder(LLFolderViewFolder* folder) = 0; + virtual void doItem(LLFolderViewItem* item) = 0; +}; + +class LLSelectFirstFilteredItem : public LLFolderViewFunctor +{ +public: + LLSelectFirstFilteredItem() : mItemSelected(FALSE) {} + virtual ~LLSelectFirstFilteredItem() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item); + BOOL wasItemSelected() { return mItemSelected; } +protected: + BOOL mItemSelected; +}; + +class LLOpenFilteredFolders : public LLFolderViewFunctor +{ +public: + LLOpenFilteredFolders() {} + virtual ~LLOpenFilteredFolders() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item); +}; + +class LLSaveFolderState : public LLFolderViewFunctor +{ +public: + LLSaveFolderState() : mApply(FALSE) {} + virtual ~LLSaveFolderState() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item) {} + void setApply(BOOL apply); + void clearOpenFolders() { mOpenFolders.clear(); } +protected: + std::set mOpenFolders; + BOOL mApply; +}; + +class LLOpenFoldersWithSelection : public LLFolderViewFunctor +{ +public: + LLOpenFoldersWithSelection() {} + virtual ~LLOpenFoldersWithSelection() {} + virtual void doFolder(LLFolderViewFolder* folder); + virtual void doItem(LLFolderViewItem* item); +}; + +// Flags for buildContextMenu() +const U32 SUPPRESS_OPEN_ITEM = 0x1; +const U32 FIRST_SELECTED_ITEM = 0x2; + +#endif // LL_LLFOLDERVIEW_H diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp new file mode 100644 index 0000000000..741fc9c324 --- /dev/null +++ b/indra/llui/llfolderviewitem.cpp @@ -0,0 +1,2032 @@ +/** +* @file llfolderviewitem.cpp +* @brief Items and folders that can appear in a hierarchical folder view +* +* $LicenseInfo:firstyear=2001&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 "linden_common.h" +#include "llfolderviewitem.h" + +#include "llfolderview.h" +#include "llfolderviewmodel.h" +#include "llpanel.h" +#include "llcriticaldamp.h" +#include "llclipboard.h" +#include "llfocusmgr.h" // gFocusMgr +#include "lltrans.h" +#include "llwindow.h" + +///---------------------------------------------------------------------------- +/// Class LLFolderViewItem +///---------------------------------------------------------------------------- + +static LLDefaultChildRegistry::Register r("folder_view_item"); + +// statics +std::map LLFolderViewItem::sFonts; // map of styles to fonts + +// only integers can be initialized in header +const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f; +const F32 LLFolderViewItem::FOLDER_OPEN_TIME_CONSTANT = 0.03f; + +const LLColor4U DEFAULT_WHITE(255, 255, 255); + + +//static +LLFontGL* LLFolderViewItem::getLabelFontForStyle(U8 style) +{ + LLFontGL* rtn = sFonts[style]; + if (!rtn) // grab label font with this style, lazily + { + LLFontDescriptor labelfontdesc("SansSerif", "Small", style); + rtn = LLFontGL::getFont(labelfontdesc); + if (!rtn) + { + rtn = LLFontGL::getFontDefault(); + } + sFonts[style] = rtn; + } + return rtn; +} + +//static +void LLFolderViewItem::initClass() +{ +} + +//static +void LLFolderViewItem::cleanupClass() +{ + sFonts.clear(); +} + + +// NOTE: Optimize this, we call it a *lot* when opening a large inventory +LLFolderViewItem::Params::Params() +: root(), + listener(), + folder_arrow_image("folder_arrow_image"), + folder_indentation("folder_indentation"), + selection_image("selection_image"), + item_height("item_height"), + item_top_pad("item_top_pad"), + creation_date() +{} + +// Default constructor +LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) +: LLView(p), + mLabelWidth(0), + mLabelWidthDirty(false), + mParentFolder( NULL ), + mIsSelected( FALSE ), + mIsCurSelection( FALSE ), + mSelectPending(FALSE), + mLabelStyle( LLFontGL::NORMAL ), + mHasVisibleChildren(FALSE), + mIndentation(0), + mItemHeight(p.item_height), + //TODO RN: create interface for string highlighting + //mStringMatchOffset(std::string::npos), + mControlLabelRotation(0.f), + mDragAndDropTarget(FALSE), + mLabel(p.name), + mRoot(p.root), + mViewModelItem(p.listener), + mIsMouseOverTitle(false) +{ + if (mViewModelItem) + { + mViewModelItem->setFolderViewItem(this); + } +} + +BOOL LLFolderViewItem::postBuild() +{ + refresh(); + return TRUE; +} + +// Destroys the object +LLFolderViewItem::~LLFolderViewItem( void ) +{ + delete mViewModelItem; + mViewModelItem = NULL; +} + +LLFolderView* LLFolderViewItem::getRoot() +{ + return mRoot; +} + +const LLFolderView* LLFolderViewItem::getRoot() const +{ + return mRoot; +} +// Returns true if this object is a child (or grandchild, etc.) of potential_ancestor. +BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) +{ + LLFolderViewItem* root = this; + while( root->mParentFolder ) + { + if( root->mParentFolder == potential_ancestor ) + { + return TRUE; + } + root = root->mParentFolder; + } + return FALSE; +} + +LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) +{ + if (!mParentFolder) + { + return NULL; + } + + LLFolderViewItem* itemp = mParentFolder->getNextFromChild( this, include_children ); + while(itemp && !itemp->getVisible()) + { + LLFolderViewItem* next_itemp = itemp->mParentFolder->getNextFromChild( itemp, include_children ); + if (itemp == next_itemp) + { + // hit last item + return itemp->getVisible() ? itemp : this; + } + itemp = next_itemp; + } + + return itemp; +} + +LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) +{ + if (!mParentFolder) + { + return NULL; + } + + LLFolderViewItem* itemp = mParentFolder->getPreviousFromChild( this, include_children ); + + // Skip over items that are invisible or are hidden from the UI. + while(itemp && !itemp->getVisible()) + { + LLFolderViewItem* next_itemp = itemp->mParentFolder->getPreviousFromChild( itemp, include_children ); + if (itemp == next_itemp) + { + // hit first item + return itemp->getVisible() ? itemp : this; + } + itemp = next_itemp; + } + + return itemp; +} + +BOOL LLFolderViewItem::passedFilter(S32 filter_generation) +{ + return getViewModelItem()->passedFilter(filter_generation); +} + +void LLFolderViewItem::refresh() +{ + LLFolderViewModelItem& vmi = *getViewModelItem(); + + mLabel = vmi.getDisplayName(); + + setToolTip(mLabel); + mIcon = vmi.getIcon(); + mIconOpen = vmi.getIconOpen(); + mIconOverlay = vmi.getIconOverlay(); + + if (mRoot->useLabelSuffix()) + { + mLabelStyle = vmi.getLabelStyle(); + mLabelSuffix = vmi.getLabelSuffix(); + } + + //TODO RN: make sure this logic still fires + //std::string searchable_label(mLabel); + //searchable_label.append(mLabelSuffix); + //LLStringUtil::toUpper(searchable_label); + + //if (mSearchableLabel.compare(searchable_label)) + //{ + // mSearchableLabel.assign(searchable_label); + // vmi.dirtyFilter(); + // // some part of label has changed, so overall width has potentially changed, and sort order too + // if (mParentFolder) + // { + // mParentFolder->requestSort(); + // mParentFolder->requestArrange(); + // } + //} + + mLabelWidthDirty = true; + vmi.dirtyFilter(); +} + +// Utility function for LLFolderView +void LLFolderViewItem::arrangeAndSet(BOOL set_selection, + BOOL take_keyboard_focus) +{ + LLFolderView* root = getRoot(); + if (getParentFolder()) + { + getParentFolder()->requestArrange(); + } + if(set_selection) + { + getRoot()->setSelection(this, TRUE, take_keyboard_focus); + if(root) + { + root->scrollToShowSelection(); + } + } +} + + +std::set LLFolderViewItem::getSelectionList() const +{ + std::set selection; + return selection; +} + +// addToFolder() returns TRUE if it succeeds. FALSE otherwise +BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder) +{ + return folder->addItem(this); +} + + +// Finds width and height of this object and its children. Also +// makes sure that this view and its children are the right size. +S32 LLFolderViewItem::arrange( S32* width, S32* height ) +{ + const Params& p = LLUICtrlFactory::getDefaultParams(); + S32 indentation = p.folder_indentation(); + // Only indent deeper items in hierarchy + mIndentation = (getParentFolder()) + ? getParentFolder()->getIndentation() + indentation + : 0; + if (mLabelWidthDirty) + { + mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT; + mLabelWidthDirty = false; + } + + *width = llmax(*width, mLabelWidth + mIndentation); + + // determine if we need to use ellipses to avoid horizontal scroll. EXT-719 + bool use_ellipses = getRoot()->getUseEllipses(); + if (use_ellipses) + { + // limit to set rect to avoid horizontal scrollbar + *width = llmin(*width, getRoot()->getRect().getWidth()); + } + *height = getItemHeight(); + return *height; +} + +S32 LLFolderViewItem::getItemHeight() +{ + return mItemHeight; +} + +// *TODO: This can be optimized a lot by simply recording that it is +// selected in the appropriate places, and assuming that set selection +// means 'deselect' for a leaf item. Do this optimization after +// multiple selection is implemented to make sure it all plays nice +// together. +BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) +{ + if (selection == this && !mIsSelected) + { + selectItem(); + } + else if (mIsSelected) // Deselect everything else. + { + deselectItem(); + } + return mIsSelected; +} + +BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) +{ + if (selection == this) + { + if (mIsSelected) + { + deselectItem(); + } + else + { + selectItem(); + } + return TRUE; + } + return FALSE; +} + +void LLFolderViewItem::deselectItem(void) +{ + mIsSelected = FALSE; +} + +void LLFolderViewItem::selectItem(void) +{ + if (mIsSelected == FALSE) + { + getViewModelItem()->selectItem(); + mIsSelected = TRUE; + } +} + +BOOL LLFolderViewItem::isMovable() +{ + return getViewModelItem()->isItemMovable(); +} + +BOOL LLFolderViewItem::isRemovable() +{ + return getViewModelItem()->isItemRemovable(); +} + +void LLFolderViewItem::destroyView() +{ + getRoot()->removeFromSelectionList(this); + + if (mParentFolder) + { + // removeView deletes me + mParentFolder->extractItem(this); + } + delete this; +} + +// Call through to the viewed object and return true if it can be +// removed. +//BOOL LLFolderViewItem::removeRecursively(BOOL single_item) +BOOL LLFolderViewItem::remove() +{ + if(!isRemovable()) + { + return FALSE; + } + return getViewModelItem()->removeItem(); +} + +// Build an appropriate context menu for the item. +void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + getViewModelItem()->buildContextMenu(menu, flags); +} + +void LLFolderViewItem::openItem( void ) +{ + getViewModelItem()->openItem(); +} + +void LLFolderViewItem::rename(const std::string& new_name) +{ + if( !new_name.empty() ) + { + getViewModelItem()->renameItem(new_name); + + if(mParentFolder) + { + mParentFolder->requestSort(); + } + } + } + +const std::string& LLFolderViewItem::getName( void ) const +{ + return getViewModelItem()->getName(); +} + +// LLView functionality +BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) +{ + if(!mIsSelected) + { + getRoot()->setSelection(this, FALSE); + } + make_ui_sound("UISndClick"); + return TRUE; +} + +BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) +{ + if (LLView::childrenHandleMouseDown(x, y, mask)) + { + return TRUE; + } + + // No handler needed for focus lost since this class has no + // state that depends on it. + gFocusMgr.setMouseCapture( this ); + + if (!mIsSelected) + { + if(mask & MASK_CONTROL) + { + getRoot()->changeSelection(this, !mIsSelected); + } + else if (mask & MASK_SHIFT) + { + getParentFolder()->extendSelectionTo(this); + } + else + { + getRoot()->setSelection(this, FALSE); + } + make_ui_sound("UISndClick"); + } + else + { + mSelectPending = TRUE; + } + + mDragStartX = x; + mDragStartY = y; + return TRUE; +} + +BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) +{ + static LLCachedControl drag_and_drop_threshold(*LLUI::sSettingGroups["config"],"DragAndDropDistanceThreshold"); + + mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); + + if( hasMouseCapture() && isMovable() ) + { + LLFolderView* root = getRoot(); + + if( (x - mDragStartX) * (x - mDragStartX) + (y - mDragStartY) * (y - mDragStartY) > drag_and_drop_threshold() * drag_and_drop_threshold() + && root->getCurSelectedItem() + && root->startDrag()) + { + // RN: when starting drag and drop, clear out last auto-open + root->autoOpenTest(NULL); + root->setShowSelectionContext(TRUE); + + // Release keyboard focus, so that if stuff is dropped into the + // world, pressing the delete key won't blow away the inventory + // item. + gFocusMgr.setKeyboardFocus(NULL); + + getWindow()->setCursor(UI_CURSOR_ARROW); + return TRUE; + } + else + { + getWindow()->setCursor(UI_CURSOR_NOLOCKED); + return TRUE; + } + } + else + { + getRoot()->setShowSelectionContext(FALSE); + getWindow()->setCursor(UI_CURSOR_ARROW); + // let parent handle this then... + return FALSE; + } +} + + +BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) +{ + getViewModelItem()->openItem(); + return TRUE; +} + +BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) +{ + if (LLView::childrenHandleMouseUp(x, y, mask)) + { + return TRUE; + } + + // if mouse hasn't moved since mouse down... + if ( pointInView(x, y) && mSelectPending ) + { + //...then select + if(mask & MASK_CONTROL) + { + getRoot()->changeSelection(this, !mIsSelected); + } + else if (mask & MASK_SHIFT) + { + getParentFolder()->extendSelectionTo(this); + } + else + { + getRoot()->setSelection(this, FALSE); + } + } + + mSelectPending = FALSE; + + if( hasMouseCapture() ) + { + if (getRoot()) + { + getRoot()->setShowSelectionContext(FALSE); + } + gFocusMgr.setMouseCapture( NULL ); + } + return TRUE; +} + +void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mIsMouseOverTitle = false; +} + +BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL handled = FALSE; + BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + handled = accepted; + if (accepted) + { + mDragAndDropTarget = TRUE; + *accept = ACCEPT_YES_MULTI; + } + else + { + *accept = ACCEPT_NO; + } + if(mParentFolder && !handled) + { + // store this item to get it in LLFolderBridge::dragItemIntoFolder on drop event. + mRoot->setDraggingOverItem(this); + handled = mParentFolder->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg); + mRoot->setDraggingOverItem(NULL); + } + if (handled) + { + lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewItem" << llendl; + } + + return handled; +} + +void LLFolderViewItem::draw() +{ + static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); + static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); + static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); + static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); + static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); + static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); + static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); + static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); + static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); + static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); + static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + + const Params& default_params = LLUICtrlFactory::getDefaultParams(); + const S32 TOP_PAD = default_params.item_top_pad; + const S32 FOCUS_LEFT = 1; + const LLFontGL* font = getLabelFontForStyle(mLabelStyle); + + getViewModelItem()->update(); + + //--------------------------------------------------------------------------------// + // Draw open folder arrow + // + if (hasVisibleChildren() || getViewModelItem()->hasChildren()) + { + LLUIImage* arrow_image = default_params.folder_arrow_image; + gl_draw_scaled_rotated_image( + mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD - TOP_PAD, + ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor); + } + + + //--------------------------------------------------------------------------------// + // Draw highlight for selected items + // + const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); + const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled + const S32 focus_top = getRect().getHeight(); + const S32 focus_bottom = getRect().getHeight() - mItemHeight; + const bool folder_open = (getRect().getHeight() > mItemHeight + 4); + if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLColor4 bg_color = sHighlightBgColor; + if (!mIsCurSelection) + { + // do time-based fade of extra objects + F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f); + if (getRoot() && getRoot()->getShowSingleSelection()) + { + // fading out + bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, bg_color.mV[VALPHA], 0.f); + } + else + { + // fading in + bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]); + } + } + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + bg_color, filled); + if (mIsCurSelection) + { + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + sFocusOutlineColor, FALSE); + } + if (folder_open) + { + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, // overlap with bottom edge of above rect + getRect().getWidth() - 2, + 0, + sFocusOutlineColor, FALSE); + if (show_context) + { + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, + getRect().getWidth() - 2, + 0, + sHighlightBgColor, TRUE); + } + } + } + else if (mIsMouseOverTitle) + { + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + sMouseOverColor, FALSE); + } + + //--------------------------------------------------------------------------------// + // Draw DragNDrop highlight + // + if (mDragAndDropTarget) + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + sHighlightBgColor, FALSE); + if (folder_open) + { + gl_rect_2d(FOCUS_LEFT, + focus_bottom + 1, // overlap with bottom edge of above rect + getRect().getWidth() - 2, + 0, + sHighlightBgColor, FALSE); + } + mDragAndDropTarget = FALSE; + } + + //--------------------------------------------------------------------------------// + // Draw open icon + // + const S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD; + if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) // For open folders + { + mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1); + } + else if (mIcon) + { + mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1); + } + + if (mIconOverlay && getRoot()->showItemLinkOverlays()) + { + mIconOverlay->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1); + } + + //--------------------------------------------------------------------------------// + // Exit if no label to draw + // + if (mLabel.empty()) + { + return; + } + + LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; + //TODO RN: implement this in terms of getColor() + //if (highlight_link) color = sLinkColor; + //if (gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor; + + F32 right_x = 0; + F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation); + + //--------------------------------------------------------------------------------// + // Draw the actual label text + // + font->renderUTF8(mLabel, 0, text_left, y, color, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE); + + //--------------------------------------------------------------------------------// + // Draw label suffix + // + if (!mLabelSuffix.empty()) + { + font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, S32_MAX, &right_x, FALSE ); + } + + //--------------------------------------------------------------------------------// + // Highlight string match + // + //TODO RN: expose interface for highlighting + //if (mStringMatchOffset != std::string::npos) + //{ + // // don't draw backgrounds for zero-length strings + // S32 filter_string_length = getRoot()->getFilterSubString().size(); + // if (filter_string_length > 0) + // { + // std::string combined_string = mLabel + mLabelSuffix; + // S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; + // S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; + // S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); + // S32 top = getRect().getHeight() - TOP_PAD; + // + // LLUIImage* box_image = default_params.selection_image; + // LLRect box_rect(left, top, right, bottom); + // box_image->draw(box_rect, sFilterBGColor); + // F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset); + // F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + // font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy, + // sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + // filter_string_length, S32_MAX, &right_x, FALSE ); + // } + //} +} + +const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const + { + return getRoot()->getFolderViewModel(); +} + +LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) + { + return getRoot()->getFolderViewModel(); +} + + +///---------------------------------------------------------------------------- +/// Class LLFolderViewFolder +///---------------------------------------------------------------------------- + +LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): + LLFolderViewItem( p ), + mIsOpen(FALSE), + mExpanderHighlighted(FALSE), + mCurHeight(0.f), + mTargetHeight(0.f), + mAutoOpenCountdown(0.f), + mLastArrangeGeneration( -1 ), + mLastCalculatedWidth(0) +{ +} + +// Destroys the object +LLFolderViewFolder::~LLFolderViewFolder( void ) +{ + // The LLView base class takes care of object destruction. make sure that we + // don't have mouse or keyboard focus + gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() +} + +// addToFolder() returns TRUE if it succeeds. FALSE otherwise +BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) +{ + return folder->addFolder(this); +} + +static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); + +// Finds width and height of this object and its children. Also +// makes sure that this view and its children are the right size. +S32 LLFolderViewFolder::arrange( S32* width, S32* height ) +{ + // sort before laying out contents + getRoot()->getFolderViewModel()->sort(this); + + LLFastTimer t2(FTM_ARRANGE); + + // evaluate mHasVisibleChildren + mHasVisibleChildren = false; + if (getViewModelItem()->descendantsPassedFilter()) + { + // We have to verify that there's at least one child that's not filtered out + bool found = false; + // Try the items first + for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + found = itemp->passedFilter(); + if (found) + break; + } + if (!found) + { + // If no item found, try the folders + for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) + { + LLFolderViewFolder* folderp = (*fit); + found = folderp->passedFilter(); + if (found) + break; + } + } + + mHasVisibleChildren = found; + } + + // calculate height as a single item (without any children), and reshapes rectangle to match + LLFolderViewItem::arrange( width, height ); + + // clamp existing animated height so as to never get smaller than a single item + mCurHeight = llmax((F32)*height, mCurHeight); + + // initialize running height value as height of single item in case we have no children + F32 running_height = (F32)*height; + F32 target_height = (F32)*height; + + // are my children visible? + if (needsArrange()) + { + // set last arrange generation first, in case children are animating + // and need to be arranged again + mLastArrangeGeneration = getRoot()->getArrangeGeneration(); + if (isOpen()) + { + // Add sizes of children + S32 parent_item_height = getRect().getHeight(); + + for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) + { + LLFolderViewFolder* folderp = (*fit); + folderp->setVisible(folderp->passedFilter()); // passed filter or has descendants that passed filter + + if (folderp->getVisible()) + { + S32 child_width = *width; + S32 child_height = 0; + S32 child_top = parent_item_height - llround(running_height); + + target_height += folderp->arrange( &child_width, &child_height ); + + running_height += (F32)child_height; + *width = llmax(*width, child_width); + folderp->setOrigin( 0, child_top - folderp->getRect().getHeight() ); + } + } + for(items_t::iterator iit = mItems.begin(); + iit != mItems.end(); ++iit) + { + LLFolderViewItem* itemp = (*iit); + itemp->setVisible(itemp->passedFilter()); + + if (itemp->getVisible()) + { + S32 child_width = *width; + S32 child_height = 0; + S32 child_top = parent_item_height - llround(running_height); + + target_height += itemp->arrange( &child_width, &child_height ); + // don't change width, as this item is as wide as its parent folder by construction + itemp->reshape( itemp->getRect().getWidth(), child_height); + + running_height += (F32)child_height; + *width = llmax(*width, child_width); + itemp->setOrigin( 0, child_top - itemp->getRect().getHeight() ); + } + } + } + + mTargetHeight = target_height; + // cache this width so next time we can just return it + mLastCalculatedWidth = *width; + } + else + { + // just use existing width + *width = mLastCalculatedWidth; + } + + // animate current height towards target height + if (llabs(mCurHeight - mTargetHeight) > 1.f) + { + mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(isOpen() ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); + + requestArrange(); + + // hide child elements that fall out of current animated height + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + // number of pixels that bottom of folder label is from top of parent folder + if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() + > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) + { + // hide if beyond current folder height + (*fit)->setVisible(FALSE); + } + } + + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + // number of pixels that bottom of item label is from top of parent folder + if (getRect().getHeight() - (*iit)->getRect().mBottom + > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) + { + (*iit)->setVisible(FALSE); + } + } + } + else + { + mCurHeight = mTargetHeight; + } + + // don't change width as this item is already as wide as its parent folder + reshape(getRect().getWidth(),llround(mCurHeight)); + + // pass current height value back to parent + *height = llround(mCurHeight); + + return llround(mTargetHeight); +} + +BOOL LLFolderViewFolder::needsArrange() +{ + return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); +} + +void LLFolderViewFolder::requestSort() +{ + getViewModelItem()->requestSort(); +} + +//TODO RN: get height resetting working +//void LLFolderViewFolder::setPassedFilter(BOOL passed, BOOL passed_folder, S32 filter_generation) +//{ +// // if this folder is now filtered, but wasn't before +// // (it just passed) +// if (passed && !passedFilter(filter_generation)) +// { +// // reset current height, because last time we drew it +// // it might have had more visible items than now +// mCurHeight = 0.f; +// } +// +// LLFolderViewItem::setPassedFilter(passed, passed_folder, filter_generation); +//} + + +// Passes selection information on to children and record selection +// information if necessary. +BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, + BOOL take_keyboard_focus) +{ + BOOL rv = FALSE; + if (selection == this) + { + if (!isSelected()) + { + selectItem(); + } + rv = TRUE; + } + else + { + if (isSelected()) + { + deselectItem(); + } + rv = FALSE; + } + BOOL child_selected = FALSE; + + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if((*fit)->setSelection(selection, openitem, take_keyboard_focus)) + { + rv = TRUE; + child_selected = TRUE; + } + } + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if((*iit)->setSelection(selection, openitem, take_keyboard_focus)) + { + rv = TRUE; + child_selected = TRUE; + } + } + if(openitem && child_selected) + { + setOpenArrangeRecursively(TRUE); + } + return rv; +} + +// This method is used to change the selection of an item. +// Recursively traverse all children; if 'selection' is 'this' then change +// the select status if necessary. +// Returns TRUE if the selection state of this folder, or of a child, was changed. +BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected) +{ + BOOL rv = FALSE; + if(selection == this) + { + if (isSelected() != selected) + { + rv = TRUE; + if (selected) + { + selectItem(); + } + else + { + deselectItem(); + } + } + } + + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if((*fit)->changeSelection(selection, selected)) + { + rv = TRUE; + } + } + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if((*iit)->changeSelection(selection, selected)) + { + rv = TRUE; + } + } + return rv; +} + +LLFolderViewFolder* LLFolderViewFolder::getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse) +{ + if (!item_a->getParentFolder() || !item_b->getParentFolder()) return NULL; + + std::deque item_a_ancestors; + + LLFolderViewFolder* parent = item_a->getParentFolder(); + while(parent) + { + item_a_ancestors.push_back(parent); + parent = parent->getParentFolder(); + } + + std::deque item_b_ancestors; + + parent = item_b->getParentFolder(); + while(parent) + { + item_b_ancestors.push_back(parent); + parent = parent->getParentFolder(); + } + + LLFolderViewFolder* common_ancestor = item_a->getRoot(); + + while(item_a_ancestors.size() > item_b_ancestors.size()) + { + item_a = item_a_ancestors.front(); + item_a_ancestors.pop_front(); + } + + while(item_b_ancestors.size() > item_a_ancestors.size()) + { + item_b = item_b_ancestors.front(); + item_b_ancestors.pop_front(); + } + + while(item_a_ancestors.size()) + { + common_ancestor = item_a_ancestors.front(); + + if (item_a_ancestors.front() == item_b_ancestors.front()) + { + // which came first, sibling a or sibling b? + for (folders_t::iterator it = common_ancestor->mFolders.begin(), end_it = common_ancestor->mFolders.end(); + it != end_it; + ++it) + { + LLFolderViewItem* item = *it; + + if (item == item_a) + { + reverse = false; + return common_ancestor; + } + if (item == item_b) + { + reverse = true; + return common_ancestor; + } + } + + for (items_t::iterator it = common_ancestor->mItems.begin(), end_it = common_ancestor->mItems.end(); + it != end_it; + ++it) + { + LLFolderViewItem* item = *it; + + if (item == item_a) + { + reverse = false; + return common_ancestor; + } + if (item == item_b) + { + reverse = true; + return common_ancestor; + } + } + break; + } + + item_a = item_a_ancestors.front(); + item_a_ancestors.pop_front(); + item_b = item_b_ancestors.front(); + item_b_ancestors.pop_front(); + } + + return NULL; +} + +void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector& items) +{ + bool selecting = start == NULL; + if (reverse) + { + for (items_t::reverse_iterator it = mItems.rbegin(), end_it = mItems.rend(); + it != end_it; + ++it) + { + if (*it == end) + { + return; + } + if (selecting) + { + items.push_back(*it); + } + + if (*it == start) + { + selecting = true; + } + } + for (folders_t::reverse_iterator it = mFolders.rbegin(), end_it = mFolders.rend(); + it != end_it; + ++it) + { + if (*it == end) + { + return; + } + + if (selecting) + { + items.push_back(*it); + } + + if (*it == start) + { + selecting = true; + } + } + } + else + { + for (folders_t::iterator it = mFolders.begin(), end_it = mFolders.end(); + it != end_it; + ++it) + { + if (*it == end) + { + return; + } + + if (selecting) + { + items.push_back(*it); + } + + if (*it == start) + { + selecting = true; + } + } + for (items_t::iterator it = mItems.begin(), end_it = mItems.end(); + it != end_it; + ++it) + { + if (*it == end) + { + return; + } + + if (selecting) + { + items.push_back(*it); + } + + if (*it == start) + { + selecting = true; + } + } + } +} + +void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) +{ + if (getRoot()->getAllowMultiSelect() == FALSE) return; + + LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); + if (cur_selected_item == NULL) + { + cur_selected_item = new_selection; + } + + + bool reverse = false; + LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse); + if (!common_ancestor) return; + + LLFolderViewItem* last_selected_item_from_cur = cur_selected_item; + LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder(); + + std::vector items_to_select_forward; + + while(cur_folder != common_ancestor) + { + cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); + + last_selected_item_from_cur = cur_folder; + cur_folder = cur_folder->getParentFolder(); + } + + std::vector items_to_select_reverse; + + LLFolderViewItem* last_selected_item_from_new = new_selection; + cur_folder = new_selection->getParentFolder(); + while(cur_folder != common_ancestor) + { + cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); + + last_selected_item_from_new = cur_folder; + cur_folder = cur_folder->getParentFolder(); + } + + common_ancestor->gatherChildRangeExclusive(last_selected_item_from_cur, last_selected_item_from_new, reverse, items_to_select_forward); + + for (std::vector::reverse_iterator it = items_to_select_reverse.rbegin(), end_it = items_to_select_reverse.rend(); + it != end_it; + ++it) + { + items_to_select_forward.push_back(*it); + } + + LLFolderView* root = getRoot(); + + for (std::vector::iterator it = items_to_select_forward.begin(), end_it = items_to_select_forward.end(); + it != end_it; + ++it) + { + LLFolderViewItem* item = *it; + if (item->isSelected()) + { + root->removeFromSelectionList(item); + } + else + { + item->selectItem(); + } + root->addToSelectionList(item); + } + + if (new_selection->isSelected()) + { + root->removeFromSelectionList(new_selection); + } + else + { + new_selection->selectItem(); + } + root->addToSelectionList(new_selection); +} + + +void LLFolderViewFolder::destroyView() +{ + std::for_each(mItems.begin(), mItems.end(), DeletePointer()); + mItems.clear(); + + while (!mFolders.empty()) + { + LLFolderViewFolder *folderp = mFolders.back(); + folderp->destroyView(); // removes entry from mFolders + } + + LLFolderViewItem::destroyView(); +} + +// extractItem() removes the specified item from the folder, but +// doesn't delete it. +void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) +{ + items_t::iterator it = std::find(mItems.begin(), mItems.end(), item); + if(it == mItems.end()) + { + // This is an evil downcast. However, it's only doing + // pointer comparison to find if (which it should be ) the + // item is in the container, so it's pretty safe. + LLFolderViewFolder* f = static_cast(item); + folders_t::iterator ft; + ft = std::find(mFolders.begin(), mFolders.end(), f); + if (ft != mFolders.end()) + { + mFolders.erase(ft); + } + } + else + { + mItems.erase(it); + } + //item has been removed, need to update filter + getViewModelItem()->removeChild(item->getViewModelItem()); + getViewModelItem()->dirtyFilter(); + //because an item is going away regardless of filter status, force rearrange + requestArrange(); + removeChild(item); +} + +BOOL LLFolderViewFolder::isMovable() +{ + if( !(getViewModelItem()->isItemMovable()) ) + { + return FALSE; + } + + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if(!(*iit)->isMovable()) + { + return FALSE; + } + } + + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if(!(*fit)->isMovable()) + { + return FALSE; + } + } + return TRUE; +} + + +BOOL LLFolderViewFolder::isRemovable() +{ + if( !(getViewModelItem()->isItemRemovable()) ) + { + return FALSE; + } + + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + if(!(*iit)->isRemovable()) + { + return FALSE; + } + } + + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + if(!(*fit)->isRemovable()) + { + return FALSE; + } + } + return TRUE; +} + +// this is an internal method used for adding items to folders. +BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) +{ + if (item->getParentFolder()) + { + item->getParentFolder()->extractItem(item); + } + item->setParentFolder(this); + + mItems.push_back(item); + + item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); + item->setVisible(FALSE); + + addChild(item); + + item->getViewModelItem()->dirtyFilter(); + + // Handle sorting + requestArrange(); + requestSort(); + + getViewModelItem()->addChild(item->getViewModelItem()); + + //TODO RN - make sort bubble up as long as parent Folder doesn't have anything matching sort criteria + //// Traverse parent folders and update creation date and resort, if necessary + //LLFolderViewFolder* parentp = this; + //while (parentp) + //{ + // if (parentp->mSortFunction.isByDate()) + // { + // // parent folder doesn't have a time stamp yet, so get it from us + // parentp->requestSort(); + // } + + // parentp = parentp->getParentFolder(); + //} + + return TRUE; +} + +// this is an internal method used for adding items to folders. +BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) +{ + if (folder->mParentFolder) + { + folder->mParentFolder->extractItem(folder); + } + folder->mParentFolder = this; + mFolders.push_back(folder); + folder->setOrigin(0, 0); + folder->reshape(getRect().getWidth(), 0); + folder->setVisible(FALSE); + addChild( folder ); + folder->getViewModelItem()->dirtyFilter(); + // rearrange all descendants too, as our indentation level might have changed + folder->requestArrange(); + requestSort(); + + getViewModelItem()->addChild(folder->getViewModelItem()); + + return TRUE; +} + +void LLFolderViewFolder::requestArrange() +{ + mLastArrangeGeneration = -1; + // flag all items up to root + if (mParentFolder) + { + mParentFolder->requestArrange(); + } +} + +void LLFolderViewFolder::toggleOpen() +{ + setOpen(!isOpen()); +} + +// Force a folder open or closed +void LLFolderViewFolder::setOpen(BOOL openitem) +{ + setOpenArrangeRecursively(openitem); +} + +void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse) +{ + BOOL was_open = isOpen(); + mIsOpen = openitem; + if(!was_open && openitem) + { + getViewModelItem()->openItem(); + } + else if(was_open && !openitem) + { + getViewModelItem()->closeItem(); + } + + if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) + { + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + (*fit)->setOpenArrangeRecursively(openitem, RECURSE_DOWN); /* Flawfinder: ignore */ + } + } + if (mParentFolder + && (recurse == RECURSE_UP + || recurse == RECURSE_UP_DOWN)) + { + mParentFolder->setOpenArrangeRecursively(openitem, RECURSE_UP); + } + + if (was_open != isOpen()) + { + requestArrange(); + } +} + +BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, + BOOL drop, + EDragAndDropType c_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); + if (accepted) + { + mDragAndDropTarget = TRUE; + *accept = ACCEPT_YES_MULTI; + } + else + { + *accept = ACCEPT_NO; + } + + // drag and drop to child item, so clear pending auto-opens + getRoot()->autoOpenTest(NULL); + + return TRUE; +} + +void LLFolderViewFolder::openItem( void ) +{ + toggleOpen(); +} + +void LLFolderViewFolder::applyFunctorToChildren(LLFolderViewFunctor& functor) +{ + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + functor.doItem((*fit)); + } + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + functor.doItem((*iit)); + } +} + +void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor) +{ + functor.doFolder(this); + + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + (*fit)->applyFunctorRecursively(functor); + } + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + functor.doItem((*iit)); + } +} + +// LLView functionality +BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL handled = FALSE; + + if (isOpen()) + { + handled = (childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL); + } + + if (!handled) + { + handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + + lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewFolder" << llendl; + } + + return TRUE; +} + +BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); + + if (accepted) + { + mDragAndDropTarget = TRUE; + *accept = ACCEPT_YES_MULTI; + } + else + { + *accept = ACCEPT_NO; + } + + if (!drop && accepted) + { + getRoot()->autoOpenTest(this); + } + + return TRUE; +} + + +BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) +{ + BOOL handled = FALSE; + + if( isOpen() ) + { + handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; + } + if (!handled) + { + handled = LLFolderViewItem::handleRightMouseDown( x, y, mask ); + } + return handled; +} + + +BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) +{ + mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); + + BOOL handled = LLView::handleHover(x, y, mask); + + if (!handled) + { + // this doesn't do child processing + handled = LLFolderViewItem::handleHover(x, y, mask); + } + + return handled; +} + +BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) +{ + BOOL handled = FALSE; + if( isOpen() ) + { + handled = childrenHandleMouseDown(x,y,mask) != NULL; + } + if( !handled ) + { + if(mIndentation < x && x < mIndentation + ARROW_SIZE + TEXT_PAD) + { + toggleOpen(); + handled = TRUE; + } + else + { + // do normal selection logic + handled = LLFolderViewItem::handleMouseDown(x, y, mask); + } + } + + return handled; +} + +BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) +{ + BOOL handled = FALSE; + if( isOpen() ) + { + handled = childrenHandleDoubleClick( x, y, mask ) != NULL; + } + if( !handled ) + { + if(mIndentation < x && x < mIndentation + ARROW_SIZE + TEXT_PAD) + { + // don't select when user double-clicks plus sign + // so as not to contradict single-click behavior + toggleOpen(); + } + else + { + getRoot()->setSelection(this, FALSE); + toggleOpen(); + } + handled = TRUE; + } + return handled; +} + +void LLFolderViewFolder::draw() +{ + if (mAutoOpenCountdown != 0.f) + { + mControlLabelRotation = mAutoOpenCountdown * -90.f; + } + else if (isOpen()) + { + mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f)); + } + else + { + mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f)); + } + + LLFolderViewItem::draw(); + + // draw children if root folder, or any other folder that is open or animating to closed state + if( getRoot() == this || (isOpen() || mCurHeight != mTargetHeight )) + { + LLView::draw(); + } + + mExpanderHighlighted = FALSE; +} + +// this does prefix traversal, as folders are listed above their contents +LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children ) +{ + BOOL found_item = FALSE; + + LLFolderViewItem* result = NULL; + // when not starting from a given item, start at beginning + if(item == NULL) + { + found_item = TRUE; + } + + // find current item among children + folders_t::iterator fit = mFolders.begin(); + folders_t::iterator fend = mFolders.end(); + + items_t::iterator iit = mItems.begin(); + items_t::iterator iend = mItems.end(); + + // if not trivially starting at the beginning, we have to find the current item + if (!found_item) + { + // first, look among folders, since they are always above items + for(; fit != fend; ++fit) + { + if(item == (*fit)) + { + found_item = TRUE; + // if we are on downwards traversal + if (include_children && (*fit)->isOpen()) + { + // look for first descendant + return (*fit)->getNextFromChild(NULL, TRUE); + } + // otherwise advance to next folder + ++fit; + include_children = TRUE; + break; + } + } + + // didn't find in folders? Check items... + if (!found_item) + { + for(; iit != iend; ++iit) + { + if(item == (*iit)) + { + found_item = TRUE; + // point to next item + ++iit; + break; + } + } + } + } + + if (!found_item) + { + // you should never call this method with an item that isn't a child + // so we should always find something + llassert(FALSE); + return NULL; + } + + // at this point, either iit or fit point to a candidate "next" item + // if both are out of range, we need to punt up to our parent + + // now, starting from found folder, continue through folders + // searching for next visible folder + while(fit != fend && !(*fit)->getVisible()) + { + // turn on downwards traversal for next folder + ++fit; + } + + if (fit != fend) + { + result = (*fit); + } + else + { + // otherwise, scan for next visible item + while(iit != iend && !(*iit)->getVisible()) + { + ++iit; + } + + // check to see if we have a valid item + if (iit != iend) + { + result = (*iit); + } + } + + if( !result && mParentFolder ) + { + // If there are no siblings or children to go to, recurse up one level in the tree + // and skip children for this folder, as we've already discounted them + result = mParentFolder->getNextFromChild(this, FALSE); + } + + return result; +} + +// this does postfix traversal, as folders are listed above their contents +LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, BOOL include_children ) +{ + BOOL found_item = FALSE; + + LLFolderViewItem* result = NULL; + // when not starting from a given item, start at end + if(item == NULL) + { + found_item = TRUE; + } + + // find current item among children + folders_t::reverse_iterator fit = mFolders.rbegin(); + folders_t::reverse_iterator fend = mFolders.rend(); + + items_t::reverse_iterator iit = mItems.rbegin(); + items_t::reverse_iterator iend = mItems.rend(); + + // if not trivially starting at the end, we have to find the current item + if (!found_item) + { + // first, look among items, since they are always below the folders + for(; iit != iend; ++iit) + { + if(item == (*iit)) + { + found_item = TRUE; + // point to next item + ++iit; + break; + } + } + + // didn't find in items? Check folders... + if (!found_item) + { + for(; fit != fend; ++fit) + { + if(item == (*fit)) + { + found_item = TRUE; + // point to next folder + ++fit; + break; + } + } + } + } + + if (!found_item) + { + // you should never call this method with an item that isn't a child + // so we should always find something + llassert(FALSE); + return NULL; + } + + // at this point, either iit or fit point to a candidate "next" item + // if both are out of range, we need to punt up to our parent + + // now, starting from found item, continue through items + // searching for next visible item + while(iit != iend && !(*iit)->getVisible()) + { + ++iit; + } + + if (iit != iend) + { + // we found an appropriate item + result = (*iit); + } + else + { + // otherwise, scan for next visible folder + while(fit != fend && !(*fit)->getVisible()) + { + ++fit; + } + + // check to see if we have a valid folder + if (fit != fend) + { + // try selecting child element of this folder + if ((*fit)->isOpen()) + { + result = (*fit)->getPreviousFromChild(NULL); + } + else + { + result = (*fit); + } + } + } + + if( !result ) + { + // If there are no siblings or children to go to, recurse up one level in the tree + // which gets back to this folder, which will only be visited if it is a valid, visible item + result = this; + } + + return result; +} + diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h new file mode 100644 index 0000000000..9cb885066a --- /dev/null +++ b/indra/llui/llfolderviewitem.h @@ -0,0 +1,420 @@ +/** +* @file llfolderviewitem.h +* @brief Items and folders that can appear in a hierarchical folder view +* +* $LicenseInfo:firstyear=2001&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 LLFOLDERVIEWITEM_H +#define LLFOLDERVIEWITEM_H + +#include "llview.h" +#include "lluiimage.h" + +class LLFolderView; +class LLFolderViewModelItem; +class LLFolderViewFolder; +class LLFolderViewFunctor; +class LLFolderViewFilter; +class LLFolderViewModelInterface; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFolderViewItem +// +// An instance of this class represents a single item in a folder view +// such as an inventory item or a file. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFolderViewItem : public LLView +{ +public: + static void initClass(); + static void cleanupClass(); + + struct Params : public LLInitParam::Block + { + Optional folder_arrow_image, + selection_image; + Optional root; + Mandatory listener; + + Optional folder_indentation, // pixels + item_height, + item_top_pad; + + Optional creation_date; + + Params(); + }; + + // layout constants + static const S32 LEFT_PAD = 5; + // LEFT_INDENTATION is set via folder_indentation above + static const S32 ICON_PAD = 2; + static const S32 ICON_WIDTH = 16; + static const S32 TEXT_PAD = 1; + static const S32 TEXT_PAD_RIGHT = 4; + static const S32 ARROW_SIZE = 12; + static const S32 MAX_FOLDER_ITEM_OVERLAP = 2; + // animation parameters + static const F32 FOLDER_CLOSE_TIME_CONSTANT; + static const F32 FOLDER_OPEN_TIME_CONSTANT; + +private: + BOOL mIsSelected; + +protected: + friend class LLUICtrlFactory; + friend class LLFolderViewModelItem; + + LLFolderViewItem(const Params& p); + + std::string mLabel; + S32 mLabelWidth; + bool mLabelWidthDirty; + LLFolderViewFolder* mParentFolder; + LLFolderViewModelItem* mViewModelItem; + BOOL mIsCurSelection; + BOOL mSelectPending; + LLFontGL::StyleFlags mLabelStyle; + std::string mLabelSuffix; + LLUIImagePtr mIcon; + LLUIImagePtr mIconOpen; + LLUIImagePtr mIconOverlay; + BOOL mHasVisibleChildren; + S32 mIndentation; + S32 mItemHeight; + S32 mDragStartX, + mDragStartY; + + //TODO RN: create interface for string highlighting + //std::string::size_type mStringMatchOffset; + F32 mControlLabelRotation; + LLFolderView* mRoot; + BOOL mDragAndDropTarget; + bool mIsMouseOverTitle; + + // this is an internal method used for adding items to folders. A + // no-op at this level, but reimplemented in derived classes. + virtual BOOL addItem(LLFolderViewItem*) { return FALSE; } + virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; } + + static LLFontGL* getLabelFontForStyle(U8 style); + +public: + BOOL postBuild(); + + virtual void openItem( void ); + + void arrangeAndSet(BOOL set_selection, BOOL take_keyboard_focus); + + virtual ~LLFolderViewItem( void ); + + // addToFolder() returns TRUE if it succeeds. FALSE otherwise + virtual BOOL addToFolder(LLFolderViewFolder* folder); + + // Finds width and height of this object and it's children. Also + // makes sure that this view and it's children are the right size. + virtual S32 arrange( S32* width, S32* height ); + virtual S32 getItemHeight(); + + // If 'selection' is 'this' then note that otherwise ignore. + // Returns TRUE if this item ends up being selected. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); + + // This method is used to set the selection state of an item. + // If 'selection' is 'this' then note selection. + // Returns TRUE if the selection state of this item was changed. + virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + + // this method is used to deselect this element + void deselectItem(); + + // this method is used to select this element + virtual void selectItem(); + + // gets multiple-element selection + virtual std::set getSelectionList() const; + + // Returns true is this object and all of its children can be removed (deleted by user) + virtual BOOL isRemovable(); + + // Returns true is this object and all of its children can be moved + virtual BOOL isMovable(); + + // destroys this item recursively + virtual void destroyView(); + + BOOL isSelected() const { return mIsSelected; } + + void setUnselected() { mIsSelected = FALSE; } + + void setIsCurSelection(BOOL select) { mIsCurSelection = select; } + + BOOL getIsCurSelection() { return mIsCurSelection; } + + BOOL hasVisibleChildren() { return mHasVisibleChildren; } + + // Call through to the viewed object and return true if it can be + // removed. Returns true if it's removed. + //virtual BOOL removeRecursively(BOOL single_item); + BOOL remove(); + + // Build an appropriate context menu for the item. Flags unused. + void buildContextMenu(class LLMenuGL& menu, U32 flags); + + // This method returns the actual name of the thing being + // viewed. This method will ask the viewed object itself. + const std::string& getName( void ) const; + + // This method returns the label displayed on the view. This + // method was primarily added to allow sorting on the folder + // contents possible before the entire view has been constructed. + const std::string& getLabel() const { return mLabel; } + + + LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } + const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } + + void setParentFolder(LLFolderViewFolder* parent) { mParentFolder = parent; } + + LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); + LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); + + const LLFolderViewModelItem* getViewModelItem( void ) const { return mViewModelItem; } + LLFolderViewModelItem* getViewModelItem( void ) { return mViewModelItem; } + + const LLFolderViewModelInterface* getFolderViewModel( void ) const; + LLFolderViewModelInterface* getFolderViewModel( void ); + + // just rename the object. + void rename(const std::string& new_name); + + + // Show children (unfortunate that this is called "open") + virtual void setOpen(BOOL open = TRUE) {}; + virtual BOOL isOpen() const { return FALSE; } + + virtual LLFolderView* getRoot(); + virtual const LLFolderView* getRoot() const; + BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); + S32 getIndentation() { return mIndentation; } + + virtual BOOL passedFilter(S32 filter_generation = -1); + + // refresh information from the object being viewed. + virtual void refresh(); + + // LLView functionality + virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); + virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + + virtual void onMouseLeave(S32 x, S32 y, MASK mask); + + virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; } + + // virtual void handleDropped(); + virtual void draw(); + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + +private: + static std::map sFonts; // map of styles to fonts +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFolderViewFolder +// +// An instance of an LLFolderViewFolder represents a collection of +// more folders and items. This is used to build the hierarchy of +// items found in the folder view. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLFolderViewFolder : public LLFolderViewItem +{ +protected: + LLFolderViewFolder( const LLFolderViewItem::Params& ); + friend class LLUICtrlFactory; + +public: + + typedef std::list items_t; + typedef std::list folders_t; + +protected: + items_t mItems; + folders_t mFolders; + + BOOL mIsOpen; + BOOL mExpanderHighlighted; + F32 mCurHeight; + F32 mTargetHeight; + F32 mAutoOpenCountdown; + S32 mLastArrangeGeneration; + S32 mLastCalculatedWidth; + S32 mMostFilteredDescendantGeneration; + bool mNeedsSort; + +public: + typedef enum e_recurse_type + { + RECURSE_NO, + RECURSE_UP, + RECURSE_DOWN, + RECURSE_UP_DOWN + } ERecurseType; + + + virtual ~LLFolderViewFolder( void ); + + LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); + LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); + + // addToFolder() returns TRUE if it succeeds. FALSE otherwise + virtual BOOL addToFolder(LLFolderViewFolder* folder); + + // Finds width and height of this object and it's children. Also + // makes sure that this view and it's children are the right size. + virtual S32 arrange( S32* width, S32* height ); + + BOOL needsArrange(); + + bool descendantsPassedFilter(S32 filter_generation = -1); + + // Passes selection information on to children and record + // selection information if necessary. + // Returns TRUE if this object (or a child) ends up being selected. + // If 'openitem' is TRUE then folders are opened up along the way to the selection. + virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus = TRUE); + + // This method is used to change the selection of an item. + // Recursively traverse all children; if 'selection' is 'this' then change + // the select status if necessary. + // Returns TRUE if the selection state of this folder, or of a child, was changed. + virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); + + // this method is used to group select items + void extendSelectionTo(LLFolderViewItem* selection); + + // Returns true is this object and all of its children can be removed. + virtual BOOL isRemovable(); + + // Returns true is this object and all of its children can be moved + virtual BOOL isMovable(); + + // destroys this folder, and all children + virtual void destroyView(); + + // If this folder can be removed, remove all children that can be + // removed, return TRUE if this is empty after the operation and + // it's viewed folder object can be removed. + //virtual BOOL removeRecursively(BOOL single_item); + //virtual BOOL remove(); + + // extractItem() removes the specified item from the folder, but + // doesn't delete it. + virtual void extractItem( LLFolderViewItem* item ); + + // This function is called by a child that needs to be resorted. + void resort(LLFolderViewItem* item); + + void setAutoOpenCountdown(F32 countdown) { mAutoOpenCountdown = countdown; } + + // folders can be opened. This will usually be called by internal + // methods. + virtual void toggleOpen(); + + // Force a folder open or closed + virtual void setOpen(BOOL openitem = TRUE); + + // Called when a child is refreshed. + virtual void requestArrange(); + + virtual void requestSort(); + + // internal method which doesn't update the entire view. This + // method was written because the list iterators destroy the state + // of other iterations, thus, we can't arrange while iterating + // through the children (such as when setting which is selected. + virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO); + + // Get the current state of the folder. + virtual BOOL isOpen() const { return mIsOpen; } + + // special case if an object is dropped on the child. + BOOL handleDragAndDropFromChild(MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + + void applyFunctorRecursively(LLFolderViewFunctor& functor); + + // Just apply this functor to the folder's immediate children. + void applyFunctorToChildren(LLFolderViewFunctor& functor); + + virtual void openItem( void ); + virtual BOOL addItem(LLFolderViewItem* item); + virtual BOOL addFolder( LLFolderViewFolder* folder); + + // LLView functionality + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); + virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + BOOL handleDragAndDropToThisFolder(MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + virtual void draw(); + + folders_t::iterator getFoldersBegin() { return mFolders.begin(); } + folders_t::iterator getFoldersEnd() { return mFolders.end(); } + folders_t::size_type getFoldersCount() const { return mFolders.size(); } + + items_t::const_iterator getItemsBegin() const { return mItems.begin(); } + items_t::const_iterator getItemsEnd() const { return mItems.end(); } + items_t::size_type getItemsCount() const { return mItems.size(); } + + LLFolderViewFolder* getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse); + void gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector& items); + +public: + //WARNING: do not call directly...use the appropriate LLFolderViewModel-derived class instead + template void sortFolders(const SORT_FUNC& func) { mFolders.sort(func); } + template void sortItems(const SORT_FUNC& func) { mItems.sort(func); } +}; + + +#endif // LLFOLDERVIEWITEM_H diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp new file mode 100644 index 0000000000..dc6e4d754b --- /dev/null +++ b/indra/llui/llfolderviewmodel.cpp @@ -0,0 +1,53 @@ +/** + * @file llfolderviewmodel.cpp + * @brief Implementation of the view model collection of classes. + * + * $LicenseInfo:firstyear=2001&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 "linden_common.h" + +#include "llfolderviewmodel.h" +#include "lltrans.h" + +bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) +{ + return item->getSortVersion() < mTargetSortVersion; +} + +std::string LLFolderViewModelCommon::getStatusText() +{ + if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter()->getCurrentGeneration()) + { + return LLTrans::getString("Searching"); + } + else + { + return getFilter()->getEmptyLookupMessage(); + } +} + +void LLFolderViewModelCommon::filter() +{ + getFilter()->setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + mFolderView->getViewModelItem()->filter(*getFilter()); +} diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h new file mode 100644 index 0000000000..0f5f9a1f50 --- /dev/null +++ b/indra/llui/llfolderviewmodel.h @@ -0,0 +1,353 @@ +/** + * @file llfolderviewmodel.h + * + * $LicenseInfo:firstyear=2001&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 LLFOLDERVIEWMODEL_H +#define LLFOLDERVIEWMODEL_H + +#include "llfontgl.h" // just for StyleFlags enum +#include "llfolderview.h" + +// These are grouping of inventory types. +// Order matters when sorting system folders to the top. +enum EInventorySortGroup +{ + SG_SYSTEM_FOLDER, + SG_TRASH_FOLDER, + SG_NORMAL_FOLDER, + SG_ITEM +}; + +class LLFontGL; +class LLInventoryModel; +class LLMenuGL; +class LLUIImage; +class LLUUID; +class LLFolderViewItem; +class LLFolderViewFolder; + +class LLFolderViewFilter +{ +public: + enum EFilterModified + { + FILTER_NONE, // nothing to do, already filtered + FILTER_RESTART, // restart filtering from scratch + FILTER_LESS_RESTRICTIVE, // existing filtered items will certainly pass this filter + FILTER_MORE_RESTRICTIVE // if you didn't pass the previous filter, you definitely won't pass this one + }; + +public: + + LLFolderViewFilter() {} + virtual ~LLFolderViewFilter() {} + + // +-------------------------------------------------------------------+ + // + Execution And Results + // +-------------------------------------------------------------------+ + virtual bool check(const LLFolderViewModelItem* item) = 0; + virtual bool checkFolder(const LLFolderViewModelItem* folder) const = 0; + + virtual void setEmptyLookupMessage(const std::string& message) = 0; + virtual std::string getEmptyLookupMessage() const = 0; + + virtual bool showAllResults() const = 0; + + // +-------------------------------------------------------------------+ + // + Status + // +-------------------------------------------------------------------+ + virtual bool isActive() const = 0; + virtual bool isModified() const = 0; + virtual void clearModified() = 0; + virtual const std::string& getName() const = 0; + virtual const std::string& getFilterText() = 0; + //RN: this is public to allow system to externally force a global refilter + virtual void setModified(EFilterModified behavior = FILTER_RESTART) = 0; + + // +-------------------------------------------------------------------+ + // + Count + // +-------------------------------------------------------------------+ + virtual void setFilterCount(S32 count) = 0; + virtual S32 getFilterCount() const = 0; + virtual void decrementFilterCount() = 0; + + // +-------------------------------------------------------------------+ + // + Default + // +-------------------------------------------------------------------+ + virtual bool isDefault() const = 0; + virtual bool isNotDefault() const = 0; + virtual void markDefault() = 0; + virtual void resetDefault() = 0; + + // +-------------------------------------------------------------------+ + // + Generation + // +-------------------------------------------------------------------+ + virtual S32 getCurrentGeneration() const = 0; + virtual S32 getFirstSuccessGeneration() const = 0; + virtual S32 getFirstRequiredGeneration() const = 0; +}; + +class LLFolderViewModelInterface +{ +public: + virtual ~LLFolderViewModelInterface() {} + virtual void requestSortAll() = 0; + + virtual void sort(class LLFolderViewFolder*) = 0; + virtual void filter() = 0; + + virtual bool contentsReady() = 0; + virtual void setFolderView(LLFolderView* folder_view) = 0; + virtual LLFolderViewFilter* getFilter() = 0; + virtual const LLFolderViewFilter* getFilter() const = 0; + virtual std::string getStatusText() = 0; + + virtual bool startDrag(std::vector& items) = 0; +}; + +class LLFolderViewModelCommon : public LLFolderViewModelInterface +{ +public: + LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) + {} + + virtual void requestSortAll() + { + // sort everything + mTargetSortVersion++; + } + virtual std::string getStatusText(); + virtual void filter(); + + void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} + +protected: + bool needsSort(class LLFolderViewModelItem* item); + + S32 mTargetSortVersion; + LLFolderView* mFolderView; + +}; + +template +class LLFolderViewModel : public LLFolderViewModelCommon +{ +public: + LLFolderViewModel(){} + virtual ~LLFolderViewModel() {} + + typedef SORT_TYPE SortType; + typedef ITEM_TYPE ItemType; + typedef FOLDER_TYPE FolderType; + typedef FILTER_TYPE FilterType; + + virtual SortType& getSorter() { return mSorter; } + virtual const SortType& getSorter() const { return mSorter; } + virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } + + virtual FilterType* getFilter() { return &mFilter; } + virtual const FilterType* getFilter() const { return &mFilter; } + virtual void setFilter(const FilterType& filter) { mFilter = filter; } + + // TODO RN: remove this and put all filtering logic in view model + // add getStatusText and isFiltering() + virtual bool contentsReady() { return true; } + + + struct ViewModelCompare + { + ViewModelCompare(const SortType& sorter) + : mSorter(sorter) + {} + + bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + const SortType& mSorter; + }; + + void sort(LLFolderViewFolder* folder) + { + if (needsSort(folder->getViewModelItem())) + { + folder->sortFolders(ViewModelCompare(getSorter())); + folder->sortItems(ViewModelCompare(getSorter())); + folder->getViewModelItem()->setSortVersion(mTargetSortVersion); + folder->requestArrange(); + } + } + +protected: + SortType mSorter; + FilterType mFilter; +}; + +// This is am abstract base class that users of the folderview classes +// would use to bridge the folder view with the underlying data +class LLFolderViewModelItem +{ +public: + virtual ~LLFolderViewModelItem( void ) {}; + + virtual void update() {} //called when drawing + virtual const std::string& getName() const = 0; + virtual const std::string& getDisplayName() const = 0; + virtual const std::string& getSearchableName() const = 0; + + virtual LLPointer getIcon() const = 0; + virtual LLPointer getIconOpen() const { return getIcon(); } + virtual LLPointer getIconOverlay() const { return NULL; } + + virtual LLFontGL::StyleFlags getLabelStyle() const = 0; + virtual std::string getLabelSuffix() const = 0; + + virtual void openItem( void ) = 0; + virtual void closeItem( void ) = 0; + virtual void selectItem(void) = 0; + + virtual BOOL isItemRenameable() const = 0; + virtual BOOL renameItem(const std::string& new_name) = 0; + + virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder + virtual void move( LLFolderViewModelItem* parent_listener ) = 0; + + virtual BOOL isItemRemovable( void ) const = 0; // Can be destroyed + virtual BOOL removeItem() = 0; + virtual void removeBatch(std::vector& batch) = 0; + + virtual BOOL isItemCopyable() const = 0; + virtual BOOL copyToClipboard() const = 0; + virtual BOOL cutToClipboard() const = 0; + + virtual BOOL isClipboardPasteable() const = 0; + virtual void pasteFromClipboard() = 0; + virtual void pasteLinkFromClipboard() = 0; + + virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; + + virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? + + virtual bool filter( LLFolderViewFilter& filter) = 0; + virtual bool passedFilter(S32 filter_generation = -1) = 0; + virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; + virtual void dirtyFilter() = 0; + + virtual S32 getLastFilterGeneration() const = 0; + + virtual bool hasChildren() const = 0; + virtual void addChild(LLFolderViewModelItem* child) = 0; + virtual void removeChild(LLFolderViewModelItem* child) = 0; + + // This method will be called to determine if a drop can be + // performed, and will set drop to TRUE if a drop is + // requested. Returns TRUE if a drop is possible/happened, + // otherwise FALSE. + virtual BOOL dragOrDrop(MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + std::string& tooltip_msg) = 0; + + virtual void requestSort() = 0; + virtual S32 getSortVersion() = 0; + virtual void setSortVersion(S32 version) = 0; + virtual void setParent(LLFolderViewModelItem* parent) = 0; + +protected: + + friend class LLFolderViewItem; + virtual void setFolderViewItem(LLFolderViewItem* folder_view_item) = 0; + +}; + +class LLFolderViewModelItemCommon : public LLFolderViewModelItem +{ +public: + LLFolderViewModelItemCommon() + : mSortVersion(-1), + mPassedFilter(true), + mPassedFolderFilter(true), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mMostFilteredDescendantGeneration(-1), + mParent(NULL) + { + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + } + + void requestSort() { mSortVersion = -1; } + S32 getSortVersion() { return mSortVersion; } + void setSortVersion(S32 version) { mSortVersion = version;} + + S32 getLastFilterGeneration() const { return mLastFilterGeneration; } + void dirtyFilter() + { + mLastFilterGeneration = -1; + + // bubble up dirty flag all the way to root + if (mParent) + { + mParent->dirtyFilter(); + } + } + virtual void addChild(LLFolderViewModelItem* child) + { + mChildren.push_back(child); + child->setParent(this); + } + virtual void removeChild(LLFolderViewModelItem* child) + { + mChildren.remove(child); + child->setParent(NULL); + } + +protected: + virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } + + S32 mSortVersion; + bool mPassedFilter; + bool mPassedFolderFilter; + + S32 mLastFilterGeneration; + S32 mMostFilteredDescendantGeneration; + + + typedef std::list child_list_t; + child_list_t mChildren; + LLFolderViewModelItem* mParent; + + void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} + LLFolderViewItem* mFolderViewItem; +}; + + +#endif // LLFOLDERVIEWMODEL_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 64bc70da58..b31b99f47c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -253,9 +253,6 @@ set(viewer_SOURCE_FILES llfloaterwhitelistentry.cpp llfloaterwindowsize.cpp llfloaterworldmap.cpp - llfolderview.cpp - llfolderviewitem.cpp - llfolderviewmodel.cpp llfolderviewmodelinventory.cpp llfollowcam.cpp llfriendcard.cpp @@ -813,10 +810,7 @@ set(viewer_HEADER_FILES llfloaterwhitelistentry.h llfloaterwindowsize.h llfloaterworldmap.h - llfolderview.h - llfolderviewmodel.h llfolderviewmodelinventory.h - llfolderviewitem.h llfollowcam.h llfriendcard.h llgesturelistener.h diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp deleted file mode 100644 index 10677db094..0000000000 --- a/indra/newview/llfolderview.cpp +++ /dev/null @@ -1,2105 +0,0 @@ -/** - * @file llfolderview.cpp - * @brief Implementation of the folder view collection of classes. - * - * $LicenseInfo:firstyear=2001&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 "llfolderview.h" -#include "llfolderviewmodel.h" -#include "llclipboard.h" // *TODO: remove this once hack below gone. -#include "llkeyboard.h" -#include "lllineeditor.h" -#include "llmenugl.h" -#include "llpanel.h" -#include "llscrollcontainer.h" // hack to allow scrolling -#include "lltextbox.h" -#include "lltrans.h" -#include "llui.h" -#include "lluictrlfactory.h" - -// Linden library includes -#include "lldbstrings.h" -#include "llfocusmgr.h" -#include "llfontgl.h" -#include "llgl.h" -#include "llrender.h" - -// Third-party library includes -#include - -///---------------------------------------------------------------------------- -/// Local function declarations, constants, enums, and typedefs -///---------------------------------------------------------------------------- - -const S32 RENAME_WIDTH_PAD = 4; -const S32 RENAME_HEIGHT_PAD = 1; -const S32 AUTO_OPEN_STACK_DEPTH = 16; -const S32 MIN_ITEM_WIDTH_VISIBLE = LLFolderViewItem::ICON_WIDTH - + LLFolderViewItem::ICON_PAD - + LLFolderViewItem::ARROW_SIZE - + LLFolderViewItem::TEXT_PAD - + /*first few characters*/ 40; -const S32 MINIMUM_RENAMER_WIDTH = 80; - -// *TODO: move in params in xml if necessary. Requires modification of LLFolderView & LLInventoryPanel Params. -const S32 STATUS_TEXT_HPAD = 6; -const S32 STATUS_TEXT_VPAD = 8; - -enum { - SIGNAL_NO_KEYBOARD_FOCUS = 1, - SIGNAL_KEYBOARD_FOCUS = 2 -}; - -F32 LLFolderView::sAutoOpenTime = 1.f; - -//--------------------------------------------------------------------------- - -// Tells all folders in a folderview to close themselves -// For efficiency, calls setOpenArrangeRecursively(). -// The calling function must then call: -// LLFolderView* root = getRoot(); -// if( root ) -// { -// root->arrange( NULL, NULL ); -// root->scrollToShowSelection(); -// } -// to patch things up. -class LLCloseAllFoldersFunctor : public LLFolderViewFunctor -{ -public: - LLCloseAllFoldersFunctor(BOOL close) { mOpen = !close; } - virtual ~LLCloseAllFoldersFunctor() {} - virtual void doFolder(LLFolderViewFolder* folder); - virtual void doItem(LLFolderViewItem* item); - - BOOL mOpen; -}; - - -void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder) -{ - folder->setOpenArrangeRecursively(mOpen); -} - -// Do nothing. -void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) -{ } - -///---------------------------------------------------------------------------- -/// Class LLFolderViewScrollContainer -///---------------------------------------------------------------------------- - -// virtual -const LLRect LLFolderViewScrollContainer::getScrolledViewRect() const -{ - LLRect rect = LLRect::null; - if (mScrolledView) - { - LLFolderView* folder_view = dynamic_cast(mScrolledView); - if (folder_view) - { - S32 height = folder_view->getRect().getHeight(); - - rect = mScrolledView->getRect(); - rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height); - } - } - - return rect; -} - -LLFolderViewScrollContainer::LLFolderViewScrollContainer(const LLScrollContainer::Params& p) -: LLScrollContainer(p) -{} - -///---------------------------------------------------------------------------- -/// Class LLFolderView -///---------------------------------------------------------------------------- -LLFolderView::Params::Params() -: task_id("task_id"), - title("title"), - use_label_suffix("use_label_suffix"), - allow_multiselect("allow_multiselect", true), - show_empty_message("show_empty_message", true), - use_ellipses("use_ellipses", false) -{ - folder_indentation = -4; -} - - -// Default constructor -LLFolderView::LLFolderView(const Params& p) -: LLFolderViewFolder(p), - mScrollContainer( NULL ), - mPopupMenuHandle(), - mAllowMultiSelect(p.allow_multiselect), - mShowEmptyMessage(p.show_empty_message), - mShowFolderHierarchy(FALSE), - mSourceID(p.task_id), - mRenameItem( NULL ), - mNeedsScroll( FALSE ), - mUseLabelSuffix(p.use_label_suffix), - mPinningSelectedItem(FALSE), - mNeedsAutoSelect( FALSE ), - mAutoSelectOverride(FALSE), - mNeedsAutoRename(FALSE), - mShowSelectionContext(FALSE), - mShowSingleSelection(FALSE), - mArrangeGeneration(0), - mSignalSelectCallback(0), - mMinWidth(0), - mDragAndDropThisFrame(FALSE), - mCallbackRegistrar(NULL), - mParentPanel(p.parent_panel), - mUseEllipses(p.use_ellipses), - mDraggingOverItem(NULL), - mStatusTextBox(NULL), - mShowItemLinkOverlays(p.show_item_link_overlays), - mViewModel(p.view_model) -{ - mViewModel->setFolderView(this); - mRoot = this; - - LLRect rect = p.rect; - LLRect new_rect(rect.mLeft, rect.mBottom + getRect().getHeight(), rect.mLeft + getRect().getWidth(), rect.mBottom); - setRect( rect ); - reshape(rect.getWidth(), rect.getHeight()); - mAutoOpenItems.setDepth(AUTO_OPEN_STACK_DEPTH); - mAutoOpenCandidate = NULL; - mAutoOpenTimer.stop(); - mKeyboardSelection = FALSE; - mIndentation = p.folder_indentation; - - //clear label - // go ahead and render root folder as usual - // just make sure the label ("Inventory Folder") never shows up - mLabel = LLStringUtil::null; - - // Escape is handled by reverting the rename, not commiting it (default behavior) - LLLineEditor::Params params; - params.name("ren"); - params.rect(rect); - params.font(getLabelFontForStyle(LLFontGL::NORMAL)); - params.max_length.bytes(DB_INV_ITEM_NAME_STR_LEN); - params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); - params.prevalidate_callback(&LLTextValidate::validateASCIIPrintableNoPipe); - params.commit_on_focus_lost(true); - params.visible(false); - mRenamer = LLUICtrlFactory::create (params); - addChild(mRenamer); - - // Textbox - LLTextBox::Params text_p; - LLFontGL* font = getLabelFontForStyle(mLabelStyle); - LLRect new_r = LLRect(rect.mLeft + ICON_PAD, - rect.mTop - TEXT_PAD, - rect.mRight, - rect.mTop - TEXT_PAD - font->getLineHeight()); - text_p.rect(new_r); - text_p.name(std::string(p.name)); - text_p.font(font); - text_p.visible(false); - text_p.parse_urls(true); - text_p.wrap(true); // allow multiline text. See EXT-7564, EXT-7047 - // set text padding the same as in People panel. EXT-7047, EXT-4837 - text_p.h_pad(STATUS_TEXT_HPAD); - text_p.v_pad(STATUS_TEXT_VPAD); - mStatusTextBox = LLUICtrlFactory::create (text_p); - mStatusTextBox->setFollowsLeft(); - mStatusTextBox->setFollowsTop(); - //addChild(mStatusTextBox); - - - // make the popup menu available - LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile("menu_inventory.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); - if (!menu) - { - menu = LLUICtrlFactory::getDefaultWidget("inventory_menu"); - } - menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor")); - mPopupMenuHandle = menu->getHandle(); - - mViewModelItem->openItem(); -} - -// Destroys the object -LLFolderView::~LLFolderView( void ) -{ - closeRenamer(); - - // The release focus call can potentially call the - // scrollcontainer, which can potentially be called with a partly - // destroyed scollcontainer. Just null it out here, and no worries - // about calling into the invalid scroll container. - // Same with the renamer. - mScrollContainer = NULL; - mRenameItem = NULL; - mRenamer = NULL; - mStatusTextBox = NULL; - - mAutoOpenItems.removeAllNodes(); - - if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); - - mAutoOpenItems.removeAllNodes(); - clearSelection(); - mItems.clear(); - mFolders.clear(); - - delete mViewModel; - mViewModel = NULL; -} - -BOOL LLFolderView::canFocusChildren() const -{ - return FALSE; -} - -BOOL LLFolderView::addFolder( LLFolderViewFolder* folder) -{ - LLFolderViewFolder::addFolder(folder); - - // TODO RN: enforce sort order of My Inventory followed by Library - //mFolders.remove(folder); - //if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) - //{ - // mFolders.push_back(folder); - //} - //else - //{ - // mFolders.insert(mFolders.begin(), folder); - //} - - return TRUE; -} - -void LLFolderView::closeAllFolders() -{ - // Close all the folders - setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); - arrangeAll(); -} - -void LLFolderView::openTopLevelFolders() -{ - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - (*fit)->setOpen(TRUE); - } -} - -// This view grows and shrinks to enclose all of its children items and folders. -// *width should be 0 -// conform show folder state works -S32 LLFolderView::arrange( S32* unused_width, S32* unused_height ) -{ - mMinWidth = 0; - S32 target_height; - - LLFolderViewFolder::arrange(&mMinWidth, &target_height); - - LLRect scroll_rect = mScrollContainer->getContentWindowRect(); - reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); - - LLRect new_scroll_rect = mScrollContainer->getContentWindowRect(); - if (new_scroll_rect.getWidth() != scroll_rect.getWidth()) - { - reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); - } - - // move item renamer text field to item's new position - updateRenamerPosition(); - - return llround(mTargetHeight); -} - -static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); - -void LLFolderView::filter( LLFolderViewFilter& filter ) -{ - LLFastTimer t2(FTM_FILTER); - filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - - getViewModelItem()->filter(filter); -} - -void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLRect scroll_rect; - if (mScrollContainer) - { - LLView::reshape(width, height, called_from_parent); - scroll_rect = mScrollContainer->getContentWindowRect(); - } - width = llmax(mMinWidth, scroll_rect.getWidth()); - height = llmax(llround(mCurHeight), scroll_rect.getHeight()); - - // Restrict width within scroll container's width - if (mUseEllipses && mScrollContainer) - { - width = scroll_rect.getWidth(); - } - - LLView::reshape(width, height, called_from_parent); - mReshapeSignal(mSelectedItems, FALSE); -} - -void LLFolderView::addToSelectionList(LLFolderViewItem* item) -{ - if (item->isSelected()) - { - removeFromSelectionList(item); - } - if (mSelectedItems.size()) - { - mSelectedItems.back()->setIsCurSelection(FALSE); - } - item->setIsCurSelection(TRUE); - mSelectedItems.push_back(item); -} - -void LLFolderView::removeFromSelectionList(LLFolderViewItem* item) -{ - if (mSelectedItems.size()) - { - mSelectedItems.back()->setIsCurSelection(FALSE); - } - - selected_items_t::iterator item_iter; - for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end();) - { - if (*item_iter == item) - { - item_iter = mSelectedItems.erase(item_iter); - } - else - { - ++item_iter; - } - } - if (mSelectedItems.size()) - { - mSelectedItems.back()->setIsCurSelection(TRUE); - } -} - -LLFolderViewItem* LLFolderView::getCurSelectedItem( void ) -{ - if(mSelectedItems.size()) - { - LLFolderViewItem* itemp = mSelectedItems.back(); - llassert(itemp->getIsCurSelection()); - return itemp; - } - return NULL; -} - - -// Record the selected item and pass it down the hierachy. -BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) -{ - mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS; - - if( selection == this ) - { - return FALSE; - } - - if( selection && take_keyboard_focus) - { - mParentPanel->setFocus(TRUE); - } - - // clear selection down here because change of keyboard focus can potentially - // affect selection - clearSelection(); - - if(selection) - { - addToSelectionList(selection); - } - - BOOL rv = LLFolderViewFolder::setSelection(selection, openitem, take_keyboard_focus); - if(openitem && selection) - { - selection->getParentFolder()->requestArrange(); - } - - llassert(mSelectedItems.size() <= 1); - - return rv; -} - -BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) -{ - BOOL rv = FALSE; - - // can't select root folder - if(!selection || selection == this) - { - return FALSE; - } - - if (!mAllowMultiSelect) - { - clearSelection(); - } - - selected_items_t::iterator item_iter; - for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) - { - if (*item_iter == selection) - { - break; - } - } - - BOOL on_list = (item_iter != mSelectedItems.end()); - - if(selected && !on_list) - { - addToSelectionList(selection); - } - if(!selected && on_list) - { - removeFromSelectionList(selection); - } - - rv = LLFolderViewFolder::changeSelection(selection, selected); - - mSignalSelectCallback = SIGNAL_KEYBOARD_FOCUS; - - return rv; -} - -static LLFastTimer::DeclareTimer FTM_SANITIZE_SELECTION("Sanitize Selection"); -void LLFolderView::sanitizeSelection() -{ - LLFastTimer _(FTM_SANITIZE_SELECTION); - // store off current item in case it is automatically deselected - // and we want to preserve context - LLFolderViewItem* original_selected_item = getCurSelectedItem(); - - std::vector items_to_remove; - selected_items_t::iterator item_iter; - for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) - { - LLFolderViewItem* item = *item_iter; - - // ensure that each ancestor is open and potentially passes filtering - BOOL visible = item->getViewModelItem()->potentiallyVisible(); // initialize from filter state for this item - // modify with parent open and filters states - LLFolderViewFolder* parent_folder = item->getParentFolder(); - // Move up through parent folders and see what's visible - while(parent_folder) - { - visible = visible && parent_folder->isOpen() && parent_folder->getViewModelItem()->potentiallyVisible(); - parent_folder = parent_folder->getParentFolder(); - } - - // deselect item if any ancestor is closed or didn't pass filter requirements. - if (!visible) - { - items_to_remove.push_back(item); - } - - // disallow nested selections (i.e. folder items plus one or more ancestors) - // could check cached mum selections count and only iterate if there are any - // but that may be a premature optimization. - selected_items_t::iterator other_item_iter; - for (other_item_iter = mSelectedItems.begin(); other_item_iter != mSelectedItems.end(); ++other_item_iter) - { - LLFolderViewItem* other_item = *other_item_iter; - for( parent_folder = other_item->getParentFolder(); parent_folder; parent_folder = parent_folder->getParentFolder()) - { - if (parent_folder == item) - { - // this is a descendent of the current folder, remove from list - items_to_remove.push_back(other_item); - break; - } - } - } - - // Don't allow invisible items (such as root folders) to be selected. - if (item == getRoot()) - { - items_to_remove.push_back(item); - } - } - - std::vector::iterator item_it; - for (item_it = items_to_remove.begin(); item_it != items_to_remove.end(); ++item_it ) - { - changeSelection(*item_it, FALSE); // toggle selection (also removes from list) - } - - // if nothing selected after prior constraints... - if (mSelectedItems.empty()) - { - // ...select first available parent of original selection - LLFolderViewItem* new_selection = NULL; - if (original_selected_item) - { - for(LLFolderViewFolder* parent_folder = original_selected_item->getParentFolder(); - parent_folder; - parent_folder = parent_folder->getParentFolder()) - { - if (parent_folder->getViewModelItem()->potentiallyVisible()) - { - // give initial selection to first ancestor folder that potentially passes the filter - if (!new_selection) - { - new_selection = parent_folder; - } - - // if any ancestor folder of original item is closed, move the selection up - // to the highest closed - if (!parent_folder->isOpen()) - { - new_selection = parent_folder; - } - } - } - } - else - { - new_selection = NULL; - } - - if (new_selection) - { - setSelection(new_selection, FALSE, FALSE); - } - } -} - -void LLFolderView::clearSelection() -{ - for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); - item_it != mSelectedItems.end(); - ++item_it) - { - (*item_it)->setUnselected(); - } - - mSelectedItems.clear(); -} - -std::set LLFolderView::getSelectionList() const -{ - std::set selection; - std::copy(mSelectedItems.begin(), mSelectedItems.end(), std::inserter(selection, selection.begin())); - return selection; -} - -BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source) -{ - std::vector types; - uuid_vec_t cargo_ids; - selected_items_t::iterator item_it; - BOOL can_drag = TRUE; - if (!mSelectedItems.empty()) - { - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - EDragAndDropType type = DAD_NONE; - LLUUID id = LLUUID::null; - can_drag = can_drag && (*item_it)->getViewModelItem()->startDrag(&type, &id); - - types.push_back(type); - cargo_ids.push_back(id); - } - - LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, source, mSourceID); - } - return can_drag; -} - -void LLFolderView::commitRename( const LLSD& data ) -{ - finishRenamingItem(); -} - -void LLFolderView::draw() -{ - //LLFontGL* font = getLabelFontForStyle(mLabelStyle); - - // if cursor has moved off of me during drag and drop - // close all auto opened folders - if (!mDragAndDropThisFrame) - { - closeAutoOpenedFolders(); - } - - // while dragging, update selection rendering to reflect single/multi drag status - if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) - { - EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); - if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) - { - setShowSingleSelection(TRUE); - } - else - { - setShowSingleSelection(FALSE); - } - } - else - { - setShowSingleSelection(FALSE); - } - - - if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size()) - { - mSearchString.clear(); - } - - if (hasVisibleChildren()) - { - mStatusTextBox->setVisible( FALSE ); - } - else if (mShowEmptyMessage) - { - mStatusTextBox->setValue(getFolderViewModel()->getStatusText()); - mStatusTextBox->setVisible( TRUE ); - - // firstly reshape message textbox with current size. This is necessary to - // LLTextBox::getTextPixelHeight works properly - const LLRect local_rect = getLocalRect(); - mStatusTextBox->setShape(local_rect); - - // get preferable text height... - S32 pixel_height = mStatusTextBox->getTextPixelHeight(); - bool height_changed = local_rect.getHeight() != pixel_height; - if (height_changed) - { - // ... if it does not match current height, lets rearrange current view. - // This will indirectly call ::arrange and reshape of the status textbox. - // We should call this method to also notify parent about required rect. - // See EXT-7564, EXT-7047. - S32 height = 0; - S32 width = 0; - S32 total_height = arrange( &width, &height ); - notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); - - LLUI::popMatrix(); - LLUI::pushMatrix(); - LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom); - } - } - - // skip over LLFolderViewFolder::draw since we don't want the folder icon, label, - // and arrow for the root folder - LLView::draw(); - - mDragAndDropThisFrame = FALSE; -} - -void LLFolderView::finishRenamingItem( void ) -{ - if(!mRenamer) - { - return; - } - if( mRenameItem ) - { - mRenameItem->rename( mRenamer->getText() ); - } - - closeRenamer(); - - // List is re-sorted alphabetically, so scroll to make sure the selected item is visible. - scrollToShowSelection(); -} - -void LLFolderView::closeRenamer( void ) -{ - if (mRenamer && mRenamer->getVisible()) - { - // Triggers onRenamerLost() that actually closes the renamer. - LLUI::removePopup(mRenamer); - } -} - -bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector& selectedItems) -{ - LLFolderViewItem* item_parent = dynamic_cast(item->getParent()); - - if (item_parent) - { - for(std::vector::const_iterator it = selectedItems.begin(); it != selectedItems.end(); ++it) - { - const LLFolderViewItem* const selected_item = (*it); - - LLFolderViewItem* parent = item_parent; - - while (parent) - { - if (selected_item == parent) - { - return true; - } - - parent = dynamic_cast(parent->getParent()); - } - } - } - - return false; -} - -void LLFolderView::removeSelectedItems() -{ - if(getVisible() && getEnabled()) - { - // just in case we're removing the renaming item. - mRenameItem = NULL; - - // create a temporary structure which we will use to remove - // items, since the removal will futz with internal data - // structures. - std::vector items; - S32 count = mSelectedItems.size(); - if(count == 0) return; - LLFolderViewItem* item = NULL; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - item = *item_it; - if (item && item->isRemovable()) - { - items.push_back(item); - } - else - { - llinfos << "Cannot delete " << item->getName() << llendl; - return; - } - } - - // iterate through the new container. - count = items.size(); - LLUUID new_selection_id; - if(count == 1) - { - LLFolderViewItem* item_to_delete = items[0]; - LLFolderViewFolder* parent = item_to_delete->getParentFolder(); - LLFolderViewItem* new_selection = item_to_delete->getNextOpenNode(FALSE); - if (!new_selection) - { - new_selection = item_to_delete->getPreviousOpenNode(FALSE); - } - if(parent) - { - if (item_to_delete->remove()) - { - // change selection on successful delete - if (new_selection) - { - getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); - } - else - { - getRoot()->setSelection(NULL, mParentPanel->hasFocus()); - } - } - } - arrangeAll(); - } - else if (count > 1) - { - LLDynamicArray listeners; - LLFolderViewModelItem* listener; - LLFolderViewItem* last_item = items[count - 1]; - LLFolderViewItem* new_selection = last_item->getNextOpenNode(FALSE); - while(new_selection && new_selection->isSelected()) - { - new_selection = new_selection->getNextOpenNode(FALSE); - } - if (!new_selection) - { - new_selection = last_item->getPreviousOpenNode(FALSE); - while (new_selection && (new_selection->isSelected() || isDescendantOfASelectedItem(new_selection, items))) - { - new_selection = new_selection->getPreviousOpenNode(FALSE); - } - } - if (new_selection) - { - getRoot()->setSelection(new_selection, new_selection->isOpen(), mParentPanel->hasFocus()); - } - else - { - getRoot()->setSelection(NULL, mParentPanel->hasFocus()); - } - - for(S32 i = 0; i < count; ++i) - { - listener = items[i]->getViewModelItem(); - if(listener && (listeners.find(listener) == LLDynamicArray::FAIL)) - { - listeners.put(listener); - } - } - listener = static_cast(listeners.get(0)); - if(listener) - { - listener->removeBatch(listeners); - } - } - arrangeAll(); - scrollToShowSelection(); - } -} - -// TODO RN: abstract -// open the selected item. -void LLFolderView::openSelectedItems( void ) -{ - //TODO RN: get working again - //if(getVisible() && getEnabled()) - //{ - // if (mSelectedItems.size() == 1) - // { - // mSelectedItems.front()->openItem(); - // } - // else - // { - // LLMultiPreview* multi_previewp = new LLMultiPreview(); - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // // IT_{OBJECT,ATTACHMENT} creates LLProperties - // // floaters; others create LLPreviews. Put - // // each one in the right type of container. - // LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); - // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); - // if (is_prop) - // LLFloater::setFloaterHost(multi_propertiesp); - // else - // LLFloater::setFloaterHost(multi_previewp); - // listener->openItem(); - // } - - // LLFloater::setFloaterHost(NULL); - // // *NOTE: LLMulti* will safely auto-delete when open'd - // // without any children. - // multi_previewp->openFloater(LLSD()); - // multi_propertiesp->openFloater(LLSD()); - // } - //} -} - -void LLFolderView::propertiesSelectedItems( void ) -{ - //TODO RN: get working again - //if(getVisible() && getEnabled()) - //{ - // if (mSelectedItems.size() == 1) - // { - // LLFolderViewItem* folder_item = mSelectedItems.front(); - // if(!folder_item) return; - // folder_item->getViewModelItem()->showProperties(); - // } - // else - // { - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - // LLFloater::setFloaterHost(multi_propertiesp); - - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // (*item_it)->getViewModelItem()->showProperties(); - // } - - // LLFloater::setFloaterHost(NULL); - // multi_propertiesp->openFloater(LLSD()); - // } - //} -} - - -void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) -{ - if ((mAutoOpenItems.check() == item) || - (mAutoOpenItems.getDepth() >= (U32)AUTO_OPEN_STACK_DEPTH) || - item->isOpen()) - { - return; - } - - // close auto-opened folders - LLFolderViewFolder* close_item = mAutoOpenItems.check(); - while (close_item && close_item != item->getParentFolder()) - { - mAutoOpenItems.pop(); - close_item->setOpenArrangeRecursively(FALSE); - close_item = mAutoOpenItems.check(); - } - - item->requestArrange(); - - mAutoOpenItems.push(item); - - item->setOpen(TRUE); - LLRect content_rect = mScrollContainer->getContentWindowRect(); - LLRect constraint_rect(0,content_rect.getHeight(), content_rect.getWidth(), 0); - scrollToShowItem(item, constraint_rect); -} - -void LLFolderView::closeAutoOpenedFolders() -{ - while (mAutoOpenItems.check()) - { - LLFolderViewFolder* close_item = mAutoOpenItems.pop(); - close_item->setOpen(FALSE); - } - - if (mAutoOpenCandidate) - { - mAutoOpenCandidate->setAutoOpenCountdown(0.f); - } - mAutoOpenCandidate = NULL; - mAutoOpenTimer.stop(); -} - -BOOL LLFolderView::autoOpenTest(LLFolderViewFolder* folder) -{ - if (folder && mAutoOpenCandidate == folder) - { - if (mAutoOpenTimer.getStarted()) - { - if (!mAutoOpenCandidate->isOpen()) - { - mAutoOpenCandidate->setAutoOpenCountdown(clamp_rescale(mAutoOpenTimer.getElapsedTimeF32(), 0.f, sAutoOpenTime, 0.f, 1.f)); - } - if (mAutoOpenTimer.getElapsedTimeF32() > sAutoOpenTime) - { - autoOpenItem(folder); - mAutoOpenTimer.stop(); - return TRUE; - } - } - return FALSE; - } - - // otherwise new candidate, restart timer - if (mAutoOpenCandidate) - { - mAutoOpenCandidate->setAutoOpenCountdown(0.f); - } - mAutoOpenCandidate = folder; - mAutoOpenTimer.start(); - return FALSE; -} - -BOOL LLFolderView::canCopy() const -{ - if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) - { - return FALSE; - } - - for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) - { - const LLFolderViewItem* item = *selected_it; - if (!item->getViewModelItem()->isItemCopyable()) - { - return FALSE; - } - } - return TRUE; -} - -// copy selected item -void LLFolderView::copy() -{ - // *NOTE: total hack to clear the inventory clipboard - LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); - if(getVisible() && getEnabled() && (count > 0)) - { - LLFolderViewModelItem* listener = NULL; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - listener = (*item_it)->getViewModelItem(); - if(listener) - { - listener->copyToClipboard(); - } - } - } - mSearchString.clear(); -} - -BOOL LLFolderView::canCut() const -{ - if (!(getVisible() && getEnabled() && (mSelectedItems.size() > 0))) - { - return FALSE; - } - - for (selected_items_t::const_iterator selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) - { - const LLFolderViewItem* item = *selected_it; - const LLFolderViewModelItem* listener = item->getViewModelItem(); - - if (!listener || !listener->isItemRemovable()) - { - return FALSE; - } - } - return TRUE; -} - -void LLFolderView::cut() -{ - // clear the inventory clipboard - LLClipboard::instance().reset(); - S32 count = mSelectedItems.size(); - if(getVisible() && getEnabled() && (count > 0)) - { - LLFolderViewModelItem* listener = NULL; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - listener = (*item_it)->getViewModelItem(); - if(listener) - { - listener->cutToClipboard(); - listener->removeItem(); - } - } - } - mSearchString.clear(); -} - -BOOL LLFolderView::canPaste() const -{ - if (mSelectedItems.empty()) - { - return FALSE; - } - - if(getVisible() && getEnabled()) - { - for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); - item_it != mSelectedItems.end(); ++item_it) - { - // *TODO: only check folders and parent folders of items - const LLFolderViewItem* item = (*item_it); - const LLFolderViewModelItem* listener = item->getViewModelItem(); - if(!listener || !listener->isClipboardPasteable()) - { - const LLFolderViewFolder* folderp = item->getParentFolder(); - listener = folderp->getViewModelItem(); - if (!listener || !listener->isClipboardPasteable()) - { - return FALSE; - } - } - } - return TRUE; - } - return FALSE; -} - -// paste selected item -void LLFolderView::paste() -{ - if(getVisible() && getEnabled()) - { - // find set of unique folders to paste into - std::set folder_set; - - selected_items_t::iterator selected_it; - for (selected_it = mSelectedItems.begin(); selected_it != mSelectedItems.end(); ++selected_it) - { - LLFolderViewItem* item = *selected_it; - LLFolderViewFolder* folder = dynamic_cast(item); - if (folder == NULL) - { - item = item->getParentFolder(); - } - folder_set.insert(folder); - } - - std::set::iterator set_iter; - for(set_iter = folder_set.begin(); set_iter != folder_set.end(); ++set_iter) - { - LLFolderViewModelItem* listener = (*set_iter)->getViewModelItem(); - if(listener && listener->isClipboardPasteable()) - { - listener->pasteFromClipboard(); - } - } - } - mSearchString.clear(); -} - -// public rename functionality - can only start the process -void LLFolderView::startRenamingSelectedItem( void ) -{ - // make sure selection is visible - scrollToShowSelection(); - - S32 count = mSelectedItems.size(); - LLFolderViewItem* item = NULL; - if(count > 0) - { - item = mSelectedItems.front(); - } - if(getVisible() && getEnabled() && (count == 1) && item && item->getViewModelItem() && - item->getViewModelItem()->isItemRenameable()) - { - mRenameItem = item; - - updateRenamerPosition(); - - - mRenamer->setText(item->getName()); - mRenamer->selectAll(); - mRenamer->setVisible( TRUE ); - // set focus will fail unless item is visible - mRenamer->setFocus( TRUE ); - mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this)); - LLUI::addPopup(mRenamer); - } -} - -BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) -{ - BOOL handled = FALSE; - - // SL-51858: Key presses are not being passed to the Popup menu. - // A proper fix is non-trivial so instead just close the menu. - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu && menu->isOpen()) - { - LLMenuGL::sMenuContainer->hideMenus(); - } - - LLView *item = NULL; - if (getChildCount() > 0) - { - item = *(getChildList()->begin()); - } - - switch( key ) - { - case KEY_F2: - mSearchString.clear(); - startRenamingSelectedItem(); - handled = TRUE; - break; - - case KEY_RETURN: - if (mask == MASK_NONE) - { - if( mRenameItem && mRenamer->getVisible() ) - { - finishRenamingItem(); - mSearchString.clear(); - handled = TRUE; - } - else - { - LLFolderView::openSelectedItems(); - handled = TRUE; - } - } - break; - - case KEY_ESCAPE: - if( mRenameItem && mRenamer->getVisible() ) - { - closeRenamer(); - handled = TRUE; - } - mSearchString.clear(); - break; - - case KEY_PAGE_UP: - mSearchString.clear(); - mScrollContainer->pageUp(30); - handled = TRUE; - break; - - case KEY_PAGE_DOWN: - mSearchString.clear(); - mScrollContainer->pageDown(30); - handled = TRUE; - break; - - case KEY_HOME: - mSearchString.clear(); - mScrollContainer->goToTop(); - handled = TRUE; - break; - - case KEY_END: - mSearchString.clear(); - mScrollContainer->goToBottom(); - break; - - case KEY_DOWN: - if((mSelectedItems.size() > 0) && mScrollContainer) - { - LLFolderViewItem* last_selected = getCurSelectedItem(); - - if (!mKeyboardSelection) - { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; - } - - LLFolderViewItem* next = NULL; - if (mask & MASK_SHIFT) - { - // don't shift select down to children of folders (they are implicitly selected through parent) - next = last_selected->getNextOpenNode(FALSE); - if (next) - { - if (next->isSelected()) - { - // shrink selection - getRoot()->changeSelection(last_selected, FALSE); - } - else if (last_selected->getParentFolder() == next->getParentFolder()) - { - // grow selection - getRoot()->changeSelection(next, TRUE); - } - } - } - else - { - next = last_selected->getNextOpenNode(); - if( next ) - { - if (next == last_selected) - { - //special case for LLAccordionCtrl - if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed - { - clearSelection(); - return TRUE; - } - return FALSE; - } - setSelection( next, FALSE, TRUE ); - } - else - { - //special case for LLAccordionCtrl - if(notifyParent(LLSD().with("action","select_next")) > 0 )//message was processed - { - clearSelection(); - return TRUE; - } - return FALSE; - } - } - scrollToShowSelection(); - mSearchString.clear(); - handled = TRUE; - } - break; - - case KEY_UP: - if((mSelectedItems.size() > 0) && mScrollContainer) - { - LLFolderViewItem* last_selected = mSelectedItems.back(); - - if (!mKeyboardSelection) - { - setSelection(last_selected, FALSE, TRUE); - mKeyboardSelection = TRUE; - } - - LLFolderViewItem* prev = NULL; - if (mask & MASK_SHIFT) - { - // don't shift select down to children of folders (they are implicitly selected through parent) - prev = last_selected->getPreviousOpenNode(FALSE); - if (prev) - { - if (prev->isSelected()) - { - // shrink selection - getRoot()->changeSelection(last_selected, FALSE); - } - else if (last_selected->getParentFolder() == prev->getParentFolder()) - { - // grow selection - getRoot()->changeSelection(prev, TRUE); - } - } - } - else - { - prev = last_selected->getPreviousOpenNode(); - if( prev ) - { - if (prev == this) - { - // If case we are in accordion tab notify parent to go to the previous accordion - if(notifyParent(LLSD().with("action","select_prev")) > 0 )//message was processed - { - clearSelection(); - return TRUE; - } - - return FALSE; - } - setSelection( prev, FALSE, TRUE ); - } - } - scrollToShowSelection(); - mSearchString.clear(); - - handled = TRUE; - } - break; - - case KEY_RIGHT: - if(mSelectedItems.size()) - { - LLFolderViewItem* last_selected = getCurSelectedItem(); - last_selected->setOpen( TRUE ); - mSearchString.clear(); - handled = TRUE; - } - break; - - case KEY_LEFT: - if(mSelectedItems.size()) - { - LLFolderViewItem* last_selected = getCurSelectedItem(); - LLFolderViewItem* parent_folder = last_selected->getParentFolder(); - if (!last_selected->isOpen() && parent_folder && parent_folder->getParentFolder()) - { - setSelection(parent_folder, FALSE, TRUE); - } - else - { - last_selected->setOpen( FALSE ); - } - mSearchString.clear(); - scrollToShowSelection(); - handled = TRUE; - } - break; - } - - if (!handled && mParentPanel->hasFocus()) - { - if (key == KEY_BACKSPACE) - { - mSearchTimer.reset(); - if (mSearchString.size()) - { - mSearchString.erase(mSearchString.size() - 1, 1); - } - search(getCurSelectedItem(), mSearchString, FALSE); - handled = TRUE; - } - } - - return handled; -} - - -BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) -{ - if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL - { - return FALSE; - } - - if (uni_char > 0x7f) - { - llwarns << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << llendl; - return FALSE; - } - - BOOL handled = FALSE; - if (mParentPanel->hasFocus()) - { - // SL-51858: Key presses are not being passed to the Popup menu. - // A proper fix is non-trivial so instead just close the menu. - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu && menu->isOpen()) - { - LLMenuGL::sMenuContainer->hideMenus(); - } - - //do text search - if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout")) - { - mSearchString.clear(); - } - mSearchTimer.reset(); - if (mSearchString.size() < 128) - { - mSearchString += uni_char; - } - search(getCurSelectedItem(), mSearchString, FALSE); - - handled = TRUE; - } - - return handled; -} - - -BOOL LLFolderView::canDoDelete() const -{ - if (mSelectedItems.size() == 0) return FALSE; - - for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - if (!(*item_it)->getViewModelItem()->isItemRemovable()) - { - return FALSE; - } - } - return TRUE; -} - -void LLFolderView::doDelete() -{ - if(mSelectedItems.size() > 0) - { - removeSelectedItems(); - } -} - - -BOOL LLFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) -{ - mKeyboardSelection = FALSE; - mSearchString.clear(); - - mParentPanel->setFocus(TRUE); - - LLEditMenuHandler::gEditMenuHandler = this; - - return LLView::handleMouseDown( x, y, mask ); -} - -BOOL LLFolderView::search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward) -{ - // get first selected item - LLFolderViewItem* search_item = first_item; - - // make sure search string is upper case - std::string upper_case_string = search_string; - LLStringUtil::toUpper(upper_case_string); - - // if nothing selected, select first item in folder - if (!search_item) - { - // start from first item - search_item = getNextFromChild(NULL); - } - - // search over all open nodes for first substring match (with wrapping) - BOOL found = FALSE; - LLFolderViewItem* original_search_item = search_item; - do - { - // wrap at end - if (!search_item) - { - if (backward) - { - search_item = getPreviousFromChild(NULL); - } - else - { - search_item = getNextFromChild(NULL); - } - if (!search_item || search_item == original_search_item) - { - break; - } - } - - const std::string current_item_label(search_item->getViewModelItem()->getSearchableName()); - S32 search_string_length = llmin(upper_case_string.size(), current_item_label.size()); - if (!current_item_label.compare(0, search_string_length, upper_case_string)) - { - found = TRUE; - break; - } - if (backward) - { - search_item = search_item->getPreviousOpenNode(); - } - else - { - search_item = search_item->getNextOpenNode(); - } - - } while(search_item != original_search_item); - - - if (found) - { - setSelection(search_item, FALSE, TRUE); - scrollToShowSelection(); - } - - return found; -} - -BOOL LLFolderView::handleDoubleClick( S32 x, S32 y, MASK mask ) -{ - // skip LLFolderViewFolder::handleDoubleClick() - return LLView::handleDoubleClick( x, y, mask ); -} - -BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) -{ - // all user operations move keyboard focus to inventory - // this way, we know when to stop auto-updating a search - mParentPanel->setFocus(TRUE); - - BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; - S32 count = mSelectedItems.size(); - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if ( handled - && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible - && menu ) - { - if (mCallbackRegistrar) - mCallbackRegistrar->pushScope(); - - updateMenuOptions(menu); - - menu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, menu, x, y); - if (mCallbackRegistrar) - mCallbackRegistrar->popScope(); - } - else - { - if (menu && menu->getVisible()) - { - menu->setVisible(FALSE); - } - setSelection(NULL, FALSE, TRUE); - } - return handled; -} - -// Add "--no options--" if the menu is completely blank. -BOOL LLFolderView::addNoOptions(LLMenuGL* menu) const -{ - const std::string nooptions_str = "--no options--"; - LLView *nooptions_item = NULL; - - const LLView::child_list_t *list = menu->getChildList(); - for (LLView::child_list_t::const_iterator itor = list->begin(); - itor != list->end(); - ++itor) - { - LLView *menu_item = (*itor); - if (menu_item->getVisible()) - { - return FALSE; - } - std::string name = menu_item->getName(); - if (menu_item->getName() == nooptions_str) - { - nooptions_item = menu_item; - } - } - if (nooptions_item) - { - nooptions_item->setVisible(TRUE); - nooptions_item->setEnabled(FALSE); - return TRUE; - } - return FALSE; -} - -BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask ) -{ - return LLView::handleHover( x, y, mask ); -} - -BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - mDragAndDropThisFrame = TRUE; - // have children handle it first - BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, - accept, tooltip_msg); - - // when drop is not handled by child, it should be handled - // by the folder which is the hierarchy root. - if (!handled) - { - handled = LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } - - return handled; -} - -void LLFolderView::deleteAllChildren() -{ - closeRenamer(); - if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); - mPopupMenuHandle = LLHandle(); - mScrollContainer = NULL; - mRenameItem = NULL; - mRenamer = NULL; - mStatusTextBox = NULL; - - clearSelection(); - LLView::deleteAllChildren(); -} - -void LLFolderView::scrollToShowSelection() -{ - if ( mSelectedItems.size() ) - { - mNeedsScroll = TRUE; - } -} - -// If the parent is scroll container, scroll it to make the selection -// is maximally visible. -void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect) -{ - if (!mScrollContainer) return; - - // don't scroll to items when mouse is being used to scroll/drag and drop - if (gFocusMgr.childHasMouseCapture(mScrollContainer)) - { - mNeedsScroll = FALSE; - return; - } - - // if item exists and is in visible portion of parent folder... - if(item) - { - LLRect local_rect = item->getLocalRect(); - LLRect item_scrolled_rect; // item position relative to display area of scroller - LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect(); - - S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); - S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight(); - // when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder - S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); - - // get portion of item that we want to see... - LLRect item_local_rect = LLRect(item->getIndentation(), - local_rect.getHeight(), - llmin(MIN_ITEM_WIDTH_VISIBLE, local_rect.getWidth()), - llmax(0, local_rect.getHeight() - max_height_to_show)); - - LLRect item_doc_rect; - - item->localRectToOtherView(item_local_rect, &item_doc_rect, this); - - mScrollContainer->scrollToShowRect( item_doc_rect, constraint_rect ); - - } -} - -LLRect LLFolderView::getVisibleRect() -{ - S32 visible_height = mScrollContainer->getRect().getHeight(); - S32 visible_width = mScrollContainer->getRect().getWidth(); - LLRect visible_rect; - visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height); - return visible_rect; -} - -BOOL LLFolderView::getShowSelectionContext() -{ - if (mShowSelectionContext) - { - return TRUE; - } - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu && menu->getVisible()) - { - return TRUE; - } - return FALSE; -} - -void LLFolderView::setShowSingleSelection(BOOL show) -{ - if (show != mShowSingleSelection) - { - mMultiSelectionFadeTimer.reset(); - mShowSingleSelection = show; - } -} - -static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select"); -static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); - -// Main idle routine -void LLFolderView::update() -{ - // If this is associated with the user's inventory, don't do anything - // until that inventory is loaded up. - LLFastTimer t2(FTM_INVENTORY); - - if (getFolderViewModel()->getFilter()->isModified() && getFolderViewModel()->getFilter()->isNotDefault()) - { - mNeedsAutoSelect = TRUE; - } - getFolderViewModel()->getFilter()->clearModified(); - - // filter to determine visibility before arranging - filter(*(getFolderViewModel()->getFilter())); - - // automatically show matching items, and select first one if we had a selection - if (mNeedsAutoSelect) - { - LLFastTimer t3(FTM_AUTO_SELECT); - // select new item only if a filtered item not currently selected - LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); - if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getViewModelItem()->potentiallyVisible())) - { - // these are named variables to get around gcc not binding non-const references to rvalues - // and functor application is inherently non-const to allow for stateful functors - LLSelectFirstFilteredItem functor; - applyFunctorRecursively(functor); - } - - // Open filtered folders for folder views with mAutoSelectOverride=TRUE. - // Used by LLPlacesFolderView. - if (getFolderViewModel()->getFilter()->showAllResults()) - { - // these are named variables to get around gcc not binding non-const references to rvalues - // and functor application is inherently non-const to allow for stateful functors - LLOpenFilteredFolders functor; - applyFunctorRecursively(functor); - } - - scrollToShowSelection(); - } - - BOOL filter_finished = getViewModelItem()->passedFilter() - && mViewModel->contentsReady(); - if (filter_finished - || gFocusMgr.childHasKeyboardFocus(getParent()) // assume we are inside a scroll container - || gFocusMgr.childHasMouseCapture(getParent())) - { - // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process - mNeedsAutoSelect = FALSE; - } - - - // during filtering process, try to pin selected item's location on screen - // this will happen when searching your inventory and when new items arrive - if (!filter_finished) - { - // calculate rectangle to pin item to at start of animated rearrange - if (!mPinningSelectedItem && !mSelectedItems.empty()) - { - // lets pin it! - mPinningSelectedItem = TRUE; - - LLRect visible_content_rect = mScrollContainer->getVisibleContentRect(); - LLFolderViewItem* selected_item = mSelectedItems.back(); - - LLRect item_rect; - selected_item->localRectToOtherView(selected_item->getLocalRect(), &item_rect, this); - // if item is visible in scrolled region - if (visible_content_rect.overlaps(item_rect)) - { - // then attempt to keep it in same place on screen - mScrollConstraintRect = item_rect; - mScrollConstraintRect.translate(-visible_content_rect.mLeft, -visible_content_rect.mBottom); - } - else - { - // otherwise we just want it onscreen somewhere - LLRect content_rect = mScrollContainer->getContentWindowRect(); - mScrollConstraintRect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); - } - } - } - else - { - // stop pinning selected item after folders stop rearranging - if (!needsArrange()) - { - mPinningSelectedItem = FALSE; - } - } - - LLRect constraint_rect; - if (mPinningSelectedItem) - { - // use last known constraint rect for pinned item - constraint_rect = mScrollConstraintRect; - } - else - { - // during normal use (page up/page down, etc), just try to fit item on screen - LLRect content_rect = mScrollContainer->getContentWindowRect(); - constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); - } - - BOOL is_visible = isInVisibleChain(); - - if ( is_visible ) - { - sanitizeSelection(); - if( needsArrange() ) - { - S32 height = 0; - S32 width = 0; - S32 total_height = arrange( &width, &height ); - notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); - } - } - - if (mSelectedItems.size() && mNeedsScroll) - { - scrollToShowItem(mSelectedItems.back(), constraint_rect); - // continue scrolling until animated layout change is done - if (filter_finished - && (!needsArrange() || !is_visible)) - { - mNeedsScroll = FALSE; - } - } - - if (mSignalSelectCallback) - { - //RN: we use keyboard focus as a proxy for user-explicit actions - BOOL take_keyboard_focus = (mSignalSelectCallback == SIGNAL_KEYBOARD_FOCUS); - mSelectSignal(mSelectedItems, take_keyboard_focus); - } - mSignalSelectCallback = FALSE; -} - -void LLFolderView::dumpSelectionInformation() -{ - llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; - llinfos << "****************************************" << llendl; - selected_items_t::iterator item_it; - for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - { - llinfos << " " << (*item_it)->getName() << llendl; - } - llinfos << "****************************************" << llendl; -} - -void LLFolderView::updateRenamerPosition() -{ - if(mRenameItem) - { - // See also LLFolderViewItem::draw() - S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mRenameItem->getIndentation(); - S32 y = mRenameItem->getRect().getHeight() - mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; - mRenameItem->localPointToScreen( x, y, &x, &y ); - screenPointToLocal( x, y, &x, &y ); - mRenamer->setOrigin( x, y ); - - LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0); - if (mScrollContainer) - { - scroller_rect = mScrollContainer->getContentWindowRect(); - } - - S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH); - S32 height = mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD; - mRenamer->reshape( width, height, TRUE ); - } -} - -// Update visibility and availability (i.e. enabled/disabled) of context menu items. -void LLFolderView::updateMenuOptions(LLMenuGL* menu) -{ - const LLView::child_list_t *list = menu->getChildList(); - - LLView::child_list_t::const_iterator menu_itor; - for (menu_itor = list->begin(); menu_itor != list->end(); ++menu_itor) - { - (*menu_itor)->setVisible(FALSE); - (*menu_itor)->pushVisible(TRUE); - (*menu_itor)->setEnabled(TRUE); - } - - // Successively filter out invalid options - - U32 flags = FIRST_SELECTED_ITEM; - for (selected_items_t::iterator item_itor = mSelectedItems.begin(); - item_itor != mSelectedItems.end(); - ++item_itor) - { - LLFolderViewItem* selected_item = (*item_itor); - selected_item->buildContextMenu(*menu, flags); - flags = 0x0; - } - - addNoOptions(menu); -} - -// Refresh the context menu (that is already shown). -void LLFolderView::updateMenu() -{ - LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if (menu && menu->getVisible()) - { - updateMenuOptions(menu); - menu->needsArrange(); // update menu height if needed - } -} - -bool LLFolderView::selectFirstItem() -{ - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();++iter) - { - LLFolderViewFolder* folder = (*iter ); - if (folder->getVisible()) - { - LLFolderViewItem* itemp = folder->getNextFromChild(0,true); - if(itemp) - setSelection(itemp,FALSE,TRUE); - return true; - } - - } - for(items_t::iterator iit = mItems.begin(); - iit != mItems.end(); ++iit) - { - LLFolderViewItem* itemp = (*iit); - if (itemp->getVisible()) - { - setSelection(itemp,FALSE,TRUE); - return true; - } - } - return false; -} -bool LLFolderView::selectLastItem() -{ - for(items_t::reverse_iterator iit = mItems.rbegin(); - iit != mItems.rend(); ++iit) - { - LLFolderViewItem* itemp = (*iit); - if (itemp->getVisible()) - { - setSelection(itemp,FALSE,TRUE); - return true; - } - } - for (folders_t::reverse_iterator iter = mFolders.rbegin(); - iter != mFolders.rend();++iter) - { - LLFolderViewFolder* folder = (*iter); - if (folder->getVisible()) - { - LLFolderViewItem* itemp = folder->getPreviousFromChild(0,true); - if(itemp) - setSelection(itemp,FALSE,TRUE); - return true; - } - } - return false; -} - - -S32 LLFolderView::notify(const LLSD& info) -{ - if(info.has("action")) - { - std::string str_action = info["action"]; - if(str_action == "select_first") - { - setFocus(true); - selectFirstItem(); - scrollToShowSelection(); - return 1; - - } - else if(str_action == "select_last") - { - setFocus(true); - selectLastItem(); - scrollToShowSelection(); - return 1; - } - } - return 0; -} - - -///---------------------------------------------------------------------------- -/// Local function definitions -///---------------------------------------------------------------------------- - -void LLFolderView::onRenamerLost() -{ - if (mRenamer && mRenamer->getVisible()) - { - mRenamer->setVisible(FALSE); - - // will commit current name (which could be same as original name) - mRenamer->setFocus(FALSE); - } - - if( mRenameItem ) - { - setSelection( mRenameItem, TRUE ); - mRenameItem = NULL; - } -} - -S32 LLFolderView::getItemHeight() -{ - if(!hasVisibleChildren()) - { - //We need to display status textbox, let's reserve some place for it - return llmax(0, mStatusTextBox->getTextPixelHeight()); - } - return 0; -} diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h deleted file mode 100644 index 78f1d8aff2..0000000000 --- a/indra/newview/llfolderview.h +++ /dev/null @@ -1,393 +0,0 @@ -/** - * @file llfolderview.h - * @brief Definition of the folder view collection of classes. - * - * $LicenseInfo:firstyear=2001&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$ - */ - -/** - * - * The folder view collection of classes provides an interface for - * making a 'folder view' similar to the way the a single pane file - * folder interface works. - * - */ - -#ifndef LL_LLFOLDERVIEW_H -#define LL_LLFOLDERVIEW_H - -#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder - -#include "lluictrl.h" -#include "v4color.h" -#include "stdenums.h" -#include "lldepthstack.h" -#include "lleditmenuhandler.h" -#include "llfontgl.h" -#include "llscrollcontainer.h" -#include "lltooldraganddrop.h" - -class LLFolderViewModelInterface; -class LLFolderViewFolder; -class LLFolderViewItem; -class LLFolderViewFilter; -class LLPanel; -class LLLineEditor; -class LLMenuGL; -class LLUICtrl; -class LLTextBox; - -/** - * Class LLFolderViewScrollContainer - * - * A scroll container which provides the information about the height - * of currently displayed folder view contents. - * Used for updating vertical scroll bar visibility in inventory panel. - * See LLScrollContainer::calcVisibleSize(). - */ -class LLFolderViewScrollContainer : public LLScrollContainer -{ -public: - /*virtual*/ ~LLFolderViewScrollContainer() {}; - /*virtual*/ const LLRect getScrolledViewRect() const; - -protected: - LLFolderViewScrollContainer(const LLScrollContainer::Params& p); - friend class LLUICtrlFactory; -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFolderView -// -// The LLFolderView represents the root level folder view object. -// It manages the screen region of the folder view. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler -{ -public: - struct Params : public LLInitParam::Block - { - Mandatory parent_panel; - Optional task_id; - Optional title; - Optional use_label_suffix, - allow_multiselect, - show_empty_message, - use_ellipses, - show_item_link_overlays; - Mandatory view_model; - - Params(); - }; - - friend class LLFolderViewScrollContainer; - - LLFolderView(const Params&); - virtual ~LLFolderView( void ); - - virtual BOOL canFocusChildren() const; - - virtual const LLFolderView* getRoot() const { return this; } - virtual LLFolderView* getRoot() { return this; } - - LLFolderViewModelInterface* getFolderViewModel() { return mViewModel; } - const LLFolderViewModelInterface* getFolderViewModel() const { return mViewModel; } - - void setFilterPermMask(PermissionMask filter_perm_mask); - - typedef boost::signals2::signal& items, BOOL user_action)> signal_t; - void setSelectCallback(const signal_t::slot_type& cb) { mSelectSignal.connect(cb); } - void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } - - bool getAllowMultiSelect() { return mAllowMultiSelect; } - - // Close all folders in the view - void closeAllFolders(); - void openTopLevelFolders(); - - virtual BOOL addFolder( LLFolderViewFolder* folder); - - // Find width and height of this object and its children. Also - // makes sure that this view and its children are the right size. - virtual S32 arrange( S32* width, S32* height ); - virtual S32 getItemHeight(); - - void arrangeAll() { mArrangeGeneration++; } - S32 getArrangeGeneration() { return mArrangeGeneration; } - - // applies filters to control visibility of items - virtual void filter( LLFolderViewFilter& filter); - - // Get the last selected item - virtual LLFolderViewItem* getCurSelectedItem( void ); - - // Record the selected item and pass it down the hierarchy. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus = TRUE); - - // This method is used to toggle the selection of an item. Walks - // children, and keeps track of selected objects. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - - virtual std::set getSelectionList() const; - S32 getNumSelectedItems() { return mSelectedItems.size(); } - - // Make sure if ancestor is selected, descendants are not - void sanitizeSelection(); - virtual void clearSelection(); - void addToSelectionList(LLFolderViewItem* item); - void removeFromSelectionList(LLFolderViewItem* item); - - BOOL startDrag(LLToolDragAndDrop::ESource source); - void setDragAndDropThisFrame() { mDragAndDropThisFrame = TRUE; } - void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; } - LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; } - - // Deletion functionality - void removeSelectedItems(); - - // Open the selected item - void openSelectedItems( void ); - void propertiesSelectedItems( void ); - - void autoOpenItem(LLFolderViewFolder* item); - void closeAutoOpenedFolders(); - BOOL autoOpenTest(LLFolderViewFolder* item); - BOOL isOpen() const { return TRUE; } // root folder always open - - // Copy & paste - virtual void copy(); - virtual BOOL canCopy() const; - - virtual void cut(); - virtual BOOL canCut() const; - - virtual void paste(); - virtual BOOL canPaste() const; - - virtual void doDelete(); - virtual BOOL canDoDelete() const; - - // Public rename functionality - can only start the process - void startRenamingSelectedItem( void ); - - // LLView functionality - ///*virtual*/ BOOL handleKey( KEY key, MASK mask, BOOL called_from_parent ); - /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleHover( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) { setShowSelectionContext(FALSE); } - virtual void draw(); - virtual void deleteAllChildren(); - - void scrollToShowSelection(); - void scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect); - void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; } - LLRect getVisibleRect(); - - BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); - void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; } - BOOL getShowSelectionContext(); - void setShowSingleSelection(BOOL show); - BOOL getShowSingleSelection() { return mShowSingleSelection; } - F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } - bool getUseEllipses() { return mUseEllipses; } - - void update(); // needs to be called periodically (e.g. once per frame) - - BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } - BOOL needsAutoRename() { return mNeedsAutoRename; } - void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } - void setPinningSelectedItem(BOOL val) { mPinningSelectedItem = val; } - void setAutoSelectOverride(BOOL val) { mAutoSelectOverride = val; } - - bool showItemLinkOverlays() { return mShowItemLinkOverlays; } - - void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; } - - LLPanel* getParentPanel() { return mParentPanel; } - // DEBUG only - void dumpSelectionInformation(); - - virtual S32 notify(const LLSD& info) ; - - bool useLabelSuffix() { return mUseLabelSuffix; } - void updateMenu(); - -private: - void updateMenuOptions(LLMenuGL* menu); - void updateRenamerPosition(); - -protected: - LLScrollContainer* mScrollContainer; // NULL if this is not a child of a scroll container. - - void commitRename( const LLSD& data ); - void onRenamerLost(); - - void finishRenamingItem( void ); - void closeRenamer( void ); - - bool selectFirstItem(); - bool selectLastItem(); - - BOOL addNoOptions(LLMenuGL* menu) const; - - -protected: - LLHandle mPopupMenuHandle; - - typedef std::deque selected_items_t; - selected_items_t mSelectedItems; - BOOL mKeyboardSelection; - BOOL mAllowMultiSelect; - BOOL mShowEmptyMessage; - BOOL mShowFolderHierarchy; - LLUUID mSourceID; - - // Renaming variables and methods - LLFolderViewItem* mRenameItem; // The item currently being renamed - LLLineEditor* mRenamer; - - BOOL mNeedsScroll; - BOOL mPinningSelectedItem; - LLRect mScrollConstraintRect; - BOOL mNeedsAutoSelect; - BOOL mAutoSelectOverride; - BOOL mNeedsAutoRename; - bool mUseLabelSuffix; - bool mShowItemLinkOverlays; - - LLDepthStack mAutoOpenItems; - LLFolderViewFolder* mAutoOpenCandidate; - LLFrameTimer mAutoOpenTimer; - LLFrameTimer mSearchTimer; - std::string mSearchString; - BOOL mShowSelectionContext; - BOOL mShowSingleSelection; - LLFrameTimer mMultiSelectionFadeTimer; - S32 mArrangeGeneration; - - signal_t mSelectSignal; - signal_t mReshapeSignal; - S32 mSignalSelectCallback; - S32 mMinWidth; - BOOL mDragAndDropThisFrame; - - LLPanel* mParentPanel; - - LLFolderViewModelInterface* mViewModel; - - /** - * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll. - * NOTE: For now it's used only to cut LLFolderViewItem::mLabel text for Landmarks in Places Panel. - */ - bool mUseEllipses; // See EXT-719 - - /** - * Contains item under mouse pointer while dragging - */ - LLFolderViewItem* mDraggingOverItem; // See EXT-719 - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* mCallbackRegistrar; - -public: - static F32 sAutoOpenTime; - LLTextBox* mStatusTextBox; - -}; - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFolderViewFunctor -// -// Simple abstract base class for applying a functor to folders and -// items in a folder view hierarchy. This is suboptimal for algorithms -// that only work folders or only work on items, but I'll worry about -// that later when it's determined to be too slow. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFolderViewFunctor -{ -public: - virtual ~LLFolderViewFunctor() {} - virtual void doFolder(LLFolderViewFolder* folder) = 0; - virtual void doItem(LLFolderViewItem* item) = 0; -}; - -class LLSelectFirstFilteredItem : public LLFolderViewFunctor -{ -public: - LLSelectFirstFilteredItem() : mItemSelected(FALSE) {} - virtual ~LLSelectFirstFilteredItem() {} - virtual void doFolder(LLFolderViewFolder* folder); - virtual void doItem(LLFolderViewItem* item); - BOOL wasItemSelected() { return mItemSelected; } -protected: - BOOL mItemSelected; -}; - -class LLOpenFilteredFolders : public LLFolderViewFunctor -{ -public: - LLOpenFilteredFolders() {} - virtual ~LLOpenFilteredFolders() {} - virtual void doFolder(LLFolderViewFolder* folder); - virtual void doItem(LLFolderViewItem* item); -}; - -class LLSaveFolderState : public LLFolderViewFunctor -{ -public: - LLSaveFolderState() : mApply(FALSE) {} - virtual ~LLSaveFolderState() {} - virtual void doFolder(LLFolderViewFolder* folder); - virtual void doItem(LLFolderViewItem* item) {} - void setApply(BOOL apply); - void clearOpenFolders() { mOpenFolders.clear(); } -protected: - std::set mOpenFolders; - BOOL mApply; -}; - -class LLOpenFoldersWithSelection : public LLFolderViewFunctor -{ -public: - LLOpenFoldersWithSelection() {} - virtual ~LLOpenFoldersWithSelection() {} - virtual void doFolder(LLFolderViewFolder* folder); - virtual void doItem(LLFolderViewItem* item); -}; - -// Flags for buildContextMenu() -const U32 SUPPRESS_OPEN_ITEM = 0x1; -const U32 FIRST_SELECTED_ITEM = 0x2; - -#endif // LL_LLFOLDERVIEW_H diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp deleted file mode 100644 index dee3fe7218..0000000000 --- a/indra/newview/llfolderviewitem.cpp +++ /dev/null @@ -1,2060 +0,0 @@ -/** -* @file llfolderviewitem.cpp -* @brief Items and folders that can appear in a hierarchical folder view -* -* $LicenseInfo:firstyear=2001&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 "llfolderviewitem.h" - -// viewer includes -#include "llfolderview.h" -#include "llfolderviewmodel.h" -#include "llpanel.h" - -// linden library includes -#include "llclipboard.h" -#include "llfocusmgr.h" // gFocusMgr -#include "lltrans.h" - -///---------------------------------------------------------------------------- -/// Class LLFolderViewItem -///---------------------------------------------------------------------------- - -static LLDefaultChildRegistry::Register r("folder_view_item"); - -// statics -std::map LLFolderViewItem::sFonts; // map of styles to fonts - -// only integers can be initialized in header -const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f; -const F32 LLFolderViewItem::FOLDER_OPEN_TIME_CONSTANT = 0.03f; - -const LLColor4U DEFAULT_WHITE(255, 255, 255); - - -//static -LLFontGL* LLFolderViewItem::getLabelFontForStyle(U8 style) -{ - LLFontGL* rtn = sFonts[style]; - if (!rtn) // grab label font with this style, lazily - { - LLFontDescriptor labelfontdesc("SansSerif", "Small", style); - rtn = LLFontGL::getFont(labelfontdesc); - if (!rtn) - { - rtn = LLFontGL::getFontDefault(); - } - sFonts[style] = rtn; - } - return rtn; -} - -//static -void LLFolderViewItem::initClass() -{ -} - -//static -void LLFolderViewItem::cleanupClass() -{ - sFonts.clear(); -} - - -// NOTE: Optimize this, we call it a *lot* when opening a large inventory -LLFolderViewItem::Params::Params() -: root(), - listener(), - folder_arrow_image("folder_arrow_image"), - folder_indentation("folder_indentation"), - selection_image("selection_image"), - item_height("item_height"), - item_top_pad("item_top_pad"), - creation_date() -{} - -// Default constructor -LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) -: LLView(p), - mLabelWidth(0), - mLabelWidthDirty(false), - mParentFolder( NULL ), - mIsSelected( FALSE ), - mIsCurSelection( FALSE ), - mSelectPending(FALSE), - mLabelStyle( LLFontGL::NORMAL ), - mHasVisibleChildren(FALSE), - mIndentation(0), - mItemHeight(p.item_height), - //TODO RN: create interface for string highlighting - //mStringMatchOffset(std::string::npos), - mControlLabelRotation(0.f), - mDragAndDropTarget(FALSE), - mLabel(p.name), - mRoot(p.root), - mViewModelItem(p.listener), - mIsMouseOverTitle(false) -{ - if (mViewModelItem) - { - mViewModelItem->setFolderViewItem(this); - } -} - -BOOL LLFolderViewItem::postBuild() -{ - refresh(); - return TRUE; -} - -// Destroys the object -LLFolderViewItem::~LLFolderViewItem( void ) -{ - delete mViewModelItem; - mViewModelItem = NULL; -} - -LLFolderView* LLFolderViewItem::getRoot() -{ - return mRoot; -} - -const LLFolderView* LLFolderViewItem::getRoot() const -{ - return mRoot; -} -// Returns true if this object is a child (or grandchild, etc.) of potential_ancestor. -BOOL LLFolderViewItem::isDescendantOf( const LLFolderViewFolder* potential_ancestor ) -{ - LLFolderViewItem* root = this; - while( root->mParentFolder ) - { - if( root->mParentFolder == potential_ancestor ) - { - return TRUE; - } - root = root->mParentFolder; - } - return FALSE; -} - -LLFolderViewItem* LLFolderViewItem::getNextOpenNode(BOOL include_children) -{ - if (!mParentFolder) - { - return NULL; - } - - LLFolderViewItem* itemp = mParentFolder->getNextFromChild( this, include_children ); - while(itemp && !itemp->getVisible()) - { - LLFolderViewItem* next_itemp = itemp->mParentFolder->getNextFromChild( itemp, include_children ); - if (itemp == next_itemp) - { - // hit last item - return itemp->getVisible() ? itemp : this; - } - itemp = next_itemp; - } - - return itemp; -} - -LLFolderViewItem* LLFolderViewItem::getPreviousOpenNode(BOOL include_children) -{ - if (!mParentFolder) - { - return NULL; - } - - LLFolderViewItem* itemp = mParentFolder->getPreviousFromChild( this, include_children ); - - // Skip over items that are invisible or are hidden from the UI. - while(itemp && !itemp->getVisible()) - { - LLFolderViewItem* next_itemp = itemp->mParentFolder->getPreviousFromChild( itemp, include_children ); - if (itemp == next_itemp) - { - // hit first item - return itemp->getVisible() ? itemp : this; - } - itemp = next_itemp; - } - - return itemp; -} - -BOOL LLFolderViewItem::passedFilter(S32 filter_generation) -{ - return getViewModelItem()->passedFilter(filter_generation); -} - -void LLFolderViewItem::refresh() -{ - LLFolderViewModelItem& vmi = *getViewModelItem(); - - mLabel = vmi.getDisplayName(); - - setToolTip(mLabel); - mIcon = vmi.getIcon(); - mIconOpen = vmi.getIconOpen(); - mIconOverlay = vmi.getIconOverlay(); - - if (mRoot->useLabelSuffix()) - { - mLabelStyle = vmi.getLabelStyle(); - mLabelSuffix = vmi.getLabelSuffix(); - } - - //TODO RN: make sure this logic still fires - //std::string searchable_label(mLabel); - //searchable_label.append(mLabelSuffix); - //LLStringUtil::toUpper(searchable_label); - - //if (mSearchableLabel.compare(searchable_label)) - //{ - // mSearchableLabel.assign(searchable_label); - // vmi.dirtyFilter(); - // // some part of label has changed, so overall width has potentially changed, and sort order too - // if (mParentFolder) - // { - // mParentFolder->requestSort(); - // mParentFolder->requestArrange(); - // } - //} - - mLabelWidthDirty = true; - vmi.dirtyFilter(); -} - -// Utility function for LLFolderView -void LLFolderViewItem::arrangeAndSet(BOOL set_selection, - BOOL take_keyboard_focus) -{ - LLFolderView* root = getRoot(); - if (getParentFolder()) - { - getParentFolder()->requestArrange(); - } - if(set_selection) - { - getRoot()->setSelection(this, TRUE, take_keyboard_focus); - if(root) - { - root->scrollToShowSelection(); - } - } -} - - -std::set LLFolderViewItem::getSelectionList() const -{ - std::set selection; - return selection; -} - -// addToFolder() returns TRUE if it succeeds. FALSE otherwise -BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder) -{ - return folder->addItem(this); -} - - -// Finds width and height of this object and its children. Also -// makes sure that this view and its children are the right size. -S32 LLFolderViewItem::arrange( S32* width, S32* height ) -{ - const Params& p = LLUICtrlFactory::getDefaultParams(); - S32 indentation = p.folder_indentation(); - // Only indent deeper items in hierarchy - mIndentation = (getParentFolder()) - ? getParentFolder()->getIndentation() + indentation - : 0; - if (mLabelWidthDirty) - { - mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT; - mLabelWidthDirty = false; - } - - *width = llmax(*width, mLabelWidth + mIndentation); - - // determine if we need to use ellipses to avoid horizontal scroll. EXT-719 - bool use_ellipses = getRoot()->getUseEllipses(); - if (use_ellipses) - { - // limit to set rect to avoid horizontal scrollbar - *width = llmin(*width, getRoot()->getRect().getWidth()); - } - *height = getItemHeight(); - return *height; -} - -S32 LLFolderViewItem::getItemHeight() -{ - return mItemHeight; -} - -// *TODO: This can be optimized a lot by simply recording that it is -// selected in the appropriate places, and assuming that set selection -// means 'deselect' for a leaf item. Do this optimization after -// multiple selection is implemented to make sure it all plays nice -// together. -BOOL LLFolderViewItem::setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus) -{ - if (selection == this && !mIsSelected) - { - selectItem(); - } - else if (mIsSelected) // Deselect everything else. - { - deselectItem(); - } - return mIsSelected; -} - -BOOL LLFolderViewItem::changeSelection(LLFolderViewItem* selection, BOOL selected) -{ - if (selection == this) - { - if (mIsSelected) - { - deselectItem(); - } - else - { - selectItem(); - } - return TRUE; - } - return FALSE; -} - -void LLFolderViewItem::deselectItem(void) -{ - mIsSelected = FALSE; -} - -void LLFolderViewItem::selectItem(void) -{ - if (mIsSelected == FALSE) - { - getViewModelItem()->selectItem(); - mIsSelected = TRUE; - } -} - -BOOL LLFolderViewItem::isMovable() -{ - return getViewModelItem()->isItemMovable(); -} - -BOOL LLFolderViewItem::isRemovable() -{ - return getViewModelItem()->isItemRemovable(); -} - -void LLFolderViewItem::destroyView() -{ - getRoot()->removeFromSelectionList(this); - - if (mParentFolder) - { - // removeView deletes me - mParentFolder->extractItem(this); - } - delete this; -} - -// Call through to the viewed object and return true if it can be -// removed. -//BOOL LLFolderViewItem::removeRecursively(BOOL single_item) -BOOL LLFolderViewItem::remove() -{ - if(!isRemovable()) - { - return FALSE; - } - return getViewModelItem()->removeItem(); -} - -// Build an appropriate context menu for the item. -void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - getViewModelItem()->buildContextMenu(menu, flags); -} - -void LLFolderViewItem::openItem( void ) -{ - getViewModelItem()->openItem(); -} - -void LLFolderViewItem::rename(const std::string& new_name) -{ - if( !new_name.empty() ) - { - getViewModelItem()->renameItem(new_name); - - if(mParentFolder) - { - mParentFolder->requestSort(); - } - } - } - -const std::string& LLFolderViewItem::getName( void ) const -{ - return getViewModelItem()->getName(); -} - -// LLView functionality -BOOL LLFolderViewItem::handleRightMouseDown( S32 x, S32 y, MASK mask ) -{ - if(!mIsSelected) - { - getRoot()->setSelection(this, FALSE); - } - make_ui_sound("UISndClick"); - return TRUE; -} - -BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) -{ - if (LLView::childrenHandleMouseDown(x, y, mask)) - { - return TRUE; - } - - // No handler needed for focus lost since this class has no - // state that depends on it. - gFocusMgr.setMouseCapture( this ); - - if (!mIsSelected) - { - if(mask & MASK_CONTROL) - { - getRoot()->changeSelection(this, !mIsSelected); - } - else if (mask & MASK_SHIFT) - { - getParentFolder()->extendSelectionTo(this); - } - else - { - getRoot()->setSelection(this, FALSE); - } - make_ui_sound("UISndClick"); - } - else - { - mSelectPending = TRUE; - } - - if( isMovable() ) - { - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y ); - LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y ); - } - return TRUE; -} - -BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) -{ - mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); - - if( hasMouseCapture() && isMovable() ) - { - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y ); - BOOL can_drag = TRUE; - if( LLToolDragAndDrop::getInstance()->isOverThreshold( screen_x, screen_y ) ) - { - LLFolderView* root = getRoot(); - - if(root->getCurSelectedItem()) - { - LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_WORLD; - - // *TODO: push this into listener and remove - // dependency on llagent - src = getViewModelItem()->getDragSource(); - - can_drag = root->startDrag(src); - if (can_drag) - { - // if (getViewModelItem()) getViewModelItem()->startDrag(); - // RN: when starting drag and drop, clear out last auto-open - root->autoOpenTest(NULL); - root->setShowSelectionContext(TRUE); - - // Release keyboard focus, so that if stuff is dropped into the - // world, pressing the delete key won't blow away the inventory - // item. - gFocusMgr.setKeyboardFocus(NULL); - - return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); - } - } - } - - if (can_drag) - { - getWindow()->setCursor(UI_CURSOR_ARROW); - } - else - { - getWindow()->setCursor(UI_CURSOR_NOLOCKED); - } - return TRUE; - } - else - { - if (getRoot()) - { - getRoot()->setShowSelectionContext(FALSE); - } - getWindow()->setCursor(UI_CURSOR_ARROW); - // let parent handle this then... - return FALSE; - } -} - - -BOOL LLFolderViewItem::handleDoubleClick( S32 x, S32 y, MASK mask ) -{ - getViewModelItem()->openItem(); - return TRUE; -} - -BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask ) -{ - if (LLView::childrenHandleMouseUp(x, y, mask)) - { - return TRUE; - } - - // if mouse hasn't moved since mouse down... - if ( pointInView(x, y) && mSelectPending ) - { - //...then select - if(mask & MASK_CONTROL) - { - getRoot()->changeSelection(this, !mIsSelected); - } - else if (mask & MASK_SHIFT) - { - getParentFolder()->extendSelectionTo(this); - } - else - { - getRoot()->setSelection(this, FALSE); - } - } - - mSelectPending = FALSE; - - if( hasMouseCapture() ) - { - if (getRoot()) - { - getRoot()->setShowSelectionContext(FALSE); - } - gFocusMgr.setMouseCapture( NULL ); - } - return TRUE; -} - -void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask) -{ - mIsMouseOverTitle = false; -} - -BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - BOOL handled = FALSE; - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); - handled = accepted; - if (accepted) - { - mDragAndDropTarget = TRUE; - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; - } - if(mParentFolder && !handled) - { - // store this item to get it in LLFolderBridge::dragItemIntoFolder on drop event. - mRoot->setDraggingOverItem(this); - handled = mParentFolder->handleDragAndDropFromChild(mask,drop,cargo_type,cargo_data,accept,tooltip_msg); - mRoot->setDraggingOverItem(NULL); - } - if (handled) - { - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewItem" << llendl; - } - - return handled; -} - -void LLFolderViewItem::draw() -{ - static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); - static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); - static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); - static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); - static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); - static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); - static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); - static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); - static LLUIColor sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); - static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); - static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); - - const Params& default_params = LLUICtrlFactory::getDefaultParams(); - const S32 TOP_PAD = default_params.item_top_pad; - const S32 FOCUS_LEFT = 1; - const LLFontGL* font = getLabelFontForStyle(mLabelStyle); - - getViewModelItem()->update(); - - //--------------------------------------------------------------------------------// - // Draw open folder arrow - // - if (hasVisibleChildren() || getViewModelItem()->hasChildren()) - { - LLUIImage* arrow_image = default_params.folder_arrow_image; - gl_draw_scaled_rotated_image( - mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD - TOP_PAD, - ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor); - } - - - //--------------------------------------------------------------------------------// - // Draw highlight for selected items - // - const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE); - const BOOL filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : FALSE); // If we have keyboard focus, draw selection filled - const S32 focus_top = getRect().getHeight(); - const S32 focus_bottom = getRect().getHeight() - mItemHeight; - const bool folder_open = (getRect().getHeight() > mItemHeight + 4); - if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLColor4 bg_color = sHighlightBgColor; - if (!mIsCurSelection) - { - // do time-based fade of extra objects - F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f); - if (getRoot() && getRoot()->getShowSingleSelection()) - { - // fading out - bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, bg_color.mV[VALPHA], 0.f); - } - else - { - // fading in - bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]); - } - } - gl_rect_2d(FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - bg_color, filled); - if (mIsCurSelection) - { - gl_rect_2d(FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - sFocusOutlineColor, FALSE); - } - if (folder_open) - { - gl_rect_2d(FOCUS_LEFT, - focus_bottom + 1, // overlap with bottom edge of above rect - getRect().getWidth() - 2, - 0, - sFocusOutlineColor, FALSE); - if (show_context) - { - gl_rect_2d(FOCUS_LEFT, - focus_bottom + 1, - getRect().getWidth() - 2, - 0, - sHighlightBgColor, TRUE); - } - } - } - else if (mIsMouseOverTitle) - { - gl_rect_2d(FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - sMouseOverColor, FALSE); - } - - //--------------------------------------------------------------------------------// - // Draw DragNDrop highlight - // - if (mDragAndDropTarget) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(FOCUS_LEFT, - focus_top, - getRect().getWidth() - 2, - focus_bottom, - sHighlightBgColor, FALSE); - if (folder_open) - { - gl_rect_2d(FOCUS_LEFT, - focus_bottom + 1, // overlap with bottom edge of above rect - getRect().getWidth() - 2, - 0, - sHighlightBgColor, FALSE); - } - mDragAndDropTarget = FALSE; - } - - //--------------------------------------------------------------------------------// - // Draw open icon - // - const S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD; - if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) // For open folders - { - mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1); - } - else if (mIcon) - { - mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1); - } - - if (mIconOverlay && getRoot()->showItemLinkOverlays()) - { - mIconOverlay->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1); - } - - //--------------------------------------------------------------------------------// - // Exit if no label to draw - // - if (mLabel.empty()) - { - return; - } - - LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; - //TODO RN: implement this in terms of getColor() - //if (highlight_link) color = sLinkColor; - //if (gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor; - - F32 right_x = 0; - F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; - F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation); - - //--------------------------------------------------------------------------------// - // Draw the actual label text - // - font->renderUTF8(mLabel, 0, text_left, y, color, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE); - - //--------------------------------------------------------------------------------// - // Draw label suffix - // - if (!mLabelSuffix.empty()) - { - font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor, - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, S32_MAX, &right_x, FALSE ); - } - - //--------------------------------------------------------------------------------// - // Highlight string match - // - //TODO RN: expose interface for highlighting - //if (mStringMatchOffset != std::string::npos) - //{ - // // don't draw backgrounds for zero-length strings - // S32 filter_string_length = getRoot()->getFilterSubString().size(); - // if (filter_string_length > 0) - // { - // std::string combined_string = mLabel + mLabelSuffix; - // S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; - // S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; - // S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); - // S32 top = getRect().getHeight() - TOP_PAD; - // - // LLUIImage* box_image = default_params.selection_image; - // LLRect box_rect(left, top, right, bottom); - // box_image->draw(box_rect, sFilterBGColor); - // F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset); - // F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; - // font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy, - // sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - // filter_string_length, S32_MAX, &right_x, FALSE ); - // } - //} -} - -const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const - { - return getRoot()->getFolderViewModel(); -} - -LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) - { - return getRoot()->getFolderViewModel(); -} - - -///---------------------------------------------------------------------------- -/// Class LLFolderViewFolder -///---------------------------------------------------------------------------- - -LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): - LLFolderViewItem( p ), - mIsOpen(FALSE), - mExpanderHighlighted(FALSE), - mCurHeight(0.f), - mTargetHeight(0.f), - mAutoOpenCountdown(0.f), - mLastArrangeGeneration( -1 ), - mLastCalculatedWidth(0) -{ -} - -// Destroys the object -LLFolderViewFolder::~LLFolderViewFolder( void ) -{ - // The LLView base class takes care of object destruction. make sure that we - // don't have mouse or keyboard focus - gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() -} - -// addToFolder() returns TRUE if it succeeds. FALSE otherwise -BOOL LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) -{ - return folder->addFolder(this); -} - -static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); - -// Finds width and height of this object and its children. Also -// makes sure that this view and its children are the right size. -S32 LLFolderViewFolder::arrange( S32* width, S32* height ) -{ - // sort before laying out contents - getRoot()->getFolderViewModel()->sort(this); - - LLFastTimer t2(FTM_ARRANGE); - - // evaluate mHasVisibleChildren - mHasVisibleChildren = false; - if (getViewModelItem()->descendantsPassedFilter()) - { - // We have to verify that there's at least one child that's not filtered out - bool found = false; - // Try the items first - for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit) - { - LLFolderViewItem* itemp = (*iit); - found = itemp->passedFilter(); - if (found) - break; - } - if (!found) - { - // If no item found, try the folders - for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) - { - LLFolderViewFolder* folderp = (*fit); - found = folderp->passedFilter(); - if (found) - break; - } - } - - mHasVisibleChildren = found; - } - - // calculate height as a single item (without any children), and reshapes rectangle to match - LLFolderViewItem::arrange( width, height ); - - // clamp existing animated height so as to never get smaller than a single item - mCurHeight = llmax((F32)*height, mCurHeight); - - // initialize running height value as height of single item in case we have no children - F32 running_height = (F32)*height; - F32 target_height = (F32)*height; - - // are my children visible? - if (needsArrange()) - { - // set last arrange generation first, in case children are animating - // and need to be arranged again - mLastArrangeGeneration = getRoot()->getArrangeGeneration(); - if (isOpen()) - { - // Add sizes of children - S32 parent_item_height = getRect().getHeight(); - - for(folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit) - { - LLFolderViewFolder* folderp = (*fit); - folderp->setVisible(folderp->passedFilter()); // passed filter or has descendants that passed filter - - if (folderp->getVisible()) - { - S32 child_width = *width; - S32 child_height = 0; - S32 child_top = parent_item_height - llround(running_height); - - target_height += folderp->arrange( &child_width, &child_height ); - - running_height += (F32)child_height; - *width = llmax(*width, child_width); - folderp->setOrigin( 0, child_top - folderp->getRect().getHeight() ); - } - } - for(items_t::iterator iit = mItems.begin(); - iit != mItems.end(); ++iit) - { - LLFolderViewItem* itemp = (*iit); - itemp->setVisible(itemp->passedFilter()); - - if (itemp->getVisible()) - { - S32 child_width = *width; - S32 child_height = 0; - S32 child_top = parent_item_height - llround(running_height); - - target_height += itemp->arrange( &child_width, &child_height ); - // don't change width, as this item is as wide as its parent folder by construction - itemp->reshape( itemp->getRect().getWidth(), child_height); - - running_height += (F32)child_height; - *width = llmax(*width, child_width); - itemp->setOrigin( 0, child_top - itemp->getRect().getHeight() ); - } - } - } - - mTargetHeight = target_height; - // cache this width so next time we can just return it - mLastCalculatedWidth = *width; - } - else - { - // just use existing width - *width = mLastCalculatedWidth; - } - - // animate current height towards target height - if (llabs(mCurHeight - mTargetHeight) > 1.f) - { - mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(isOpen() ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); - - requestArrange(); - - // hide child elements that fall out of current animated height - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - // number of pixels that bottom of folder label is from top of parent folder - if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() - > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) - { - // hide if beyond current folder height - (*fit)->setVisible(FALSE); - } - } - - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - // number of pixels that bottom of item label is from top of parent folder - if (getRect().getHeight() - (*iit)->getRect().mBottom - > llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) - { - (*iit)->setVisible(FALSE); - } - } - } - else - { - mCurHeight = mTargetHeight; - } - - // don't change width as this item is already as wide as its parent folder - reshape(getRect().getWidth(),llround(mCurHeight)); - - // pass current height value back to parent - *height = llround(mCurHeight); - - return llround(mTargetHeight); -} - -BOOL LLFolderViewFolder::needsArrange() -{ - return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); -} - -void LLFolderViewFolder::requestSort() -{ - getViewModelItem()->requestSort(); -} - -//TODO RN: get height resetting working -//void LLFolderViewFolder::setPassedFilter(BOOL passed, BOOL passed_folder, S32 filter_generation) -//{ -// // if this folder is now filtered, but wasn't before -// // (it just passed) -// if (passed && !passedFilter(filter_generation)) -// { -// // reset current height, because last time we drew it -// // it might have had more visible items than now -// mCurHeight = 0.f; -// } -// -// LLFolderViewItem::setPassedFilter(passed, passed_folder, filter_generation); -//} - - -// Passes selection information on to children and record selection -// information if necessary. -BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, - BOOL take_keyboard_focus) -{ - BOOL rv = FALSE; - if (selection == this) - { - if (!isSelected()) - { - selectItem(); - } - rv = TRUE; - } - else - { - if (isSelected()) - { - deselectItem(); - } - rv = FALSE; - } - BOOL child_selected = FALSE; - - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - if((*fit)->setSelection(selection, openitem, take_keyboard_focus)) - { - rv = TRUE; - child_selected = TRUE; - } - } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - if((*iit)->setSelection(selection, openitem, take_keyboard_focus)) - { - rv = TRUE; - child_selected = TRUE; - } - } - if(openitem && child_selected) - { - setOpenArrangeRecursively(TRUE); - } - return rv; -} - -// This method is used to change the selection of an item. -// Recursively traverse all children; if 'selection' is 'this' then change -// the select status if necessary. -// Returns TRUE if the selection state of this folder, or of a child, was changed. -BOOL LLFolderViewFolder::changeSelection(LLFolderViewItem* selection, BOOL selected) -{ - BOOL rv = FALSE; - if(selection == this) - { - if (isSelected() != selected) - { - rv = TRUE; - if (selected) - { - selectItem(); - } - else - { - deselectItem(); - } - } - } - - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - if((*fit)->changeSelection(selection, selected)) - { - rv = TRUE; - } - } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - if((*iit)->changeSelection(selection, selected)) - { - rv = TRUE; - } - } - return rv; -} - -LLFolderViewFolder* LLFolderViewFolder::getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse) -{ - if (!item_a->getParentFolder() || !item_b->getParentFolder()) return NULL; - - std::deque item_a_ancestors; - - LLFolderViewFolder* parent = item_a->getParentFolder(); - while(parent) - { - item_a_ancestors.push_back(parent); - parent = parent->getParentFolder(); - } - - std::deque item_b_ancestors; - - parent = item_b->getParentFolder(); - while(parent) - { - item_b_ancestors.push_back(parent); - parent = parent->getParentFolder(); - } - - LLFolderViewFolder* common_ancestor = item_a->getRoot(); - - while(item_a_ancestors.size() > item_b_ancestors.size()) - { - item_a = item_a_ancestors.front(); - item_a_ancestors.pop_front(); - } - - while(item_b_ancestors.size() > item_a_ancestors.size()) - { - item_b = item_b_ancestors.front(); - item_b_ancestors.pop_front(); - } - - while(item_a_ancestors.size()) - { - common_ancestor = item_a_ancestors.front(); - - if (item_a_ancestors.front() == item_b_ancestors.front()) - { - // which came first, sibling a or sibling b? - for (folders_t::iterator it = common_ancestor->mFolders.begin(), end_it = common_ancestor->mFolders.end(); - it != end_it; - ++it) - { - LLFolderViewItem* item = *it; - - if (item == item_a) - { - reverse = false; - return common_ancestor; - } - if (item == item_b) - { - reverse = true; - return common_ancestor; - } - } - - for (items_t::iterator it = common_ancestor->mItems.begin(), end_it = common_ancestor->mItems.end(); - it != end_it; - ++it) - { - LLFolderViewItem* item = *it; - - if (item == item_a) - { - reverse = false; - return common_ancestor; - } - if (item == item_b) - { - reverse = true; - return common_ancestor; - } - } - break; - } - - item_a = item_a_ancestors.front(); - item_a_ancestors.pop_front(); - item_b = item_b_ancestors.front(); - item_b_ancestors.pop_front(); - } - - return NULL; -} - -void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector& items) -{ - bool selecting = start == NULL; - if (reverse) - { - for (items_t::reverse_iterator it = mItems.rbegin(), end_it = mItems.rend(); - it != end_it; - ++it) - { - if (*it == end) - { - return; - } - if (selecting) - { - items.push_back(*it); - } - - if (*it == start) - { - selecting = true; - } - } - for (folders_t::reverse_iterator it = mFolders.rbegin(), end_it = mFolders.rend(); - it != end_it; - ++it) - { - if (*it == end) - { - return; - } - - if (selecting) - { - items.push_back(*it); - } - - if (*it == start) - { - selecting = true; - } - } - } - else - { - for (folders_t::iterator it = mFolders.begin(), end_it = mFolders.end(); - it != end_it; - ++it) - { - if (*it == end) - { - return; - } - - if (selecting) - { - items.push_back(*it); - } - - if (*it == start) - { - selecting = true; - } - } - for (items_t::iterator it = mItems.begin(), end_it = mItems.end(); - it != end_it; - ++it) - { - if (*it == end) - { - return; - } - - if (selecting) - { - items.push_back(*it); - } - - if (*it == start) - { - selecting = true; - } - } - } -} - -void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) -{ - if (getRoot()->getAllowMultiSelect() == FALSE) return; - - LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); - if (cur_selected_item == NULL) - { - cur_selected_item = new_selection; - } - - - bool reverse = false; - LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse); - if (!common_ancestor) return; - - LLFolderViewItem* last_selected_item_from_cur = cur_selected_item; - LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder(); - - std::vector items_to_select_forward; - - while(cur_folder != common_ancestor) - { - cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); - - last_selected_item_from_cur = cur_folder; - cur_folder = cur_folder->getParentFolder(); - } - - std::vector items_to_select_reverse; - - LLFolderViewItem* last_selected_item_from_new = new_selection; - cur_folder = new_selection->getParentFolder(); - while(cur_folder != common_ancestor) - { - cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); - - last_selected_item_from_new = cur_folder; - cur_folder = cur_folder->getParentFolder(); - } - - common_ancestor->gatherChildRangeExclusive(last_selected_item_from_cur, last_selected_item_from_new, reverse, items_to_select_forward); - - for (std::vector::reverse_iterator it = items_to_select_reverse.rbegin(), end_it = items_to_select_reverse.rend(); - it != end_it; - ++it) - { - items_to_select_forward.push_back(*it); - } - - LLFolderView* root = getRoot(); - - for (std::vector::iterator it = items_to_select_forward.begin(), end_it = items_to_select_forward.end(); - it != end_it; - ++it) - { - LLFolderViewItem* item = *it; - if (item->isSelected()) - { - root->removeFromSelectionList(item); - } - else - { - item->selectItem(); - } - root->addToSelectionList(item); - } - - if (new_selection->isSelected()) - { - root->removeFromSelectionList(new_selection); - } - else - { - new_selection->selectItem(); - } - root->addToSelectionList(new_selection); -} - - -void LLFolderViewFolder::destroyView() -{ - std::for_each(mItems.begin(), mItems.end(), DeletePointer()); - mItems.clear(); - - while (!mFolders.empty()) - { - LLFolderViewFolder *folderp = mFolders.back(); - folderp->destroyView(); // removes entry from mFolders - } - - LLFolderViewItem::destroyView(); -} - -// extractItem() removes the specified item from the folder, but -// doesn't delete it. -void LLFolderViewFolder::extractItem( LLFolderViewItem* item ) -{ - items_t::iterator it = std::find(mItems.begin(), mItems.end(), item); - if(it == mItems.end()) - { - // This is an evil downcast. However, it's only doing - // pointer comparison to find if (which it should be ) the - // item is in the container, so it's pretty safe. - LLFolderViewFolder* f = static_cast(item); - folders_t::iterator ft; - ft = std::find(mFolders.begin(), mFolders.end(), f); - if (ft != mFolders.end()) - { - mFolders.erase(ft); - } - } - else - { - mItems.erase(it); - } - //item has been removed, need to update filter - getViewModelItem()->removeChild(item->getViewModelItem()); - getViewModelItem()->dirtyFilter(); - //because an item is going away regardless of filter status, force rearrange - requestArrange(); - removeChild(item); -} - -BOOL LLFolderViewFolder::isMovable() -{ - if( !(getViewModelItem()->isItemMovable()) ) - { - return FALSE; - } - - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - if(!(*iit)->isMovable()) - { - return FALSE; - } - } - - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - if(!(*fit)->isMovable()) - { - return FALSE; - } - } - return TRUE; -} - - -BOOL LLFolderViewFolder::isRemovable() -{ - if( !(getViewModelItem()->isItemRemovable()) ) - { - return FALSE; - } - - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - if(!(*iit)->isRemovable()) - { - return FALSE; - } - } - - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - if(!(*fit)->isRemovable()) - { - return FALSE; - } - } - return TRUE; -} - -// this is an internal method used for adding items to folders. -BOOL LLFolderViewFolder::addItem(LLFolderViewItem* item) -{ - if (item->getParentFolder()) - { - item->getParentFolder()->extractItem(item); - } - item->setParentFolder(this); - - mItems.push_back(item); - - item->setRect(LLRect(0, 0, getRect().getWidth(), 0)); - item->setVisible(FALSE); - - addChild(item); - - item->getViewModelItem()->dirtyFilter(); - - // Handle sorting - requestArrange(); - requestSort(); - - getViewModelItem()->addChild(item->getViewModelItem()); - - //TODO RN - make sort bubble up as long as parent Folder doesn't have anything matching sort criteria - //// Traverse parent folders and update creation date and resort, if necessary - //LLFolderViewFolder* parentp = this; - //while (parentp) - //{ - // if (parentp->mSortFunction.isByDate()) - // { - // // parent folder doesn't have a time stamp yet, so get it from us - // parentp->requestSort(); - // } - - // parentp = parentp->getParentFolder(); - //} - - return TRUE; -} - -// this is an internal method used for adding items to folders. -BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) -{ - if (folder->mParentFolder) - { - folder->mParentFolder->extractItem(folder); - } - folder->mParentFolder = this; - mFolders.push_back(folder); - folder->setOrigin(0, 0); - folder->reshape(getRect().getWidth(), 0); - folder->setVisible(FALSE); - addChild( folder ); - folder->getViewModelItem()->dirtyFilter(); - // rearrange all descendants too, as our indentation level might have changed - folder->requestArrange(); - requestSort(); - - getViewModelItem()->addChild(folder->getViewModelItem()); - - return TRUE; -} - -void LLFolderViewFolder::requestArrange() -{ - mLastArrangeGeneration = -1; - // flag all items up to root - if (mParentFolder) - { - mParentFolder->requestArrange(); - } -} - -void LLFolderViewFolder::toggleOpen() -{ - setOpen(!isOpen()); -} - -// Force a folder open or closed -void LLFolderViewFolder::setOpen(BOOL openitem) -{ - setOpenArrangeRecursively(openitem); -} - -void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse) -{ - BOOL was_open = isOpen(); - mIsOpen = openitem; - if(!was_open && openitem) - { - getViewModelItem()->openItem(); - } - else if(was_open && !openitem) - { - getViewModelItem()->closeItem(); - } - - if (recurse == RECURSE_DOWN || recurse == RECURSE_UP_DOWN) - { - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - (*fit)->setOpenArrangeRecursively(openitem, RECURSE_DOWN); /* Flawfinder: ignore */ - } - } - if (mParentFolder - && (recurse == RECURSE_UP - || recurse == RECURSE_UP_DOWN)) - { - mParentFolder->setOpenArrangeRecursively(openitem, RECURSE_UP); - } - - if (was_open != isOpen()) - { - requestArrange(); - } -} - -BOOL LLFolderViewFolder::handleDragAndDropFromChild(MASK mask, - BOOL drop, - EDragAndDropType c_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - BOOL accepted = mViewModelItem->dragOrDrop(mask,drop,c_type,cargo_data, tooltip_msg); - if (accepted) - { - mDragAndDropTarget = TRUE; - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; - } - - // drag and drop to child item, so clear pending auto-opens - getRoot()->autoOpenTest(NULL); - - return TRUE; -} - -void LLFolderViewFolder::openItem( void ) -{ - toggleOpen(); -} - -void LLFolderViewFolder::applyFunctorToChildren(LLFolderViewFunctor& functor) -{ - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - functor.doItem((*fit)); - } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - functor.doItem((*iit)); - } -} - -void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor) -{ - functor.doFolder(this); - - for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) - { - folders_t::iterator fit = iter++; - (*fit)->applyFunctorRecursively(functor); - } - for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) - { - items_t::iterator iit = iter++; - functor.doItem((*iit)); - } -} - -// LLView functionality -BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - BOOL handled = FALSE; - - if (isOpen()) - { - handled = (childrenHandleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL); - } - - if (!handled) - { - handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewFolder" << llendl; - } - - return TRUE; -} - -BOOL LLFolderViewFolder::handleDragAndDropToThisFolder(MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - BOOL accepted = getViewModelItem()->dragOrDrop(mask,drop,cargo_type,cargo_data, tooltip_msg); - - if (accepted) - { - mDragAndDropTarget = TRUE; - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; - } - - if (!drop && accepted) - { - getRoot()->autoOpenTest(this); - } - - return TRUE; -} - - -BOOL LLFolderViewFolder::handleRightMouseDown( S32 x, S32 y, MASK mask ) -{ - BOOL handled = FALSE; - - if( isOpen() ) - { - handled = childrenHandleRightMouseDown( x, y, mask ) != NULL; - } - if (!handled) - { - handled = LLFolderViewItem::handleRightMouseDown( x, y, mask ); - } - return handled; -} - - -BOOL LLFolderViewFolder::handleHover(S32 x, S32 y, MASK mask) -{ - mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight)); - - BOOL handled = LLView::handleHover(x, y, mask); - - if (!handled) - { - // this doesn't do child processing - handled = LLFolderViewItem::handleHover(x, y, mask); - } - - return handled; -} - -BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) -{ - BOOL handled = FALSE; - if( isOpen() ) - { - handled = childrenHandleMouseDown(x,y,mask) != NULL; - } - if( !handled ) - { - if(mIndentation < x && x < mIndentation + ARROW_SIZE + TEXT_PAD) - { - toggleOpen(); - handled = TRUE; - } - else - { - // do normal selection logic - handled = LLFolderViewItem::handleMouseDown(x, y, mask); - } - } - - return handled; -} - -BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) -{ - BOOL handled = FALSE; - if( isOpen() ) - { - handled = childrenHandleDoubleClick( x, y, mask ) != NULL; - } - if( !handled ) - { - if(mIndentation < x && x < mIndentation + ARROW_SIZE + TEXT_PAD) - { - // don't select when user double-clicks plus sign - // so as not to contradict single-click behavior - toggleOpen(); - } - else - { - getRoot()->setSelection(this, FALSE); - toggleOpen(); - } - handled = TRUE; - } - return handled; -} - -void LLFolderViewFolder::draw() -{ - if (mAutoOpenCountdown != 0.f) - { - mControlLabelRotation = mAutoOpenCountdown * -90.f; - } - else if (isOpen()) - { - mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f)); - } - else - { - mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f)); - } - - LLFolderViewItem::draw(); - - // draw children if root folder, or any other folder that is open or animating to closed state - if( getRoot() == this || (isOpen() || mCurHeight != mTargetHeight )) - { - LLView::draw(); - } - - mExpanderHighlighted = FALSE; -} - -// this does prefix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getNextFromChild( LLFolderViewItem* item, BOOL include_children ) -{ - BOOL found_item = FALSE; - - LLFolderViewItem* result = NULL; - // when not starting from a given item, start at beginning - if(item == NULL) - { - found_item = TRUE; - } - - // find current item among children - folders_t::iterator fit = mFolders.begin(); - folders_t::iterator fend = mFolders.end(); - - items_t::iterator iit = mItems.begin(); - items_t::iterator iend = mItems.end(); - - // if not trivially starting at the beginning, we have to find the current item - if (!found_item) - { - // first, look among folders, since they are always above items - for(; fit != fend; ++fit) - { - if(item == (*fit)) - { - found_item = TRUE; - // if we are on downwards traversal - if (include_children && (*fit)->isOpen()) - { - // look for first descendant - return (*fit)->getNextFromChild(NULL, TRUE); - } - // otherwise advance to next folder - ++fit; - include_children = TRUE; - break; - } - } - - // didn't find in folders? Check items... - if (!found_item) - { - for(; iit != iend; ++iit) - { - if(item == (*iit)) - { - found_item = TRUE; - // point to next item - ++iit; - break; - } - } - } - } - - if (!found_item) - { - // you should never call this method with an item that isn't a child - // so we should always find something - llassert(FALSE); - return NULL; - } - - // at this point, either iit or fit point to a candidate "next" item - // if both are out of range, we need to punt up to our parent - - // now, starting from found folder, continue through folders - // searching for next visible folder - while(fit != fend && !(*fit)->getVisible()) - { - // turn on downwards traversal for next folder - ++fit; - } - - if (fit != fend) - { - result = (*fit); - } - else - { - // otherwise, scan for next visible item - while(iit != iend && !(*iit)->getVisible()) - { - ++iit; - } - - // check to see if we have a valid item - if (iit != iend) - { - result = (*iit); - } - } - - if( !result && mParentFolder ) - { - // If there are no siblings or children to go to, recurse up one level in the tree - // and skip children for this folder, as we've already discounted them - result = mParentFolder->getNextFromChild(this, FALSE); - } - - return result; -} - -// this does postfix traversal, as folders are listed above their contents -LLFolderViewItem* LLFolderViewFolder::getPreviousFromChild( LLFolderViewItem* item, BOOL include_children ) -{ - BOOL found_item = FALSE; - - LLFolderViewItem* result = NULL; - // when not starting from a given item, start at end - if(item == NULL) - { - found_item = TRUE; - } - - // find current item among children - folders_t::reverse_iterator fit = mFolders.rbegin(); - folders_t::reverse_iterator fend = mFolders.rend(); - - items_t::reverse_iterator iit = mItems.rbegin(); - items_t::reverse_iterator iend = mItems.rend(); - - // if not trivially starting at the end, we have to find the current item - if (!found_item) - { - // first, look among items, since they are always below the folders - for(; iit != iend; ++iit) - { - if(item == (*iit)) - { - found_item = TRUE; - // point to next item - ++iit; - break; - } - } - - // didn't find in items? Check folders... - if (!found_item) - { - for(; fit != fend; ++fit) - { - if(item == (*fit)) - { - found_item = TRUE; - // point to next folder - ++fit; - break; - } - } - } - } - - if (!found_item) - { - // you should never call this method with an item that isn't a child - // so we should always find something - llassert(FALSE); - return NULL; - } - - // at this point, either iit or fit point to a candidate "next" item - // if both are out of range, we need to punt up to our parent - - // now, starting from found item, continue through items - // searching for next visible item - while(iit != iend && !(*iit)->getVisible()) - { - ++iit; - } - - if (iit != iend) - { - // we found an appropriate item - result = (*iit); - } - else - { - // otherwise, scan for next visible folder - while(fit != fend && !(*fit)->getVisible()) - { - ++fit; - } - - // check to see if we have a valid folder - if (fit != fend) - { - // try selecting child element of this folder - if ((*fit)->isOpen()) - { - result = (*fit)->getPreviousFromChild(NULL); - } - else - { - result = (*fit); - } - } - } - - if( !result ) - { - // If there are no siblings or children to go to, recurse up one level in the tree - // which gets back to this folder, which will only be visited if it is a valid, visible item - result = this; - } - - return result; -} - diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h deleted file mode 100644 index 92923e82da..0000000000 --- a/indra/newview/llfolderviewitem.h +++ /dev/null @@ -1,418 +0,0 @@ -/** -* @file llfolderviewitem.h -* @brief Items and folders that can appear in a hierarchical folder view -* -* $LicenseInfo:firstyear=2001&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 LLFOLDERVIEWITEM_H -#define LLFOLDERVIEWITEM_H - -#include "llview.h" -#include "lluiimage.h" - -class LLFolderView; -class LLFolderViewModelItem; -class LLFolderViewFolder; -class LLFolderViewFunctor; -class LLFolderViewFilter; -class LLFolderViewModelInterface; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFolderViewItem -// -// An instance of this class represents a single item in a folder view -// such as an inventory item or a file. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLFolderViewItem : public LLView -{ -public: - static void initClass(); - static void cleanupClass(); - - struct Params : public LLInitParam::Block - { - Optional folder_arrow_image, - selection_image; - Optional root; - Mandatory listener; - - Optional folder_indentation, // pixels - item_height, - item_top_pad; - - Optional creation_date; - - Params(); - }; - - // layout constants - static const S32 LEFT_PAD = 5; - // LEFT_INDENTATION is set via folder_indentation above - static const S32 ICON_PAD = 2; - static const S32 ICON_WIDTH = 16; - static const S32 TEXT_PAD = 1; - static const S32 TEXT_PAD_RIGHT = 4; - static const S32 ARROW_SIZE = 12; - static const S32 MAX_FOLDER_ITEM_OVERLAP = 2; - // animation parameters - static const F32 FOLDER_CLOSE_TIME_CONSTANT; - static const F32 FOLDER_OPEN_TIME_CONSTANT; - -private: - BOOL mIsSelected; - -protected: - friend class LLUICtrlFactory; - friend class LLFolderViewModelItem; - - LLFolderViewItem(const Params& p); - - std::string mLabel; - S32 mLabelWidth; - bool mLabelWidthDirty; - LLFolderViewFolder* mParentFolder; - LLFolderViewModelItem* mViewModelItem; - BOOL mIsCurSelection; - BOOL mSelectPending; - LLFontGL::StyleFlags mLabelStyle; - std::string mLabelSuffix; - LLUIImagePtr mIcon; - LLUIImagePtr mIconOpen; - LLUIImagePtr mIconOverlay; - BOOL mHasVisibleChildren; - S32 mIndentation; - S32 mItemHeight; - - //TODO RN: create interface for string highlighting - //std::string::size_type mStringMatchOffset; - F32 mControlLabelRotation; - LLFolderView* mRoot; - BOOL mDragAndDropTarget; - bool mIsMouseOverTitle; - - // this is an internal method used for adding items to folders. A - // no-op at this level, but reimplemented in derived classes. - virtual BOOL addItem(LLFolderViewItem*) { return FALSE; } - virtual BOOL addFolder(LLFolderViewFolder*) { return FALSE; } - - static LLFontGL* getLabelFontForStyle(U8 style); - -public: - BOOL postBuild(); - - virtual void openItem( void ); - - void arrangeAndSet(BOOL set_selection, BOOL take_keyboard_focus); - - virtual ~LLFolderViewItem( void ); - - // addToFolder() returns TRUE if it succeeds. FALSE otherwise - virtual BOOL addToFolder(LLFolderViewFolder* folder); - - // Finds width and height of this object and it's children. Also - // makes sure that this view and it's children are the right size. - virtual S32 arrange( S32* width, S32* height ); - virtual S32 getItemHeight(); - - // If 'selection' is 'this' then note that otherwise ignore. - // Returns TRUE if this item ends up being selected. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); - - // This method is used to set the selection state of an item. - // If 'selection' is 'this' then note selection. - // Returns TRUE if the selection state of this item was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - - // this method is used to deselect this element - void deselectItem(); - - // this method is used to select this element - virtual void selectItem(); - - // gets multiple-element selection - virtual std::set getSelectionList() const; - - // Returns true is this object and all of its children can be removed (deleted by user) - virtual BOOL isRemovable(); - - // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); - - // destroys this item recursively - virtual void destroyView(); - - BOOL isSelected() const { return mIsSelected; } - - void setUnselected() { mIsSelected = FALSE; } - - void setIsCurSelection(BOOL select) { mIsCurSelection = select; } - - BOOL getIsCurSelection() { return mIsCurSelection; } - - BOOL hasVisibleChildren() { return mHasVisibleChildren; } - - // Call through to the viewed object and return true if it can be - // removed. Returns true if it's removed. - //virtual BOOL removeRecursively(BOOL single_item); - BOOL remove(); - - // Build an appropriate context menu for the item. Flags unused. - void buildContextMenu(class LLMenuGL& menu, U32 flags); - - // This method returns the actual name of the thing being - // viewed. This method will ask the viewed object itself. - const std::string& getName( void ) const; - - // This method returns the label displayed on the view. This - // method was primarily added to allow sorting on the folder - // contents possible before the entire view has been constructed. - const std::string& getLabel() const { return mLabel; } - - - LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; } - const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; } - - void setParentFolder(LLFolderViewFolder* parent) { mParentFolder = parent; } - - LLFolderViewItem* getNextOpenNode( BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousOpenNode( BOOL include_children = TRUE ); - - const LLFolderViewModelItem* getViewModelItem( void ) const { return mViewModelItem; } - LLFolderViewModelItem* getViewModelItem( void ) { return mViewModelItem; } - - const LLFolderViewModelInterface* getFolderViewModel( void ) const; - LLFolderViewModelInterface* getFolderViewModel( void ); - - // just rename the object. - void rename(const std::string& new_name); - - - // Show children (unfortunate that this is called "open") - virtual void setOpen(BOOL open = TRUE) {}; - virtual BOOL isOpen() const { return FALSE; } - - virtual LLFolderView* getRoot(); - virtual const LLFolderView* getRoot() const; - BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor ); - S32 getIndentation() { return mIndentation; } - - virtual BOOL passedFilter(S32 filter_generation = -1); - - // refresh information from the object being viewed. - virtual void refresh(); - - // LLView functionality - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - - virtual void onMouseLeave(S32 x, S32 y, MASK mask); - - virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; } - - // virtual void handleDropped(); - virtual void draw(); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - -private: - static std::map sFonts; // map of styles to fonts -}; - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLFolderViewFolder -// -// An instance of an LLFolderViewFolder represents a collection of -// more folders and items. This is used to build the hierarchy of -// items found in the folder view. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLFolderViewFolder : public LLFolderViewItem -{ -protected: - LLFolderViewFolder( const LLFolderViewItem::Params& ); - friend class LLUICtrlFactory; - -public: - - typedef std::list items_t; - typedef std::list folders_t; - -protected: - items_t mItems; - folders_t mFolders; - - BOOL mIsOpen; - BOOL mExpanderHighlighted; - F32 mCurHeight; - F32 mTargetHeight; - F32 mAutoOpenCountdown; - S32 mLastArrangeGeneration; - S32 mLastCalculatedWidth; - S32 mMostFilteredDescendantGeneration; - bool mNeedsSort; - -public: - typedef enum e_recurse_type - { - RECURSE_NO, - RECURSE_UP, - RECURSE_DOWN, - RECURSE_UP_DOWN - } ERecurseType; - - - virtual ~LLFolderViewFolder( void ); - - LLFolderViewItem* getNextFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); - LLFolderViewItem* getPreviousFromChild( LLFolderViewItem*, BOOL include_children = TRUE ); - - // addToFolder() returns TRUE if it succeeds. FALSE otherwise - virtual BOOL addToFolder(LLFolderViewFolder* folder); - - // Finds width and height of this object and it's children. Also - // makes sure that this view and it's children are the right size. - virtual S32 arrange( S32* width, S32* height ); - - BOOL needsArrange(); - - bool descendantsPassedFilter(S32 filter_generation = -1); - - // Passes selection information on to children and record - // selection information if necessary. - // Returns TRUE if this object (or a child) ends up being selected. - // If 'openitem' is TRUE then folders are opened up along the way to the selection. - virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus = TRUE); - - // This method is used to change the selection of an item. - // Recursively traverse all children; if 'selection' is 'this' then change - // the select status if necessary. - // Returns TRUE if the selection state of this folder, or of a child, was changed. - virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected); - - // this method is used to group select items - void extendSelectionTo(LLFolderViewItem* selection); - - // Returns true is this object and all of its children can be removed. - virtual BOOL isRemovable(); - - // Returns true is this object and all of its children can be moved - virtual BOOL isMovable(); - - // destroys this folder, and all children - virtual void destroyView(); - - // If this folder can be removed, remove all children that can be - // removed, return TRUE if this is empty after the operation and - // it's viewed folder object can be removed. - //virtual BOOL removeRecursively(BOOL single_item); - //virtual BOOL remove(); - - // extractItem() removes the specified item from the folder, but - // doesn't delete it. - virtual void extractItem( LLFolderViewItem* item ); - - // This function is called by a child that needs to be resorted. - void resort(LLFolderViewItem* item); - - void setAutoOpenCountdown(F32 countdown) { mAutoOpenCountdown = countdown; } - - // folders can be opened. This will usually be called by internal - // methods. - virtual void toggleOpen(); - - // Force a folder open or closed - virtual void setOpen(BOOL openitem = TRUE); - - // Called when a child is refreshed. - virtual void requestArrange(); - - virtual void requestSort(); - - // internal method which doesn't update the entire view. This - // method was written because the list iterators destroy the state - // of other iterations, thus, we can't arrange while iterating - // through the children (such as when setting which is selected. - virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO); - - // Get the current state of the folder. - virtual BOOL isOpen() const { return mIsOpen; } - - // special case if an object is dropped on the child. - BOOL handleDragAndDropFromChild(MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - - void applyFunctorRecursively(LLFolderViewFunctor& functor); - - // Just apply this functor to the folder's immediate children. - void applyFunctorToChildren(LLFolderViewFunctor& functor); - - virtual void openItem( void ); - virtual BOOL addItem(LLFolderViewItem* item); - virtual BOOL addFolder( LLFolderViewFolder* folder); - - // LLView functionality - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - BOOL handleDragAndDropToThisFolder(MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - virtual void draw(); - - folders_t::iterator getFoldersBegin() { return mFolders.begin(); } - folders_t::iterator getFoldersEnd() { return mFolders.end(); } - folders_t::size_type getFoldersCount() const { return mFolders.size(); } - - items_t::const_iterator getItemsBegin() const { return mItems.begin(); } - items_t::const_iterator getItemsEnd() const { return mItems.end(); } - items_t::size_type getItemsCount() const { return mItems.size(); } - - LLFolderViewFolder* getCommonAncestor(LLFolderViewItem* item_a, LLFolderViewItem* item_b, bool& reverse); - void gatherChildRangeExclusive(LLFolderViewItem* start, LLFolderViewItem* end, bool reverse, std::vector& items); - -public: - //WARNING: do not call directly...use the appropriate LLFolderViewModel-derived class instead - template void sortFolders(const SORT_FUNC& func) { mFolders.sort(func); } - template void sortItems(const SORT_FUNC& func) { mItems.sort(func); } -}; - - -#endif // LLFOLDERVIEWITEM_H diff --git a/indra/newview/llfolderviewmodel.cpp b/indra/newview/llfolderviewmodel.cpp deleted file mode 100644 index ca6225aca7..0000000000 --- a/indra/newview/llfolderviewmodel.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llfolderviewmodel.cpp - * @brief Implementation of the view model collection of classes. - * - * $LicenseInfo:firstyear=2001&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 "llfolderviewmodel.h" -#include "lltrans.h" - -bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) -{ - return item->getSortVersion() < mTargetSortVersion; -} - -std::string LLFolderViewModelCommon::getStatusText() -{ - if (!contentsReady() || mFolderView->getViewModelItem()->getLastFilterGeneration() < getFilter()->getCurrentGeneration()) - { - return LLTrans::getString("Searching"); - } - else - { - return getFilter()->getEmptyLookupMessage(); - } -} - -void LLFolderViewModelCommon::filter() -{ - getFilter()->setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - mFolderView->getViewModelItem()->filter(*getFilter()); -} diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h deleted file mode 100644 index 079409c2a4..0000000000 --- a/indra/newview/llfolderviewmodel.h +++ /dev/null @@ -1,357 +0,0 @@ -/** - * @file llfolderviewmodel.h - * - * $LicenseInfo:firstyear=2001&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 LLFOLDERVIEWMODEL_H -#define LLFOLDERVIEWMODEL_H - -#include "llfontgl.h" // just for StyleFlags enum -#include "llfolderview.h" - -// These are grouping of inventory types. -// Order matters when sorting system folders to the top. -enum EInventorySortGroup -{ - SG_SYSTEM_FOLDER, - SG_TRASH_FOLDER, - SG_NORMAL_FOLDER, - SG_ITEM -}; - -class LLFontGL; -class LLInventoryModel; -class LLMenuGL; -class LLUIImage; -class LLUUID; -class LLFolderViewItem; -class LLFolderViewFolder; - -class LLFolderViewFilter -{ -public: - enum EFilterModified - { - FILTER_NONE, // nothing to do, already filtered - FILTER_RESTART, // restart filtering from scratch - FILTER_LESS_RESTRICTIVE, // existing filtered items will certainly pass this filter - FILTER_MORE_RESTRICTIVE // if you didn't pass the previous filter, you definitely won't pass this one - }; - -public: - - LLFolderViewFilter() {} - virtual ~LLFolderViewFilter() {} - - // +-------------------------------------------------------------------+ - // + Execution And Results - // +-------------------------------------------------------------------+ - virtual bool check(const LLFolderViewModelItem* item) = 0; - virtual bool check(const LLInventoryItem* item) = 0; - virtual bool checkFolder(const LLFolderViewModelItem* folder) const = 0; - virtual bool checkFolder(const LLUUID& folder_id) const = 0; - - virtual void setEmptyLookupMessage(const std::string& message) = 0; - virtual std::string getEmptyLookupMessage() const = 0; - - virtual bool showAllResults() const = 0; - - // +-------------------------------------------------------------------+ - // + Status - // +-------------------------------------------------------------------+ - virtual bool isActive() const = 0; - virtual bool isModified() const = 0; - virtual void clearModified() = 0; - virtual const std::string& getName() const = 0; - virtual const std::string& getFilterText() = 0; - //RN: this is public to allow system to externally force a global refilter - virtual void setModified(EFilterModified behavior = FILTER_RESTART) = 0; - - // +-------------------------------------------------------------------+ - // + Count - // +-------------------------------------------------------------------+ - virtual void setFilterCount(S32 count) = 0; - virtual S32 getFilterCount() const = 0; - virtual void decrementFilterCount() = 0; - - // +-------------------------------------------------------------------+ - // + Default - // +-------------------------------------------------------------------+ - virtual bool isDefault() const = 0; - virtual bool isNotDefault() const = 0; - virtual void markDefault() = 0; - virtual void resetDefault() = 0; - - // +-------------------------------------------------------------------+ - // + Generation - // +-------------------------------------------------------------------+ - virtual S32 getCurrentGeneration() const = 0; - virtual S32 getFirstSuccessGeneration() const = 0; - virtual S32 getFirstRequiredGeneration() const = 0; -}; - -class LLFolderViewModelInterface -{ -public: - virtual void requestSortAll() = 0; - - virtual void sort(class LLFolderViewFolder*) = 0; - virtual void filter() = 0; - - virtual bool contentsReady() = 0; - virtual void setFolderView(LLFolderView* folder_view) = 0; - virtual LLFolderViewFilter* getFilter() = 0; - virtual const LLFolderViewFilter* getFilter() const = 0; - virtual std::string getStatusText() = 0; -}; - -class LLFolderViewModelCommon : public LLFolderViewModelInterface -{ -public: - LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) - {} - - virtual void requestSortAll() - { - // sort everything - mTargetSortVersion++; - } - virtual std::string getStatusText(); - virtual void filter(); - - void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} - -protected: - bool needsSort(class LLFolderViewModelItem* item); - - S32 mTargetSortVersion; - LLFolderView* mFolderView; - -}; - -template -class LLFolderViewModel : public LLFolderViewModelCommon -{ -public: - LLFolderViewModel(){} - virtual ~LLFolderViewModel() {} - - typedef SORT_TYPE SortType; - typedef ITEM_TYPE ItemType; - typedef FOLDER_TYPE FolderType; - typedef FILTER_TYPE FilterType; - - virtual SortType& getSorter() { return mSorter; } - virtual const SortType& getSorter() const { return mSorter; } - virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } - - virtual FilterType* getFilter() { return &mFilter; } - virtual const FilterType* getFilter() const { return &mFilter; } - virtual void setFilter(const FilterType& filter) { mFilter = filter; } - - // TODO RN: remove this and put all filtering logic in view model - // add getStatusText and isFiltering() - virtual bool contentsReady() { return true; } - - - struct ViewModelCompare - { - ViewModelCompare(const SortType& sorter) - : mSorter(sorter) - {} - - bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const - { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); - } - - bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const - { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); - } - - const SortType& mSorter; - }; - - void sort(LLFolderViewFolder* folder) - { - if (needsSort(folder->getViewModelItem())) - { - folder->sortFolders(ViewModelCompare(getSorter())); - folder->sortItems(ViewModelCompare(getSorter())); - folder->getViewModelItem()->setSortVersion(mTargetSortVersion); - folder->requestArrange(); - } - } - -protected: - SortType mSorter; - FilterType mFilter; -}; - -// This is am abstract base class that users of the folderview classes -// would use to bridge the folder view with the underlying data -class LLFolderViewModelItem -{ -public: - virtual ~LLFolderViewModelItem( void ) {}; - - virtual void update() {} //called when drawing - virtual const std::string& getName() const = 0; - virtual const std::string& getDisplayName() const = 0; - virtual const std::string& getSearchableName() const = 0; - - virtual LLPointer getIcon() const = 0; - virtual LLPointer getIconOpen() const { return getIcon(); } - virtual LLPointer getIconOverlay() const { return NULL; } - - virtual LLFontGL::StyleFlags getLabelStyle() const = 0; - virtual std::string getLabelSuffix() const = 0; - - virtual void openItem( void ) = 0; - virtual void closeItem( void ) = 0; - virtual void selectItem(void) = 0; - - virtual BOOL isItemRenameable() const = 0; - virtual BOOL renameItem(const std::string& new_name) = 0; - - virtual BOOL isItemMovable( void ) const = 0; // Can be moved to another folder - virtual void move( LLFolderViewModelItem* parent_listener ) = 0; - - virtual BOOL isItemRemovable( void ) const = 0; // Can be destroyed - virtual BOOL removeItem() = 0; - virtual void removeBatch(std::vector& batch) = 0; - - virtual BOOL isItemCopyable() const = 0; - virtual BOOL copyToClipboard() const = 0; - virtual BOOL cutToClipboard() const = 0; - - virtual BOOL isClipboardPasteable() const = 0; - virtual void pasteFromClipboard() = 0; - virtual void pasteLinkFromClipboard() = 0; - - virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; - - virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? - - virtual bool filter( LLFolderViewFilter& filter) = 0; - virtual bool passedFilter(S32 filter_generation = -1) = 0; - virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; - virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; - virtual void dirtyFilter() = 0; - - virtual S32 getLastFilterGeneration() const = 0; - - // This method should be called when a drag begins. returns TRUE - // if the drag can begin, otherwise FALSE. - virtual LLToolDragAndDrop::ESource getDragSource() const = 0; - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; - - virtual bool hasChildren() const = 0; - virtual void addChild(LLFolderViewModelItem* child) = 0; - virtual void removeChild(LLFolderViewModelItem* child) = 0; - - // This method will be called to determine if a drop can be - // performed, and will set drop to TRUE if a drop is - // requested. Returns TRUE if a drop is possible/happened, - // otherwise FALSE. - virtual BOOL dragOrDrop(MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - std::string& tooltip_msg) = 0; - - virtual void requestSort() = 0; - virtual S32 getSortVersion() = 0; - virtual void setSortVersion(S32 version) = 0; - virtual void setParent(LLFolderViewModelItem* parent) = 0; - -protected: - - friend class LLFolderViewItem; - virtual void setFolderViewItem(LLFolderViewItem* folder_view_item) = 0; - -}; - -class LLFolderViewModelItemCommon : public LLFolderViewModelItem -{ -public: - LLFolderViewModelItemCommon() - : mSortVersion(-1), - mPassedFilter(true), - mPassedFolderFilter(true), - mFolderViewItem(NULL), - mLastFilterGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mParent(NULL) - { - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); - } - - void requestSort() { mSortVersion = -1; } - S32 getSortVersion() { return mSortVersion; } - void setSortVersion(S32 version) { mSortVersion = version;} - - S32 getLastFilterGeneration() const { return mLastFilterGeneration; } - void dirtyFilter() - { - mLastFilterGeneration = -1; - - // bubble up dirty flag all the way to root - if (mParent) - { - mParent->dirtyFilter(); - } - } - virtual void addChild(LLFolderViewModelItem* child) - { - mChildren.push_back(child); - child->setParent(this); - } - virtual void removeChild(LLFolderViewModelItem* child) - { - mChildren.remove(child); - child->setParent(NULL); - } - -protected: - virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } - - S32 mSortVersion; - bool mPassedFilter; - bool mPassedFolderFilter; - - S32 mLastFilterGeneration; - S32 mMostFilteredDescendantGeneration; - - - typedef std::list child_list_t; - child_list_t mChildren; - LLFolderViewModelItem* mParent; - - void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} - LLFolderViewItem* mFolderViewItem; -}; - - -#endif // LLFOLDERVIEWMODEL_H diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 99831c61bf..d23b4af8cb 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -28,12 +28,38 @@ #include "llfolderviewmodelinventory.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" +#include "lltooldraganddrop.h" // // class LLFolderViewModelInventory // static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); +bool LLFolderViewModelInventory::startDrag(std::vector& items) +{ + std::vector types; + uuid_vec_t cargo_ids; + std::vector::iterator item_it; + bool can_drag = true; + if (!items.empty()) + { + for (item_it = items.begin(); item_it != items.end(); ++item_it) + { + EDragAndDropType type = DAD_NONE; + LLUUID id = LLUUID::null; + can_drag = can_drag && static_cast(*item_it)->startDrag(&type, &id); + + types.push_back(type); + cargo_ids.push_back(id); + } + + LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, + static_cast(items.front())->getDragSource(), mTaskID); + } + return can_drag; +} + + void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index a8fe3f57ea..12a977b28b 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -29,6 +29,9 @@ #define LL_LLFOLDERVIEWMODELINVENTORY_H #include "llinventoryfilter.h" +#include "llinventory.h" +#include "llwearabletype.h" +#include "lltooldraganddrop.h" class LLFolderViewModelItemInventory : public LLFolderViewModelItemCommon @@ -62,6 +65,10 @@ public: virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); virtual bool filter( LLFolderViewFilter& filter); virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); + + virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; + virtual LLToolDragAndDrop::ESource getDragSource() const = 0; + protected: class LLFolderViewModelInventory* mRootViewModel; }; @@ -97,11 +104,13 @@ class LLFolderViewModelInventory public: typedef LLFolderViewModel base_t; - virtual ~LLFolderViewModelInventory() {} + void setTaskID(const LLUUID& id) {mTaskID = id;} void sort(LLFolderViewFolder* folder); - bool contentsReady(); + bool startDrag(std::vector& items); +private: + LLUUID mTaskID; }; #endif // LL_LLFOLDERVIEWMODELINVENTORY_H diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 9615f3f44d..f68cf07d8c 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -65,8 +65,6 @@ public: virtual const std::string& getSearchableName() const { return mName; } virtual const LLUUID& getUUID() const { return mUUID; } virtual time_t getCreationDate() const { return 0; } - virtual PermissionMask getPermissionMask() const { return PERM_ALL; } - virtual LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; } virtual LLPointer getIcon() const { return NULL; } virtual LLPointer getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } @@ -88,8 +86,6 @@ public: virtual void buildContextMenu(LLMenuGL& menu, U32 flags) { } virtual BOOL isUpToDate() const { return TRUE; } virtual bool hasChildren() const { return FALSE; } - virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; } - virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; } virtual bool potentiallyVisible() { return true; } virtual bool filter( LLFolderViewFilter& filter) { return true; } @@ -107,11 +103,6 @@ public: void setVisibleIfDetached(BOOL visible); - // This method should be called when a drag begins. - // Returns TRUE if the drag can begin, FALSE otherwise. - virtual LLToolDragAndDrop::ESource getDragSource() const { return LLToolDragAndDrop::SOURCE_PEOPLE; } - virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const { return FALSE; } - // This method will be called to determine if a drop can be // performed, and will set drop to TRUE if a drop is // requested. diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index e235d9cf5f..b4a91ca0f7 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -35,6 +35,7 @@ #include "llinventorypanel.h" #include "llviewercontrol.h" #include "llwearable.h" +#include "lltooldraganddrop.h" class LLInventoryFilter; class LLInventoryPanel; @@ -119,7 +120,7 @@ public: void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, menuentry_vec_t &disabled_items, U32 flags); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual LLToolDragAndDrop::ESource getDragSource() const; + virtual LLToolDragAndDrop::ESource getDragSource() const; virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const; virtual BOOL dragOrDrop(MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index fed9893158..0aa67cddca 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -571,7 +571,24 @@ void LLInventoryPanel::onIdle(void *userdata) void LLInventoryPanel::idle(void* user_data) { LLInventoryPanel* panel = (LLInventoryPanel*)user_data; - panel->mFolderRoot->doIdle(); + panel->mFolderRoot->update(); + // while dragging, update selection rendering to reflect single/multi drag status + if (LLToolDragAndDrop::getInstance()->hasMouseCapture()) + { + EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); + if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) + { + panel->mFolderRoot->setShowSingleSelection(TRUE); + } + else + { + panel->mFolderRoot->setShowSingleSelection(FALSE); + } + } + else + { + panel->mFolderRoot->setShowSingleSelection(FALSE); + } } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 002c0c1113..ca20051a51 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1557,7 +1557,6 @@ void LLPanelObjectInventory::reset() LLFolderView::Params p; p.name = "task inventory"; p.title = "task inventory"; - p.task_id = getTaskUUID(); p.parent_panel = this; p.tool_tip= LLTrans::getString("PanelContentsTooltip"); p.listener = LLTaskInvFVBridge::createObjectBridge(this, NULL); @@ -1823,6 +1822,7 @@ void LLPanelObjectInventory::refresh() removeVOInventoryListener(); clearContents(); } + mInventoryViewModel.setTaskID(mTaskUUID); //llinfos << "LLPanelObjectInventory::refresh() " << mTaskUUID << llendl; } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 4a9e106687..cb59f704a5 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -58,6 +58,7 @@ #include "lltoolmgr.h" #include "lltoolpipette.h" #include "llfiltereditor.h" +#include "llwindow.h" #include "lltool.h" #include "llviewerwindow.h" -- cgit v1.2.3 From d3edb1c466f42e2c46c77e43b26d700c6298b8d6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 4 Jul 2012 00:30:00 -0700 Subject: CHUI-101 WIP Make LLFolderview general purpose partial fix for crash on startup --- indra/llui/llfolderview.cpp | 4 ++-- indra/llui/llfolderviewitem.h | 2 +- indra/newview/llimfloatercontainer.cpp | 17 ++++++++++++++--- indra/newview/llimfloatercontainer.h | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 0d3bc44ae4..990b79a30b 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1798,8 +1798,8 @@ void LLFolderView::update() BOOL filter_finished = getViewModelItem()->passedFilter() && mViewModel->contentsReady(); if (filter_finished - || gFocusMgr.childHasKeyboardFocus(getParent()) // assume we are inside a scroll container - || gFocusMgr.childHasMouseCapture(getParent())) + || gFocusMgr.childHasKeyboardFocus(mParentPanel) + || gFocusMgr.childHasMouseCapture(mParentPanel)) { // finishing the filter process, giving focus to the folder view, or dragging the scrollbar all stop the auto select process mNeedsAutoSelect = FALSE; diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 9cb885066a..50d3e0580e 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -53,7 +53,7 @@ public: { Optional folder_arrow_image, selection_image; - Optional root; + Mandatory root; Mandatory listener; Optional folder_indentation, // pixels diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 261b5f33a2..2b943df48f 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -47,8 +47,9 @@ // LLIMFloaterContainer // LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) -: LLMultiFloater(seed) - ,mExpandCollapseBtn(NULL) +: LLMultiFloater(seed), + mExpandCollapseBtn(NULL), + mFolders(NULL) { // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -90,6 +91,16 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); + LLFolderView::Params p; + //TODO RN: define view model for conversations + //p.view_model = ?; + p.parent_panel = mConversationsListPanel; + p.rect = mConversationsListPanel->getLocalRect(); + p.follows.flags = FOLLOWS_ALL; + + mFolders = LLUICtrlFactory::create(p); + mConversationsListPanel->addChild(mFolders); + mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -512,7 +523,7 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); //params.creation_date = bridge->getCreationDate(); - //params.root = mFolderRoot; + params.root = mFolders; params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index f68cf07d8c..890a115a04 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -194,6 +194,7 @@ private: LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) conversations_items_map mConversationsItems; conversations_widgets_map mConversationsWidgets; + LLFolderView* mFolders; }; #endif // LL_LLIMFLOATERCONTAINER_H -- cgit v1.2.3 From 22f8301b1dea787e0adda80b2625a8d7d9ddbda4 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 4 Jul 2012 17:18:48 +0300 Subject: CHUI-172 CHUI-183 FIX Disabled applying stored rect dimensions when Nearby chat is hosted in Conversations floater. --- indra/newview/llimconversation.cpp | 4 ---- indra/newview/llnearbychat.cpp | 32 +++++++++++++++++++------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index acdd7ba46a..c855a844cf 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -254,9 +254,7 @@ void LLIMConversation::updateHeaderAndToolbar() if (mDragHandle) { mDragHandle->setTitleVisible(!is_hosted); - setCanDrag(!is_hosted); } - setCanResize(!is_hosted); // The button (>>) should be disabled for torn off P2P conversations. mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat); @@ -349,8 +347,6 @@ void LLIMConversation::onOpen(const LLSD& key) host_floater->collapseMessagesPane(false); } - setCanResize(TRUE); - updateHeaderAndToolbar(); } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index a81d6b4025..13e9eeee66 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -364,20 +364,18 @@ void LLNearbyChat::onOpen(const LLSD& key) bool LLNearbyChat::applyRectControl() { - bool rect_controlled = LLFloater::applyRectControl(); + bool is_torn_off = getHost() == NULL; -/* if (!mNearbyChat->getVisible()) + // Resize is limited to torn off floaters. + // A hosted floater is not resizable. + if (is_torn_off) { - reshape(getRect().getWidth(), getMinHeight()); - enableResizeCtrls(true, true, false); - } - else - {*/ enableResizeCtrls(true); - setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); -// } + } - return rect_controlled; + setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); + + return LLFloater::applyRectControl(); } void LLNearbyChat::onChatFontChange(LLFontGL* fontp) @@ -408,9 +406,17 @@ void LLNearbyChat::showHistory() { openFloater(); setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); - reshape(getRect().getWidth(), mExpandedHeight); - enableResizeCtrls(true); - storeRectControl(); + + bool is_torn_off = getHost() == NULL; + + // Reshape and enable resize controls only if it's a torn off floater. + // Otherwise all the size changes should be handled by LLIMFloaterContainer. + if (is_torn_off) + { + reshape(getRect().getWidth(), mExpandedHeight); + enableResizeCtrls(true); + storeRectControl(); + } } std::string LLNearbyChat::getCurrentChat() -- cgit v1.2.3 From e0eeed2680a2c6ba1055ac2a9f6465cb8004b7d6 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 4 Jul 2012 20:53:47 +0300 Subject: CHUI-189 FIXED (Blocked objects by name are not sorted correctly) - Fixed sort criteria. It's needed to take into account that objects in mute list are represented by two types: LLMute::BY_NAME and LLMute::OBJECT --- indra/newview/llblocklist.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index cb68f677eb..0165a9c4e8 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -267,9 +267,15 @@ bool LLBlockListNameTypeComparator::doCompare(const LLBlockedListItem* blocked_i LLMute::EType type1 = blocked_item1->getType(); LLMute::EType type2 = blocked_item2->getType(); - if (type1 != type2) + // if mute type is LLMute::BY_NAME or LLMute::OBJECT it means that this mute is an object + bool both_mutes_are_objects = (LLMute::OBJECT == type1 || LLMute::BY_NAME == type1) && (LLMute::OBJECT == type2 || LLMute::BY_NAME == type2); + + // mute types may be different, but since both LLMute::BY_NAME and LLMute::OBJECT types represent objects + // it's needed to perform additional checking of both_mutes_are_objects variable + if (type1 != type2 && !both_mutes_are_objects) { - return type1 > type2; + // objects in block list go first, so return true if mute type is not an avatar + return LLMute::AGENT != type1; } return NAME_COMPARATOR.compare(blocked_item1, blocked_item2); -- cgit v1.2.3 From 1fa326ccdbb9b99fedac0b4cdab232ec1fbe8d74 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 4 Jul 2012 21:13:25 +0300 Subject: CHUI-136 ADDITIONAL FIX (Implement new design for blocked list on the people floater) - Disabled object profile functionality according to the spec --- indra/newview/llblocklist.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 0165a9c4e8..066cb71677 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -195,7 +195,13 @@ bool LLBlockList::isActionEnabled(const LLSD& userdata) const std::string command_name = userdata.asString(); - if ("unblock_item" == command_name || "profile_item" == command_name) + if ("profile_item" == command_name) + { + LLBlockedListItem* item = getBlockedItem(); + action_enabled = item && (LLMute::AGENT == item->getType()); + } + + if ("unblock_item" == command_name) { action_enabled = getSelectedItem() != NULL; } @@ -227,10 +233,6 @@ void LLBlockList::onCustomAction(const LLSD& userdata) LLAvatarActions::showProfile(item->getUUID()); break; - case LLMute::OBJECT: - LLFloaterSidePanelContainer::showPanel("inventory", LLSD().with("id", item->getUUID())); - break; - default: break; } -- cgit v1.2.3 From ff448aed525b8c1d2f05b6a5816ba6855707e4b8 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 5 Jul 2012 19:23:34 +0300 Subject: CHUI-200 FIXED Show correct and localized name of the nearby chat In the conversations list --- indra/newview/llimfloatercontainer.cpp | 4 ---- indra/newview/llnearbychat.cpp | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 08ace601a3..134623722c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -534,10 +534,6 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mFloater(floaterp), mContainer(containerp) { - // Hack: the nearby chat has no name so we catch that case and impose one - // Of course, we won't be doing this in the final code - if (name == "") - mName = "Nearby Chat"; } // Virtual action callbacks diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 13e9eeee66..644304aff3 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -158,6 +158,10 @@ BOOL LLNearbyChat::postBuild() enableResizeCtrls(true, true, false); + // title must be defined BEFORE call addToHost() because + // it is used for show the item's name in the conversations list + setTitle(getString("NearbyChatTitle")); + addToHost(); //for menu @@ -182,7 +186,6 @@ BOOL LLNearbyChat::postBuild() loadHistory(); } - setTitle(getString("NearbyChatTitle")); return LLIMConversation::postBuild(); } -- cgit v1.2.3 From 89d8a49f28dac5d99ec05a5201203ec57f72be02 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 5 Jul 2012 14:14:35 +0300 Subject: CHUI-197 FIXED Conversation names updating when checked corresponding preference --- indra/newview/llimfloatercontainer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 134623722c..30a77bef98 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -104,6 +104,8 @@ BOOL LLIMFloaterContainer::postBuild() collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed")); collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed")); + LLAvatarNameCache::addUseDisplayNamesCallback( + boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); return TRUE; } -- cgit v1.2.3 From c76c73770bf1a4095100cdb79021826ebebbd2f0 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 4 Jul 2012 17:57:46 +0300 Subject: CHUI-195 FIXED Starting ad-hoc conference call does not open Conversations floater --- indra/newview/llimview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 79018ec366..cdbb7c7cca 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2583,7 +2583,6 @@ LLUUID LLIMMgr::addSession( LLDynamicArray ids; ids.put(other_participant_id); LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice); - notifyObserverSessionVoiceOrIMStarted(session_id); return session_id; } @@ -2653,6 +2652,8 @@ LLUUID LLIMMgr::addSession( noteMutedUsers(session_id, ids); } + notifyObserverSessionVoiceOrIMStarted(session_id); + return session_id; } -- cgit v1.2.3 From 73ad740443e615467f7e14fe4fb3f04d8abe2f9c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 4 Jul 2012 16:45:02 +0300 Subject: CHUI-170 FIXED Save Torn off state of Nearby Chat between sessions --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llimconversation.cpp | 8 +------- indra/newview/llimconversation.h | 2 +- indra/newview/llimfloatercontainer.cpp | 5 ++--- indra/newview/llnearbychat.cpp | 27 ++++++++++++++++++++++++--- indra/newview/llnearbychat.h | 2 ++ 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4a586b02af..da3ff2d1ee 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1639,6 +1639,17 @@ Value + NearbyChatIsNotTornOff + + Comment + saving torn-off state of the nearby chat between sessions + Persist + 1 + Type + Boolean + Value + 1 + CloseChatOnReturn Comment diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index c855a844cf..3c6c5c3898 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -55,12 +55,6 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) { mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2)); -// mCommitCallbackRegistrar.add("IMSession.ExpCollapseBtn.Click", -// boost::bind(&LLIMConversation::onSlide, this)); -// mCommitCallbackRegistrar.add("IMSession.CloseBtn.Click", -// boost::bind(&LLFloater::onClickClose, this)); - mCommitCallbackRegistrar.add("IMSession.TearOffBtn.Click", - boost::bind(&LLIMConversation::onTearOffClicked, this)); mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", boost::bind(&LLIMConversation::onIMCompactExpandedMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.CheckItem", @@ -366,7 +360,7 @@ void LLIMConversation::onClose(bool app_quitting) void LLIMConversation::onTearOffClicked() { - onClickTearOff(this); + LLFloater::onClickTearOff(this); updateHeaderAndToolbar(); } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 50663137ac..682779a44b 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -78,7 +78,7 @@ protected: bool onIMShowModesMenuItemCheck(const LLSD& userdata); bool onIMShowModesMenuItemEnable(const LLSD& userdata); static void onSlide(LLIMConversation *self); - void onTearOffClicked(); + virtual void onTearOffClicked(); // refresh a visual state of the Call button void updateCallBtnState(bool callIsActive); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 30a77bef98..546eccbd04 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -302,9 +302,8 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLUUID nearbychat_uuid = LLUUID::null; // Hacky but true: the session id for nearby chat is always null - LLFloater* floaterp = findConversationItem(nearbychat_uuid); - if (floaterp == NULL) + LLFloater* nearby_chat = LLFloaterReg::findInstance("chat_bar"); + if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 644304aff3..384762549a 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -345,15 +345,36 @@ void LLNearbyChat::enableDisableCallBtn() getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/); } +void LLNearbyChat::onTearOffClicked() +{ + LLIMConversation::onTearOffClicked(); + + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + + // see CHUI-170: Save torn-off state of the nearby chat between sessions + BOOL in_the_multifloater = (getHost() == im_box); + gSavedSettings.setBOOL("NearbyChatIsNotTornOff", in_the_multifloater); +} + void LLNearbyChat::addToHost() { - if (LLIMConversation::isChatMultiTab()) + if ( LLIMConversation::isChatMultiTab()) { LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - if (im_box) { - im_box->addFloater(this, FALSE, LLTabContainer::END); + if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) + { + im_box->addFloater(this, TRUE, LLTabContainer::END); + } + else + { + // setting of the "potential" host: this sequence sets + // LLFloater::mHostHandle = NULL (a current host), but + // LLFloater::mLastHostHandle = im_box (a "future" host) + setHost(im_box); + setHost(NULL); + } } } } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 61404df942..90feb71488 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -101,6 +101,8 @@ protected: void onToggleNearbyChatPanel(); + /*virtual*/ void onTearOffClicked(); + static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); EChatType processChatTypeTriggers(EChatType type, std::string &str); -- cgit v1.2.3 From ec15ff6350c0997421cf2884e40aa9feaa070d4d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 5 Jul 2012 16:42:20 -0700 Subject: CHUI-98 : WIP, use the refactored folder view for conversation view list --- indra/llui/llfolderview.cpp | 36 ++++++++++----- indra/newview/llimfloatercontainer.cpp | 23 +++++++++- indra/newview/llimfloatercontainer.h | 83 ++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 14 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 990b79a30b..92e3b7a8e9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -320,10 +320,10 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height ) LLFolderViewFolder::arrange(&mMinWidth, &target_height); - LLRect scroll_rect = mScrollContainer->getContentWindowRect(); + LLRect scroll_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); - LLRect new_scroll_rect = mScrollContainer->getContentWindowRect(); + LLRect new_scroll_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); if (new_scroll_rect.getWidth() != scroll_rect.getWidth()) { reshape( llmax(scroll_rect.getWidth(), mMinWidth), llround(mCurHeight) ); @@ -945,7 +945,7 @@ void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) mAutoOpenItems.push(item); item->setOpen(TRUE); - LLRect content_rect = mScrollContainer->getContentWindowRect(); + LLRect content_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); LLRect constraint_rect(0,content_rect.getHeight(), content_rect.getWidth(), 0); scrollToShowItem(item, constraint_rect); } @@ -1225,25 +1225,37 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) case KEY_PAGE_UP: mSearchString.clear(); - mScrollContainer->pageUp(30); + if (mScrollContainer) + { + mScrollContainer->pageUp(30); + } handled = TRUE; break; case KEY_PAGE_DOWN: mSearchString.clear(); - mScrollContainer->pageDown(30); + if (mScrollContainer) + { + mScrollContainer->pageDown(30); + } handled = TRUE; break; case KEY_HOME: mSearchString.clear(); - mScrollContainer->goToTop(); + if (mScrollContainer) + { + mScrollContainer->goToTop(); + } handled = TRUE; break; case KEY_END: mSearchString.clear(); - mScrollContainer->goToBottom(); + if (mScrollContainer) + { + mScrollContainer->goToBottom(); + } break; case KEY_DOWN: @@ -1719,8 +1731,8 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr LLRect LLFolderView::getVisibleRect() { - S32 visible_height = mScrollContainer->getRect().getHeight(); - S32 visible_width = mScrollContainer->getRect().getWidth(); + S32 visible_height = (mScrollContainer ? mScrollContainer->getRect().getHeight() : 0); + S32 visible_width = (mScrollContainer ? mScrollContainer->getRect().getWidth() : 0); LLRect visible_rect; visible_rect.setLeftTopAndSize(-getRect().mLeft, visible_height - getRect().mBottom, visible_width, visible_height); return visible_rect; @@ -1816,7 +1828,7 @@ void LLFolderView::update() // lets pin it! mPinningSelectedItem = TRUE; - LLRect visible_content_rect = mScrollContainer->getVisibleContentRect(); + LLRect visible_content_rect = (mScrollContainer ? mScrollContainer->getVisibleContentRect() : LLRect()); LLFolderViewItem* selected_item = mSelectedItems.back(); LLRect item_rect; @@ -1831,7 +1843,7 @@ void LLFolderView::update() else { // otherwise we just want it onscreen somewhere - LLRect content_rect = mScrollContainer->getContentWindowRect(); + LLRect content_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); mScrollConstraintRect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); } } @@ -1854,7 +1866,7 @@ void LLFolderView::update() else { // during normal use (page up/page down, etc), just try to fit item on screen - LLRect content_rect = mScrollContainer->getContentWindowRect(); + LLRect content_rect = (mScrollContainer ? mScrollContainer->getContentWindowRect() : LLRect()); constraint_rect.setOriginAndSize(0, 0, content_rect.getWidth(), content_rect.getHeight()); } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 2b943df48f..be38eddbaf 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -91,12 +91,14 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); + mRoot = new LLConversationItem(); LLFolderView::Params p; - //TODO RN: define view model for conversations - //p.view_model = ?; + // CHUI-98 : View Model for conversations + p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; p.rect = mConversationsListPanel->getLocalRect(); p.follows.flags = FOLLOWS_ALL; + p.listener = mRoot; mFolders = LLUICtrlFactory::create(p); mConversationsListPanel->addChild(mFolders); @@ -544,6 +546,15 @@ LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLF mName = "Nearby Chat"; } +LLConversationItem::LLConversationItem() : + mName(""), + mUUID(), + mFloater(NULL), + mContainer(NULL) +{ +} + + // Virtual action callbacks void LLConversationItem::selectItem(void) { @@ -589,4 +600,12 @@ void LLConversationItem::showProperties(void) { } +bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const +{ + // We compare only by name for the moment + // *TODO : Implement the sorting by date + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + return (compare < 0); +} + // EOF diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 890a115a04..f146e65897 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -57,6 +57,7 @@ class LLConversationItem : public LLFolderViewModelItemCommon { public: LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); + LLConversationItem(); virtual ~LLConversationItem() {} // Stub those things we won't really be using in this conversation context @@ -120,6 +121,86 @@ private: LLFloater* mFloater; LLIMFloaterContainer* mContainer; }; + +// We don't want to ever filter conversations but we need to declare that class to create a conversation view model. +// We just stubb everything for the moment. +class LLConversationFilter : public LLFolderViewFilter +{ +public: + + enum ESortOrderType + { + SO_NAME = 0, // Sort inventory by name + SO_DATE = 0x1, // Sort inventory by date + }; + + LLConversationFilter() { mEmpty = ""; } + ~LLConversationFilter() {} + + bool check(const LLFolderViewModelItem* item) { return true; } + bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + void setEmptyLookupMessage(const std::string& message) { } + std::string getEmptyLookupMessage() const { return mEmpty; } + bool showAllResults() const { return true; } + + bool isActive() const { return false; } + bool isModified() const { return false; } + void clearModified() { } + const std::string& getName() const { return mEmpty; } + const std::string& getFilterText() { return mEmpty; } + void setModified(EFilterModified behavior = FILTER_RESTART) { } + + void setFilterCount(S32 count) { } + S32 getFilterCount() const { return 0; } + void decrementFilterCount() { } + + bool isDefault() const { return true; } + bool isNotDefault() const { return false; } + void markDefault() { } + void resetDefault() { } + + S32 getCurrentGeneration() const { return 0; } + S32 getFirstSuccessGeneration() const { return 0; } + S32 getFirstRequiredGeneration() const { return 0; } +private: + std::string mEmpty; +}; + +class LLConversationSort +{ +public: + LLConversationSort(U32 order = 0) + : mSortOrder(order), + mByDate(false), + mByName(false) + { + mByDate = (order & LLConversationFilter::SO_DATE); + mByName = (order & LLConversationFilter::SO_NAME); + } + + bool isByDate() const { return mByDate; } + U32 getSortOrder() const { return mSortOrder; } + + bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const; +private: + U32 mSortOrder; + bool mByDate; + bool mByName; +}; + +class LLConversationViewModel +: public LLFolderViewModel +{ +public: + typedef LLFolderViewModel base_t; + + void sort(LLFolderViewFolder* folder) { } // *TODO : implement conversation sort + bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat + bool startDrag(std::vector& items) { return false; } // We do not allow drag of conversation items + +private: +}; + // CHUI-137 : End class LLIMFloaterContainer @@ -189,6 +270,8 @@ public: void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); LLFloater* findConversationItem(LLUUID& uuid); private: + LLConversationViewModel mConversationViewModel; + LLConversationItem* mRoot; LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); // Conversation list data LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) -- cgit v1.2.3 From c3e048a2f14b08ec4428ea9f5a10f17de154e1fc Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 6 Jul 2012 13:30:05 +0300 Subject: build fix --- indra/newview/llimfloatercontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 546eccbd04..f3b97776fc 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llavataractions.h" #include "llavatariconctrl.h" +#include "llavatarnamecache.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" #include "llimview.h" -- cgit v1.2.3 From 9ab042dd1d003da15dd579f366db04d4aae3ff6b Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 6 Jul 2012 17:49:02 +0300 Subject: CHUI-196 FIXED (Chat text entry area gets resized unexpectedly with certain user display names) - Fixed label length calculating --- indra/llui/lltextbase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 3b3bc64c5b..a7bc6bbb77 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -510,7 +510,7 @@ void LLTextBase::drawText() } else if (text_len <= 0 && !mLabel.empty() && !hasFocus()) { - text_len = mLabel.length(); + text_len = mLabel.getWString().length(); } S32 selection_left = -1; @@ -1816,7 +1816,7 @@ void LLTextBase::resetLabel() style->setColor(mTentativeFgColor); LLStyleConstSP sp(style); - LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, getLabel().length() + 1, *this); + LLTextSegmentPtr label = new LLLabelTextSegment(sp, 0, mLabel.getWString().length() + 1, *this); insertSegment(label); } } @@ -2988,7 +2988,7 @@ const LLWString& LLLabelTextSegment::getWText() const /*virtual*/ const S32 LLLabelTextSegment::getLength() const { - return mEditor.getLabel().length(); + return mEditor.getWlabel().length(); } // -- cgit v1.2.3 From 0b8a57cab8628ba064a14250a140ca9615669d2c Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Sat, 7 Jul 2012 00:50:31 +0300 Subject: Linux build fix. LLFolderViewModelItem placed before the call to a method of this class in LLFolderViewModel::sort(). --- indra/llui/llfolderviewmodel.h | 207 ++++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 104 deletions(-) diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 0f5f9a1f50..268ae8eea8 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -107,110 +107,6 @@ public: virtual S32 getFirstRequiredGeneration() const = 0; }; -class LLFolderViewModelInterface -{ -public: - virtual ~LLFolderViewModelInterface() {} - virtual void requestSortAll() = 0; - - virtual void sort(class LLFolderViewFolder*) = 0; - virtual void filter() = 0; - - virtual bool contentsReady() = 0; - virtual void setFolderView(LLFolderView* folder_view) = 0; - virtual LLFolderViewFilter* getFilter() = 0; - virtual const LLFolderViewFilter* getFilter() const = 0; - virtual std::string getStatusText() = 0; - - virtual bool startDrag(std::vector& items) = 0; -}; - -class LLFolderViewModelCommon : public LLFolderViewModelInterface -{ -public: - LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) - {} - - virtual void requestSortAll() - { - // sort everything - mTargetSortVersion++; - } - virtual std::string getStatusText(); - virtual void filter(); - - void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} - -protected: - bool needsSort(class LLFolderViewModelItem* item); - - S32 mTargetSortVersion; - LLFolderView* mFolderView; - -}; - -template -class LLFolderViewModel : public LLFolderViewModelCommon -{ -public: - LLFolderViewModel(){} - virtual ~LLFolderViewModel() {} - - typedef SORT_TYPE SortType; - typedef ITEM_TYPE ItemType; - typedef FOLDER_TYPE FolderType; - typedef FILTER_TYPE FilterType; - - virtual SortType& getSorter() { return mSorter; } - virtual const SortType& getSorter() const { return mSorter; } - virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } - - virtual FilterType* getFilter() { return &mFilter; } - virtual const FilterType* getFilter() const { return &mFilter; } - virtual void setFilter(const FilterType& filter) { mFilter = filter; } - - // TODO RN: remove this and put all filtering logic in view model - // add getStatusText and isFiltering() - virtual bool contentsReady() { return true; } - - - struct ViewModelCompare - { - ViewModelCompare(const SortType& sorter) - : mSorter(sorter) - {} - - bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const - { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); - } - - bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const - { - return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); - } - - const SortType& mSorter; - }; - - void sort(LLFolderViewFolder* folder) - { - if (needsSort(folder->getViewModelItem())) - { - folder->sortFolders(ViewModelCompare(getSorter())); - folder->sortItems(ViewModelCompare(getSorter())); - folder->getViewModelItem()->setSortVersion(mTargetSortVersion); - folder->requestArrange(); - } - } - -protected: - SortType mSorter; - FilterType mFilter; -}; - // This is am abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data class LLFolderViewModelItem @@ -349,5 +245,108 @@ protected: LLFolderViewItem* mFolderViewItem; }; +class LLFolderViewModelInterface +{ +public: + virtual ~LLFolderViewModelInterface() {} + virtual void requestSortAll() = 0; + + virtual void sort(class LLFolderViewFolder*) = 0; + virtual void filter() = 0; + + virtual bool contentsReady() = 0; + virtual void setFolderView(LLFolderView* folder_view) = 0; + virtual LLFolderViewFilter* getFilter() = 0; + virtual const LLFolderViewFilter* getFilter() const = 0; + virtual std::string getStatusText() = 0; + + virtual bool startDrag(std::vector& items) = 0; +}; + +class LLFolderViewModelCommon : public LLFolderViewModelInterface +{ +public: + LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) + {} + + virtual void requestSortAll() + { + // sort everything + mTargetSortVersion++; + } + virtual std::string getStatusText(); + virtual void filter(); + + void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} + +protected: + bool needsSort(class LLFolderViewModelItem* item); + + S32 mTargetSortVersion; + LLFolderView* mFolderView; + +}; + +template +class LLFolderViewModel : public LLFolderViewModelCommon +{ +public: + LLFolderViewModel(){} + virtual ~LLFolderViewModel() {} + + typedef SORT_TYPE SortType; + typedef ITEM_TYPE ItemType; + typedef FOLDER_TYPE FolderType; + typedef FILTER_TYPE FilterType; + + virtual SortType& getSorter() { return mSorter; } + virtual const SortType& getSorter() const { return mSorter; } + virtual void setSorter(const SortType& sorter) { mSorter = sorter; requestSortAll(); } + + virtual FilterType* getFilter() { return &mFilter; } + virtual const FilterType* getFilter() const { return &mFilter; } + virtual void setFilter(const FilterType& filter) { mFilter = filter; } + + // TODO RN: remove this and put all filtering logic in view model + // add getStatusText and isFiltering() + virtual bool contentsReady() { return true; } + + + struct ViewModelCompare + { + ViewModelCompare(const SortType& sorter) + : mSorter(sorter) + {} + + bool operator () (const LLFolderViewItem* a, const LLFolderViewItem* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + bool operator () (const LLFolderViewFolder* a, const LLFolderViewFolder* b) const + { + return mSorter(static_cast(a->getViewModelItem()), static_cast(b->getViewModelItem())); + } + + const SortType& mSorter; + }; + + void sort(LLFolderViewFolder* folder) + { + if (needsSort(folder->getViewModelItem())) + { + folder->sortFolders(ViewModelCompare(getSorter())); + folder->sortItems(ViewModelCompare(getSorter())); + folder->getViewModelItem()->setSortVersion(mTargetSortVersion); + folder->requestArrange(); + } + } + +protected: + SortType mSorter; + FilterType mFilter; +}; #endif // LLFOLDERVIEWMODEL_H -- cgit v1.2.3 From c9e11635488720626601b7b4a7926f09031a6908 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Sat, 7 Jul 2012 01:10:30 +0300 Subject: Another Linux build fix. --- indra/llui/llfolderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 92e3b7a8e9..8ade17b763 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1927,7 +1927,7 @@ void LLFolderView::updateRenamerPosition() screenPointToLocal( x, y, &x, &y ); mRenamer->setOrigin( x, y ); - LLRect scroller_rect(0, 0, LLUI::getWindowSize().mV[VX], 0); + LLRect scroller_rect(0, 0, (S32)LLUI::getWindowSize().mV[VX], 0); if (mScrollContainer) { scroller_rect = mScrollContainer->getContentWindowRect(); -- cgit v1.2.3 From b490266226ac79cc7570ff7ee921506e941cce16 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 9 Jul 2012 11:49:43 -0700 Subject: CHUI-98 : WIP. Clean up conversation list data structure and comments --- indra/newview/llimfloatercontainer.cpp | 14 +++++++------- indra/newview/llimfloatercontainer.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index be38eddbaf..d343c8be24 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -49,7 +49,7 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), - mFolders(NULL) + mConversationsRoot(NULL) { // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -91,17 +91,17 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild("conversations_list_panel"); - mRoot = new LLConversationItem(); - LLFolderView::Params p; // CHUI-98 : View Model for conversations + LLConversationItem* base_item = new LLConversationItem(); + LLFolderView::Params p; p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; p.rect = mConversationsListPanel->getLocalRect(); p.follows.flags = FOLLOWS_ALL; - p.listener = mRoot; + p.listener = base_item; - mFolders = LLUICtrlFactory::create(p); - mConversationsListPanel->addChild(mFolders); + mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsListPanel->addChild(mConversationsRoot); mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -525,7 +525,7 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat //params.icon = bridge->getIcon(); //params.icon_open = bridge->getOpenIcon(); //params.creation_date = bridge->getCreationDate(); - params.root = mFolders; + params.root = mConversationsRoot; params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index f146e65897..8f0ec27905 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -264,20 +264,20 @@ private: LLLayoutPanel* mConversationsPane; LLLayoutStack* mConversationsStack; - // CHUI-137 : Temporary implementation of conversations list + // Conversation list implementation public: void removeConversationListItem(LLFloater* floaterp, bool change_focus = true); void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); LLFloater* findConversationItem(LLUUID& uuid); private: - LLConversationViewModel mConversationViewModel; - LLConversationItem* mRoot; LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); + // Conversation list data - LLPanel* mConversationsListPanel; // This is the widget we add items to (i.e. clickable title for each conversation) + LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to conversations_items_map mConversationsItems; conversations_widgets_map mConversationsWidgets; - LLFolderView* mFolders; + LLConversationViewModel mConversationViewModel; + LLFolderView* mConversationsRoot; }; #endif // LL_LLIMFLOATERCONTAINER_H -- cgit v1.2.3 From b203fe12f8ea19ee80d9de1ac6ff4ebbc3bdb493 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 10 Jul 2012 16:49:49 +0300 Subject: CHUI-201 FIX for crash when leaving a voice call via the end call prompt. Fixed the problem with confirmLeaveCallCallback() firing after the chat floater is destroyed. --- indra/newview/llimfloater.cpp | 57 +++++++++++++++++++++++-------------------- indra/newview/llimfloater.h | 2 ++ 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a506f0f9f3..23c97c5345 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -118,6 +118,35 @@ void LLIMFloater::refresh() } } +// virtual +void LLIMFloater::onClickCloseBtn() +{ + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + mSessionID); + + if (session == NULL) + { + llwarns << "Empty session." << llendl; + return; + } + + bool is_call_with_chat = session->isGroupSessionType() + || session->isAdHocSessionType() || session->isP2PSessionType(); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + if (is_call_with_chat && voice_channel != NULL + && voice_channel->isActive()) + { + LLSD payload; + payload["session_id"] = mSessionID; + LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); + return; + } + + LLIMConversation::onClickCloseBtn(); +} + /* static */ void LLIMFloater::newIMCallback(const LLSD& data) { @@ -407,8 +436,7 @@ void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); // then we can close the current session - gIMMgr->leaveSession(mSessionID); - LLIMConversation::onClose(false); + onClose(false); // Start a new ad hoc voice call if we invite new participants to a P2P call, // or start a text chat otherwise. @@ -667,29 +695,6 @@ LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id) void LLIMFloater::onClose(bool app_quitting) { - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - mSessionID); - - if (session == NULL) - { - llwarns << "Empty session." << llendl; - return; - } - - bool is_call_with_chat = session->isGroupSessionType() - || session->isAdHocSessionType() || session->isP2PSessionType(); - - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - - if (is_call_with_chat && voice_channel != NULL - && voice_channel->isActive()) - { - LLSD payload; - payload["session_id"] = mSessionID; - LLNotificationsUtil::add("ConfirmLeaveCall", LLSD(), payload, confirmLeaveCallCallback); - return; - } - setTyping(false); // The source of much argument and design thrashing @@ -1278,7 +1283,7 @@ void LLIMFloater::confirmLeaveCallCallback(const LLSD& notification, const LLSD& const LLSD& payload = notification["payload"]; LLUUID session_id = payload["session_id"]; - LLFloater* im_floater = LLFloaterReg::findInstance("impanel", session_id); + LLFloater* im_floater = findInstance(session_id); if (option == 0 && im_floater != NULL) { im_floater->closeFloater(); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 2e8fc84746..2ac11ded20 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -132,6 +132,8 @@ private: /*virtual*/ void refresh(); + /*virtual*/ void onClickCloseBtn(); + // Update the window title, input field help text, etc. void updateSessionName(const std::string& ui_title, const std::string& ui_label); -- cgit v1.2.3 From aafbf0d21301ccaf2e447a556d08e6686f519d4d Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 11 Jul 2012 17:19:22 +0300 Subject: CHUI-203 FIXED Conversations floater resizing when it is opened with FUI Chat button. --- indra/newview/llimfloatercontainer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index e9144a4969..f54b3672e5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -393,7 +393,9 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) { LLRect floater_rect = getRect(); floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); - setShape(floater_rect); + + // Set by_user = true so that reshaped rect is saved in user_settings. + setShape(floater_rect, true); updateResizeLimits(); -- cgit v1.2.3 From 6dff1477d5898c54ea0a08aa72bd099b628433e7 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 12 Jul 2012 16:36:01 +0300 Subject: CHUI-199 FIXED Save positioning of conversations between sessions --- indra/newview/llimconversation.cpp | 33 ++++++++++++++++++---- indra/newview/llimconversation.h | 1 + indra/newview/llimfloatercontainer.cpp | 19 ------------- indra/newview/llimfloatercontainer.h | 1 - .../skins/default/xui/en/floater_im_session.xml | 1 + 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 3c6c5c3898..4774cc2d5a 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -219,16 +219,39 @@ void LLIMConversation::updateHeaderAndToolbar() { bool is_hosted = getHost() != NULL; - if (is_hosted) + if (mWasHosted != is_hosted) { - for (S32 i = 0; i < BUTTON_COUNT; i++) + mWasHosted = is_hosted; + LLView* floater_contents = getChild("contents_view"); + LLRect contents_rect = floater_contents->getRect(); + + if (is_hosted) { - if (mButtons[i]) + for (S32 i = 0; i < BUTTON_COUNT; i++) { - // Hide the standard header buttons in a docked IM floater. - mButtons[i]->setVisible(false); + if (mButtons[i]) + { + // Hide the standard header buttons in a docked IM floater. + mButtons[i]->setVisible(false); + } } + + // we don't show the header when the floater is hosted, so reshape floater contents + // to occupy the header space. + LLRect floater_rect = getRect(); + contents_rect.setOriginAndSize( + contents_rect.mLeft, + contents_rect.mBottom, + floater_rect.getWidth(), + floater_rect.getHeight()); } + else + { + // reduce the floater contents height by header height + contents_rect.mTop -= getHeaderHeight(); + } + + floater_contents->setShape(contents_rect); } // Participant list should be visible only in torn off floaters. diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 682779a44b..19d1e523f0 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -91,6 +91,7 @@ protected: bool mIsNearbyChat; bool mIsP2PChat; + bool mWasHosted; LLLayoutPanel* mParticipantListPanel; LLParticipantList* mParticipantList; diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index f54b3672e5..bf0fc2f6c0 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -154,12 +154,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, // Add a conversation list item in the left pane addConversationListItem(floaterp->getTitle(), session_id, floaterp); - LLView* floater_contents = floaterp->getChild("contents_view"); - - // we don't show the header when the floater is hosted, - // so reshape floater contents to occupy the header space - floater_contents->setShape(floaterp->getRect()); - LLIconCtrl* icon = 0; if(gAgent.isInGroup(session_id, TRUE)) @@ -185,19 +179,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, mTabContainer->setTabImage(floaterp, icon); } -// virtual -void LLIMFloaterContainer::removeFloater(LLFloater* floaterp) -{ - LLMultiFloater::removeFloater(floaterp); - - LLRect contents_rect = floaterp->getRect(); - - // reduce the floater contents height by header height - contents_rect.mTop -= floaterp->getHeaderHeight(); - - LLView* floater_contents = floaterp->getChild("contents_view"); - floater_contents->setShape(contents_rect); -} void LLIMFloaterContainer::onCloseFloater(LLUUID& id) { diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 0d988b5b73..b624b7558a 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -220,7 +220,6 @@ public: /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); - /*virtual*/ void removeFloater(LLFloater* floaterp); /*virtual*/ void tabClose(); diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 32eb4ebdae..95f6708e96 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -9,6 +9,7 @@ can_dock="false" can_minimize="true" can_close="true" + save_rect="true" visible="false" width="394" can_resize="true" -- cgit v1.2.3 From af7de5dd9373a5a15c4d5ea107782e50eb3ce62c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 12 Jul 2012 19:06:29 +0300 Subject: CHUI-170 Workaround for the permanently showing of the nearbychat's name in a conversations list when that floater is torn-off --- indra/newview/llnearbychat.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 384762549a..1c81cdc4bc 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -363,6 +363,9 @@ void LLNearbyChat::addToHost() LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); if (im_box) { + // Make sure the Nearby Chat is present in the conversations list + im_box->addConversationListItem(getTitle(), getKey(), this); + if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) { im_box->addFloater(this, TRUE, LLTabContainer::END); -- cgit v1.2.3 From 7f7a9b7cbae153b00b8a77d3d662257bf6152912 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Fri, 13 Jul 2012 20:06:35 +0300 Subject: CHUI-205 FIXED conversations selection in the conversations list. Each conversation item is added to the folder view which lists all conversations. --- indra/newview/llimfloatercontainer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index bf0fc2f6c0..4f626cb5d2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -438,6 +438,9 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI LLFolderViewItem* widget = createConversationItemWidget(item); mConversationsWidgets[floaterp] = widget; + // Add a new conversation widget to the root folder of a folder view. + mConversationsRoot->addItem(widget); + // Add it to the UI widget->setVisible(TRUE); mConversationsListPanel->addChild(widget); @@ -460,7 +463,7 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; - delete widget; + widget->destroyView(); } // Suppress the conversation items and widgets from their respective maps -- cgit v1.2.3 From 56277fa43c6f6491d356c6fb8a0a0275d4cd00fc Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 13 Jul 2012 20:24:44 +0300 Subject: CHUI-206 FIXED Viewer crash when selecting to cut inventory item, then selecting to cut another inventory item --- indra/newview/llfolderviewmodelinventory.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index d23b4af8cb..dff1e1be90 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -158,22 +158,20 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite if (item->getLastFilterGeneration() < filter_generation) { + // recursive application of the filter for child items + item->filter( filter ); + if (item->getLastFilterGeneration() >= must_pass_generation && !item->passedFilter(must_pass_generation)) { // failed to pass an earlier filter that was a subset of the current one // go ahead and flag this item as done - item->filter(filter); if (item->passedFilter()) { llerrs << "Invalid shortcut in inventory filtering!" << llendl; } item->setPassedFilter(false, false, filter_generation); } - else - { - item->filter( filter ); - } } // track latest generation to pass any child items, for each folder up to root -- cgit v1.2.3 From 8fd35a0a084303073bc40580d69c797c073fb4dc Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 13 Jul 2012 16:30:33 +0300 Subject: CHUI-207 FIXED cancellation of removal of the object that has already been removed --- indra/newview/llinventorypanel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 0aa67cddca..ed370e9add 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -533,7 +533,6 @@ void LLInventoryPanel::modelChanged(U32 mask) // Remove the item's UI. removeItemID(viewmodel_item->getUUID()); view_item->destroyView(); - removeItemID(viewmodel_item->getUUID()); } } } -- cgit v1.2.3 From b3ca0b09dcbe6189d6b1f6d0439b0d9d6f575007 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 17 Jul 2012 16:43:48 +0300 Subject: Fixed positioning of conversations into container --- indra/newview/llimconversation.cpp | 51 ++++++++++++++++++++++++-------------- indra/newview/llimconversation.h | 3 +++ 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 4774cc2d5a..ec7e0ee6cb 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -43,6 +43,7 @@ const F32 REFRESH_INTERVAL = 0.2f; LLIMConversation::LLIMConversation(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id) , mIsP2PChat(false) + , mWasHosted(false) , mExpandCollapseBtn(NULL) , mTearOffBtn(NULL) , mCloseBtn(NULL) @@ -80,6 +81,8 @@ LLIMConversation::~LLIMConversation() BOOL LLIMConversation::postBuild() { + BOOL result; + mCloseBtn = getChild("close_btn"); mCloseBtn->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); @@ -103,6 +106,7 @@ BOOL LLIMConversation::postBuild() } buildParticipantList(); + updateHeaderAndToolbar(); if (isChatMultiTab()) @@ -111,13 +115,14 @@ BOOL LLIMConversation::postBuild() { setCanClose(FALSE); } - return LLFloater::postBuild(); + result = LLFloater::postBuild(); } else { - return LLDockableFloater::postBuild(); + result = LLDockableFloater::postBuild(); } + return result; } void LLIMConversation::draw() @@ -215,7 +220,7 @@ bool LLIMConversation::onIMShowModesMenuItemEnable(const LLSD& userdata) return (plain_text && (is_not_names || mIsP2PChat)); } -void LLIMConversation::updateHeaderAndToolbar() +void LLIMConversation::hideOrShowTitle() { bool is_hosted = getHost() != NULL; @@ -227,23 +232,9 @@ void LLIMConversation::updateHeaderAndToolbar() if (is_hosted) { - for (S32 i = 0; i < BUTTON_COUNT; i++) - { - if (mButtons[i]) - { - // Hide the standard header buttons in a docked IM floater. - mButtons[i]->setVisible(false); - } - } - // we don't show the header when the floater is hosted, so reshape floater contents // to occupy the header space. - LLRect floater_rect = getRect(); - contents_rect.setOriginAndSize( - contents_rect.mLeft, - contents_rect.mBottom, - floater_rect.getWidth(), - floater_rect.getHeight()); + contents_rect.mTop += getHeaderHeight(); } else { @@ -253,6 +244,30 @@ void LLIMConversation::updateHeaderAndToolbar() floater_contents->setShape(contents_rect); } +} + +void LLIMConversation::hideAllStandardButtons() +{ + for (S32 i = 0; i < BUTTON_COUNT; i++) + { + if (mButtons[i]) + { + // Hide the standard header buttons in a docked IM floater. + mButtons[i]->setVisible(false); + } + } +} + +void LLIMConversation::updateHeaderAndToolbar() +{ + bool is_hosted = getHost() != NULL; + + if (is_hosted) + { + hideAllStandardButtons(); + } + + hideOrShowTitle(); // Participant list should be visible only in torn off floaters. bool is_participant_list_visible = diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 19d1e523f0..e6b4f534cc 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -89,6 +89,9 @@ protected: void buildParticipantList(); void onSortMenuItemClicked(const LLSD& userdata); + void hideOrShowTitle(); + void hideAllStandardButtons(); + bool mIsNearbyChat; bool mIsP2PChat; bool mWasHosted; -- cgit v1.2.3 From ec4d1a2450807afcff5c0f0ebf651c9e67f1b310 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 17 Jul 2012 12:07:25 -0700 Subject: CHUI-234 : Fix crashers in landmarks panel --- indra/newview/llpanellandmarks.cpp | 2 +- indra/newview/llplacesinventorypanel.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index faef923338..4bbab52e5a 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -651,7 +651,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesI // Start background fetch, mostly for My Inventory and Library if (expanded) { - const LLUUID &cat_id = mCurrentSelectedList->getRootFolderID(); + const LLUUID &cat_id = inventory_list->getRootFolderID(); // Just because the category itself has been fetched, doesn't mean its child folders have. /* if (!gInventory.isCategoryComplete(cat_id)) diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index d95d5eac19..65d9691902 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -93,6 +93,7 @@ void LLPlacesInventoryPanel::buildFolderView(const LLInventoryPanel::Params& par p.parent_panel = this; p.allow_multiselect = mAllowMultiSelect; p.use_ellipses = true; // truncate inventory item text so remove horizontal scroller + p.view_model = &mInventoryViewModel; mFolderRoot = LLUICtrlFactory::create(p); } -- cgit v1.2.3 From 15f6f877f923ecc85489c0159ca62deb02de1201 Mon Sep 17 00:00:00 2001 From: merov_linden Date: Thu, 19 Jul 2012 03:57:24 +0100 Subject: CHUI-236 : WIP : Modify the handling of FT_ROOT_INVENTORY which was creating havoc in LLInventoryModel instantiation. Still, some of those hack will have to come back on. --- indra/newview/llinventorymodel.cpp | 37 ++++++++++++++++---------------- indra/newview/llplacesinventorypanel.cpp | 37 +------------------------------- 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9b0d12b353..3250d60179 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -210,7 +210,7 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons if (!cat) break; const LLFolderType::EType folder_type = cat->getPreferredType(); if (folder_type != LLFolderType::FT_NONE && - folder_type != LLFolderType::FT_ROOT_INVENTORY && +// folder_type != LLFolderType::FT_ROOT_INVENTORY && !LLFolderType::lookupIsEnsembleType(folder_type)) { return cat; @@ -380,11 +380,12 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe LLUUID rv = LLUUID::null; const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID(); - if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) - { - rv = root_id; - } - else if (root_id.notNull()) +// if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) +// { +// rv = root_id; +// } +// else if (root_id.notNull()) + if (root_id.notNull()) { cat_array_t* cats = NULL; cats = get_ptr_in_map(mParentChildCategoryTree, root_id); @@ -2026,11 +2027,11 @@ void LLInventoryModel::buildParentChildMap() { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } - else if(LLFolderType::FT_ROOT_INVENTORY == pref) - { +// else if(LLFolderType::FT_ROOT_INVENTORY == pref) +// { // it's the root - cat->setParent(LLUUID::null); - } +// cat->setParent(LLUUID::null); +// } else { // it's a protected folder. @@ -2160,14 +2161,14 @@ void LLInventoryModel::buildParentChildMap() if(category && category->getPreferredType() != LLFolderType::FT_ROOT_INVENTORY) continue; - if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) - { - if(category->getUUID()!=mRootFolderID) - { - LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); - new_inv_root_folder_id = category->getUUID(); - } - } +// if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) +// { +// if(category->getUUID()!=mRootFolderID) +// { +// LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); +// new_inv_root_folder_id = category->getUUID(); +// } +// } } } diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index 65d9691902..c46681f556 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -60,44 +60,9 @@ LLPlacesInventoryPanel::~LLPlacesInventoryPanel() void LLPlacesInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) { - // Determine the root folder in case specified, and - // build the views starting with that folder. - const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(params.start_folder); - - LLUUID root_id; - - if ("LIBRARY" == params.start_folder()) - { - root_id = gInventory.getLibraryRootFolderID(); - } - else - { - root_id = (preferred_type != LLFolderType::FT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); - } - - LLRect folder_rect(0, - 0, - getRect().getWidth(), - 0); - LLPlacesFolderView::Params p; - p.name = getName(); - p.title = getLabel(); - p.rect = folder_rect; - p.listener = mInvFVBridgeBuilder->createBridge(LLAssetType::AT_CATEGORY, - LLAssetType::AT_CATEGORY, - LLInventoryType::IT_CATEGORY, - this, - &mInventoryViewModel, - NULL, - root_id); - p.parent_panel = this; - p.allow_multiselect = mAllowMultiSelect; - p.use_ellipses = true; // truncate inventory item text so remove horizontal scroller - p.view_model = &mInventoryViewModel; - mFolderRoot = LLUICtrlFactory::create(p); + LLInventoryPanel::buildFolderView(params); } - // save current folder open state void LLPlacesInventoryPanel::saveFolderState() { -- cgit v1.2.3 From efa73d4975afda19ee5255d5cca33fa96fc21eb4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 19 Jul 2012 20:38:07 -0700 Subject: CHUI-236 : WIP : Places panel works for My Inventory but still empty lists for Favorites Bar, My Landmarks and Library. --- indra/newview/llinventorymodel.cpp | 37 ++++++++++++++++++------------------- indra/newview/llinventorypanel.cpp | 25 +++++++++++-------------- indra/newview/llinventorypanel.h | 1 - 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 3250d60179..9b0d12b353 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -210,7 +210,7 @@ const LLViewerInventoryCategory *LLInventoryModel::getFirstNondefaultParent(cons if (!cat) break; const LLFolderType::EType folder_type = cat->getPreferredType(); if (folder_type != LLFolderType::FT_NONE && -// folder_type != LLFolderType::FT_ROOT_INVENTORY && + folder_type != LLFolderType::FT_ROOT_INVENTORY && !LLFolderType::lookupIsEnsembleType(folder_type)) { return cat; @@ -380,12 +380,11 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe LLUUID rv = LLUUID::null; const LLUUID &root_id = (find_in_library) ? gInventory.getLibraryRootFolderID() : gInventory.getRootFolderID(); -// if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) -// { -// rv = root_id; -// } -// else if (root_id.notNull()) - if (root_id.notNull()) + if(LLFolderType::FT_ROOT_INVENTORY == preferred_type) + { + rv = root_id; + } + else if (root_id.notNull()) { cat_array_t* cats = NULL; cats = get_ptr_in_map(mParentChildCategoryTree, root_id); @@ -2027,11 +2026,11 @@ void LLInventoryModel::buildParentChildMap() { cat->setParent(findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND)); } -// else if(LLFolderType::FT_ROOT_INVENTORY == pref) -// { + else if(LLFolderType::FT_ROOT_INVENTORY == pref) + { // it's the root -// cat->setParent(LLUUID::null); -// } + cat->setParent(LLUUID::null); + } else { // it's a protected folder. @@ -2161,14 +2160,14 @@ void LLInventoryModel::buildParentChildMap() if(category && category->getPreferredType() != LLFolderType::FT_ROOT_INVENTORY) continue; -// if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) -// { -// if(category->getUUID()!=mRootFolderID) -// { -// LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); -// new_inv_root_folder_id = category->getUUID(); -// } -// } + if ( category && 0 == LLStringUtil::compareInsensitive(name, category->getName()) ) + { + if(category->getUUID()!=mRootFolderID) + { + LLUUID& new_inv_root_folder_id = const_cast(mRootFolderID); + new_inv_root_folder_id = category->getUUID(); + } + } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index ed370e9add..340f851ed8 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -193,6 +193,15 @@ void LLInventoryPanel::buildFolderView(const LLInventoryPanel::Params& params) void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { + // Clear up the root view + // Note: This needs to be done *before* we build the new folder view + LLFolderViewItem* root_view = getItemByID(gInventory.getRootFolderID()); + if (root_view) + { + removeItemID(static_cast(root_view->getViewModelItem())->getUUID()); + root_view->destroyView(); + } + LLMemType mt(LLMemType::MTYPE_INVENTORY_POST_BUILD); mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves @@ -228,6 +237,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { initializeViews(); } + gIdleCallbacks.addFunction(onIdle, (void*)this); if (mSortOrderSetting != INHERIT_SORT_ORDER) @@ -595,7 +605,7 @@ void LLInventoryPanel::initializeViews() { if (!gInventory.isInventoryUsable()) return; - rebuildViewsFor(gInventory.getRootFolderID()); + buildNewViews(gInventory.getRootFolderID()); gIdleCallbacks.addFunction(idle, this); @@ -622,19 +632,6 @@ void LLInventoryPanel::initializeViews() } } -LLFolderViewItem* LLInventoryPanel::rebuildViewsFor(const LLUUID& id) -{ - // Destroy the old view for this ID so we can rebuild it. - LLFolderViewItem* old_view = getItemByID(id); - if (old_view) - { - old_view->destroyView(); - removeItemID(static_cast(old_view->getViewModelItem())->getUUID()); - } - - return buildNewViews(id); -} - LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool useLabelSuffix) { LLRect folder_rect(0, diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 465ccdd582..4fcc93b0c4 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -237,7 +237,6 @@ public: protected: // Builds the UI. Call this once the inventory is usable. void initializeViews(); - LLFolderViewItem* rebuildViewsFor(const LLUUID& id); // Given the id and the parent, build all of the folder views. virtual void buildFolderView(const LLInventoryPanel::Params& params); LLFolderViewItem* buildNewViews(const LLUUID& id); -- cgit v1.2.3 From 6227a5c273efbe732c8068400d7e4b5486981bba Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 19 Jul 2012 19:16:36 +0300 Subject: CHUI-231, CHUI-233 [FIXED] - Modified and simplified algorithm of reshaping floater's body (content) and showing/hiding of the title for prevent of present and future issues with floater's repositioning --- indra/newview/llimconversation.cpp | 32 ++++++++-------------- indra/newview/llimconversation.h | 3 +- .../skins/default/xui/en/floater_im_session.xml | 2 +- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index ec7e0ee6cb..ec534b903d 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -43,7 +43,6 @@ const F32 REFRESH_INTERVAL = 0.2f; LLIMConversation::LLIMConversation(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id) , mIsP2PChat(false) - , mWasHosted(false) , mExpandCollapseBtn(NULL) , mTearOffBtn(NULL) , mCloseBtn(NULL) @@ -224,26 +223,17 @@ void LLIMConversation::hideOrShowTitle() { bool is_hosted = getHost() != NULL; - if (mWasHosted != is_hosted) - { - mWasHosted = is_hosted; - LLView* floater_contents = getChild("contents_view"); - LLRect contents_rect = floater_contents->getRect(); - - if (is_hosted) - { - // we don't show the header when the floater is hosted, so reshape floater contents - // to occupy the header space. - contents_rect.mTop += getHeaderHeight(); - } - else - { - // reduce the floater contents height by header height - contents_rect.mTop -= getHeaderHeight(); - } - - floater_contents->setShape(contents_rect); - } + const LLFloater::Params& default_params = LLFloater::getDefaultParams(); + S32 floater_header_size = default_params.header_height; + LLView* floater_contents = getChild("contents_view"); + + LLRect floater_rect = getLocalRect(); + S32 top_border_of_contents = floater_rect.mTop - (is_hosted? 0 : floater_header_size); + LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents); + LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom); + mDragHandle->setShape(handle_rect); + mDragHandle->setVisible(! is_hosted); + floater_contents->setShape(contents_rect); } void LLIMConversation::hideAllStandardButtons() diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index e6b4f534cc..c3dff96d5d 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -89,12 +89,11 @@ protected: void buildParticipantList(); void onSortMenuItemClicked(const LLSD& userdata); - void hideOrShowTitle(); + void hideOrShowTitle(); // toggle the floater's drag handle void hideAllStandardButtons(); bool mIsNearbyChat; bool mIsP2PChat; - bool mWasHosted; LLLayoutPanel* mParticipantListPanel; LLParticipantList* mParticipantList; diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 95f6708e96..560e1be213 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -9,7 +9,7 @@ can_dock="false" can_minimize="true" can_close="true" - save_rect="true" + save_rect="false" visible="false" width="394" can_resize="true" -- cgit v1.2.3 From 7c9be0e3de6821478c71e4646f07fb112e0e572c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 19 Jul 2012 15:11:56 +0300 Subject: CHUI-229 [FIXED] Nearby chat conversation does not appear initially in conversation list if no other conversations are present --- indra/newview/llimfloater.cpp | 8 +++--- indra/newview/llimfloatercontainer.cpp | 48 ++++++++++++++++++---------------- indra/newview/llimfloatercontainer.h | 1 + indra/newview/llnearbychat.cpp | 8 +++--- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 23c97c5345..22ce3cd42b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -346,6 +346,10 @@ BOOL LLIMFloater::postBuild() initIMFloater(); + // Add a conversation list item in the left pane + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + im_box->addConversationListItem(getTitle(), getKey(), this); + return TRUE; } @@ -641,10 +645,6 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) } } - // Add a conversation list item in the left pane: nothing will be done if already in there - // but relevant clean up will be done to ensure consistency of the conversation list - floater_container->addConversationListItem(floater->getTitle(), session_id, floater); - floater->openFloater(floater->getKey()); } else diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4f626cb5d2..005794444b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -150,9 +150,6 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp, LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); LLUUID session_id = floaterp->getKey(); - - // Add a conversation list item in the left pane - addConversationListItem(floaterp->getTitle(), session_id, floaterp); LLIconCtrl* icon = 0; @@ -280,6 +277,8 @@ void LLIMFloaterContainer::draw() collapseMessagesPane(true); } LLFloater::draw(); + + repositioningWidgets(); } void LLIMFloaterContainer::tabClose() @@ -306,7 +305,7 @@ void LLIMFloaterContainer::setVisible(BOOL visible) LLFloaterReg::toggleInstanceOrBringToFront(name); } } - + // We need to show/hide all the associated conversations that have been torn off // (and therefore, are not longer managed by the multifloater), // so that they show/hide with the conversations manager. @@ -409,6 +408,23 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } } +void LLIMFloaterContainer::repositioningWidgets() +{ + LLRect panel_rect = mConversationsListPanel->getRect(); + S32 item_height = 16; + int index = 0; + for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + widget_it != mConversationsWidgets.end(); + widget_it++, ++index) + { + LLFolderViewItem* widget = widget_it->second; + widget->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + } +} + // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) { @@ -443,14 +459,11 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI // Add it to the UI widget->setVisible(TRUE); + + repositioningWidgets(); + mConversationsListPanel->addChild(widget); - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - S32 index = mConversationsWidgets.size() - 1; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); + return; } @@ -470,18 +483,7 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool mConversationsItems.erase(floaterp); mConversationsWidgets.erase(floaterp); - // Reposition the leftover conversation items - LLRect panel_rect = mConversationsListPanel->getRect(); - S32 item_height = 16; - int index = 0; - for (widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it, ++index) - { - LLFolderViewItem* widget = widget_it->second; - widget->setRect(LLRect(0, - panel_rect.getHeight() - item_height*index, - panel_rect.getWidth(), - panel_rect.getHeight() - item_height*(index+1))); - } + repositioningWidgets(); // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index b624b7558a..a25ea0ab46 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -254,6 +254,7 @@ private: void collapseConversationsPane(bool collapse); void updateState(bool collapse, S32 delta_width); + void repositioningWidgets(); void onAddButtonClicked(); void onAvatarPicked(const uuid_vec_t& ids); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 1c81cdc4bc..a21690bed8 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -158,7 +158,7 @@ BOOL LLNearbyChat::postBuild() enableResizeCtrls(true, true, false); - // title must be defined BEFORE call addToHost() because + // title must be defined BEFORE call addConversationListItem() because // it is used for show the item's name in the conversations list setTitle(getString("NearbyChatTitle")); @@ -186,6 +186,9 @@ BOOL LLNearbyChat::postBuild() loadHistory(); } + // added row in the conversations list when nearby chat is tear-off + LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); + im_box->addConversationListItem(getTitle(), LLSD(), this); return LLIMConversation::postBuild(); } @@ -363,9 +366,6 @@ void LLNearbyChat::addToHost() LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); if (im_box) { - // Make sure the Nearby Chat is present in the conversations list - im_box->addConversationListItem(getTitle(), getKey(), this); - if (gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) { im_box->addFloater(this, TRUE, LLTabContainer::END); -- cgit v1.2.3 From 3ae21b429e67faf4ee32c9387c63a552b883a472 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 20 Jul 2012 17:16:22 +0300 Subject: CHUI-207 FIXED Emptying Lost and Found and Trash in inventory crashes viewer --- indra/newview/llinventorymodel.cpp | 23 +++++++++++++++++++++-- indra/newview/llinventorypanel.cpp | 13 ++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9b0d12b353..fe65b87afd 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1240,14 +1240,33 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) items, INCLUDE_TRASH); S32 count = items.count(); + + item_map_t::iterator item_map_end = mItemMap.end(); + cat_map_t::iterator cat_map_end = mCategoryMap.end(); + LLUUID uu_id; + for(S32 i = 0; i < count; ++i) { - deleteObject(items.get(i)->getUUID()); + uu_id = items.get(i)->getUUID(); + + // This check prevents the deletion of a previously deleted item. + // This is necessary because deletion is not done in a hierarchical + // order. The current item may have been already deleted as a child + // of its deleted parent. + if (mItemMap.find(uu_id) != item_map_end) + { + deleteObject(uu_id); + } } + count = categories.count(); for(S32 i = 0; i < count; ++i) { - deleteObject(categories.get(i)->getUUID()); + uu_id = categories.get(i)->getUUID(); + if (mCategoryMap.find(uu_id) != cat_map_end) + { + deleteObject(uu_id); + } } } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 340f851ed8..6a7ee3b6a0 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -421,7 +421,14 @@ void LLInventoryPanel::modelChanged(U32 mask) // LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item // to folder is the fast way to get a folder without searching through folders tree. - LLFolderViewFolder* view_folder = dynamic_cast(view_item); + LLFolderViewFolder* view_folder = NULL; + + // Check requires as this item might have already been deleted + // as a child of its deleted parent. + if (model_item && view_item) + { + view_folder = dynamic_cast(view_item); + } ////////////////////////////// // LABEL Operation @@ -448,7 +455,7 @@ void LLInventoryPanel::modelChanged(U32 mask) if (mask & LLInventoryObserver::REBUILD) { handled = true; - if (model_item && view_item) + if (model_item && view_item && viewmodel_item) { view_item->destroyView(); removeItemID(viewmodel_item->getUUID()); @@ -538,7 +545,7 @@ void LLInventoryPanel::modelChanged(U32 mask) ////////////////////////////// // REMOVE Operation // This item has been removed from memory, but its associated UI element still exists. - else if (!model_item && view_item) + else if (!model_item && view_item && viewmodel_item) { // Remove the item's UI. removeItemID(viewmodel_item->getUUID()); -- cgit v1.2.3 From 176b7d82be3b48344e2a54f81402352273719108 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 23 Jul 2012 19:33:39 -0700 Subject: CHUI-227 FIX Teleport offers sent are not received cleaned up serialization of LLSD to param block so that it can round-trip also, optimized LLXMLNode and fixed an assert --- indra/llui/llnotifications.cpp | 10 +---- indra/llui/llsdparam.cpp | 33 +++++----------- indra/llxml/llxmlnode.cpp | 87 +++++++++--------------------------------- indra/llxml/llxmlnode.h | 5 +-- indra/llxuixml/llinitparam.cpp | 5 --- indra/llxuixml/llinitparam.h | 31 ++++++++++++--- indra/llxuixml/llxuiparser.cpp | 12 +++++- 7 files changed, 66 insertions(+), 117 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 48128e0b40..7e1e2c3c9b 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -223,14 +223,6 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica LLParamSDParser parser; parser.writeSD(mFormData, p.form_elements); - if (!mFormData.isArray() && !mFormData.isUndefined()) - { - // change existing contents to a one element array - LLSD new_llsd_array = LLSD::emptyArray(); - new_llsd_array.append(mFormData); - mFormData = new_llsd_array; - } - for (LLSD::array_iterator it = mFormData.beginArray(), end_it = mFormData.endArray(); it != end_it; ++it) @@ -516,7 +508,7 @@ LLSD LLNotification::asLLSD() p.id = mId; p.name = mTemplatep->mName; p.form_elements = getForm()->asLLSD(); - + p.substitutions = mSubstitutions; p.payload = mPayload; p.time_stamp = mTimestamp; diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 811e20e810..5a0d688f4f 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -223,10 +223,14 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser: { bool new_traversal = it->second; - LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; - - if (child_sd->isArray()) + LLSD* child_sd; + if (it->first.empty()) { + child_sd = sd_to_write; + if (child_sd->isUndefined()) + { + *child_sd = LLSD::emptyArray(); + } if (new_traversal) { // write to new element at end @@ -240,22 +244,7 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser: } else { - if (new_traversal - && child_sd->isDefined() - && !child_sd->isArray()) - { - // copy child contents into first element of an array - LLSD new_array = LLSD::emptyArray(); - new_array.append(*child_sd); - // assign array to slot that previously held the single value - *child_sd = new_array; - // return next element in that array - sd_to_write = &((*child_sd)[1]); - } - else - { - sd_to_write = child_sd; - } + sd_to_write = &(*sd_to_write)[it->first]; } it->second = false; } @@ -283,11 +272,9 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI it != sd.endArray(); ++it) { - if (!stack.empty()) - { - stack.back().second = true; - } + stack.push_back(make_pair(std::string(), true)); readSDValues(cb, *it, stack); + stack.pop_back(); } } else if (sd.isUndefined()) diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 2ffb0d8503..45839595a0 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -259,7 +259,7 @@ BOOL LLXMLNode::removeChild(LLXMLNode *target_child) return FALSE; } -void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) +void LLXMLNode::addChild(LLXMLNodePtr& new_child) { if (new_child->mParent != NULL) { @@ -273,6 +273,11 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) new_child->mParent = this; if (new_child->mIsAttribute) { + LLXMLAttribList::iterator found_it = mAttributes.find(new_child->mName); + if (found_it != mAttributes.end()) + { + removeChild(found_it->second); + } mAttributes.insert(std::make_pair(new_child->mName, new_child)); } else @@ -285,49 +290,11 @@ void LLXMLNode::addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child) } mChildren->map.insert(std::make_pair(new_child->mName, new_child)); - // if after_child is specified, it damn well better be in the list of children - // for this node. I'm not going to assert that, because it would be expensive, - // but don't specify that parameter if you didn't get the value for it from the - // list of children of this node! - if (after_child.isNull()) - { - if (mChildren->tail != new_child) - { - mChildren->tail->mNext = new_child; - new_child->mPrev = mChildren->tail; - mChildren->tail = new_child; - } - } - // if after_child == parent, then put new_child at beginning - else if (after_child == this) - { - // add to front of list - new_child->mNext = mChildren->head; - if (mChildren->head) - { - mChildren->head->mPrev = new_child; - mChildren->head = new_child; - } - else // no children - { - mChildren->head = new_child; - mChildren->tail = new_child; - } - } - else + if (mChildren->tail != new_child) { - if (after_child->mNext.notNull()) - { - // if after_child was not the last item, fix up some pointers - after_child->mNext->mPrev = new_child; - new_child->mNext = after_child->mNext; - } - new_child->mPrev = after_child; - after_child->mNext = new_child; - if (mChildren->tail == after_child) - { - mChildren->tail = new_child; - } + mChildren->tail->mNext = new_child; + new_child->mPrev = mChildren->tail; + mChildren->tail = new_child; } } @@ -343,8 +310,9 @@ LLXMLNodePtr LLXMLNode::createChild(const char* name, BOOL is_attribute) // virtual LLXMLNodePtr LLXMLNode::createChild(LLStringTableEntry* name, BOOL is_attribute) { - LLXMLNode* ret = new LLXMLNode(name, is_attribute); + LLXMLNodePtr ret(new LLXMLNode(name, is_attribute)); ret->mID.clear(); + addChild(ret); return ret; } @@ -358,11 +326,12 @@ BOOL LLXMLNode::deleteChild(LLXMLNode *child) return FALSE; } -void LLXMLNode::setParent(LLXMLNodePtr new_parent) +void LLXMLNode::setParent(LLXMLNodePtr& new_parent) { if (new_parent.notNull()) { - new_parent->addChild(this); + LLXMLNodePtr this_ptr(this); + new_parent->addChild(this_ptr); } else { @@ -681,27 +650,6 @@ bool LLXMLNode::updateNode( return TRUE; } - -// static -LLXMLNodePtr LLXMLNode::replaceNode(LLXMLNodePtr node, LLXMLNodePtr update_node) -{ - if (!node || !update_node) - { - llwarns << "Node invalid" << llendl; - return node; - } - - LLXMLNodePtr cloned_node = update_node->deepCopy(); - node->mParent->addChild(cloned_node, node); // add after node - LLXMLNodePtr parent = node->mParent; - parent->removeChild(node); - parent->updateDefault(); - - return cloned_node; -} - - - // static bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree) { @@ -1198,7 +1146,7 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) std::vector::iterator itor3; for (itor3=to_delete_list.begin(); itor3!=to_delete_list.end(); ++itor3) { - (*itor3)->setParent(NULL); + (*itor3)->setParent(LLXMLNodePtr()); } } } @@ -2733,7 +2681,8 @@ void LLXMLNode::setName(LLStringTableEntry* name) mName = name; if (old_parent) { - old_parent->addChild(this); + LLXMLNodePtr this_ptr(this); + old_parent->addChild(this_ptr); } } diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index e3da7169e7..ec486d7957 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -127,8 +127,8 @@ public: BOOL isNull(); BOOL deleteChild(LLXMLNode* child); - void addChild(LLXMLNodePtr new_child, LLXMLNodePtr after_child = LLXMLNodePtr(NULL)); - void setParent(LLXMLNodePtr new_parent); // reparent if necessary + void addChild(LLXMLNodePtr& new_child); + void setParent(LLXMLNodePtr& new_parent); // reparent if necessary // Serialization static bool parseFile( @@ -147,7 +147,6 @@ public: static bool updateNode( LLXMLNodePtr& node, LLXMLNodePtr& update_node); - static LLXMLNodePtr replaceNode(LLXMLNodePtr node, LLXMLNodePtr replacement_node); static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector& paths); diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 3c0d0aaa7e..bb160b3c0b 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -227,12 +227,7 @@ namespace LLInitParam if (serialize_func) { const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - // each param descriptor remembers its serial number - // so we can inspect the same param under different names - // and see that it has the same number - name_stack.push_back(std::make_pair("", true)); serialize_func(*param, parser, name_stack, diff_param); - name_stack.pop_back(); } } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index d44ccac6e4..606676be2c 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -1317,10 +1317,18 @@ namespace LLInitParam static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { + Parser::name_stack_range_t new_name_stack_range(name_stack_range); self_t& typed_param = static_cast(param); value_t value; + + // pop first element if empty string + if (new_name_stack_range.first != new_name_stack_range.second && new_name_stack_range.first->first.empty()) + { + ++new_name_stack_range.first; + } + // no further names in stack, attempt to parse value now - if (name_stack_range.first == name_stack_range.second) + if (new_name_stack_range.first == new_name_stack_range.second) { // attempt to read value directly if (parser.readValue(value)) @@ -1353,14 +1361,14 @@ namespace LLInitParam static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) { const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided() || name_stack.empty()) return; + if (!typed_param.isProvided()) return; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; ++it) { std::string key = it->getValueName(); - name_stack.back().second = true; + name_stack.push_back(std::make_pair(std::string(), true)); if(key.empty()) // not parsed via name values, write out value directly @@ -1382,6 +1390,8 @@ namespace LLInitParam break; } } + + name_stack.pop_back(); } } @@ -1519,9 +1529,16 @@ namespace LLInitParam static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { + Parser::name_stack_range_t new_name_stack_range(name_stack_range); self_t& typed_param = static_cast(param); bool new_value = false; + // pop first element if empty string + if (new_name_stack_range.first != new_name_stack_range.second && new_name_stack_range.first->first.empty()) + { + new_value |= new_name_stack_range.first->second; + ++new_name_stack_range.first; + } if (new_name || typed_param.mValues.empty()) { new_value = true; @@ -1531,7 +1548,7 @@ namespace LLInitParam param_value_t& value = typed_param.mValues.back(); // attempt to parse block... - if(value.deserializeBlock(parser, name_stack_range, new_name)) + if(value.deserializeBlock(parser, new_name_stack_range, new_name)) { typed_param.setProvided(); return true; @@ -1564,13 +1581,13 @@ namespace LLInitParam static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) { const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided() || name_stack.empty()) return; + if (!typed_param.isProvided()) return; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; ++it) { - name_stack.back().second = true; + name_stack.push_back(std::make_pair(std::string(), true)); std::string key = it->getValueName(); if (!key.empty()) @@ -1583,6 +1600,8 @@ namespace LLInitParam { it->serializeBlock(parser, name_stack, NULL); } + + name_stack.pop_back(); } } diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 9cd88a1620..3ad5ad7d42 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -621,7 +621,7 @@ void LLXUIXSDWriter::writeXSD(const std::string& type_name, const std::string& p nodep->createChild("schemaLocation", true)->setStringValue(widget_name + ".xsd"); // add to front of schema - mSchemaNode->addChild(nodep, mSchemaNode); + mSchemaNode->addChild(nodep); } for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems(); @@ -877,16 +877,24 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) it = next_it) { ++next_it; + bool force_new_node = false; + if (it->first.empty()) { it->second = false; continue; } + if (next_it != stack.end() && next_it->first.empty() && next_it->second) + { + force_new_node = true; + } + + out_nodes_t::iterator found_it = mOutNodes.find(it->first); // node with this name not yet written - if (found_it == mOutNodes.end() || it->second) + if (found_it == mOutNodes.end() || it->second || force_new_node) { // make an attribute if we are the last element on the name stack bool is_attribute = next_it == stack.end(); -- cgit v1.2.3 From 0a28a63ce05755d22b09badc41bdd23d5baab1bb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 24 Jul 2012 12:03:00 -0700 Subject: fix for gcc builds --- indra/llxml/llxmlnode.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 45839595a0..afb0d87da9 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -147,13 +147,15 @@ LLXMLNodePtr LLXMLNode::deepCopy() for (LLXMLChildList::iterator iter = mChildren->map.begin(); iter != mChildren->map.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } } for (LLXMLAttribList::iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter) { - newnode->addChild(iter->second->deepCopy()); + LLXMLNodePtr temp_ptr_for_gcc(iter->second->deepCopy()); + newnode->addChild(temp_ptr_for_gcc); } return newnode; @@ -1146,7 +1148,8 @@ void LLXMLNode::scrubToTree(LLXMLNode *tree) std::vector::iterator itor3; for (itor3=to_delete_list.begin(); itor3!=to_delete_list.end(); ++itor3) { - (*itor3)->setParent(LLXMLNodePtr()); + LLXMLNodePtr ptr; + (*itor3)->setParent(ptr); } } } -- cgit v1.2.3 From f303eeccf705f677e48c5738e5119352fd86b31d Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 24 Jul 2012 22:47:35 +0300 Subject: CHUI-209 FIX for properly updating folder names in folder view after they have been renamed. The old display name should be cleared before refreshing the views for both items and folders in folder view, otherwise the old name will be used upon renaming. --- indra/newview/llinventorybridge.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index b4a91ca0f7..9997d1720f 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -81,7 +81,7 @@ public: // LLInvFVBridge functionality //-------------------------------------------------------------------- virtual const LLUUID& getUUID() const { return mUUID; } - virtual void clearDisplayName() {} + virtual void clearDisplayName() { mDisplayName.clear(); } virtual void restoreItem() {} virtual void restoreToWorld() {} @@ -229,8 +229,6 @@ public: virtual bool hasChildren() const { return FALSE; } virtual BOOL isUpToDate() const { return TRUE; } - /*virtual*/ void clearDisplayName() { mDisplayName.clear(); } - LLViewerInventoryItem* getItem() const; protected: -- cgit v1.2.3 From decd8a435d8fb15bab52eec9e447b176e33eb5cf Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 24 Jul 2012 14:42:28 -0700 Subject: CHUI-211: Problem was due to a non-heap variable being deleted and then referenced later (which was found by ProductEngine). Also the crash occurred at a specifc location llpangelobjectinventory::reset() during a static_cast, so now using a dynamic_cast as a safeguard. --- indra/llui/llfolderview.cpp | 3 ++- indra/newview/llpanelobjectinventory.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8ade17b763..10729a3eae 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -266,7 +266,8 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); - delete mViewModel; + //product engine bugfix, prevent deletion of non-heap data + //delete mViewModel; mViewModel = NULL; } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index ca20051a51..937d3bb8c5 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1565,7 +1565,12 @@ void LLPanelObjectInventory::reset() mFolders = LLUICtrlFactory::create(p); // this ensures that we never say "searching..." or "no items found" //TODO RN: make this happen by manipulating filter object directly - static_cast(mFolders->getFolderViewModel()->getFilter())->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); + LLInventoryFilter* inventoryFilter = dynamic_cast(mFolders->getFolderViewModel()->getFilter()); + if(inventoryFilter) + { + inventoryFilter->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); + } + mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); if (hasFocus()) -- cgit v1.2.3 From 1736c7b74e5291b1fee91ae72ff52391ae7d946f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 24 Jul 2012 15:19:18 -0700 Subject: Backed out changeset: a20e437a726c --- indra/newview/llfolderviewmodelinventory.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index dff1e1be90..d23b4af8cb 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -158,20 +158,22 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite if (item->getLastFilterGeneration() < filter_generation) { - // recursive application of the filter for child items - item->filter( filter ); - if (item->getLastFilterGeneration() >= must_pass_generation && !item->passedFilter(must_pass_generation)) { // failed to pass an earlier filter that was a subset of the current one // go ahead and flag this item as done + item->filter(filter); if (item->passedFilter()) { llerrs << "Invalid shortcut in inventory filtering!" << llendl; } item->setPassedFilter(false, false, filter_generation); } + else + { + item->filter( filter ); + } } // track latest generation to pass any child items, for each folder up to root -- cgit v1.2.3 From 891a09561d4dff23836c8618d481a6cd2dd001de Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 24 Jul 2012 20:29:20 -0700 Subject: CHUI-206 FIX Viewer crash when selecting to cut inventory item, then selecting to cut another inventory item Seems to work now, without filtering de-optimization --- indra/llui/llfolderview.cpp | 2 +- indra/newview/llfolderviewmodelinventory.cpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8ade17b763..943e690948 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1123,7 +1123,7 @@ void LLFolderView::paste() LLFolderViewFolder* folder = dynamic_cast(item); if (folder == NULL) { - item = item->getParentFolder(); + folder = item->getParentFolder(); } folder_set.insert(folder); } diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index d23b4af8cb..faf5b3e7ac 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -163,11 +163,6 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { // failed to pass an earlier filter that was a subset of the current one // go ahead and flag this item as done - item->filter(filter); - if (item->passedFilter()) - { - llerrs << "Invalid shortcut in inventory filtering!" << llendl; - } item->setPassedFilter(false, false, filter_generation); } else -- cgit v1.2.3 From de8cd534b985450f6d9ff9d2ad947a2a110f76a8 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 25 Jul 2012 16:16:06 +0300 Subject: CHUI-230 [FIXED] Torn off conversation window size resizes when viewer window is resized --- indra/newview/llnearbychat.cpp | 10 ---------- indra/newview/skins/default/xui/en/floater_im_session.xml | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index a21690bed8..4e53082c05 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -391,17 +391,7 @@ void LLNearbyChat::onOpen(const LLSD& key) bool LLNearbyChat::applyRectControl() { - bool is_torn_off = getHost() == NULL; - - // Resize is limited to torn off floaters. - // A hosted floater is not resizable. - if (is_torn_off) - { - enableResizeCtrls(true); - } - setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); - return LLFloater::applyRectControl(); } diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 560e1be213..95f6708e96 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -9,7 +9,7 @@ can_dock="false" can_minimize="true" can_close="true" - save_rect="false" + save_rect="true" visible="false" width="394" can_resize="true" -- cgit v1.2.3 From c4f59fd5882d8b019830292e9e5ed1d2480f73ef Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Jul 2012 14:30:17 -0700 Subject: CHUI-239 FIX Viewer crash when opening object with contents --- indra/newview/llfloatertools.cpp | 4 ++-- indra/newview/llfolderviewmodelinventory.cpp | 10 +++++----- indra/newview/llfolderviewmodelinventory.h | 10 +++------- indra/newview/llinventorybridge.cpp | 5 ++--- indra/newview/llinventorypanel.h | 1 + indra/newview/llpanelobjectinventory.cpp | 8 ++++++-- indra/newview/llpanelobjectinventory.h | 2 ++ indra/newview/llplacesinventorybridge.cpp | 2 -- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 6978e6a430..43465d4209 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -660,8 +660,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnEdit ->setToggleState( edit_visible ); mRadioGroupEdit->setVisible( edit_visible ); - bool linked_parts = gSavedSettings.getBOOL("EditLinkedParts"); - getChildView("RenderingCost")->setVisible( !linked_parts && (edit_visible || focus_visible || move_visible) && sShowObjectCost); + //bool linked_parts = gSavedSettings.getBOOL("EditLinkedParts"); + //getChildView("RenderingCost")->setVisible( !linked_parts && (edit_visible || focus_visible || move_visible) && sShowObjectCost); mBtnLink->setVisible(edit_visible); mBtnUnlink->setVisible(edit_visible); diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index dff1e1be90..e8135496d5 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -109,7 +109,7 @@ bool LLFolderViewModelInventory::contentsReady() void LLFolderViewModelItemInventory::requestSort() { LLFolderViewModelItemCommon::requestSort(); - if (mRootViewModel->getSorter().isByDate()) + if (mRootViewModel.getSorter().isByDate()) { // sort by date potentially affects parent folders which use a date // derived from newest item in them @@ -123,14 +123,14 @@ void LLFolderViewModelItemInventory::requestSort() bool LLFolderViewModelItemInventory::potentiallyVisible() { return passedFilter() // we've passed the filter - || getLastFilterGeneration() < mRootViewModel->getFilter()->getFirstSuccessGeneration() // or we don't know yet + || getLastFilterGeneration() < mRootViewModel.getFilter()->getFirstSuccessGeneration() // or we don't know yet || descendantsPassedFilter(); } bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) { - if (filter_generation < 0 && mRootViewModel) - filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); + if (filter_generation < 0) + filter_generation = mRootViewModel.getFilter()->getFirstSuccessGeneration(); return mPassedFolderFilter && mLastFilterGeneration >= filter_generation @@ -139,7 +139,7 @@ bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) { - if (filter_generation < 0) filter_generation = mRootViewModel->getFilter()->getFirstSuccessGeneration(); + if (filter_generation < 0) filter_generation = mRootViewModel.getFilter()->getFirstSuccessGeneration(); return mMostFilteredDescendantGeneration >= filter_generation; } diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 12a977b28b..eb2a4bfdec 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -37,13 +37,9 @@ class LLFolderViewModelItemInventory : public LLFolderViewModelItemCommon { public: - LLFolderViewModelItemInventory() - : mRootViewModel(NULL) + LLFolderViewModelItemInventory(class LLFolderViewModelInventory& root_view_model) + : mRootViewModel(root_view_model) {} - void setRootViewModel(class LLFolderViewModelInventory* root_view_model) - { - mRootViewModel = root_view_model; - } virtual const LLUUID& getUUID() const = 0; virtual time_t getCreationDate() const = 0; // UTC seconds virtual void setCreationDate(time_t creation_date_utc) = 0; @@ -70,7 +66,7 @@ public: virtual LLToolDragAndDrop::ESource getDragSource() const = 0; protected: - class LLFolderViewModelInventory* mRootViewModel; + class LLFolderViewModelInventory& mRootViewModel; }; class LLInventorySort diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d17c25d9f3..9f1d4bdec9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -190,7 +190,8 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, mUUID(uuid), mRoot(root), mInvType(LLInventoryType::IT_NONE), - mIsLink(FALSE) + mIsLink(FALSE), + LLFolderViewModelItemInventory(inventory->getRootViewModel()) { mInventoryPanel = inventory->getInventoryPanelHandle(); const LLInventoryObject* obj = getInventoryObject(); @@ -1158,7 +1159,6 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, if (new_listener) { new_listener->mInvType = inv_type; - new_listener->setRootViewModel(view_model); } return new_listener; @@ -6484,7 +6484,6 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( && actual_asset_type != LLAssetType::AT_LINK_FOLDER) { new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); - new_listener->setRootViewModel(view_model); } else { diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 4fcc93b0c4..910325cdbc 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -104,6 +104,7 @@ public: public: LLInventoryModel* getModel() { return mInventory; } + LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } // LLView methods void draw(); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 937d3bb8c5..9bd716e900 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -155,7 +155,8 @@ LLTaskInvFVBridge::LLTaskInvFVBridge( LLPanelObjectInventory* panel, const LLUUID& uuid, const std::string& name, - U32 flags): + U32 flags) +: LLFolderViewModelItemInventory(panel->getRootViewModel()), mUUID(uuid), mName(name), mPanel(panel), @@ -1915,7 +1916,10 @@ void LLPanelObjectInventory::idle(void* user_data) { LLPanelObjectInventory* self = (LLPanelObjectInventory*)user_data; - + if (self->mFolders) + { + self->mFolders->update(); + } if (self->mInventoryNeedsUpdate) { self->updateInventory(); diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index 7e857f8b31..593fb43b6d 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -56,6 +56,8 @@ public: virtual BOOL postBuild(); + LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } + void doToSelected(const LLSD& userdata); void refresh(); diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp index af29ab7ea9..1a5f64e295 100644 --- a/indra/newview/llplacesinventorybridge.cpp +++ b/indra/newview/llplacesinventorybridge.cpp @@ -165,7 +165,6 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; } new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags); - new_listener->setRootViewModel(view_model); break; case LLAssetType::AT_CATEGORY: if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) @@ -183,7 +182,6 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( break; } new_listener = new LLPlacesFolderBridge(inv_type, inventory, root, uuid); - new_listener->setRootViewModel(view_model); break; default: new_listener = LLInventoryFVBridgeBuilder::createBridge( -- cgit v1.2.3 From f6dfd6bf0f3ea0e9b5f56a939867353c393539d6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Jul 2012 18:20:54 -0700 Subject: CHUI-222 FIX Selecting None in inventory filters does not update until inventory selected --- indra/llui/llfolderview.cpp | 2 - indra/llui/llfolderviewitem.cpp | 11 +++-- indra/llui/llfolderviewmodel.h | 4 +- indra/newview/llfolderviewmodelinventory.cpp | 74 +++++++++++++--------------- indra/newview/llfolderviewmodelinventory.h | 4 +- indra/newview/llimfloatercontainer.h | 2 +- indra/newview/llpanelobjectinventory.cpp | 2 +- 7 files changed, 49 insertions(+), 50 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 10729a3eae..147af04f30 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -266,8 +266,6 @@ LLFolderView::~LLFolderView( void ) mItems.clear(); mFolders.clear(); - //product engine bugfix, prevent deletion of non-heap data - //delete mViewModel; mViewModel = NULL; } diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 741fc9c324..a356d587f9 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1543,11 +1543,14 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) void LLFolderViewFolder::requestArrange() { - mLastArrangeGeneration = -1; - // flag all items up to root - if (mParentFolder) + //if ( mLastArrangeGeneration != -1) { - mParentFolder->requestArrange(); + mLastArrangeGeneration = -1; + // flag all items up to root + if (mParentFolder) + { + mParentFolder->requestArrange(); + } } } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 268ae8eea8..acdec53602 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -152,7 +152,7 @@ public: virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? - virtual bool filter( LLFolderViewFilter& filter) = 0; + virtual void filter( LLFolderViewFilter& filter) = 0; virtual bool passedFilter(S32 filter_generation = -1) = 0; virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; @@ -192,6 +192,7 @@ public: : mSortVersion(-1), mPassedFilter(true), mPassedFolderFilter(true), + mPrevPassedAllFilters(false), mFolderViewItem(NULL), mLastFilterGeneration(-1), mMostFilteredDescendantGeneration(-1), @@ -232,6 +233,7 @@ protected: S32 mSortVersion; bool mPassedFilter; bool mPassedFolderFilter; + bool mPrevPassedAllFilters; S32 mLastFilterGeneration; S32 mMostFilteredDescendantGeneration; diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index e8135496d5..13ca73917b 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -133,8 +133,9 @@ bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation) filter_generation = mRootViewModel.getFilter()->getFirstSuccessGeneration(); return mPassedFolderFilter - && mLastFilterGeneration >= filter_generation - && (mPassedFilter || descendantsPassedFilter(filter_generation)); + && (descendantsPassedFilter(filter_generation) + || (mLastFilterGeneration >= filter_generation + && mPassedFilter)); } bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation) @@ -148,30 +149,29 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo mPassedFilter = passed; mPassedFolderFilter = passed_folder; mLastFilterGeneration = filter_generation; + + bool passed_filter_before = mPrevPassedAllFilters; + mPrevPassedAllFilters = passedFilter(filter_generation); + + if (passed_filter_before != mPrevPassedAllFilters) + { + //TODO RN: ensure this still happens, but without dependency on folderview + LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); + if (parent_folder) + { + parent_folder->requestArrange(); + } + } } -bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) { - bool passed_filter_before = item->passedFilter(); S32 filter_generation = filter.getCurrentGeneration(); - S32 must_pass_generation = filter.getFirstRequiredGeneration(); if (item->getLastFilterGeneration() < filter_generation) { // recursive application of the filter for child items item->filter( filter ); - - if (item->getLastFilterGeneration() >= must_pass_generation - && !item->passedFilter(must_pass_generation)) - { - // failed to pass an earlier filter that was a subset of the current one - // go ahead and flag this item as done - if (item->passedFilter()) - { - llerrs << "Invalid shortcut in inventory filtering!" << llendl; - } - item->setPassedFilter(false, false, filter_generation); - } } // track latest generation to pass any child items, for each folder up to root @@ -184,39 +184,36 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite view_model->mMostFilteredDescendantGeneration = filter_generation; view_model = static_cast(view_model->mParent); } - - return !passed_filter_before; - } - else // !item->passedfilter() - { - return passed_filter_before; } } -bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { - bool changed = false; + const S32 filter_generation = filter.getCurrentGeneration(); + const S32 must_pass_generation = filter.getFirstRequiredGeneration(); + + if (getLastFilterGeneration() >= must_pass_generation + && !passedFilter(must_pass_generation)) + { + // failed to pass an earlier filter that was a subset of the current one + // go ahead and flag this item as done + setPassedFilter(false, false, filter_generation); + return; + } if(!mChildren.empty() - && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass - || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement + && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass + || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement { // now query children - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end() && filter.getFilterCount() > 0; + for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end(); + iter != end_iter && filter.getFilterCount() > 0; ++iter) { - changed |= filterChildItem((*iter), filter); + filterChildItem((*iter), filter); } } - if (changed) - { - //TODO RN: ensure this still happens, but without dependency on folderview - LLFolderViewFolder* folder = static_cast(mFolderViewItem); - folder->requestArrange(); - } - // if we didn't use all filter iterations // that means we filtered all of our descendants // so filter ourselves now @@ -229,11 +226,10 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) ? filter.checkFolder(this) : true; - setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration()); + setPassedFilter(passed_filter, passed_filter_folder, filter_generation); //TODO RN: create interface for string highlighting //mStringMatchOffset = filter.getStringMatchOffset(this); } - return changed; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index eb2a4bfdec..ab67c93897 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -59,8 +59,8 @@ public: virtual bool passedFilter(S32 filter_generation = -1); virtual bool descendantsPassedFilter(S32 filter_generation = -1); virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); - virtual bool filter( LLFolderViewFilter& filter); - virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); + virtual void filter( LLFolderViewFilter& filter); + virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0; virtual LLToolDragAndDrop::ESource getDragSource() const = 0; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index a25ea0ab46..7005ab7b6a 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -89,7 +89,7 @@ public: virtual bool hasChildren() const { return FALSE; } virtual bool potentiallyVisible() { return true; } - virtual bool filter( LLFolderViewFilter& filter) { return true; } + virtual void filter( LLFolderViewFilter& filter) { } virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) { } virtual bool passedFilter(S32 filter_generation = -1) { return true; } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 9bd716e900..4719191231 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1616,7 +1616,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object, iter != inventory->end(); ) { LLInventoryObject* item = *iter++; - LLFloaterProperties* floater = LLFloaterReg::findTypedInstance("properites", item->getUUID()); + LLFloaterProperties* floater = LLFloaterReg::findTypedInstance("properties", item->getUUID()); if(floater) { floater->refresh(); -- cgit v1.2.3 From 69b57d4ac075db855d88c2ff0e8c580e9e41ebf7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Jul 2012 19:54:39 -0700 Subject: CHUI-252 FIX Deleting an item from object contents in build tools crashes viewer also improved selection behavior for object contents when deleting/adding items --- indra/llui/llhandle.h | 13 +++---- indra/newview/llpanelobjectinventory.cpp | 64 ++++++++++++++++++++++++++------ indra/newview/llpanelobjectinventory.h | 7 ++++ 3 files changed, 66 insertions(+), 18 deletions(-) diff --git a/indra/llui/llhandle.h b/indra/llui/llhandle.h index 37c657dd92..680a1a7f1d 100644 --- a/indra/llui/llhandle.h +++ b/indra/llui/llhandle.h @@ -158,13 +158,6 @@ public: return mHandle; } -protected: - typedef LLHandle handle_type_t; - LLHandleProvider() - { - // provided here to enforce T deriving from LLHandleProvider - } - template LLHandle getDerivedHandle(typename boost::enable_if< typename boost::is_convertible >::type* dummy = 0) const { @@ -173,6 +166,12 @@ protected: return downcast_handle; } +protected: + typedef LLHandle handle_type_t; + LLHandleProvider() + { + // provided here to enforce T deriving from LLHandleProvider + } private: mutable LLRootHandle mHandle; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 4719191231..473b5d9479 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1535,6 +1535,8 @@ void LLPanelObjectInventory::clearContents() LLToolDragAndDrop::getInstance()->endDrag(); } + clearItemIDs(); + if( mScroller ) { // removes mFolders @@ -1550,8 +1552,6 @@ void LLPanelObjectInventory::reset() { clearContents(); - //setBorderVisible(FALSE); - mCommitCallbackRegistrar.pushScope(); // push local callbacks LLRect dummy_rect(0, 1, 1, 0); @@ -1631,15 +1631,20 @@ void LLPanelObjectInventory::updateInventory() // << " panel UUID: " << panel->mTaskUUID << "\n" // << " task UUID: " << object->mID << llendl; // We're still interested in this task's inventory. + std::vector selected_item_ids; std::set selected_items; BOOL inventory_has_focus = FALSE; - if (mHaveInventory) + if (mHaveInventory && mFolders) { selected_items = mFolders->getSelectionList(); inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders); } - - reset(); + for (std::set::iterator it = selected_items.begin(), end_it = selected_items.end(); + it != end_it; + ++it) + { + selected_item_ids.push_back(static_cast((*it)->getViewModelItem())->getUUID()); + } LLViewerObject* objectp = gObjectList.findObject(mTaskUUID); if (objectp) @@ -1647,10 +1652,11 @@ void LLPanelObjectInventory::updateInventory() LLInventoryObject* inventory_root = objectp->getInventoryRoot(); LLInventoryObject::object_list_t contents; objectp->getInventoryContents(contents); - mHaveInventory = TRUE; if (inventory_root && !contents.empty()) { + reset(); + createFolderViews(inventory_root, contents); mIsInventoryEmpty = FALSE; mFolders->setEnabled(TRUE); @@ -1660,6 +1666,8 @@ void LLPanelObjectInventory::updateInventory() // TODO: create an empty inventory mIsInventoryEmpty = TRUE; } + + mHaveInventory = TRUE; } else { @@ -1669,11 +1677,12 @@ void LLPanelObjectInventory::updateInventory() } // restore previous selection - std::set::iterator selection_it; - BOOL first_item = TRUE; - for (selection_it = selected_items.begin(); selection_it != selected_items.end(); ++selection_it) + std::vector::iterator selection_it; + bool first_item = true; + for (selection_it = selected_item_ids.begin(); selection_it != selected_item_ids.end(); ++selection_it) { - LLFolderViewItem* selected_item = (*selection_it); + LLFolderViewItem* selected_item = getItemByID(*selection_it); + if (selected_item) { //HACK: "set" first item then "change" each other one to get keyboard focus right @@ -1689,7 +1698,10 @@ void LLPanelObjectInventory::updateInventory() } } - mFolders->requestArrange(); + if (mFolders) + { + mFolders->requestArrange(); + } mInventoryNeedsUpdate = FALSE; // Edit menu handler is set in onFocusReceived } @@ -1761,6 +1773,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li view = LLUICtrlFactory::create (params); } view->addToFolder(folder); + addItemID(obj->getUUID(), view); } } @@ -1944,3 +1957,32 @@ void LLPanelObjectInventory::onFocusReceived() LLPanel::onFocusReceived(); } + + +LLFolderViewItem* LLPanelObjectInventory::getItemByID( const LLUUID& id ) +{ + std::map::iterator map_it; + map_it = mItemMap.find(id); + if (map_it != mItemMap.end()) + { + return map_it->second; + } + + return NULL; +} + +void LLPanelObjectInventory::removeItemID( const LLUUID& id ) +{ + mItemMap.erase(id); +} + +void LLPanelObjectInventory::addItemID( const LLUUID& id, LLFolderViewItem* itemp ) +{ + mItemMap[id] = itemp; +} + +void LLPanelObjectInventory::clearItemIDs() +{ + mItemMap.clear(); +} + diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index 593fb43b6d..f497c695b3 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -88,8 +88,15 @@ protected: LLInventoryObject* parent, LLFolderViewFolder* folder); void clearContents(); + LLFolderViewItem* getItemByID(const LLUUID& id); + + void addItemID( const LLUUID& id, LLFolderViewItem* itemp ); + void removeItemID(const LLUUID& id); + void clearItemIDs(); private: + std::map mItemMap; + LLScrollContainer* mScroller; LLFolderView* mFolders; -- cgit v1.2.3 From 88f259f7c1aefea197ae8b6c49a79de09feebf5b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Jul 2012 20:08:17 -0700 Subject: optimization of LLSD param parsing --- indra/llui/llsdparam.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 5a0d688f4f..54c8389772 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -305,6 +305,12 @@ namespace LLInitParam // block param interface bool ParamValue::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name) { + if (name_stack.first == name_stack.second + && p.readValue(mValue)) + { + return true; + } + LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack); LLSD::String string; @@ -325,7 +331,11 @@ namespace LLInitParam void ParamValue::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const { - // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack); + // attempt to write LLSD out directly + if (!p.writeValue(mValue, name_stack)) + { + // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack); + } } } -- cgit v1.2.3 From 779d982717098e608285b171ac06f5b9f43a94a0 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 26 Jul 2012 16:30:27 -0700 Subject: made Deprecated params write-only --- indra/llxuixml/llinitparam.h | 36 ++++++++++++++++++++++++++++++++---- indra/newview/llinventoryfilter.cpp | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 606676be2c..71cd550693 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -2015,10 +2015,12 @@ namespace LLInitParam } }; - class Deprecated : public Param + // can appear in data files, but will ignored during parsing + // cannot read or write in code + class Ignored : public Param { public: - explicit Deprecated(const char* name) + explicit Ignored(const char* name) : Param(DERIVED_BLOCK::getBlockDescriptor().mCurrentBlockPtr) { BlockDescriptor& block_descriptor = DERIVED_BLOCK::getBlockDescriptor(); @@ -2049,8 +2051,34 @@ namespace LLInitParam } }; - // different semantics for documentation purposes, but functionally identical - typedef Deprecated Ignored; + // can appear in data files, or be written to in code, but data will be ignored + // cannot be read in code + class Deprecated : public Ignored + { + public: + explicit Deprecated(const char* name) : Ignored(name) {} + + // dummy writer interfaces + template + Deprecated& operator =(const T& val) + { + // do nothing + return *this; + } + + template + DERIVED_BLOCK& operator()(const T& val) + { + // do nothing + return static_cast(Param::enclosingBlock()); + } + + template + void set(const T& val, bool flag_as_provided = true) + { + // do nothing + } + }; public: static BlockDescriptor& getBlockDescriptor() diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 3f38d80a39..3e14faa55e 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -89,7 +89,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); // If it's a folder and we're showing all folders, return automatically. - const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY;; + const BOOL is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)) { return passed_clipboard; -- cgit v1.2.3 From 5221e48ef64d3965f6d4d3dbf0f937982230d11c Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 26 Jul 2012 17:26:27 -0700 Subject: CHUI-251: Resetting the object inventory panel after deleting the last object. --- indra/newview/llpanelobjectinventory.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 473b5d9479..fe1ff01bc2 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1653,13 +1653,16 @@ void LLPanelObjectInventory::updateInventory() LLInventoryObject::object_list_t contents; objectp->getInventoryContents(contents); - if (inventory_root && !contents.empty()) + if (inventory_root) { reset(); + mIsInventoryEmpty = contents.empty(); + if (!mIsInventoryEmpty) + { - createFolderViews(inventory_root, contents); - mIsInventoryEmpty = FALSE; - mFolders->setEnabled(TRUE); + createFolderViews(inventory_root, contents); + mFolders->setEnabled(TRUE); + } } else { -- cgit v1.2.3 From 1e65ba1f909604b027cb7dee5631f698a9f550a8 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 26 Jul 2012 18:57:54 -0700 Subject: CHUI-251: Adding back in the root 'Contents' folder under the Build floater Content tab. --- indra/newview/llpanelobjectinventory.cpp | 25 +++++++++++++++++-------- indra/newview/skins/default/xui/en/strings.xml | 3 --- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index fe1ff01bc2..5887f4d244 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1656,13 +1656,9 @@ void LLPanelObjectInventory::updateInventory() if (inventory_root) { reset(); - mIsInventoryEmpty = contents.empty(); - if (!mIsInventoryEmpty) - { - - createFolderViews(inventory_root, contents); - mFolders->setEnabled(TRUE); - } + mIsInventoryEmpty = FALSE; + createFolderViews(inventory_root, contents); + mFolders->setEnabled(TRUE); } else { @@ -1725,7 +1721,20 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root); if(bridge) { - createViewsForCategory(&contents, inventory_root, mFolders); + LLFolderViewFolder::Params p; + p.name = inventory_root->getName(); + p.tool_tip = p.name; + p.root = mFolders; + p.listener = bridge; + + LLFolderViewFolder* new_folder = LLUICtrlFactory::create(p); + new_folder->addToFolder(mFolders); + new_folder->toggleOpen(); + + if (!contents.empty()) + { + createViewsForCategory(&contents, inventory_root, new_folder); + } } } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 7790a382d9..fff892af68 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2447,9 +2447,6 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale Debits [weekday,datetime,utc] [mth,datetime,utc] [day,datetime,utc], [year,datetime,utc] - - Contents - Acquired Items Cancel -- cgit v1.2.3 From e9f640a26fd6c9219ba28336231621e2ad2558fc Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 27 Jul 2012 17:36:41 +0300 Subject: CHUI-198 FIXED (Hitting minimize option on conversations floater closes floater, not minimize) - Removed code which was hiding floater on minimizing floater. --- indra/newview/llimfloatercontainer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 005794444b..c19683b1c2 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -257,8 +257,6 @@ void LLIMFloaterContainer::setMinimized(BOOL b) if (isMinimized() == b) return; LLMultiFloater::setMinimized(b); - // Hide minimized floater (see EXT-5315) - setVisible(!b); if (isMinimized()) return; -- cgit v1.2.3 From f82d0b171964a0b24ab0eca64febc0c1e3821138 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 27 Jul 2012 17:51:40 +0300 Subject: CHUI-204 FIXED (Conversations panel can be re-sized too small with all conversations torn off) - Increased min width of conversations panel by 10 pixels --- indra/newview/skins/default/xui/en/floater_im_container.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 8e434b5848..e5ef80e352 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -33,7 +33,7 @@ auto_resize="true" height="430" name="conversations_layout_panel" - min_dim="41" + min_dim="51" width="268"> Date: Fri, 27 Jul 2012 22:25:17 +0300 Subject: CHUI-151 FIXED (Implement conversation log) A brief explanation of what have been implemented. More information can be found in comments. 1. Created conversation history viewer (llfloaterconversationpreview) 2. Created LLConversation and LLConversationLog classes which represent and hold data of conversations (llconversationlog) 3. Created LLConversationLogList and LLConversationLogListItem which are the visual representation of LLConversationLog and LLConversation respectively 4. Created LLFloaterConversationLog - which holds and displays LLConversationLogList --- indra/newview/CMakeLists.txt | 10 + indra/newview/app_settings/settings.xml | 22 ++ indra/newview/llappviewer.cpp | 4 + indra/newview/llconversationlog.cpp | 336 ++++++++++++++++ indra/newview/llconversationlog.h | 164 ++++++++ indra/newview/llconversationloglist.cpp | 422 +++++++++++++++++++++ indra/newview/llconversationloglist.h | 143 +++++++ indra/newview/llconversationloglistitem.cpp | 157 ++++++++ indra/newview/llconversationloglistitem.h | 77 ++++ indra/newview/llfloaterconversationlog.cpp | 127 +++++++ indra/newview/llfloaterconversationlog.h | 61 +++ indra/newview/llfloaterconversationpreview.cpp | 112 ++++++ indra/newview/llfloaterconversationpreview.h | 51 +++ indra/newview/llimfloater.cpp | 12 + indra/newview/llimfloater.h | 6 + indra/newview/llimview.cpp | 17 +- indra/newview/llimview.h | 10 +- indra/newview/llstartup.cpp | 3 + indra/newview/llviewerfloaterreg.cpp | 4 + indra/newview/llviewermessage.cpp | 5 +- indra/newview/llvoicevivox.cpp | 1 + .../default/xui/en/floater_conversation_log.xml | 84 ++++ .../xui/en/floater_conversation_preview.xml | 53 +++ .../skins/default/xui/en/floater_im_container.xml | 1 + .../default/xui/en/menu_conversation_log_gear.xml | 134 +++++++ .../default/xui/en/menu_conversation_log_view.xml | 37 ++ .../skins/default/xui/en/menu_participant_view.xml | 16 + .../xui/en/panel_conversation_log_list_item.xml | 108 ++++++ 28 files changed, 2167 insertions(+), 10 deletions(-) create mode 100644 indra/newview/llconversationlog.cpp create mode 100644 indra/newview/llconversationlog.h create mode 100644 indra/newview/llconversationloglist.cpp create mode 100644 indra/newview/llconversationloglist.h create mode 100644 indra/newview/llconversationloglistitem.cpp create mode 100644 indra/newview/llconversationloglistitem.h create mode 100644 indra/newview/llfloaterconversationlog.cpp create mode 100644 indra/newview/llfloaterconversationlog.h create mode 100644 indra/newview/llfloaterconversationpreview.cpp create mode 100644 indra/newview/llfloaterconversationpreview.h create mode 100644 indra/newview/skins/default/xui/en/floater_conversation_log.xml create mode 100644 indra/newview/skins/default/xui/en/floater_conversation_preview.xml create mode 100644 indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml create mode 100644 indra/newview/skins/default/xui/en/menu_conversation_log_view.xml create mode 100644 indra/newview/skins/default/xui/en/menu_participant_view.xml create mode 100644 indra/newview/skins/default/xui/en/panel_conversation_log_list_item.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b31b99f47c..3fe1aec5ff 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -130,6 +130,9 @@ set(viewer_SOURCE_FILES llcommandlineparser.cpp llcompilequeue.cpp llconfirmationmanager.cpp + llconversationlog.cpp + llconversationloglist.cpp + llconversationloglistitem.cpp llcurrencyuimanager.cpp llcylinder.cpp lldateutil.cpp @@ -185,6 +188,8 @@ set(viewer_SOURCE_FILES llfloaterbuyland.cpp llfloatercamera.cpp llfloatercolorpicker.cpp + llfloaterconversationlog.cpp + llfloaterconversationpreview.cpp llfloaterdeleteenvpreset.cpp llfloaterdestinations.cpp llfloaterdisplayname.cpp @@ -687,6 +692,9 @@ set(viewer_HEADER_FILES llcommandlineparser.h llcompilequeue.h llconfirmationmanager.h + llconversationlog.h + llconversationloglist.h + llconversationloglistitem.h llcurrencyuimanager.h llcylinder.h lldateutil.h @@ -742,6 +750,8 @@ set(viewer_HEADER_FILES llfloaterbuyland.h llfloatercamera.h llfloatercolorpicker.h + llfloaterconversationlog.h + llfloaterconversationpreview.h llfloaterdeleteenvpreset.h llfloaterdestinations.h llfloaterdisplayname.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index da3ff2d1ee..7a5abba971 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10004,6 +10004,28 @@ Value 2 + CallLogSortOrder + + Comment + Specifies sort order for Call Log (0 = by name, 1 = by date) + Persist + 1 + Type + U32 + Value + 2 + + SortFriendsFirst + + Comment + Specifies whether friends will be sorted first in Call Log + Persist + 1 + Type + Boolean + Value + 1 + ShowPGSearchAll Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1174d108d2..fe3a1ebf65 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -59,6 +59,7 @@ #include "llares.h" #include "llcurl.h" #include "llcalc.h" +#include "llconversationlog.h" #include "lltexturestats.h" #include "lltexturestats.h" #include "llviewerwindow.h" @@ -1757,6 +1758,9 @@ bool LLAppViewer::cleanup() // save mute list. gMuteList used to also be deleted here too. LLMuteList::getInstance()->cache(gAgent.getID()); + //save call log list + LLConversationLog::instance().cache(); + if (mPurgeOnExit) { llinfos << "Purging all cache files on exit" << llendflush; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp new file mode 100644 index 0000000000..df9350407d --- /dev/null +++ b/indra/newview/llconversationlog.cpp @@ -0,0 +1,336 @@ +/** + * @file llconversationlog.h + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llagent.h" +#include "llconversationlog.h" +#include "lltrans.h" + +struct Conversation_params +{ + Conversation_params(time_t time) + : mTime(time), + mTimestamp(LLConversation::createTimestamp(time)) + {} + + time_t mTime; + std::string mTimestamp; + SessionType mConversationType; + std::string mConversationName; + std::string mHistoryFileName; + LLUUID mSessionID; + LLUUID mParticipantID; + bool mIsVoice; + bool mHasOfflineIMs; +}; + +/************************************************************************/ +/* LLConversation implementation */ +/************************************************************************/ + +LLConversation::LLConversation(const Conversation_params& params) +: mTime(params.mTime), + mTimestamp(params.mTimestamp), + mConversationType(params.mConversationType), + mConversationName(params.mConversationName), + mHistoryFileName(params.mHistoryFileName), + mSessionID(params.mSessionID), + mParticipantID(params.mParticipantID), + mIsVoice(params.mIsVoice), + mHasOfflineIMs(params.mHasOfflineIMs) +{ + setListenIMFloaterOpened(); +} + +LLConversation::LLConversation(const LLIMModel::LLIMSession& session) +: mTime(time_corrected()), + mTimestamp(createTimestamp(mTime)), + mConversationType(session.mSessionType), + mConversationName(session.mName), + mHistoryFileName(session.mHistoryFileName), + mSessionID(session.mSessionID), + mParticipantID(session.mOtherParticipantID), + mIsVoice(session.mStartedAsIMCall), + mHasOfflineIMs(session.mHasOfflineMessage) +{ + setListenIMFloaterOpened(); +} + +LLConversation::LLConversation(const LLConversation& conversation) +{ + mTime = conversation.getTime(); + mTimestamp = conversation.getTimestamp(); + mConversationType = conversation.getConversationType(); + mConversationName = conversation.getConversationName(); + mHistoryFileName = conversation.getHistoryFileName(); + mSessionID = conversation.getSessionID(); + mParticipantID = conversation.getParticipantID(); + mIsVoice = conversation.isVoice(); + mHasOfflineIMs = conversation.hasOfflineMessages(); + + setListenIMFloaterOpened(); +} + +LLConversation::~LLConversation() +{ + mIMFloaterShowedConnection.disconnect(); +} + +void LLConversation::onIMFloaterShown(const LLUUID& session_id) +{ + if (mSessionID == session_id) + { + mHasOfflineIMs = false; + } +} + +// static +const std::string LLConversation::createTimestamp(const time_t& utc_time) +{ + std::string timeStr; + LLSD substitution; + substitution["datetime"] = (S32) utc_time; + + timeStr = "["+LLTrans::getString ("TimeMonth")+"]/[" + +LLTrans::getString ("TimeDay")+"]/[" + +LLTrans::getString ("TimeYear")+"] [" + +LLTrans::getString ("TimeHour")+"]:[" + +LLTrans::getString ("TimeMin")+"]"; + + + LLStringUtil::format (timeStr, substitution); + return timeStr; +} + +void LLConversation::setListenIMFloaterOpened() +{ + LLIMFloater* floater = LLIMFloater::findInstance(mSessionID); + + bool has_offline_ims = !mIsVoice && mHasOfflineIMs; + bool ims_are_read = LLIMFloater::isVisible(floater) && floater->hasFocus(); + + // we don't need to listen for im floater with this conversation is opened + // if floater is already opened or this conversation doesn't have unread offline messages + if (has_offline_ims && !ims_are_read) + { + mIMFloaterShowedConnection = LLIMFloater::setIMFloaterShowedCallback(boost::bind(&LLConversation::onIMFloaterShown, this, _1)); + } +} +/************************************************************************/ +/* LLConversationLog implementation */ +/************************************************************************/ + +LLConversationLog::LLConversationLog() +{ + loadFromFile(getFileName()); + + LLIMMgr::instance().addSessionObserver(this); + LLAvatarTracker::instance().addObserver(this); +} +void LLConversationLog::logConversation(const LLConversation& conversation) +{ + mConversations.push_back(conversation); + notifyObservers(); +} + +void LLConversationLog::removeConversation(const LLConversation& conversation) +{ + conversations_vec_t::iterator conv_it = mConversations.begin(); + for(; conv_it != mConversations.end(); ++conv_it) + { + if (conv_it->getSessionID() == conversation.getSessionID() && conv_it->getTime() == conversation.getTime()) + { + mConversations.erase(conv_it); + notifyObservers(); + return; + } + } +} + +const LLConversation* LLConversationLog::getConversation(const LLUUID& session_id) +{ + conversations_vec_t::const_iterator conv_it = mConversations.begin(); + for(; conv_it != mConversations.end(); ++conv_it) + { + if (conv_it->getSessionID() == session_id) + { + return &*conv_it; + } + } + + return NULL; +} + +void LLConversationLog::addObserver(LLConversationLogObserver* observer) +{ + mObservers.insert(observer); +} + +void LLConversationLog::removeObserver(LLConversationLogObserver* observer) +{ + mObservers.erase(observer); +} + +void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); + if (session) + { + LLConversation conversation(*session); + LLConversationLog::instance().logConversation(conversation); + } +} + +// LLFriendObserver +void LLConversationLog::changed(U32 mask) +{ + if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE)) + { + notifyObservers(); + } +} + +void LLConversationLog::cache() +{ + saveToFile(getFileName()); +} + +std::string LLConversationLog::getFileName() +{ + std::string agent_id_string; + gAgent.getID().toString(agent_id_string); + + return gDirUtilp->getExpandedFilename(LL_PATH_CACHE, agent_id_string) + ".call_log"; +} + +bool LLConversationLog::saveToFile(const std::string& filename) +{ + if(!filename.size()) + { + llwarns << "Call log list filename is empty!" << llendl; + return false; + } + + LLFILE* fp = LLFile::fopen(filename, "wb"); + if (!fp) + { + llwarns << "Couldn't open call log list" << filename << llendl; + return false; + } + + std::string participant_id; + std::string conversation_id; + + conversations_vec_t::const_iterator conv_it = mConversations.begin(); + for (; conv_it != mConversations.end(); ++conv_it) + { + conv_it->getSessionID().toString(conversation_id); + conv_it->getParticipantID().toString(participant_id); + + // examples of two file entries + // [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe| + // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| + + fprintf(fp, "[%d] %d %d %d %s| %s %s %s|\n", + (S32)conv_it->getTime(), + (S32)conv_it->getConversationType(), + (S32)conv_it->isVoice(), + (S32)conv_it->hasOfflineMessages(), + conv_it->getConversationName().c_str(), + participant_id.c_str(), + conversation_id.c_str(), + conv_it->getHistoryFileName().c_str()); + } + fclose(fp); + return true; +} +bool LLConversationLog::loadFromFile(const std::string& filename) +{ + if(!filename.size()) + { + llwarns << "Call log list filename is empty!" << llendl; + return false; + } + + LLFILE* fp = LLFile::fopen(filename, "rb"); + if (!fp) + { + llwarns << "Couldn't open call log list" << filename << llendl; + return false; + } + + char buffer[MAX_STRING]; + char conv_name_buffer[MAX_STRING]; + char part_id_buffer[MAX_STRING]; + char conv_id_buffer[MAX_STRING]; + char history_file_name[MAX_STRING]; + int is_voice; + int has_offline_ims; + int stype; + S32 time; + + while (!feof(fp) && fgets(buffer, MAX_STRING, fp)) + { + conv_name_buffer[0] = '\0'; + part_id_buffer[0] = '\0'; + conv_id_buffer[0] = '\0'; + + sscanf(buffer, "[%d] %d %d %d %[^|]| %s %s %[^|]|", + &time, + &stype, + &is_voice, + &has_offline_ims, + conv_name_buffer, + part_id_buffer, + conv_id_buffer, + history_file_name); + + Conversation_params params(time); + params.mConversationType = (SessionType)stype; + params.mIsVoice = is_voice; + params.mHasOfflineIMs = has_offline_ims; + params.mConversationName = std::string(conv_name_buffer); + params.mParticipantID = LLUUID(part_id_buffer); + params.mSessionID = LLUUID(conv_id_buffer); + params.mHistoryFileName = std::string(history_file_name); + + LLConversation conversation(params); + mConversations.push_back(conversation); + } + fclose(fp); + + notifyObservers(); + return true; +} + +void LLConversationLog::notifyObservers() +{ + std::set::const_iterator iter = mObservers.begin(); + for (; iter != mObservers.end(); ++iter) + { + (*iter)->changed(); + } +} diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h new file mode 100644 index 0000000000..700472ca8b --- /dev/null +++ b/indra/newview/llconversationlog.h @@ -0,0 +1,164 @@ +/** + * @file llconversationlog.h + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 LLCONVERSATIONLOG_H_ +#define LLCONVERSATIONLOG_H_ + +#include "llcallingcard.h" +#include "llimfloater.h" +#include "llimview.h" + +class LLConversationLogObserver; +class Conversation_params; + +typedef LLIMModel::LLIMSession::SType SessionType; + +/* + * This class represents a particular session(conversation) of any type(im/voice/p2p/group/...) by storing some of session's data. + * Each LLConversation object has a corresponding visual representation in a form of LLConversationLogListItem. + */ +class LLConversation +{ +public: + + LLConversation(const Conversation_params& params); + LLConversation(const LLIMModel::LLIMSession& session); + LLConversation(const LLConversation& conversation); + + ~LLConversation(); + + const SessionType& getConversationType() const { return mConversationType; } + const std::string& getConversationName() const { return mConversationName; } + const std::string& getHistoryFileName() const { return mHistoryFileName; } + const LLUUID& getSessionID() const { return mSessionID; } + const LLUUID& getParticipantID() const { return mParticipantID; } + const std::string& getTimestamp() const { return mTimestamp; } + const time_t& getTime() const { return mTime; } + bool isVoice() const { return mIsVoice; } + bool hasOfflineMessages() const { return mHasOfflineIMs; } + + /* + * Resets flag of unread offline message to false when im floater with this conversation is opened. + */ + void onIMFloaterShown(const LLUUID& session_id); + + /* + * returns string representation(in form of: mm/dd/yyyy hh:mm) of time when conversation was started + */ + static const std::string createTimestamp(const time_t& utc_time); + +private: + + /* + * If conversation has unread offline messages sets callback for opening LLIMFloater + * with this conversation. + */ + void setListenIMFloaterOpened(); + + boost::signals2::connection mIMFloaterShowedConnection; + + time_t mTime; // start time of conversation + SessionType mConversationType; + std::string mConversationName; + std::string mHistoryFileName; + LLUUID mSessionID; + LLUUID mParticipantID; + bool mIsVoice; + bool mHasOfflineIMs; + std::string mTimestamp; // conversation start time in form of: mm/dd/yyyy hh:mm +}; + +/** + * LLConversationLog stores all agent's conversations. + * This class is responsible for creating and storing LLConversation objects when im or voice session starts. + * Also this class saves/retrieves conversations to/from file. + * + * Also please note that it may be several conversations with the same sessionID stored in the conversation log. + * To distinguish two conversations with the same sessionID it's also needed to compare their creation date. + */ + +class LLConversationLog : public LLSingleton, LLIMSessionObserver, LLFriendObserver +{ + friend class LLSingleton; +public: + + /** + * adds conversation to the conversation list and notifies observers + */ + void logConversation(const LLConversation& conversation); + void removeConversation(const LLConversation& conversation); + + /** + * Returns first conversation with matched session_id + */ + const LLConversation* getConversation(const LLUUID& session_id); + + void addObserver(LLConversationLogObserver* observer); + void removeObserver(LLConversationLogObserver* observer); + + const std::vector& getConversations() { return mConversations; } + + // LLIMSessionObserver triggers + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){} // Stub + virtual void sessionRemoved(const LLUUID& session_id){} // Stub + virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){} // Stub + + // LLFriendObserver trigger + virtual void changed(U32 mask); + + /** + * public method which is called on viewer exit to save conversation log + */ + void cache(); + +private: + + LLConversationLog(); + void notifyObservers(); + + /** + * constructs file name in which conversations log will be saved + * file name template: agentID.call_log. + * For example: a086icaa-782d-88d0-ae29-987a55c99sss.call_log + */ + std::string getFileName(); + + bool saveToFile(const std::string& filename); + bool loadFromFile(const std::string& filename); + + typedef std::vector conversations_vec_t; + std::vector mConversations; + std::set mObservers; +}; + +class LLConversationLogObserver +{ +public: + virtual ~LLConversationLogObserver(){} + virtual void changed() = 0; +}; + +#endif /* LLCONVERSATIONLOG_H_ */ diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp new file mode 100644 index 0000000000..0433719a89 --- /dev/null +++ b/indra/newview/llconversationloglist.cpp @@ -0,0 +1,422 @@ +/** + * @file llconversationloglist.cpp + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llavataractions.h" +#include "llagent.h" +#include "llfloaterreg.h" +#include "llfloaterconversationpreview.h" +#include "llgroupactions.h" +#include "llconversationloglist.h" +#include "llconversationloglistitem.h" +#include "llviewermenu.h" + +static LLDefaultChildRegistry::Register r("conversation_log_list"); + +static LLConversationLogListNameComparator NAME_COMPARATOR; +static LLConversationLogListDateComparator DATE_COMPARATOR; + +LLConversationLogList::LLConversationLogList(const Params& p) +: LLFlatListViewEx(p), + mIsDirty(true) +{ + LLConversationLog::instance().addObserver(this); + + // Set up context menu. + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar check_registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + + registrar.add ("Calllog.Action", boost::bind(&LLConversationLogList::onCustomAction, this, _2)); + check_registrar.add ("Calllog.Check", boost::bind(&LLConversationLogList::isActionChecked,this, _2)); + enable_registrar.add("Calllog.Enable", boost::bind(&LLConversationLogList::isActionEnabled,this, _2)); + + LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile( + "menu_conversation_log_gear.xml", + gMenuHolder, + LLViewerMenuHolderGL::child_registry_t::instance()); + if(context_menu) + { + mContextMenu = context_menu->getHandle(); + } + + mIsFriendsOnTop = gSavedSettings.getBOOL("SortFriendsFirst"); +} + +LLConversationLogList::~LLConversationLogList() +{ + if (mContextMenu.get()) + { + mContextMenu.get()->die(); + } + + LLConversationLog::instance().removeObserver(this); +} + +void LLConversationLogList::draw() +{ + if (mIsDirty) + { + refresh(); + } + LLFlatListViewEx::draw(); +} + +BOOL LLConversationLogList::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask); + + LLToggleableMenu* context_menu = mContextMenu.get(); + { + context_menu->buildDrawLabels(); + if (context_menu && size()) + context_menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(this, context_menu, x, y); + } + + return handled; +} + +void LLConversationLogList::setNameFilter(const std::string& filter) +{ + std::string filter_upper = filter; + LLStringUtil::toUpper(filter_upper); + if (mNameFilter != filter_upper) + { + mNameFilter = filter_upper; + setDirty(); + } +} + +bool LLConversationLogList::findInsensitive(std::string haystack, const std::string& needle_upper) +{ + LLStringUtil::toUpper(haystack); + return haystack.find(needle_upper) != std::string::npos; +} + +void LLConversationLogList::sortByName() +{ + setComparator(&NAME_COMPARATOR); + sort(); +} + +void LLConversationLogList::sortByDate() +{ + setComparator(&DATE_COMPARATOR); + sort(); +} + +void LLConversationLogList::toggleSortFriendsOnTop() +{ + mIsFriendsOnTop = !mIsFriendsOnTop; + gSavedSettings.setBOOL("SortFriendsFirst", mIsFriendsOnTop); + sort(); +} + +void LLConversationLogList::changed() +{ + refresh(); +} + +void LLConversationLogList::addNewItem(const LLConversation* conversation) +{ + LLConversationLogListItem* item = new LLConversationLogListItem(&*conversation); + if (!mNameFilter.empty()) + { + item->highlightNameDate(mNameFilter); + } + addItem(item, conversation->getSessionID(), ADD_TOP); +} + +void LLConversationLogList::refresh() +{ + rebuildList(); + sort(); + + mIsDirty = false; +} + +void LLConversationLogList::rebuildList() +{ + clear(); + + bool have_filter = !mNameFilter.empty(); + + const std::vector& conversations = LLConversationLog::instance().getConversations(); + std::vector::const_iterator iter = conversations.begin(); + + for (; iter != conversations.end(); ++iter) + { + bool not_found = have_filter && !findInsensitive(iter->getConversationName(), mNameFilter) && !findInsensitive(iter->getTimestamp(), mNameFilter); + if (not_found) + continue; + + addNewItem(&*iter); + } +} + +void LLConversationLogList::onCustomAction(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + const LLUUID& selected_id = getSelectedConversation()->getParticipantID(); + LLIMModel::LLIMSession::SType stype = getSelectedSessionType(); + + if ("im" == command_name) + { + switch (stype) + { + case LLIMModel::LLIMSession::P2P_SESSION: + LLAvatarActions::startIM(selected_id); + break; + + case LLIMModel::LLIMSession::GROUP_SESSION: + LLGroupActions::startIM(selected_id); + break; + + default: + break; + } + } + else if ("call" == command_name) + { + switch (stype) + { + case LLIMModel::LLIMSession::P2P_SESSION: + LLAvatarActions::startCall(selected_id); + break; + + case LLIMModel::LLIMSession::GROUP_SESSION: + LLGroupActions::startCall(selected_id); + break; + + default: + break; + } + } + else if ("view_profile" == command_name) + { + switch (stype) + { + case LLIMModel::LLIMSession::P2P_SESSION: + LLAvatarActions::showProfile(selected_id); + break; + + case LLIMModel::LLIMSession::GROUP_SESSION: + LLGroupActions::show(selected_id); + break; + + default: + break; + } + } + else if ("chat_history" == command_name) + { + const LLUUID& session_id = getSelectedConversation()->getSessionID(); + LLFloaterReg::showInstance("preview_conversation", session_id, true); + } + else if ("offer_teleport" == command_name) + { + LLAvatarActions::offerTeleport(selected_id); + } + else if("add_rem_friend" == command_name) + { + if (LLAvatarActions::isFriend(selected_id)) + { + LLAvatarActions::removeFriendDialog(selected_id); + } + else + { + LLAvatarActions::requestFriendshipDialog(selected_id); + } + } + else if ("invite_to_group" == command_name) + { + LLAvatarActions::inviteToGroup(selected_id); + } + else if ("show_on_map" == command_name) + { + LLAvatarActions::showOnMap(selected_id); + } + else if ("share" == command_name) + { + LLAvatarActions::share(selected_id); + } + else if ("pay" == command_name) + { + LLAvatarActions::pay(selected_id); + } + else if ("block" == command_name) + { + LLAvatarActions::toggleBlock(selected_id); + } +} + +bool LLConversationLogList::isActionEnabled(const LLSD& userdata) +{ + if (numSelected() != 1) + { + return false; + } + + const std::string command_name = userdata.asString(); + + LLIMModel::LLIMSession::SType stype = getSelectedSessionType(); + const LLUUID& selected_id = getSelectedConversation()->getParticipantID(); + + bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == stype; + bool is_group = LLIMModel::LLIMSession::GROUP_SESSION == stype; + + if ("can_im" == command_name || "can_view_profile" == command_name) + { + return is_p2p || is_group; + } + else if ("can_view_chat_history" == command_name) + { + return true; + } + else if ("can_call" == command_name) + { + return (is_p2p || is_group) && LLAvatarActions::canCall(); + } + else if ("add_rem_friend" == command_name || + "can_invite_to_group" == command_name || + "can_share" == command_name || + "can_block" == command_name || + "can_pay" == command_name) + { + return is_p2p; + } + else if("can_offer_teleport" == command_name) + { + return is_p2p && LLAvatarActions::canOfferTeleport(selected_id); + } + else if ("can_show_on_map") + { + return is_p2p && ((LLAvatarTracker::instance().isBuddyOnline(selected_id) && is_agent_mappable(selected_id)) || gAgent.isGodlike()); + } + + return false; +} + +bool LLConversationLogList::isActionChecked(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + + const LLUUID& selected_id = getSelectedConversation()->getParticipantID(); + bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == getSelectedSessionType(); + + if ("is_blocked" == command_name) + { + return is_p2p && LLAvatarActions::isBlocked(selected_id); + } + else if ("is_friend" == command_name) + { + return is_p2p && LLAvatarActions::isFriend(selected_id); + } + + return false; +} + +LLIMModel::LLIMSession::SType LLConversationLogList::getSelectedSessionType() +{ + const LLConversationLogListItem* item = getSelectedConversationPanel(); + + if (item) + { + return item->getConversation()->getConversationType(); + } + + return LLIMModel::LLIMSession::NONE_SESSION; +} + +const LLConversationLogListItem* LLConversationLogList::getSelectedConversationPanel() +{ + LLPanel* panel = LLFlatListViewEx::getSelectedItem(); + LLConversationLogListItem* conv_panel = dynamic_cast(panel); + + return conv_panel; +} + +const LLConversation* LLConversationLogList::getSelectedConversation() +{ + const LLConversationLogListItem* panel = getSelectedConversationPanel(); + + if (panel) + { + return panel->getConversation(); + } + + return NULL; +} + +bool LLConversationLogListItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const +{ + const LLConversationLogListItem* conversation_item1 = dynamic_cast(item1); + const LLConversationLogListItem* conversation_item2 = dynamic_cast(item2); + + if (!conversation_item1 || !conversation_item2) + { + llerror("conversation_item1 and conversation_item2 cannot be null", 0); + return true; + } + + return doCompare(conversation_item1, conversation_item2); +} + +bool LLConversationLogListNameComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const +{ + std::string name1 = conversation1->getConversation()->getConversationName(); + std::string name2 = conversation2->getConversation()->getConversationName(); + const LLUUID& id1 = conversation1->getConversation()->getParticipantID(); + const LLUUID& id2 = conversation2->getConversation()->getParticipantID(); + + LLStringUtil::toUpper(name1); + LLStringUtil::toUpper(name2); + + bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst"); + if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2))) + { + return LLAvatarActions::isFriend(id1); + } + + return name1 < name2; +} + +bool LLConversationLogListDateComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const +{ + time_t date1 = conversation1->getConversation()->getTime(); + time_t date2 = conversation2->getConversation()->getTime(); + const LLUUID& id1 = conversation1->getConversation()->getParticipantID(); + const LLUUID& id2 = conversation2->getConversation()->getParticipantID(); + + bool friends_first = gSavedSettings.getBOOL("SortFriendsFirst"); + if (friends_first && (LLAvatarActions::isFriend(id1) ^ LLAvatarActions::isFriend(id2))) + { + return LLAvatarActions::isFriend(id1); + } + + return date1 > date2; +} diff --git a/indra/newview/llconversationloglist.h b/indra/newview/llconversationloglist.h new file mode 100644 index 0000000000..dff34a74c6 --- /dev/null +++ b/indra/newview/llconversationloglist.h @@ -0,0 +1,143 @@ +/** + * @file llconversationloglist.h + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 LLCONVERSATIONLOGLIST_H_ +#define LLCONVERSATIONLOGLIST_H_ + +#include "llconversationlog.h" +#include "llflatlistview.h" +#include "lltoggleablemenu.h" + +class LLConversationLogListItem; + +/** + * List of all agent's conversations. I.e. history of conversations. + * This list represents contents of the LLConversationLog. + * Each change in LLConversationLog leads to rebuilding this list, so + * it's always in actual state. + */ + +class LLConversationLogList: public LLFlatListViewEx, public LLConversationLogObserver +{ + LOG_CLASS(LLConversationLogList); +public: + struct Params : public LLInitParam::Block + { + Params(){}; + }; + + LLConversationLogList(const Params& p); + virtual ~LLConversationLogList(); + + virtual void draw(); + + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + + LLToggleableMenu* getContextMenu() const { return mContextMenu.get(); } + + void addNewItem(const LLConversation* conversation); + void setNameFilter(const std::string& filter); + void sortByName(); + void sortByDate(); + void toggleSortFriendsOnTop(); + bool getSortFriendsOnTop() const { return mIsFriendsOnTop; } + + /** + * Changes from LLConversationLogObserver + */ + virtual void changed(); + +private: + + void setDirty(bool dirty = true) { mIsDirty = dirty; } + void refresh(); + + /** + * Clears list and re-adds items from LLConverstationLog + * If filter is not empty re-adds items which match the filter + */ + void rebuildList(); + + bool findInsensitive(std::string haystack, const std::string& needle_upper); + + void onCustomAction (const LLSD& userdata); + bool isActionEnabled(const LLSD& userdata); + bool isActionChecked(const LLSD& userdata); + + LLIMModel::LLIMSession::SType getSelectedSessionType(); + const LLConversationLogListItem* getSelectedConversationPanel(); + const LLConversation* getSelectedConversation(); + + LLHandle mContextMenu; + bool mIsDirty; + bool mIsFriendsOnTop; + std::string mNameFilter; +}; + +/** + * Abstract comparator for ConversationLogList items + */ +class LLConversationLogListItemComparator : public LLFlatListView::ItemComparator +{ + LOG_CLASS(LLConversationLogListItemComparator); + +public: + LLConversationLogListItemComparator() {}; + virtual ~LLConversationLogListItemComparator() {}; + + virtual bool compare(const LLPanel* item1, const LLPanel* item2) const; + +protected: + + virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const = 0; +}; + +class LLConversationLogListNameComparator : public LLConversationLogListItemComparator +{ + LOG_CLASS(LLConversationLogListNameComparator); + +public: + LLConversationLogListNameComparator() {}; + virtual ~LLConversationLogListNameComparator() {}; + +protected: + + virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const; +}; + +class LLConversationLogListDateComparator : public LLConversationLogListItemComparator +{ + LOG_CLASS(LLConversationLogListDateComparator); + +public: + LLConversationLogListDateComparator() {}; + virtual ~LLConversationLogListDateComparator() {}; + +protected: + + virtual bool doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const; +}; + +#endif /* LLCONVERSATIONLOGLIST_H_ */ diff --git a/indra/newview/llconversationloglistitem.cpp b/indra/newview/llconversationloglistitem.cpp new file mode 100644 index 0000000000..fc2e757864 --- /dev/null +++ b/indra/newview/llconversationloglistitem.cpp @@ -0,0 +1,157 @@ +/** + * @file llconversationloglistitem.cpp + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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" + +// llui +#include "lliconctrl.h" +#include "lltextbox.h" +#include "lltextutil.h" + +// newview +#include "llavatariconctrl.h" +#include "llconversationlog.h" +#include "llconversationloglistitem.h" +#include "llgroupiconctrl.h" +#include "llinventoryicon.h" + +LLConversationLogListItem::LLConversationLogListItem(const LLConversation* conversation) +: LLPanel(), + mConversation(conversation), + mConversationName(NULL), + mConversationDate(NULL) +{ + buildFromFile("panel_conversation_log_list_item.xml"); + + LLIMFloater* floater = LLIMFloater::findInstance(mConversation->getSessionID()); + + bool has_offline_ims = !mConversation->isVoice() && mConversation->hasOfflineMessages(); + bool ims_are_read = LLIMFloater::isVisible(floater) && floater->hasFocus(); + + if (has_offline_ims && !ims_are_read) + { + mIMFloaterShowedConnection = LLIMFloater::setIMFloaterShowedCallback(boost::bind(&LLConversationLogListItem::onIMFloaterShown, this, _1)); + } +} + +LLConversationLogListItem::~LLConversationLogListItem() +{ + mIMFloaterShowedConnection.disconnect(); +} + +BOOL LLConversationLogListItem::postBuild() +{ + initIcons(); + + // set conversation name + mConversationName = getChild("conversation_name"); + mConversationName->setValue(mConversation->getConversationName()); + + // set conversation date and time + mConversationDate = getChild("date_time"); + mConversationDate->setValue(mConversation->getTimestamp()); + + getChild("delete_btn")->setClickedCallback(boost::bind(&LLConversationLogListItem::onRemoveBtnClicked, this)); + + return TRUE; +} + +void LLConversationLogListItem::initIcons() +{ + switch (mConversation->getConversationType()) + { + case LLIMModel::LLIMSession::P2P_SESSION: + case LLIMModel::LLIMSession::ADHOC_SESSION: + { + LLAvatarIconCtrl* avatar_icon = getChild("avatar_icon"); + avatar_icon->setVisible(TRUE); + avatar_icon->setValue(mConversation->getParticipantID()); + break; + } + case LLIMModel::LLIMSession::GROUP_SESSION: + { + LLGroupIconCtrl* group_icon = getChild("group_icon"); + group_icon->setVisible(TRUE); + group_icon->setValue(mConversation->getSessionID()); + break; + } + default: + break; + } + + if (mConversation->isVoice()) + { + getChild("voice_session_icon")->setVisible(TRUE); + } + else + { + if (mConversation->hasOfflineMessages()) + { + getChild("unread_ims_icon")->setVisible(TRUE); + } + } +} + +void LLConversationLogListItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + getChildView("hovered_icon")->setVisible(true); + LLPanel::onMouseEnter(x, y, mask); +} + +void LLConversationLogListItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + getChildView("hovered_icon")->setVisible(false); + LLPanel::onMouseLeave(x, y, mask); +} + +void LLConversationLogListItem::setValue(const LLSD& value) +{ + if (!value.isMap() || !value.has("selected")) + { + return; + } + + getChildView("selected_icon")->setVisible(value["selected"]); +} + +void LLConversationLogListItem::onIMFloaterShown(const LLUUID& session_id) +{ + if (mConversation->getSessionID() == session_id) + { + getChild("unread_ims_icon")->setVisible(FALSE); + } +} + +void LLConversationLogListItem::onRemoveBtnClicked() +{ + LLConversationLog::instance().removeConversation(*mConversation); +} + +void LLConversationLogListItem::highlightNameDate(const std::string& highlited_text) +{ + LLStyle::Params params; + LLTextUtil::textboxSetHighlightedVal(mConversationName, params, mConversation->getConversationName(), highlited_text); + LLTextUtil::textboxSetHighlightedVal(mConversationDate, params, mConversation->getTimestamp(), highlited_text); +} diff --git a/indra/newview/llconversationloglistitem.h b/indra/newview/llconversationloglistitem.h new file mode 100644 index 0000000000..deba7d4563 --- /dev/null +++ b/indra/newview/llconversationloglistitem.h @@ -0,0 +1,77 @@ +/** + * @file llconversationloglistitem.h + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 LLCONVERSATIONLOGLISTITEM_H_ +#define LLCONVERSATIONLOGLISTITEM_H_ + +#include "llimfloater.h" +#include "llpanel.h" + +class LLTextBox; +class LLConversation; + +/** + * This class is a visual representation of LLConversation, each of which is LLConversationLog entry. + * LLConversationLogList consists of these LLConversationLogListItems. + * LLConversationLogListItem consists of: + * conversaion_type_icon + * conversaion_name + * conversaion_date + * Also LLConversationLogListItem holds pointer to its LLConversationLog. + */ + +class LLConversationLogListItem : public LLPanel +{ +public: + LLConversationLogListItem(const LLConversation* conversation); + virtual ~LLConversationLogListItem(); + + void onMouseEnter(S32 x, S32 y, MASK mask); + void onMouseLeave(S32 x, S32 y, MASK mask); + + virtual void setValue(const LLSD& value); + + virtual BOOL postBuild(); + + void onIMFloaterShown(const LLUUID& session_id); + void onRemoveBtnClicked(); + + const LLConversation* getConversation() const { return mConversation; } + + void highlightNameDate(const std::string& highlited_text); + +private: + + void initIcons(); + + const LLConversation* mConversation; + + LLTextBox* mConversationName; + LLTextBox* mConversationDate; + + boost::signals2::connection mIMFloaterShowedConnection; +}; + +#endif /* LLCONVERSATIONLOGITEM_H_ */ diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp new file mode 100644 index 0000000000..569ba12ed6 --- /dev/null +++ b/indra/newview/llfloaterconversationlog.cpp @@ -0,0 +1,127 @@ +/** + * @file llfloaterconversationlog.cpp + * @brief Functionality of the "conversation log" floater + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llconversationloglist.h" +#include "llfiltereditor.h" +#include "llfloaterconversationlog.h" +#include "llmenubutton.h" + +LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key) +: LLFloater(key), + mConversationLogList(NULL) +{ + mCommitCallbackRegistrar.add("CallLog.Action", boost::bind(&LLFloaterConversationLog::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("CallLog.Check", boost::bind(&LLFloaterConversationLog::isActionChecked, this, _2)); +} + +BOOL LLFloaterConversationLog::postBuild() +{ + mConversationLogList = getChild("conversation_log_list"); + + switch (gSavedSettings.getU32("CallLogSortOrder")) + { + case E_SORT_BY_NAME: + mConversationLogList->sortByName(); + break; + + case E_SORT_BY_DATE: + mConversationLogList->sortByDate(); + break; + } + + // Use the context menu of the Conversation list for the Conversation tab gear menu. + LLToggleableMenu* conversations_gear_menu = mConversationLogList->getContextMenu(); + if (conversations_gear_menu) + { + getChild("conversations_gear_btn")->setMenu(conversations_gear_menu, LLMenuButton::MP_BOTTOM_LEFT); + } + + getChild("people_filter_input")->setCommitCallback(boost::bind(&LLFloaterConversationLog::onFilterEdit, this, _2)); + + return LLFloater::postBuild(); +} + +void LLFloaterConversationLog::draw() +{ + LLFloater::draw(); +} + +void LLFloaterConversationLog::onFilterEdit(const std::string& search_string) +{ + std::string filter = search_string; + LLStringUtil::trimHead(filter); + + mConversationLogList->setNameFilter(filter); +} + + +void LLFloaterConversationLog::onCustomAction (const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + + if ("sort_by_name" == command_name) + { + mConversationLogList->sortByName(); + gSavedSettings.setU32("CallLogSortOrder", E_SORT_BY_NAME); + } + else if ("sort_by_date" == command_name) + { + mConversationLogList->sortByDate(); + gSavedSettings.setU32("CallLogSortOrder", E_SORT_BY_DATE); + } + else if ("sort_friends_on_top" == command_name) + { + mConversationLogList->toggleSortFriendsOnTop(); + } +} + +bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata) +{ + return true; +} + +bool LLFloaterConversationLog::isActionChecked(const LLSD& userdata) +{ + const std::string command_name = userdata.asString(); + + U32 sort_order = gSavedSettings.getU32("CallLogSortOrder"); + + if ("sort_by_name" == command_name) + { + return sort_order == E_SORT_BY_NAME; + } + else if ("sort_by_date" == command_name) + { + return sort_order == E_SORT_BY_DATE; + } + else if ("sort_friends_on_top" == command_name) + { + return gSavedSettings.getBOOL("SortFriendsFirst"); + } + + return false; +} diff --git a/indra/newview/llfloaterconversationlog.h b/indra/newview/llfloaterconversationlog.h new file mode 100644 index 0000000000..40dd266663 --- /dev/null +++ b/indra/newview/llfloaterconversationlog.h @@ -0,0 +1,61 @@ +/** + * @file llfloaterconversationlog.h + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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_LLFLOATERCONVERSATIONLOG_H_ +#define LL_LLFLOATERCONVERSATIONLOG_H_ + +#include "llfloater.h" + +class LLConversationLogList; + +class LLFloaterConversationLog : public LLFloater +{ +public: + + typedef enum e_sort_oder{ + E_SORT_BY_NAME = 0, + E_SORT_BY_DATE = 1, + } ESortOrder; + + LLFloaterConversationLog(const LLSD& key); + virtual ~LLFloaterConversationLog(){}; + + virtual BOOL postBuild(); + + virtual void draw(); + + void onFilterEdit(const std::string& search_string); + +private: + + void onCustomAction (const LLSD& userdata); + bool isActionEnabled(const LLSD& userdata); + bool isActionChecked(const LLSD& userdata); + + LLConversationLogList* mConversationLogList; +}; + + +#endif /* LLFLOATERCONVERSATIONLOG_H_ */ diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp new file mode 100644 index 0000000000..e8554bb066 --- /dev/null +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -0,0 +1,112 @@ +/** + * @file llfloaterconversationpreview.cpp + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llconversationlog.h" +#include "llfloaterconversationpreview.h" +#include "llimview.h" +#include "lllineeditor.h" + +LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id) +: LLFloater(session_id), + mChatHistory(NULL), + mSessionID(session_id.asUUID()) +{} + +BOOL LLFloaterConversationPreview::postBuild() +{ + mChatHistory = getChild("chat_history"); + + const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID); + if (conv) + { + std::string name = conv->getConversationName(); + LLStringUtil::format_map_t args; + args["[NAME]"] = name; + std::string title = getString("Title", args); + setTitle(title); + + getChild("description")->setValue(name); + } + + return LLFloater::postBuild(); +} + +void LLFloaterConversationPreview::draw() +{ + LLFloater::draw(); +} + +void LLFloaterConversationPreview::onOpen(const LLSD& session_id) +{ + const LLConversation* conv = LLConversationLog::instance().getConversation(session_id); + if (!conv) + { + return; + } + std::list messages; + std::string file = conv->getHistoryFileName(); + LLLogChat::loadAllHistory(file, messages); + + if (messages.size()) + { + std::ostringstream message; + std::list::const_iterator iter = messages.begin(); + for (; iter != messages.end(); ++iter) + { + LLSD msg = *iter; + + std::string time = msg["time"].asString(); + LLUUID from_id = msg["from_id"].asUUID(); + std::string from = msg["from"].asString(); + std::string message = msg["message"].asString(); + bool is_history = msg["is_history"].asBoolean(); + + LLChat chat; + chat.mFromID = from_id; + chat.mSessionID = session_id; + chat.mFromName = from; + chat.mTimeStr = time; + chat.mChatStyle = is_history ? CHAT_STYLE_HISTORY : chat.mChatStyle; + chat.mText = message; + + appendMessage(chat); + } + } +} + +void LLFloaterConversationPreview::appendMessage(const LLChat& chat) +{ + if (!chat.mMuted) + { + LLSD args; + args["use_plain_text_chat_history"] = true; + args["show_time"] = true; + args["show_names_for_p2p_conv"] = true; + + mChatHistory->appendMessage(chat); + } +} diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h new file mode 100644 index 0000000000..cfc7c34485 --- /dev/null +++ b/indra/newview/llfloaterconversationpreview.h @@ -0,0 +1,51 @@ +/** + * @file llfloaterconversationpreview.h + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 LLFLOATERCONVERSATIONPREVIEW_H_ +#define LLFLOATERCONVERSATIONPREVIEW_H_ + +#include "llchathistory.h" +#include "llfloater.h" + +class LLFloaterConversationPreview : public LLFloater +{ +public: + + LLFloaterConversationPreview(const LLSD& session_id); + virtual ~LLFloaterConversationPreview(){}; + + virtual BOOL postBuild(); + + virtual void draw(); + virtual void onOpen(const LLSD& session_id); + +private: + void appendMessage(const LLChat& chat); + + LLChatHistory* mChatHistory; + LLUUID mSessionID; +}; + +#endif /* LLFLOATERCONVERSATIONPREVIEW_H_ */ diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 22ce3cd42b..f1d7d1c04f 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -59,6 +59,8 @@ #include "llviewerchat.h" #include "llnotificationmanager.h" +floater_showed_signal_t LLIMFloater::sIMFloaterShowedSignal; + LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLIMConversation(session_id), mLastMessageIndex(-1), @@ -765,6 +767,11 @@ void LLIMFloater::setVisible(BOOL visible) chiclet->setToggleState(false); } } + + if (visible) + { + sIMFloaterShowedSignal(mSessionID); + } } BOOL LLIMFloater::getVisible() @@ -1334,3 +1341,8 @@ void LLIMFloater::addToHost(const LLUUID& session_id) } } } + +boost::signals2::connection LLIMFloater::setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb) +{ + return LLIMFloater::sIMFloaterShowedSignal.connect(cb); +} diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 2ac11ded20..7e45cf42c2 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -44,6 +44,8 @@ class LLChatHistory; class LLInventoryItem; class LLInventoryCategory; +typedef boost::signals2::signal floater_showed_signal_t; + /** * Individual IM window that appears at the bottom of the screen, * optionally "docked" to the bottom tray. @@ -125,7 +127,11 @@ public: bool getStartConferenceInSameFloater() const { return mStartConferenceInSameFloater; } + static boost::signals2::connection setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb); + static floater_showed_signal_t sIMFloaterShowedSignal; + private: + // process focus events to set a currently active session /* virtual */ void onFocusLost(); /* virtual */ void onFocusReceived(); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index cdbb7c7cca..c66c0cd865 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -175,10 +175,11 @@ LLIMModel::LLIMModel() addNewMsgCallback(boost::bind(&toast_callback, _1)); } -LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice) +LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg) : mSessionID(session_id), mName(name), mType(type), + mHasOfflineMessage(has_offline_msg), mParticipantUnreadMessageCount(0), mNumUnread(0), mOtherParticipantID(other_participant_id), @@ -375,6 +376,8 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES break; } } + default: + break; } // Update speakers list when connected if (LLVoiceChannel::STATE_CONNECTED == new_state) @@ -676,7 +679,7 @@ void LLIMModel::testMessages() //session name should not be empty bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, - const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice) + const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg) { if (name.empty()) { @@ -690,7 +693,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co return false; } - LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice); + LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice, has_offline_msg); mId2SessionMap[session_id] = session; // When notifying observer, name of session is used instead of "name", because they may not be the @@ -702,10 +705,10 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co } -bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice) +bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice, bool has_offline_msg) { uuid_vec_t no_ids; - return newSession(session_id, name, type, other_participant_id, no_ids, voice); + return newSession(session_id, name, type, other_participant_id, no_ids, voice, has_offline_msg); } bool LLIMModel::clearSession(const LLUUID& session_id) @@ -2398,6 +2401,7 @@ void LLIMMgr::addMessage( const LLUUID& target_id, const std::string& from, const std::string& msg, + bool is_offline_msg, const std::string& session_name, EInstantMessage dialog, U32 parent_estate_id, @@ -2423,7 +2427,7 @@ void LLIMMgr::addMessage( bool new_session = !hasSession(new_session_id); if (new_session) { - LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id); + LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg); // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons @@ -3315,6 +3319,7 @@ public: from_id, name, buffer, + IM_OFFLINE == offline, std::string((char*)&bin_bucket[0]), IM_SESSION_INVITE, message_params["parent_estate_id"].asInteger(), diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 80bf315aa8..fa9d20ca53 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -70,10 +70,11 @@ public: GROUP_SESSION, ADHOC_SESSION, AVALINE_SESSION, + NONE_SESSION, } SType; LLIMSession(const LLUUID& session_id, const std::string& name, - const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice); + const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg); virtual ~LLIMSession(); void sessionInitReplyReceived(const LLUUID& new_session_id); @@ -133,6 +134,8 @@ public: //if IM session is created for a voice call bool mStartedAsIMCall; + bool mHasOfflineMessage; + private: void onAdHocNameCache(const LLAvatarName& av_name); @@ -181,10 +184,10 @@ public: * @param name session name should not be empty, will return false if empty */ bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, - const uuid_vec_t& ids, bool voice = false); + const uuid_vec_t& ids, bool voice = false, bool has_offline_msg = false); bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, - const LLUUID& other_participant_id, bool voice = false); + const LLUUID& other_participant_id, bool voice = false, bool has_offline_msg = false); /** * Remove all session data associated with a session specified by session_id @@ -325,6 +328,7 @@ public: const LLUUID& target_id, const std::string& from, const std::string& msg, + bool is_offline_msg = false, const std::string& session_name = LLStringUtil::null, EInstantMessage dialog = IM_NOTHING_SPECIAL, U32 parent_estate_id = 0, diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 65fd6d7019..4cf6ff55a4 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -94,6 +94,7 @@ #include "llcallingcard.h" #include "llconsole.h" #include "llcontainerview.h" +#include "llconversationlog.h" #include "lldebugview.h" #include "lldrawable.h" #include "lleventnotifier.h" @@ -1266,6 +1267,8 @@ bool idle_startup() display_startup(); LLStartUp::setStartupState( STATE_MULTIMEDIA_INIT ); + LLConversationLog::getInstance(); + return FALSE; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index bf12b08321..5c662af875 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -50,6 +50,8 @@ #include "llfloaterbump.h" #include "llfloaterbvhpreview.h" #include "llfloatercamera.h" +#include "llfloaterconversationlog.h" +#include "llfloaterconversationpreview.h" #include "llfloaterdeleteenvpreset.h" #include "llfloaterdisplayname.h" #include "llfloatereditdaycycle.h" @@ -188,6 +190,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("chat_bar", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("destinations", "floater_destinations.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -253,6 +256,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("picks", "floater_picks.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); + LLFloaterReg::add("preview_conversation", "floater_conversation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("preview_notecard", "floater_preview_notecard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("preview_script", "floater_script_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 03c113ecb3..20887f7832 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2396,6 +2396,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, + IM_OFFLINE == offline, LLStringUtil::null, dialog, parent_estate_id, @@ -2435,7 +2436,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (!gIMMgr->isNonFriendSessionNotified(session_id)) { std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); - gIMMgr->addMessage(session_id, from_id, name, message); + gIMMgr->addMessage(session_id, from_id, name, message, IM_OFFLINE == offline); gIMMgr->addNotifiedNonFriendSessionID(session_id); } @@ -2448,6 +2449,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, + IM_OFFLINE == offline, LLStringUtil::null, dialog, parent_estate_id, @@ -2788,6 +2790,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) from_id, name, buffer, + IM_OFFLINE == offline, ll_safe_string((char*)binary_bucket), IM_SESSION_INVITE, parent_estate_id, diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index df1d3f2955..f4c88403a5 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4072,6 +4072,7 @@ void LLVivoxVoiceClient::messageEvent( session->mCallerID, session->mName.c_str(), message.c_str(), + false, LLStringUtil::null, // default arg IM_NOTHING_SPECIAL, // default arg 0, // default arg diff --git a/indra/newview/skins/default/xui/en/floater_conversation_log.xml b/indra/newview/skins/default/xui/en/floater_conversation_log.xml new file mode 100644 index 0000000000..1c5800e25f --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_conversation_log.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml new file mode 100644 index 0000000000..27b744aefb --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml @@ -0,0 +1,53 @@ + + + + CONVERSATION: [NAME] + + + Description: + + + + + diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index e5ef80e352..e8ef3c1df9 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -56,6 +56,7 @@ image_overlay="Conv_toolbar_sort" image_selected="Toolbar_Middle_Selected" image_unselected="Toolbar_Middle_Off" + menu_filename="menu_participant_view.xml" layout="topleft" left="10" name="sort_btn" diff --git a/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml new file mode 100644 index 0000000000..b8d0eef956 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml b/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml new file mode 100644 index 0000000000..4ab8cb4f7d --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml new file mode 100644 index 0000000000..6401b0e3b7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_conversation_log_list_item.xml b/indra/newview/skins/default/xui/en/panel_conversation_log_list_item.xml new file mode 100644 index 0000000000..3c98e32e7d --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_conversation_log_list_item.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + -- cgit v1.2.3 From 11e9f66e6217c22373f5d47518f6d1f9885f1793 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 28 Aug 2012 12:41:57 -0700 Subject: BUILDFIX: Correcting a linux build error. --- indra/newview/llfloaterconversationpreview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index 2c34029c5c..ae6f1441eb 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -88,8 +88,13 @@ void LLFloaterConversationPreview::showHistory() int delta = 0; if (mCurrentPage) { - double num_of_pages = (double)mMessages.size() / mPageSize; - delta = (ceil(num_of_pages) - num_of_pages) * mPageSize; + // stinson 08/28/2012 : This operation could be simplified using integer math with the mod (%) operator. + // e.g. The following code should give the same output. + // int remainder = mMessages.size() % mPageSize; + // delta = (remainder == 0) ? 0 : (mPageSize - remainder); + // Though without examining further, the remainder might be a more appropriate value. + double num_of_pages = static_cast(mMessages.size()) / static_cast(mPageSize); + delta = static_cast((ceil(num_of_pages) - num_of_pages) * static_cast(mPageSize)); } std::advance(iter, (mCurrentPage * mPageSize) - delta); -- cgit v1.2.3 From 051bc99573d7c571cea0e2e1df332c1e5e97ff19 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Aug 2012 20:08:17 +0300 Subject: CHUI-287 FIX IM toast panel is closed upon mouse up and doesn't pass the mouse click that activates "click to walk". --- indra/newview/lltoastimpanel.cpp | 4 ++-- indra/newview/lltoastimpanel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index e0cb200ef5..75e6e3d13a 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -104,9 +104,9 @@ LLToastIMPanel::~LLToastIMPanel() } //virtual -BOOL LLToastIMPanel::handleMouseDown(S32 x, S32 y, MASK mask) +BOOL LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask) { - if (LLPanel::handleMouseDown(x,y,mask) == FALSE) + if (LLPanel::handleMouseUp(x,y,mask) == FALSE) { mNotification->respond(mNotification->getResponseTemplate()); } diff --git a/indra/newview/lltoastimpanel.h b/indra/newview/lltoastimpanel.h index 279dd69bc7..3eb11fb3bc 100644 --- a/indra/newview/lltoastimpanel.h +++ b/indra/newview/lltoastimpanel.h @@ -52,7 +52,7 @@ public: LLToastIMPanel(LLToastIMPanel::Params &p); virtual ~LLToastIMPanel(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); private: void showInspector(); -- cgit v1.2.3 From c4638d1dca7f3292d7ce48ddb2f5598f86282c88 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 19:09:57 -0700 Subject: CHUI-280 : WIP : Implement update of LLConversationModel in LLParticipantList --- indra/llui/llfolderviewmodel.h | 9 +++ indra/newview/llconversationmodel.cpp | 47 ++++++++++++- indra/newview/llconversationmodel.h | 31 ++++++++- indra/newview/llparticipantlist.cpp | 125 ++++++++++++++++++++++------------ 4 files changed, 163 insertions(+), 49 deletions(-) diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 41660c6e1e..16d9c86fd7 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -262,6 +262,15 @@ public: child->setParent(NULL); dirtyFilter(); } + + virtual void clearChildren() + { + // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects + // This is different and not equivalent to calling removeChild() on each child + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + mChildren.clear(); + dirtyFilter(); + } void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a5c0244bd4..9b353809db 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -88,7 +88,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // LLConversationItemSession::LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsLoaded(false) { } @@ -97,12 +98,54 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +{ + addChild(item); + mIsLoaded = true; +} + +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +{ + removeChild(item); +} + +void LLConversationItemSession::clearParticipants() +{ + clearChildren(); + mIsLoaded = false; +} + +LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id) +{ + // This is *not* a general tree parsing algorithm. It assumes that a session contains only + // items (LLConversationItemParticipant) that have themselve no children. + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + if (participant->hasSameValue(participant_id)) + { + break; + } + } + return (iter == mChildren.end() ? NULL : participant); +} + +void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + participant->setIsMuted(is_muted); +} + // // LLConversationItemParticipant // LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsMuted(false), + mIsModerator(false) { } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 1a63230e41..484c0feb36 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -33,6 +33,8 @@ // Implementation of conversations list class LLConversationItem; +class LLConversationItemSession; +class LLConversationItemParticipant; typedef std::map conversations_items_map; typedef std::map conversations_widgets_map; @@ -100,9 +102,10 @@ public: // bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } -private: - std::string mName; - const LLUUID mUUID; + +protected: + std::string mName; // Name of the session or the participant + LLUUID mUUID; // UUID of the session or the participant }; class LLConversationItemSession : public LLConversationItem @@ -111,6 +114,19 @@ public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemSession() {} + + void setSessionID(const LLUUID& session_id) { mUUID = session_id; } + void addParticipant(LLConversationItemParticipant* item); + void removeParticipant(LLConversationItemParticipant* item); + void clearParticipants(); + LLConversationItemParticipant* findParticipant(const LLUUID& participant_id); + + void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted); + + bool isLoaded() { return mIsLoaded; } + +private: + bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; class LLConversationItemParticipant : public LLConversationItem @@ -119,6 +135,15 @@ public: LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemParticipant() {} + + bool isMuted() { return mIsMuted; } + bool isModerator() {return mIsModerator; } + void setIsMuted(bool is_muted) { mIsMuted = is_muted; } + void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; } + +private: + bool mIsMuted; // default is false + bool mIsModerator; // default is false }; // We don't want to ever filter conversations but we need to declare that class to create a conversation view model. diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 552ae196dd..6511b0a1a6 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -29,6 +29,8 @@ // common includes #include "lltrans.h" #include "llavataractions.h" +#include "llavatarnamecache.h" +#include "llavatarname.h" #include "llagent.h" #include "llimview.h" @@ -226,29 +228,34 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, mSpeakerMgr->addListener(mSpeakerClearListener, "clear"); mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator"); - mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); - LL_DEBUGS("SpeakingIndicator") << "Set session for speaking indicators: " << mSpeakerMgr->getSessionID() << LL_ENDL; - mAvatarList->setSessionID(mSpeakerMgr->getSessionID()); - mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1)); - mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); - // Set onAvatarListDoubleClicked as default on_return action. - mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); - - if (use_context_menu) - { - //mParticipantListMenu = new LLParticipantListMenu(*this); - //mAvatarList->setContextMenu(mParticipantListMenu); - mAvatarList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu); - } - else + setSessionID(mSpeakerMgr->getSessionID()); + + if (mAvatarList) { - mAvatarList->setContextMenu(NULL); - } + mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); + LL_DEBUGS("SpeakingIndicator") << "Set session for speaking indicators: " << mSpeakerMgr->getSessionID() << LL_ENDL; + mAvatarList->setSessionID(mSpeakerMgr->getSessionID()); + mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1)); + mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); + // Set onAvatarListDoubleClicked as default on_return action. + mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); + + if (use_context_menu) + { + //mParticipantListMenu = new LLParticipantListMenu(*this); + //mAvatarList->setContextMenu(mParticipantListMenu); + mAvatarList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu); + } + else + { + mAvatarList->setContextMenu(NULL); + } - if (use_context_menu && can_toggle_icons) - { - mAvatarList->setShowIcons("ParticipantListShowIcons"); - mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList)); + if (use_context_menu && can_toggle_icons) + { + mAvatarList->setShowIcons("ParticipantListShowIcons"); + mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList)); + } } //Lets fill avatarList with existing speakers @@ -396,6 +403,7 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); } } @@ -415,30 +423,39 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) */ void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id) { - LLPanel* item = mAvatarList->getItemByValue(participant_id); - - if (NULL == item) + if (mAvatarList) { - LL_WARNS("Avaline") << "Something wrong. Unable to find item for: " << participant_id << LL_ENDL; - return; - } + LLPanel* item = mAvatarList->getItemByValue(participant_id); - if (typeid(*item) == typeid(LLAvalineListItem)) - { - LL_DEBUGS("Avaline") << "Avaline caller has already correct class type for: " << participant_id << LL_ENDL; - // item representing an Avaline caller has a correct type already. - return; - } + if (NULL == item) + { + LL_WARNS("Avaline") << "Something wrong. Unable to find item for: " << participant_id << LL_ENDL; + return; + } - LL_DEBUGS("Avaline") << "remove item from the list and re-add it: " << participant_id << LL_ENDL; + if (typeid(*item) == typeid(LLAvalineListItem)) + { + LL_DEBUGS("Avaline") << "Avaline caller has already correct class type for: " << participant_id << LL_ENDL; + // item representing an Avaline caller has a correct type already. + return; + } - // remove UUID from LLAvatarList::mIDs to be able add it again. - uuid_vec_t& ids = mAvatarList->getIDs(); - uuid_vec_t::iterator pos = std::find(ids.begin(), ids.end(), participant_id); - ids.erase(pos); + LL_DEBUGS("Avaline") << "remove item from the list and re-add it: " << participant_id << LL_ENDL; - // remove item directly - mAvatarList->removeItem(item); + // remove UUID from LLAvatarList::mIDs to be able add it again. + uuid_vec_t& ids = mAvatarList->getIDs(); + uuid_vec_t::iterator pos = std::find(ids.begin(), ids.end(), participant_id); + ids.erase(pos); + + // remove item directly + mAvatarList->removeItem(item); + } + + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + removeParticipant(participant); + } // re-add avaline caller with a correct class instance. addAvatarIDExceptAgent(participant_id); @@ -562,6 +579,7 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer event // update UI on confirmation of moderator mutes if (event->getValue().asString() == "voice") { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); update_speaker_indicator(mAvatarList, speakerp->mID, speakerp->mModeratorMutedVoice); } return true; @@ -601,21 +619,40 @@ void LLParticipantList::sort() void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) { if (mExcludeAgent && gAgent.getID() == avatar_id) return; - if (mAvatarList->contains(avatar_id)) return; + if (mAvatarList && mAvatarList->contains(avatar_id)) return; bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id); + LLConversationItemParticipant* participant = NULL; + if (is_avatar) { - mAvatarList->getIDs().push_back(avatar_id); - mAvatarList->setDirty(); + // Create a participant view model instance and add it to the linked list + LLAvatarName avatar_name; + bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); + participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel); + if ( mAvatarList) + { + mAvatarList->getIDs().push_back(avatar_id); + mAvatarList->setDirty(); + } } else { std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id); - mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); + // Create a participant view model instance and add it to the linked list + participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel); + if ( mAvatarList) + { + mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); + } mAvalineUpdater->watchAvalineCaller(avatar_id); } + + // *TODO : Merov : need to declare and bind a name update callback on that "participant" instance. See LLAvatarListItem::updateAvatarName() for pattern. + // For the moment, we'll get the correct name only if it's already in the name cache (see call to LLAvatarNameCache::get() here above) + addParticipant(participant); + adjustParticipant(avatar_id); } -- cgit v1.2.3 From ad070b9155e2fddfc746319003253248ceb0eba3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 23:13:10 -0700 Subject: CHUI-280 : Implement all LLConversationModel updates in LLParticipantList. Allow mAvatarList to be NULL. --- indra/newview/llconversationmodel.cpp | 31 +++++- indra/newview/llconversationmodel.h | 6 +- indra/newview/llparticipantlist.cpp | 193 +++++++++++++++++++--------------- 3 files changed, 137 insertions(+), 93 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 9b353809db..dbf5ac6e03 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -98,15 +98,24 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } -void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant) { - addChild(item); + addChild(participant); mIsLoaded = true; } -void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { - removeChild(item); + removeChild(participant); +} + +void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + removeParticipant(participant); + } } void LLConversationItemSession::clearParticipants() @@ -135,7 +144,19 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) { LLConversationItemParticipant* participant = findParticipant(participant_id); - participant->setIsMuted(is_muted); + if (participant) + { + participant->setIsMuted(is_muted); + } +} + +void LLConversationItemSession::setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setIsModerator(is_moderator); + } } // diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 484c0feb36..aa79e5aeb0 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -116,12 +116,14 @@ public: virtual ~LLConversationItemSession() {} void setSessionID(const LLUUID& session_id) { mUUID = session_id; } - void addParticipant(LLConversationItemParticipant* item); - void removeParticipant(LLConversationItemParticipant* item); + void addParticipant(LLConversationItemParticipant* participant); + void removeParticipant(LLConversationItemParticipant* participant); + void removeParticipant(const LLUUID& participant_id); void clearParticipants(); LLConversationItemParticipant* findParticipant(const LLUUID& participant_id); void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted); + void setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator); bool isLoaded() { return mIsLoaded; } diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 6511b0a1a6..35c1a34a26 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -52,11 +52,14 @@ static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR; // helper function to update AvatarList Item's indicator in the voice participant list static void update_speaker_indicator(const LLAvatarList* const avatar_list, const LLUUID& avatar_uuid, bool is_muted) { - LLAvatarListItem* item = dynamic_cast(avatar_list->getItemByValue(avatar_uuid)); - if (item) + if (avatar_list) { - LLOutputMonitorCtrl* indicator = item->getChild("speaking_indicator"); - indicator->setIsMuted(is_muted); + LLAvatarListItem* item = dynamic_cast(avatar_list->getItemByValue(avatar_uuid)); + if (item) + { + LLOutputMonitorCtrl* indicator = item->getChild("speaking_indicator"); + indicator->setIsMuted(is_muted); + } } } @@ -281,10 +284,13 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLParticipantList::~LLParticipantList() { - mAvatarListDoubleClickConnection.disconnect(); - mAvatarListRefreshConnection.disconnect(); - mAvatarListReturnConnection.disconnect(); - mAvatarListToggleIconsConnection.disconnect(); + if (mAvatarList) + { + mAvatarListDoubleClickConnection.disconnect(); + mAvatarListRefreshConnection.disconnect(); + mAvatarListReturnConnection.disconnect(); + mAvatarListToggleIconsConnection.disconnect(); + } // It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged() // See ticket EXT-3427 @@ -300,16 +306,22 @@ LLParticipantList::~LLParticipantList() mParticipantListMenu = NULL; } - mAvatarList->setContextMenu(NULL); - mAvatarList->setComparator(NULL); + if (mAvatarList) + { + mAvatarList->setContextMenu(NULL); + mAvatarList->setComparator(NULL); + } delete mAvalineUpdater; } void LLParticipantList::setSpeakingIndicatorsVisible(BOOL visible) { - mAvatarList->setSpeakingIndicatorsVisible(visible); -}; + if (mAvatarList) + { + mAvatarList->setSpeakingIndicatorsVisible(visible); + } +} void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl) { @@ -330,82 +342,81 @@ void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl) void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) { LLAvatarList* list = dynamic_cast(ctrl); - if (list) + const std::string moderator_indicator(LLTrans::getString("IM_moderator_label")); + const std::size_t moderator_indicator_len = moderator_indicator.length(); + + // Firstly remove moderators indicator + std::set::const_iterator + moderator_list_it = mModeratorToRemoveList.begin(), + moderator_list_end = mModeratorToRemoveList.end(); + for (;moderator_list_it != moderator_list_end; ++moderator_list_it) { - const std::string moderator_indicator(LLTrans::getString("IM_moderator_label")); - const std::size_t moderator_indicator_len = moderator_indicator.length(); - - // Firstly remove moderators indicator - std::set::const_iterator - moderator_list_it = mModeratorToRemoveList.begin(), - moderator_list_end = mModeratorToRemoveList.end(); - for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + LLAvatarListItem* item = (list ? dynamic_cast (list->getItemByValue(*moderator_list_it)) : NULL); + if ( item ) { - LLAvatarListItem* item = dynamic_cast (list->getItemByValue(*moderator_list_it)); - if ( item ) + std::string name = item->getAvatarName(); + std::string tooltip = item->getAvatarToolTip(); + size_t found = name.find(moderator_indicator); + if (found != std::string::npos) { - std::string name = item->getAvatarName(); - std::string tooltip = item->getAvatarToolTip(); - size_t found = name.find(moderator_indicator); - if (found != std::string::npos) - { - name.erase(found, moderator_indicator_len); - item->setAvatarName(name); - } - found = tooltip.find(moderator_indicator); - if (found != tooltip.npos) - { - tooltip.erase(found, moderator_indicator_len); - item->setAvatarToolTip(tooltip); - } + name.erase(found, moderator_indicator_len); + item->setAvatarName(name); + } + found = tooltip.find(moderator_indicator); + if (found != tooltip.npos) + { + tooltip.erase(found, moderator_indicator_len); + item->setAvatarToolTip(tooltip); } } + setParticipantIsModerator(*moderator_list_it,false); + } - mModeratorToRemoveList.clear(); + mModeratorToRemoveList.clear(); - // Add moderators indicator - moderator_list_it = mModeratorList.begin(); - moderator_list_end = mModeratorList.end(); - for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + // Add moderators indicator + moderator_list_it = mModeratorList.begin(); + moderator_list_end = mModeratorList.end(); + for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + { + LLAvatarListItem* item = (list ? dynamic_cast (list->getItemByValue(*moderator_list_it)) : NULL); + if ( item ) { - LLAvatarListItem* item = dynamic_cast (list->getItemByValue(*moderator_list_it)); - if ( item ) + std::string name = item->getAvatarName(); + std::string tooltip = item->getAvatarToolTip(); + size_t found = name.find(moderator_indicator); + if (found == std::string::npos) { - std::string name = item->getAvatarName(); - std::string tooltip = item->getAvatarToolTip(); - size_t found = name.find(moderator_indicator); - if (found == std::string::npos) - { - name += " "; - name += moderator_indicator; - item->setAvatarName(name); - } - found = tooltip.find(moderator_indicator); - if (found == std::string::npos) - { - tooltip += " "; - tooltip += moderator_indicator; - item->setAvatarToolTip(tooltip); - } + name += " "; + name += moderator_indicator; + item->setAvatarName(name); + } + found = tooltip.find(moderator_indicator); + if (found == std::string::npos) + { + tooltip += " "; + tooltip += moderator_indicator; + item->setAvatarToolTip(tooltip); } } + setParticipantIsModerator(*moderator_list_it,true); + } - // update voice mute state of all items. See EXT-7235 - LLSpeakerMgr::speaker_list_t speaker_list; + // update voice mute state of all items. See EXT-7235 + LLSpeakerMgr::speaker_list_t speaker_list; - // Use also participants which are not in voice session now (the second arg is TRUE). - // They can already have mModeratorMutedVoice set from the previous voice session - // and LLSpeakerVoiceModerationEvent will not be sent when speaker manager is updated next time. - mSpeakerMgr->getSpeakerList(&speaker_list, TRUE); - for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++) - { - const LLPointer& speakerp = *it; + // Use also participants which are not in voice session now (the second arg is TRUE). + // They can already have mModeratorMutedVoice set from the previous voice session + // and LLSpeakerVoiceModerationEvent will not be sent when speaker manager is updated next time. + mSpeakerMgr->getSpeakerList(&speaker_list, TRUE); + for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++) + { + const LLPointer& speakerp = *it; - if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) - { - setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); - update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); - } + if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) + { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); + update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); } } } @@ -506,7 +517,7 @@ bool LLParticipantList::isHovered() { S32 x, y; LLUI::getMousePositionScreen(&x, &y); - return mAvatarList->calcScreenRect().pointInRect(x, y); + return (mAvatarList ? mAvatarList->calcScreenRect().pointInRect(x, y) : false); } bool LLParticipantList::onAddItemEvent(LLPointer event, const LLSD& userdata) @@ -525,21 +536,30 @@ bool LLParticipantList::onAddItemEvent(LLPointer event, co bool LLParticipantList::onRemoveItemEvent(LLPointer event, const LLSD& userdata) { - uuid_vec_t& group_members = mAvatarList->getIDs(); - uuid_vec_t::iterator pos = std::find(group_members.begin(), group_members.end(), event->getValue().asUUID()); - if(pos != group_members.end()) + LLUUID avatar_id = event->getValue().asUUID(); + if (mAvatarList) { - group_members.erase(pos); - mAvatarList->setDirty(); + uuid_vec_t& group_members = mAvatarList->getIDs(); + uuid_vec_t::iterator pos = std::find(group_members.begin(), group_members.end(), avatar_id); + if(pos != group_members.end()) + { + group_members.erase(pos); + mAvatarList->setDirty(); + } } + removeParticipant(avatar_id); return true; } bool LLParticipantList::onClearListEvent(LLPointer event, const LLSD& userdata) { - uuid_vec_t& group_members = mAvatarList->getIDs(); - group_members.clear(); - mAvatarList->setDirty(); + if (mAvatarList) + { + uuid_vec_t& group_members = mAvatarList->getIDs(); + group_members.clear(); + mAvatarList->setDirty(); + } + clearParticipants(); return true; } @@ -587,6 +607,7 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer event void LLParticipantList::sort() { + // *TODO : Merov : Need to plan for sort() for LLConversationModel if ( !mAvatarList ) return; @@ -631,7 +652,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel); - if ( mAvatarList) + if (mAvatarList) { mAvatarList->getIDs().push_back(avatar_id); mAvatarList->setDirty(); @@ -642,7 +663,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id); // Create a participant view model instance and add it to the linked list participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel); - if ( mAvatarList) + if (mAvatarList) { mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); } @@ -808,7 +829,7 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, LL_WARNS("Speakers") << "Speaker " << speaker_id << " not found" << llendl; return; } - LLAvatarListItem* item = dynamic_cast(mParent.mAvatarList->getItemByValue(speaker_id)); + LLAvatarListItem* item = (mParent.mAvatarList ? dynamic_cast(mParent.mAvatarList->getItemByValue(speaker_id)) : NULL); if (NULL == item) return; name = item->getAvatarName(); -- cgit v1.2.3 From ca7abc4c3be9310f4e5fec00b7d6ffadaba58ff0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 29 Aug 2012 10:07:55 -0700 Subject: CHUI-280 : Add print out debug methods --- indra/newview/llconversationmodel.cpp | 16 ++++++++++++++++ indra/newview/llconversationmodel.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index dbf5ac6e03..d7f9093a4a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -159,6 +159,18 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +void LLConversationItemSession::dumpDebugData() +{ + llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + participant->dumpDebugData(); + } +} + // // LLConversationItemParticipant // @@ -175,4 +187,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, { } +void LLConversationItemParticipant::dumpDebugData() +{ + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; +} // EOF diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index aa79e5aeb0..af3756c45d 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -127,6 +127,8 @@ public: bool isLoaded() { return mIsLoaded; } + void dumpDebugData(); + private: bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; @@ -143,6 +145,8 @@ public: void setIsMuted(bool is_muted) { mIsMuted = is_muted; } void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; } + void dumpDebugData(); + private: bool mIsMuted; // default is false bool mIsModerator; // default is false -- cgit v1.2.3 From 9ff67f4a040fae53f28aa981309bce2356df1445 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 29 Aug 2012 18:27:21 -0700 Subject: CHUI-285 : WIP : Get the conversation floater to use the same LLParticipantList as the IM and call dialog --- indra/newview/llconversationmodel.h | 4 ++-- indra/newview/llimfloatercontainer.cpp | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index af3756c45d..1a2e09dfab 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -59,8 +59,8 @@ public: virtual LLPointer getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } - virtual BOOL isItemRenameable() const { return FALSE; } - virtual BOOL renameItem(const std::string& new_name) { return FALSE; } + virtual BOOL isItemRenameable() const { return TRUE; } + virtual BOOL renameItem(const std::string& new_name) { mName = new_name; return TRUE; } virtual BOOL isItemMovable( void ) const { return FALSE; } virtual BOOL isItemRemovable( void ) const { return FALSE; } virtual BOOL isItemInTrash( void) const { return FALSE; } diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index a3f5e357c9..55cbf0b266 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -456,7 +456,9 @@ void LLIMFloaterContainer::repositioningWidgets() // CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { - std::string display_name = uuid.isNull()? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); + bool is_nearby_chat = uuid.isNull(); + + std::string display_name = is_nearby_chat ? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance @@ -470,8 +472,21 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) // and nothing wrong will happen removing it if it doesn't exist removeConversationListItem(uuid,false); - // Create a conversation item - LLConversationItem* item = new LLConversationItemSession(display_name, uuid, getRootViewModel()); + // Create a conversation session model + LLConversationItem* item = NULL; + LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); + if (speaker_manager) + { + item = new LLParticipantList(speaker_manager, NULL, getRootViewModel(), true, false); + } + if (!item) + { + llinfos << "Merov debug : Couldn't create conversation session item : " << display_name << llendl; + return; + } + // *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat? + item->renameItem(display_name); + mConversationsItems[uuid] = item; // Create a widget from it -- cgit v1.2.3 From be61b5be2f4089e12ca25ca1ece13bd0fdaea543 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 29 Aug 2012 19:18:25 -0700 Subject: CHUI-305: Problem: The 'resident picker' had multiple parents and due to the design of the resident picker it can have only one parent. Having multiple parents caused both parents to fight for depth ordering...which caused the flickering. Resolution: Now multiple 'resident pickers' can exist and they are coupled to the floater that spawned then. Meaning that when the parent floater closes, the 'resident picker' floater will also close. In addition, a shadow frustum eminates from the button that opened the 'resident picker'. --- indra/llui/llfloater.cpp | 7 +++ indra/newview/llavataractions.cpp | 10 +++- indra/newview/llavataractions.h | 3 +- indra/newview/llfloateravatarpicker.cpp | 79 ++++++++++++++++++++++++++++++-- indra/newview/llfloateravatarpicker.h | 9 +++- indra/newview/llfloatercolorpicker.cpp | 2 +- indra/newview/llfloatergodtools.cpp | 6 ++- indra/newview/llfloaterland.cpp | 12 +++-- indra/newview/llfloaterregioninfo.cpp | 26 +++++++++-- indra/newview/llfloaterreporter.cpp | 7 ++- indra/newview/llfloatersellland.cpp | 3 +- indra/newview/llimfloater.cpp | 6 ++- indra/newview/llimfloatercontainer.cpp | 4 +- indra/newview/llinventorypanel.cpp | 2 +- indra/newview/llpanelblockedlist.cpp | 26 +++++++++-- indra/newview/llpanelblockedlist.h | 2 + indra/newview/llpanelgroupinvite.cpp | 6 ++- indra/newview/llpanelmaininventory.cpp | 2 +- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/llpanelpeople.cpp | 20 +++++++- indra/newview/llpanelpeople.h | 3 ++ indra/newview/llsidepanelinventory.cpp | 2 +- 22 files changed, 201 insertions(+), 38 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8145d6d347..52812dc050 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -713,6 +713,13 @@ void LLFloater::closeFloater(bool app_quitting) make_ui_sound("UISndWindowClose"); } + //If floater is a dependent, remove it from parent (dependee) + LLFloater* dependee = mDependeeHandle.get(); + if (dependee) + { + dependee->removeDependentFloater(this); + } + // now close dependent floater for(handle_set_iter_t dependent_it = mDependents.begin(); dependent_it != mDependents.end(); ) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 93e8b9ca40..9a0c517ee0 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -744,12 +744,13 @@ std::set LLAvatarActions::getInventorySelectedUUIDs() } //static -void LLAvatarActions::shareWithAvatars() +void LLAvatarActions::shareWithAvatars(LLPanel * panel) { using namespace action_give_inventory; + LLFloater* root_floater = gFloaterView->getParentFloater(panel); LLFloaterAvatarPicker* picker = - LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2), TRUE, FALSE); + LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2), TRUE, FALSE, FALSE, root_floater->getName()); if (!picker) { return; @@ -757,6 +758,11 @@ void LLAvatarActions::shareWithAvatars() picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable)); picker->openFriendsTab(); + + if (root_floater) + { + root_floater->addDependentFloater(picker); + } LLNotificationsUtil::add("ShareNotification"); } diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 259e87c336..9d9ce966b5 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -37,6 +37,7 @@ class LLAvatarName; class LLInventoryPanel; class LLFloater; +class LLPanel; /** * Friend-related actions (add, remove, offer teleport, etc) @@ -117,7 +118,7 @@ public: /** * Share items with the picked avatars. */ - static void shareWithAvatars(); + static void shareWithAvatars(LLPanel * panel); /** * Block/unblock the avatar. diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 47acdf7057..4ac022e350 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -49,6 +49,8 @@ #include "llscrolllistcell.h" #include "lltabcontainer.h" #include "lluictrlfactory.h" +#include "llfocusmgr.h" +#include "lldraghandle.h" #include "message.h" //#include "llsdserialize.h" @@ -56,14 +58,20 @@ //put it back as a member once the legacy path is out? static std::map sAvatarNameMap; +const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; +const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; +const F32 CONTEXT_FADE_TIME = 0.08f; + LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, BOOL allow_multiple, BOOL closeOnSelect, - BOOL skip_agent) + BOOL skip_agent, + const std::string& name, + LLView * frustumOrigin) { // *TODO: Use a key to allow this not to be an effective singleton LLFloaterAvatarPicker* floater = - LLFloaterReg::showTypedInstance("avatar_picker"); + LLFloaterReg::showTypedInstance("avatar_picker", LLSD(name)); if (!floater) { llwarns << "Cannot instantiate avatar picker" << llendl; @@ -85,6 +93,11 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, floater->getChild("cancel_btn")->setLabel(close_string); } + if(frustumOrigin) + { + floater->mFrustumOrigin = frustumOrigin->getHandle(); + } + return floater; } @@ -93,7 +106,8 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), mNearMeListComplete(FALSE), - mCloseOnSelect(FALSE) + mCloseOnSelect(FALSE), + mContextConeOpacity ( 0.f ) { mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this)); } @@ -340,8 +354,67 @@ void LLFloaterAvatarPicker::populateFriend() friends_scroller->sortByColumnIndex(0, TRUE); } +void LLFloaterAvatarPicker::drawFrustum() +{ + if(mFrustumOrigin.get()) + { + LLView * frustumOrigin = mFrustumOrigin.get(); + LLRect origin_rect; + frustumOrigin->localRectToOtherView(frustumOrigin->getLocalRect(), &origin_rect, this); + // draw context cone connecting color picker with color swatch in parent floater + LLRect local_rect = getLocalRect(); + if (hasFocus() && frustumOrigin->isInVisibleChain() && mContextConeOpacity > 0.001f) + { + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLGLEnable(GL_CULL_FACE); + gGL.begin(LLRender::QUADS); + { + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); + gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.vertex2i(local_rect.mRight, local_rect.mTop); + gGL.vertex2i(local_rect.mLeft, local_rect.mTop); + + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.vertex2i(local_rect.mLeft, local_rect.mTop); + gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); + gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); + + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.vertex2i(local_rect.mRight, local_rect.mBottom); + gGL.vertex2i(local_rect.mRight, local_rect.mTop); + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); + gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); + + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); + gGL.vertex2i(local_rect.mRight, local_rect.mBottom); + gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); + gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); + } + gGL.end(); + } + + if (gFocusMgr.childHasMouseCapture(getDragHandle())) + { + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + } + else + { + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + } + } +} + void LLFloaterAvatarPicker::draw() { + drawFrustum(); + // sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars). // lets check this via mOkButtonValidateSignal callback periodically. static LLFrameTimer timer; diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 7067cd7b3e..46b685ad02 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -34,7 +34,7 @@ class LLAvatarName; class LLScrollListCtrl; -class LLFloaterAvatarPicker : public LLFloater +class LLFloaterAvatarPicker :public LLFloater { public: typedef boost::signals2::signal validate_signal_t; @@ -46,7 +46,9 @@ public: static LLFloaterAvatarPicker* show(select_callback_t callback, BOOL allow_multiple = FALSE, BOOL closeOnSelect = FALSE, - BOOL skip_agent = FALSE); + BOOL skip_agent = FALSE, + const std::string& name = "", + LLView * frustumOrigin = NULL); LLFloaterAvatarPicker(const LLSD& key); virtual ~LLFloaterAvatarPicker(); @@ -86,6 +88,7 @@ private: void setAllowMultiple(BOOL allow_multiple); LLScrollListCtrl* getActiveList(); + void drawFrustum(); virtual void draw(); virtual BOOL handleKeyHere(KEY key, MASK mask); @@ -94,6 +97,8 @@ private: BOOL mNearMeListComplete; BOOL mCloseOnSelect; BOOL mExcludeAgentFromSearchResults; + LLHandle mFrustumOrigin; + F32 mContextConeOpacity; validate_signal_t mOkButtonValidateSignal; select_callback_t mSelectionCallback; diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 05d73c2416..1cebdcffca 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -486,7 +486,7 @@ void LLFloaterColorPicker::draw() mSwatch->localRectToOtherView(mSwatch->getLocalRect(), &swatch_rect, this); // draw context cone connecting color picker with color swatch in parent floater LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && mSwatch->isInVisibleChain() && mContextConeOpacity > 0.001f) + if (hasFocus() && mSwatch->isInVisibleChain() && mContextConeOpacity > 0.001f) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable(GL_CULL_FACE); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index fb905eae11..51745fb191 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -1123,11 +1123,13 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const void LLPanelObjectTools::onClickSet() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2)); + LLView * button = getChildView("Set Target"); + LLFloater * root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), FALSE, FALSE, FALSE, root_floater->getName(), button); // grandparent is a floater, which can have a dependent if (picker) { - gFloaterView->getParentFloater(this)->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 55f3d548ec..64336b5cf7 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2733,11 +2733,13 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) void LLPanelLandAccess::onClickAddAccess() { + LLView * button = getChildView("add_allowed"); + LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1)); + boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); if (picker) { - gFloaterView->getParentFloater(this)->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } @@ -2782,11 +2784,13 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) // static void LLPanelLandAccess::onClickAddBanned() { + LLView * button = getChildView("add_banned"); + LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1)); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); if (picker) { - gFloaterView->getParentFloater(this)->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fe29bb38c7..4aebd9a4f4 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -648,7 +648,7 @@ void LLPanelRegionGeneralInfo::onClickKick() // this depends on the grandparent view being a floater // in order to set up floater dependency LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE, FALSE, parent_floater->getName()); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -924,7 +924,12 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() void LLPanelRegionDebugInfo::onClickChooseAvatar() { - LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, parent_floater->getName()); + if (child_floater) + { + parent_floater->addDependentFloater(child_floater); + } } @@ -1471,7 +1476,7 @@ void LLPanelEstateInfo::onClickKickUser() // this depends on the grandparent view being a floater // in order to set up floater dependency LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), FALSE, TRUE); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), FALSE, TRUE, FALSE, parent_floater->getName()); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -1646,8 +1651,21 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res } LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]); + //Get parent floater name + LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); + LLFloater* parent_floater = panel ? gFloaterView->getParentFloater(panel) : NULL; + const std::string& parent_floater_name = parent_floater ? parent_floater->getName() : ""; + // avatar picker yes multi-select, yes close-on-select - LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::accessAddCore3, _1, (void*)change_info), TRUE, TRUE); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::accessAddCore3, _1, (void*)change_info), + TRUE, TRUE, FALSE, parent_floater_name); + + //Allows the closed parent floater to close the child floater (avatar picker) + if (child_floater) + { + parent_floater->addDependentFloater(child_floater); + } + return false; } diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 3ec1e372eb..206bcb2c7e 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -285,10 +285,13 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) void LLFloaterReporter::onClickSelectAbuser() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ); + LLView * button = getChildView("select_abuser", TRUE); + + LLFloater * root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button); if (picker) { - gFloaterView->getParentFloater(this)->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 64c0dfa023..2ac82c553b 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -392,7 +392,8 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) void LLFloaterSellLandUI::doSelectAgent() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE); + LLView * button = getChildView("sell_to_select_agent"); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE, FALSE, this->getName(), button); // grandparent is a floater, in order to set up dependency if (picker) { diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 1c6445610f..732a204ddf 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -359,7 +359,9 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); + LLView * button = getChildView("toolbar_panel")->getChildView("add_btn"); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); if (!picker) { return; @@ -367,7 +369,7 @@ void LLIMFloater::onAddButtonClicked() // Need to disable 'ok' button when selected users are already in conversation. picker->setOkBtnEnableCb(boost::bind(&LLIMFloater::canAddSelectedToChat, this, _1)); - LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) { root_floater->addDependentFloater(picker); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4d0bd623f8..bfe4afe80b 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -415,8 +415,10 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) void LLIMFloaterContainer::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE); + LLView * button = getChildView("conversations_pane_buttons_expanded")->getChildView("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); + if (picker && root_floater) { root_floater->addDependentFloater(picker); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 03dfada77c..2a84616ddf 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -147,7 +147,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLInventoryPanel::doCreate, this, _2)); mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2)); mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this)); - mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars)); + mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); } diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 35cda14f8d..8d03930699 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -66,10 +66,19 @@ LLPanelBlockedList::LLPanelBlockedList() mEnableCallbackRegistrar.add("Block.Check", boost::bind(&LLPanelBlockedList::isActionChecked, this, _2)); } +void LLPanelBlockedList::removePicker() +{ + if(mPicker.get()) + { + mPicker.get()->closeFloater(); + } +} + BOOL LLPanelBlockedList::postBuild() { mBlockedList = getChild("blocked"); mBlockedList->setCommitOnSelectionChange(TRUE); + this->setVisibleCallback(boost::bind(&LLPanelBlockedList::removePicker, this)); switch (gSavedSettings.getU32("BlockPeopleSortOrder")) { @@ -185,11 +194,18 @@ void LLPanelBlockedList::blockResidentByName() { const BOOL allow_multiple = FALSE; const BOOL close_on_select = TRUE; - /*LLFloaterAvatarPicker* picker = */LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), allow_multiple, close_on_select); - - // *TODO: mantipov: should LLFloaterAvatarPicker be closed when panel is closed? - // old Floater dependency is not enable in panel - // addDependentFloater(picker); + + LLView * button = getChildView("plus_btn", TRUE); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), + allow_multiple, close_on_select, FALSE, root_floater->getName(), button); + + if (root_floater) + { + root_floater->addDependentFloater(picker); + } + + mPicker = picker->getHandle(); } void LLPanelBlockedList::blockObjectByName() diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 332349dfc0..07f0437656 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -61,6 +61,7 @@ private: E_SORT_BY_TYPE = 1, } ESortOrder; + void removePicker(); void updateButtons(); // UI callbacks @@ -78,6 +79,7 @@ private: private: LLBlockList* mBlockedList; + LLHandle mPicker; }; //----------------------------------------------------------------------------- diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 00dd206571..290e38ee1f 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -301,11 +301,13 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata) //Soon the avatar picker will be embedded into this panel //instead of being it's own separate floater. But that is next week. //This will do for now. -jwolk May 10, 2006 + LLView * button = panelp->getChildView("add_button"); + LLFloater * root_floater = gFloaterView->getParentFloater(panelp); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE); + boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button); if (picker) { - gFloaterView->getParentFloater(panelp)->addDependentFloater(picker); + root_floater->addDependentFloater(picker); } } } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index eb3877da5a..35cb3d59c5 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -118,7 +118,7 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this)); mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this)); mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2)); - mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars)); + mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 82956beb3d..de12826452 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1498,7 +1498,7 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&do_nothing)); mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&do_nothing)); mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&do_nothing)); - mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars)); + mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); } // Destroys the object diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 260de40eef..14045df42e 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -556,6 +556,15 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LL } } + +void LLPanelPeople::removePicker() +{ + if(mPicker.get()) + { + mPicker.get()->closeFloater(); + } +} + BOOL LLPanelPeople::postBuild() { getChild("nearby_filter_input")->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); @@ -571,6 +580,7 @@ BOOL LLPanelPeople::postBuild() LLPanel* friends_tab = getChild(FRIENDS_TAB_NAME); // updater is active only if panel is visible to user. friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2)); + friends_tab->setVisibleCallback(boost::bind(&LLPanelPeople::removePicker, this)); mOnlineFriendList = friends_tab->getChild("avatars_online"); mAllFriendList = friends_tab->getChild("avatars_all"); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); @@ -1079,8 +1089,12 @@ bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) void LLPanelPeople::onAddFriendWizButtonClicked() { + LLPanel* cur_panel = mTabContainer->getCurrentPanel(); + LLView * button = cur_panel->getChildView("friends_add_btn", TRUE); + // Show add friend wizard. - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE); + LLFloater* root_floater = gFloaterView->getParentFloater(this); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button); if (!picker) { return; @@ -1088,11 +1102,13 @@ void LLPanelPeople::onAddFriendWizButtonClicked() // Need to disable 'ok' button when friend occurs in selection picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1)); - LLFloater* root_floater = gFloaterView->getParentFloater(this); + if (root_floater) { root_floater->addDependentFloater(picker); } + + mPicker = picker->getHandle(); } void LLPanelPeople::onDeleteFriendButtonClicked() diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index da27f83074..4740964dee 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -68,6 +68,8 @@ private: E_SORT_BY_RECENT_SPEAKERS = 4, } ESortOrder; + void removePicker(); + // methods indirectly called by the updaters void updateFriendListHelpText(); void updateFriendList(); @@ -139,6 +141,7 @@ private: Updater* mNearbyListUpdater; Updater* mRecentListUpdater; Updater* mButtonsUpdater; + LLHandle< LLFloater > mPicker; }; #endif //LL_LLPANELPEOPLE_H diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index acb232c77f..8915bb2fef 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -448,7 +448,7 @@ void LLSidepanelInventory::onInfoButtonClicked() void LLSidepanelInventory::onShareButtonClicked() { - LLAvatarActions::shareWithAvatars(); + LLAvatarActions::shareWithAvatars(this); } void LLSidepanelInventory::onShopButtonClicked() -- cgit v1.2.3 From d67c295d8bb6cfd58655bf961dcf835157abb3e7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 30 Aug 2012 16:20:27 -0700 Subject: CHUI-305: Minor changes after code review. Using templated findChild() instead of getChildView(). Also using settings.xml to store common custom variables. --- indra/newview/app_settings/settings.xml | 33 +++++++++++++++++++++++++++++++ indra/newview/llavataractions.cpp | 2 +- indra/newview/llavataractions.h | 4 ++-- indra/newview/llfloateravatarpicker.cpp | 35 ++++++++++++++++++--------------- indra/newview/llfloateravatarpicker.h | 3 +++ indra/newview/llfloatercolorpicker.cpp | 34 ++++++++++++++++++-------------- indra/newview/llfloatercolorpicker.h | 4 ++++ indra/newview/llfloatergodtools.cpp | 2 +- indra/newview/llfloaterland.cpp | 4 ++-- indra/newview/llfloaterreporter.cpp | 2 +- indra/newview/llfloatersellland.cpp | 2 +- indra/newview/llimfloater.cpp | 2 +- indra/newview/llimfloatercontainer.cpp | 2 +- indra/newview/llpanelblockedlist.cpp | 2 +- indra/newview/llpanelgroupinvite.cpp | 2 +- indra/newview/llpanelpeople.cpp | 2 +- 16 files changed, 91 insertions(+), 44 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ab1ea6bdbc..b98fea7032 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1639,6 +1639,39 @@ Value + ContextConeInAlpha + + Comment + Cone In Alpha + Persist + 0 + Type + F32 + Value + 0.0 + + ContextConeOutAlpha + + Comment + Cone Out Alpha + Persist + 0 + Type + F32 + Value + 1.0 + + ContextConeFadeTime + + Comment + Cone Fade Time + Persist + 0 + Type + F32 + Value + .08 + ConversationHistoryPageSize Comment diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 9a0c517ee0..42a0376774 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -744,7 +744,7 @@ std::set LLAvatarActions::getInventorySelectedUUIDs() } //static -void LLAvatarActions::shareWithAvatars(LLPanel * panel) +void LLAvatarActions::shareWithAvatars(LLView * panel) { using namespace action_give_inventory; diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 9d9ce966b5..473b9cecc3 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -37,7 +37,7 @@ class LLAvatarName; class LLInventoryPanel; class LLFloater; -class LLPanel; +class LLView; /** * Friend-related actions (add, remove, offer teleport, etc) @@ -118,7 +118,7 @@ public: /** * Share items with the picked avatars. */ - static void shareWithAvatars(LLPanel * panel); + static void shareWithAvatars(LLView * panel); /** * Block/unblock the avatar. diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 4ac022e350..3d6441553d 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -58,10 +58,6 @@ //put it back as a member once the legacy path is out? static std::map sAvatarNameMap; -const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; -const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -const F32 CONTEXT_FADE_TIME = 0.08f; - LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, BOOL allow_multiple, BOOL closeOnSelect, @@ -106,10 +102,17 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), mNearMeListComplete(FALSE), - mCloseOnSelect(FALSE), - mContextConeOpacity ( 0.f ) + mCloseOnSelect(FALSE),a + mContextConeOpacity (0.f), + mContextConeInAlpha(0.f), + mContextConeOutAlpha(0.f), + mContextConeFadeTime(0.f) { mCommitCallbackRegistrar.add("Refresh.FriendList", boost::bind(&LLFloaterAvatarPicker::populateFriend, this)); + + mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); + mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); + mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } BOOL LLFloaterAvatarPicker::postBuild() @@ -369,31 +372,31 @@ void LLFloaterAvatarPicker::drawFrustum() LLGLEnable(GL_CULL_FACE); gGL.begin(LLRender::QUADS); { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); gGL.vertex2i(origin_rect.mLeft, origin_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(origin_rect.mRight, origin_rect.mTop); gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(origin_rect.mRight, origin_rect.mBottom); gGL.vertex2i(origin_rect.mLeft, origin_rect.mBottom); } @@ -402,11 +405,11 @@ void LLFloaterAvatarPicker::drawFrustum() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(mContextConeFadeTime)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); } } } diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 46b685ad02..ed3e51c56f 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -99,6 +99,9 @@ private: BOOL mExcludeAgentFromSearchResults; LLHandle mFrustumOrigin; F32 mContextConeOpacity; + F32 mContextConeInAlpha; + F32 mContextConeOutAlpha; + F32 mContextConeFadeTime; validate_signal_t mOkButtonValidateSignal; select_callback_t mSelectionCallback; diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 1cebdcffca..3c230bc58c 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -62,10 +62,6 @@ #include #include -const F32 CONTEXT_CONE_IN_ALPHA = 0.0f; -const F32 CONTEXT_CONE_OUT_ALPHA = 1.f; -const F32 CONTEXT_FADE_TIME = 0.08f; - ////////////////////////////////////////////////////////////////////////////// // // Class LLFloaterColorPicker @@ -105,7 +101,10 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mSwatch ( swatch ), mActive ( TRUE ), mCanApplyImmediately ( show_apply_immediate ), - mContextConeOpacity ( 0.f ) + mContextConeOpacity ( 0.f ), + mContextConeInAlpha ( 0.f ), + mContextConeOutAlpha ( 0.f ), + mContextConeFadeTime ( 0.f ) { buildFromFile ( "floater_color_picker.xml"); @@ -117,6 +116,10 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mApplyImmediateCheck->setEnabled(FALSE); mApplyImmediateCheck->set(FALSE); } + + mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); + mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); + mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } LLFloaterColorPicker::~LLFloaterColorPicker() @@ -492,31 +495,31 @@ void LLFloaterColorPicker::draw() LLGLEnable(GL_CULL_FACE); gGL.begin(LLRender::QUADS); { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeOutAlpha * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); + gGL.color4f(0.f, 0.f, 0.f, mContextConeInAlpha * mContextConeOpacity); gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); } @@ -525,11 +528,12 @@ void LLFloaterColorPicker::draw() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), + LLCriticalDamp::getInterpolant(mContextConeFadeTime)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); } mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index 8e387c4f7c..bab0617712 100644 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -189,6 +189,10 @@ class LLFloaterColorPicker LLButton* mPipetteBtn; F32 mContextConeOpacity; + F32 mContextConeInAlpha; + F32 mContextConeOutAlpha; + F32 mContextConeFadeTime; + }; #endif // LL_LLFLOATERCOLORPICKER_H diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 51745fb191..38abdcc830 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -1123,7 +1123,7 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const void LLPanelObjectTools::onClickSet() { - LLView * button = getChildView("Set Target"); + LLView * button = findChild("Set Target"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2), FALSE, FALSE, FALSE, root_floater->getName(), button); // grandparent is a floater, which can have a dependent diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 64336b5cf7..4fc6684e8e 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2733,7 +2733,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) void LLPanelLandAccess::onClickAddAccess() { - LLView * button = getChildView("add_allowed"); + LLView * button = findChild("add_allowed"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); @@ -2784,7 +2784,7 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) // static void LLPanelLandAccess::onClickAddBanned() { - LLView * button = getChildView("add_banned"); + LLView * button = findChild("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 206bcb2c7e..cf2481f99a 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -285,7 +285,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) void LLFloaterReporter::onClickSelectAbuser() { - LLView * button = getChildView("select_abuser", TRUE); + LLView * button = findChild("select_abuser", TRUE); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, root_floater->getName(), button); diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 2ac82c553b..484ecbcd04 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -392,7 +392,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) void LLFloaterSellLandUI::doSelectAgent() { - LLView * button = getChildView("sell_to_select_agent"); + LLView * button = findChild("sell_to_select_agent"); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE, FALSE, this->getName(), button); // grandparent is a floater, in order to set up dependency if (picker) diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 732a204ddf..a601561c62 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -359,7 +359,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLView * button = getChildView("toolbar_panel")->getChildView("add_btn"); + LLView * button = findChild("toolbar_panel")->findChild("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button); if (!picker) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fe00f70a28..d382b61921 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -415,7 +415,7 @@ void LLIMFloaterContainer::updateState(bool collapse, S32 delta_width) void LLIMFloaterContainer::onAddButtonClicked() { - LLView * button = getChildView("conversations_pane_buttons_expanded")->getChildView("add_btn"); + LLView * button = findChild("conversations_pane_buttons_expanded")->findChild("add_btn"); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloaterContainer::onAvatarPicked, this, _1), TRUE, TRUE, TRUE, root_floater->getName(), button); diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 8d03930699..7612af8f5e 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -195,7 +195,7 @@ void LLPanelBlockedList::blockResidentByName() const BOOL allow_multiple = FALSE; const BOOL close_on_select = TRUE; - LLView * button = getChildView("plus_btn", TRUE); + LLView * button = findChild("plus_btn", TRUE); LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker * picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), allow_multiple, close_on_select, FALSE, root_floater->getName(), button); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 290e38ee1f..36bd5d9b77 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -301,7 +301,7 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata) //Soon the avatar picker will be embedded into this panel //instead of being it's own separate floater. But that is next week. //This will do for now. -jwolk May 10, 2006 - LLView * button = panelp->getChildView("add_button"); + LLView * button = panelp->findChild("add_button"); LLFloater * root_floater = gFloaterView->getParentFloater(panelp); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 14045df42e..90e857265d 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1090,7 +1090,7 @@ bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids) void LLPanelPeople::onAddFriendWizButtonClicked() { LLPanel* cur_panel = mTabContainer->getCurrentPanel(); - LLView * button = cur_panel->getChildView("friends_add_btn", TRUE); + LLView * button = cur_panel->findChild("friends_add_btn", TRUE); // Show add friend wizard. LLFloater* root_floater = gFloaterView->getParentFloater(this); -- cgit v1.2.3 From 1aadf94fe44036d6012eb7d4f8a0b9288a719f37 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 30 Aug 2012 17:24:19 -0700 Subject: CHUI-305: Now the Region/Estate floater displays the frustum shadow when opening the Resident Picker. --- indra/newview/llfloateravatarpicker.cpp | 2 +- indra/newview/llfloaterregioninfo.cpp | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 3d6441553d..2152de1035 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -102,7 +102,7 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), mNearMeListComplete(FALSE), - mCloseOnSelect(FALSE),a + mCloseOnSelect(FALSE), mContextConeOpacity (0.f), mContextConeInAlpha(0.f), mContextConeOutAlpha(0.f), diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 4aebd9a4f4..e6b76159a1 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -647,8 +647,10 @@ void LLPanelRegionGeneralInfo::onClickKick() // this depends on the grandparent view being a floater // in order to set up floater dependency + LLView * button = findChild("kick_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE, FALSE, parent_floater->getName()); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), + FALSE, TRUE, FALSE, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -924,8 +926,10 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() void LLPanelRegionDebugInfo::onClickChooseAvatar() { + LLView * button = findChild("choose_avatar_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE, FALSE, parent_floater->getName()); + LLFloater * child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), + FALSE, TRUE, FALSE, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -1475,8 +1479,10 @@ void LLPanelEstateInfo::onClickKickUser() { // this depends on the grandparent view being a floater // in order to set up floater dependency + LLView * button = findChild("kick_user_from_estate_btn"); LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), FALSE, TRUE, FALSE, parent_floater->getName()); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), + FALSE, TRUE, FALSE, parent_floater->getName(), button); if (child_floater) { parent_floater->addDependentFloater(child_floater); @@ -1656,9 +1662,27 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res LLFloater* parent_floater = panel ? gFloaterView->getParentFloater(panel) : NULL; const std::string& parent_floater_name = parent_floater ? parent_floater->getName() : ""; + //Determine the button that triggered opening of the avatar picker + //(so that a shadow frustum from the button to the avatar picker can be created) + LLView * button = NULL; + switch(change_info->mOperationFlag) + { + case ESTATE_ACCESS_ALLOWED_AGENT_ADD: + button = panel->findChild("add_allowed_avatar_btn"); + break; + + case ESTATE_ACCESS_BANNED_AGENT_ADD: + button = panel->findChild("add_banned_avatar_btn"); + break; + + case ESTATE_ACCESS_MANAGER_ADD: + button = panel->findChild("add_estate_manager_btn"); + break; + } + // avatar picker yes multi-select, yes close-on-select LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::accessAddCore3, _1, (void*)change_info), - TRUE, TRUE, FALSE, parent_floater_name); + TRUE, TRUE, FALSE, parent_floater_name, button); //Allows the closed parent floater to close the child floater (avatar picker) if (child_floater) -- cgit v1.2.3 From ab37263a5cda14227724181c771ac1d3ef55f467 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 30 Aug 2012 21:34:48 -0700 Subject: CHUI-285 : LLIMFloaterContainer is now using LLParticipantList fully --- indra/llui/llfolderviewmodel.h | 11 +++-- indra/newview/llimfloatercontainer.cpp | 85 +++++++++++++++++++++++++++++++--- indra/newview/llimfloatercontainer.h | 4 +- indra/newview/llparticipantlist.cpp | 13 ++++-- 4 files changed, 99 insertions(+), 14 deletions(-) diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 16d9c86fd7..22bfc4dfb4 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -209,6 +209,7 @@ protected: }; + class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: @@ -249,6 +250,8 @@ public: std::string::size_type getFilterStringOffset(); std::string::size_type getFilterStringSize(); + typedef std::list child_list_t; + virtual void addChild(LLFolderViewModelItem* child) { mChildren.push_back(child); @@ -271,7 +274,11 @@ public: mChildren.clear(); dirtyFilter(); } - + + child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); } + child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } + child_list_t::size_type getChildrenCount() const { return mChildren.size(); } + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { mPassedFilter = passed; @@ -325,8 +332,6 @@ protected: S32 mLastFolderFilterGeneration; S32 mMostFilteredDescendantGeneration; - - typedef std::list child_list_t; child_list_t mChildren; LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 55cbf0b266..aa85e5023d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -442,14 +442,36 @@ void LLIMFloaterContainer::repositioningWidgets() int index = 0; for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); - widget_it++, ++index) + widget_it++) { - LLFolderViewItem* widget = widget_it->second; + LLFolderViewFolder* widget = dynamic_cast(widget_it->second); widget->setVisible(TRUE); widget->setRect(LLRect(0, panel_rect.getHeight() - item_height*index, panel_rect.getWidth(), panel_rect.getHeight() - item_height*(index+1))); + index++; + // Reposition the children as well + // Merov : This is highly suspiscious but gets the debug hack to work. This needs to be revised though. + if (widget->getItemsCount() != 0) + { + BOOL is_open = widget->isOpen(); + widget->setOpen(TRUE); + LLFolderViewFolder::items_t::const_iterator current = widget->getItemsBegin(); + LLFolderViewFolder::items_t::const_iterator end = widget->getItemsEnd(); + while (current != end) + { + LLFolderViewItem* item = (*current); + item->setVisible(TRUE); + item->setRect(LLRect(0, + panel_rect.getHeight() - item_height*index, + panel_rect.getWidth(), + panel_rect.getHeight() - item_height*(index+1))); + index++; + current++; + } + widget->setOpen(is_open); + } } } @@ -490,19 +512,51 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) mConversationsItems[uuid] = item; // Create a widget from it - LLFolderViewItem* widget = createConversationItemWidget(item); + LLConversationViewSession* widget = createConversationItemWidget(item); mConversationsWidgets[uuid] = widget; - // Add a new conversation widget to the root folder of a folder view. + // Add a new conversation widget to the root folder of the folder view widget->addToFolder(mConversationsRoot); // Add it to the UI + mConversationsListPanel->addChild(widget); widget->setVisible(TRUE); + + // Create the participants widgets now + // Note: usually, we do not get an updated avatar list at that point + LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin(); + LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd(); + llinfos << "Merov debug : create participant, children size = " << item->getChildrenCount() << llendl; + while (current_participant_model != end_participant_model) + { + LLConversationItem* participant_model = dynamic_cast(*current_participant_model); + LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(widget); + mConversationsListPanel->addChild(participant_view); + participant_view->setVisible(TRUE); + current_participant_model++; + } + // Debugging hack : uncomment to force the creation of a dummy participant + // This hack is to be eventually deleted + if (item->getChildrenCount() == 0) + { + llinfos << "Merov debug : create dummy participant" << llendl; + // Create a dummy participant : we let that leak but that's just for debugging... + std::string name("Debug Test : "); + name += display_name; + LLUUID test_id; + test_id.generate(name); + LLConversationItemParticipant* participant_model = new LLConversationItemParticipant(name, test_id, getRootViewModel()); + // Create the dummy widget + LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(widget); + mConversationsListPanel->addChild(participant_view); + participant_view->setVisible(TRUE); + } + // End debugging hack repositioningWidgets(); - mConversationsListPanel->addChild(widget); - return; } @@ -537,7 +591,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c } } -LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) +LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLConversationViewSession::Params params; @@ -554,4 +608,21 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat return LLUICtrlFactory::create(params); } +LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item) +{ + LLConversationViewSession::Params params; + + params.name = item->getDisplayName(); + //params.icon = bridge->getIcon(); + //params.icon_open = bridge->getOpenIcon(); + //params.creation_date = bridge->getCreationDate(); + params.root = mConversationsRoot; + params.listener = item; + params.rect = LLRect (0, 0, 0, 0); + params.tool_tip = params.name; + params.container = this; + + return LLUICtrlFactory::create(params); +} + // EOF diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index d6dda8ea2d..300a820a26 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -37,6 +37,7 @@ #include "llgroupmgr.h" #include "lltrans.h" #include "llconversationmodel.h" +#include "llconversationview.h" class LLButton; class LLLayoutPanel; @@ -113,7 +114,8 @@ public: void addConversationListItem(const LLUUID& uuid); private: - LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); + LLConversationViewSession* createConversationItemWidget(LLConversationItem* item); + LLConversationViewParticipant* createConversationViewParticipant(LLConversationItem* item); // Conversation list data LLPanel* mConversationsListPanel; // This is the main widget we add conversation widget to diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 35c1a34a26..fa3432fc89 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -648,10 +648,10 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) if (is_avatar) { - // Create a participant view model instance and add it to the linked list + // Create a participant view model instance LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); - participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel); + participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel); if (mAvatarList) { mAvatarList->getIDs().push_back(avatar_id); @@ -661,7 +661,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) else { std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id); - // Create a participant view model instance and add it to the linked list + // Create a participant view model instance participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel); if (mAvatarList) { @@ -672,6 +672,13 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) // *TODO : Merov : need to declare and bind a name update callback on that "participant" instance. See LLAvatarListItem::updateAvatarName() for pattern. // For the moment, we'll get the correct name only if it's already in the name cache (see call to LLAvatarNameCache::get() here above) + + // *TODO : Merov : need to update the online/offline status of the participant. + // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id)) + + llinfos << "Merov debug : added participant, name = " << participant->getName() << llendl; + + // Add the participant model to the session's children list addParticipant(participant); adjustParticipant(avatar_id); -- cgit v1.2.3 From dab6788c42260135d298b619ff92a71838bba2b8 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 31 Aug 2012 11:57:36 +0300 Subject: CHUI-157 FIXED (Implement menu bar for conversation floater) - Added View Nearby chat history option - Also replaced menu item "Add Friend / Remove" with two separate menus: Add Friend and Remove Friend. So if user is a Friend the Remove Friend option would be shown there. If the user is not a friend, the Add Friend option would be shown. --- indra/newview/llconversationloglist.cpp | 17 ++++++--- indra/newview/llfloaterconversationlog.cpp | 5 +++ indra/newview/llfloaterconversationpreview.cpp | 40 ++++++++++++---------- indra/newview/llfloaterconversationpreview.h | 2 +- .../default/xui/en/menu_conversation_log_gear.xml | 28 +++++++++------ .../default/xui/en/menu_conversation_log_view.xml | 8 +++++ 6 files changed, 66 insertions(+), 34 deletions(-) diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 257ec082a5..94be9055bd 100644 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -241,15 +241,18 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata) { LLAvatarActions::offerTeleport(selected_id); } - else if("add_rem_friend" == command_name) + else if("add_friend" == command_name) { - if (LLAvatarActions::isFriend(selected_id)) + if (!LLAvatarActions::isFriend(selected_id)) { - LLAvatarActions::removeFriendDialog(selected_id); + LLAvatarActions::requestFriendshipDialog(selected_id); } - else + } + else if("remove_friend" == command_name) + { + if (LLAvatarActions::isFriend(selected_id)) { - LLAvatarActions::requestFriendshipDialog(selected_id); + LLAvatarActions::removeFriendDialog(selected_id); } } else if ("invite_to_group" == command_name) @@ -336,6 +339,10 @@ bool LLConversationLogList::isActionChecked(const LLSD& userdata) { return is_p2p && LLAvatarActions::isFriend(selected_id); } + else if ("is_not_friend" == command_name) + { + return is_p2p && !LLAvatarActions::isFriend(selected_id); + } return false; } diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp index c77a9e74bb..4375ce5726 100644 --- a/indra/newview/llfloaterconversationlog.cpp +++ b/indra/newview/llfloaterconversationlog.cpp @@ -28,6 +28,7 @@ #include "llconversationloglist.h" #include "llfiltereditor.h" #include "llfloaterconversationlog.h" +#include "llfloaterreg.h" #include "llmenubutton.h" LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key) @@ -97,6 +98,10 @@ void LLFloaterConversationLog::onCustomAction (const LLSD& userdata) { mConversationLogList->toggleSortFriendsOnTop(); } + else if ("view_nearby_chat_history" == command_name) + { + LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true); + } } bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata) diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index ae6f1441eb..7083fb987d 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -29,6 +29,7 @@ #include "llfloaterconversationpreview.h" #include "llimview.h" #include "lllineeditor.h" +#include "lltrans.h" LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id) : LLFloater(session_id), @@ -44,20 +45,28 @@ BOOL LLFloaterConversationPreview::postBuild() getChild("more_history")->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this)); const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID); - if (conv) - { - std::string name = conv->getConversationName(); - LLStringUtil::format_map_t args; - args["[NAME]"] = name; - std::string title = getString("Title", args); - setTitle(title); + std::string name; + std::string file; - getChild("description")->setValue(name); + if (mSessionID != LLUUID::null && conv) + { + name = conv->getConversationName(); + file = conv->getHistoryFileName(); + } + else + { + name = LLTrans::getString("NearbyChatTitle"); + file = "chat"; } - std::string file = conv->getHistoryFileName(); - LLLogChat::loadChatHistory(file, mMessages, true); + LLStringUtil::format_map_t args; + args["[NAME]"] = name; + std::string title = getString("Title", args); + setTitle(title); + + getChild("description")->setValue(name); + LLLogChat::loadChatHistory(file, mMessages, true); mCurrentPage = mMessages.size() / mPageSize; return LLFloater::postBuild(); @@ -68,7 +77,7 @@ void LLFloaterConversationPreview::draw() LLFloater::draw(); } -void LLFloaterConversationPreview::onOpen(const LLSD& session_id) +void LLFloaterConversationPreview::onOpen(const LLSD& key) { showHistory(); } @@ -88,13 +97,8 @@ void LLFloaterConversationPreview::showHistory() int delta = 0; if (mCurrentPage) { - // stinson 08/28/2012 : This operation could be simplified using integer math with the mod (%) operator. - // e.g. The following code should give the same output. - // int remainder = mMessages.size() % mPageSize; - // delta = (remainder == 0) ? 0 : (mPageSize - remainder); - // Though without examining further, the remainder might be a more appropriate value. - double num_of_pages = static_cast(mMessages.size()) / static_cast(mPageSize); - delta = static_cast((ceil(num_of_pages) - num_of_pages) * static_cast(mPageSize)); + int remainder = mMessages.size() % mPageSize; + delta = (remainder == 0) ? 0 : (mPageSize - remainder); } std::advance(iter, (mCurrentPage * mPageSize) - delta); diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h index 5105ef3702..2246a44761 100644 --- a/indra/newview/llfloaterconversationpreview.h +++ b/indra/newview/llfloaterconversationpreview.h @@ -39,7 +39,7 @@ public: virtual BOOL postBuild(); virtual void draw(); - virtual void onOpen(const LLSD& session_id); + virtual void onOpen(const LLSD& key); private: void onMoreHistoryBtnClick(); diff --git a/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml index b8d0eef956..8796b87955 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml @@ -57,20 +57,28 @@ parameter="can_offer_teleport"/> - - + - + + + + + - - + + + + + -- cgit v1.2.3 From c2bb1a189c5f4c2367ee38e03371b28948e3ea81 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 31 Aug 2012 12:05:36 +0300 Subject: CHUI-154 FIXED (Add link to chat preferences from Conversation floater) - Added link to chat preferences from Conversation floater --- indra/newview/llimfloatercontainer.cpp | 22 ++++++++++++++++++++++ indra/newview/llimfloatercontainer.h | 2 ++ .../skins/default/xui/en/menu_participant_view.xml | 7 +++++++ 3 files changed, 31 insertions(+) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index aa85e5023d..f85b60cb36 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -40,6 +40,7 @@ #include "llavatarnamecache.h" #include "llgroupiconctrl.h" #include "llfloateravatarpicker.h" +#include "llfloaterpreference.h" #include "llimview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" @@ -53,6 +54,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) mExpandCollapseBtn(NULL), mConversationsRoot(NULL) { + mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); + // Firstly add our self to IMSession observers, so we catch session events LLIMMgr::getInstance()->addSessionObserver(this); @@ -435,6 +438,25 @@ void LLIMFloaterContainer::onAvatarPicked(const uuid_vec_t& ids) } } +void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) +{ + std::string command = userdata.asString(); + + if ("chat_preferences" == command) + { + LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance("preferences"); + if (floater_prefs) + { + LLTabContainer* tab_container = floater_prefs->getChild("pref core"); + LLPanel* chat_panel = tab_container->getPanelByName("chat"); + if (tab_container && chat_panel) + { + tab_container->selectTabPanel(chat_panel); + } + } + } +} + void LLIMFloaterContainer::repositioningWidgets() { LLRect panel_rect = mConversationsListPanel->getRect(); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 300a820a26..a72a3e2221 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -103,6 +103,8 @@ private: void onAddButtonClicked(); void onAvatarPicked(const uuid_vec_t& ids); + void onCustomAction (const LLSD& userdata); + LLButton* mExpandCollapseBtn; LLLayoutPanel* mMessagesPane; LLLayoutPanel* mConversationsPane; diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml index 6401b0e3b7..df2700c94c 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_view.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml @@ -2,6 +2,13 @@ + + + Date: Fri, 31 Aug 2012 16:52:50 +0300 Subject: CHUI-315 (Nearby chat messages do not appear in conversation floater): cancelled inheritance LLNearbyChat from LLSingleton; set mSingleInstance flag for it. --- indra/llui/llfloater.cpp | 7 ++++++ indra/llui/llfloater.h | 1 + indra/newview/llagent.cpp | 6 +++-- indra/newview/llchatitemscontainerctrl.cpp | 4 ++-- indra/newview/llfloatertranslationsettings.cpp | 3 ++- indra/newview/llgesturemgr.cpp | 4 +++- indra/newview/llimconversation.cpp | 31 +++++++++++++------------- indra/newview/llimview.cpp | 6 +++-- indra/newview/llnearbychat.cpp | 21 +++++++++-------- indra/newview/llnearbychat.h | 4 +--- indra/newview/llnearbychathandler.cpp | 5 +++-- indra/newview/llnotificationhandlerutil.cpp | 5 +++-- indra/newview/llnotificationtiphandler.cpp | 3 ++- indra/newview/llviewergesture.cpp | 4 +++- indra/newview/llviewerkeyboard.cpp | 3 ++- indra/newview/llviewermessage.cpp | 8 ++++--- indra/newview/llviewerwindow.cpp | 10 +++++---- 17 files changed, 76 insertions(+), 49 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 52812dc050..029c47c726 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -627,6 +627,13 @@ void LLFloater::setVisible( BOOL visible ) storeVisibilityControl(); } + +void LLFloater::setIsSingleInstance(BOOL is_single_instance) +{ + mSingleInstance = is_single_instance; +} + + // virtual void LLFloater::handleVisibilityChange ( BOOL new_visibility ) { diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index a1cac64a4a..4b738f88ea 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -217,6 +217,7 @@ public: /*virtual*/ void setFocus( BOOL b ); /*virtual*/ void setIsChrome(BOOL is_chrome); /*virtual*/ void setRect(const LLRect &rect); + void setIsSingleInstance(BOOL is_single_instance); void initFloater(const Params& p); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index be6901c36a..bb0dbc7ff0 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1911,7 +1911,8 @@ void LLAgent::startTyping() { sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } - (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_START, FALSE); + (LLFloaterReg::getTypedInstance("nearby_chat"))-> + sendChatFromViewer("", CHAT_TYPE_START, FALSE); } //----------------------------------------------------------------------------- @@ -1923,7 +1924,8 @@ void LLAgent::stopTyping() { clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); - (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + (LLFloaterReg::getTypedInstance("nearby_chat"))-> + sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); } } diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index e6340e0fa3..f1b5c42ef3 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -323,12 +323,12 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) return TRUE; else { - LLNearbyChat::instance().showHistory(); + (LLFloaterReg::getTypedInstance("nearby_chat"))->showHistory(); return FALSE; } } - LLNearbyChat::instance().showHistory(); + (LLFloaterReg::getTypedInstance("nearby_chat"))->showHistory(); return LLPanel::handleMouseUp(x,y,mask); } diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index b5b86dadc2..29d7732a68 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -293,6 +293,7 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey()); gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey()); - LLNearbyChat::instance().showTranslationCheckbox(LLTranslate::isTranslationConfigured()); + (LLFloaterReg::getTypedInstance("nearby_chat"))-> + showTranslationCheckbox(LLTranslate::isTranslationConfigured()); closeFloater(false); } diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 0377337af6..0996af6125 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -35,6 +35,7 @@ // library #include "llaudioengine.h" #include "lldatapacker.h" +#include "llfloaterreg.h" #include "llinventory.h" #include "llkeyframemotion.h" #include "llmultigesture.h" @@ -997,7 +998,8 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) const BOOL animate = FALSE; - LLNearbyChat::instance().sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + (LLFloaterReg::getTypedInstance("nearby_chat"))-> + sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); gesture->mCurrentStep++; break; diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 7bb29be27b..5a5196fb7e 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -144,7 +144,7 @@ BOOL LLIMConversation::postBuild() updateHeaderAndToolbar(); - mSaveRect = isTornOff(); + mSaveRect = !getHost(); initRectControl(); if (isChatMultiTab()) @@ -267,11 +267,11 @@ void LLIMConversation::hideOrShowTitle() LLView* floater_contents = getChild("contents_view"); LLRect floater_rect = getLocalRect(); - S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0); + S32 top_border_of_contents = floater_rect.mTop - (getHost()? 0 : floater_header_size); LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents); LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom); mDragHandle->setShape(handle_rect); - mDragHandle->setVisible(isTornOff()); + mDragHandle->setVisible(!getHost()); floater_contents->setShape(contents_rect); } @@ -289,8 +289,8 @@ void LLIMConversation::hideAllStandardButtons() void LLIMConversation::updateHeaderAndToolbar() { - bool is_torn_off = !getHost(); - if (!is_torn_off) + bool is_hosted = !!getHost(); + if (is_hosted) { hideAllStandardButtons(); } @@ -299,7 +299,7 @@ void LLIMConversation::updateHeaderAndToolbar() // Participant list should be visible only in torn off floaters. bool is_participant_list_visible = - is_torn_off + !is_hosted && gSavedSettings.getBOOL("IMShowControlPanel") && !mIsP2PChat; @@ -307,21 +307,21 @@ void LLIMConversation::updateHeaderAndToolbar() // Display collapse image (<<) if the floater is hosted // or if it is torn off but has an open control panel. - bool is_expanded = !is_torn_off || is_participant_list_visible; + bool is_expanded = is_hosted || is_participant_list_visible; mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); // toggle floater's drag handle and title visibility if (mDragHandle) { - mDragHandle->setTitleVisible(is_torn_off); + mDragHandle->setTitleVisible(!is_hosted); } // The button (>>) should be disabled for torn off P2P conversations. - mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat); + mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat); - mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon")); + mTearOffBtn->setImageOverlay(getString(is_hosted? "tear_off_icon" : "return_icon")); - mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat); + mCloseBtn->setVisible(is_hosted && !mIsNearbyChat); enableDisableCallBtn(); @@ -358,9 +358,10 @@ void LLIMConversation::processChatHistoryStyleUpdate() } } - if (LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) { - LLNearbyChat::instance().reloadMessages(); + nearby_chat->reloadMessages(); } } @@ -427,8 +428,8 @@ void LLIMConversation::onClose(bool app_quitting) void LLIMConversation::onTearOffClicked() { - setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE); - mSaveRect = isTornOff(); + setFollows(getHost()? FOLLOWS_NONE : FOLLOWS_ALL); + mSaveRect = !getHost(); initRectControl(); LLFloater::onClickTearOff(this); updateHeaderAndToolbar(); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index effcc9a826..f5392b442a 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2486,9 +2486,11 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - if (LLNearbyChat::instanceExists()) + + LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); + if (nearby_chat) { - LLNearbyChat::instance().addMessage(chat); + nearby_chat->addMessage(chat); } } else // going to IM session diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index f1518fe825..25bbc82fee 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -134,6 +134,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd) mKey = LLSD(); mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); setName("nearby_chat"); + setIsSingleInstance(TRUE); } //virtual @@ -780,20 +781,21 @@ void LLNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BO // static void LLNearbyChat::startChat(const char* line) { - if (LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) { - (LLNearbyChat::instance()).show(); - (LLNearbyChat::instance()).setVisible(TRUE); - (LLNearbyChat::instance()).setFocus(TRUE); - (LLNearbyChat::instance().mInputEditor)->setFocus(TRUE); + nearby_chat->show(); + nearby_chat->setVisible(TRUE); + nearby_chat->setFocus(TRUE); + nearby_chat->mInputEditor->setFocus(TRUE); if (line) { std::string line_string(line); - (LLNearbyChat::instance().mInputEditor)->setText(line_string); + nearby_chat->mInputEditor->setText(line_string); } - (LLNearbyChat::instance().mInputEditor)->endOfDoc(); + nearby_chat->mInputEditor->endOfDoc(); } } @@ -801,9 +803,10 @@ void LLNearbyChat::startChat(const char* line) // static void LLNearbyChat::stopChat() { - if (LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) { - (LLNearbyChat::instance().mInputEditor)->setFocus(FALSE); + nearby_chat->mInputEditor->setFocus(FALSE); gAgent.stopTyping(); } } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 379bfbee4b..4fc5cb7f76 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -35,15 +35,13 @@ #include "lloutputmonitorctrl.h" #include "llspeakers.h" #include "llscrollbar.h" -#include "llsingleton.h" #include "llviewerchat.h" #include "llpanel.h" class LLResizeBar; class LLNearbyChat - : public LLIMConversation, - public LLSingleton + : public LLIMConversation { public: // constructor for inline chat-bars (e.g. hosted in chat history window) diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 37f4cc4c19..ca3fffeffd 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -537,7 +537,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, } } - LLNearbyChat::instance().addMessage(chat_msg, true, args); + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + nearby_chat->addMessage(chat_msg, true, args); if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() @@ -553,7 +554,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // Send event on to LLEventStream sChatWatcher->post(chat); - if( LLNearbyChat::instance().isInVisibleChain() + if( nearby_chat->isInVisibleChain() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || mChannel.isDead() diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index db8e917435..2484040ac4 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -181,13 +181,14 @@ void LLHandlerUtil::logGroupNoticeToIMGroup( // static void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type) { - if (LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) { LLChat chat_msg(notification->getMessage()); chat_msg.mSourceType = type; chat_msg.mFromName = SYSTEM_FROM; chat_msg.mFromID = LLUUID::null; - LLNearbyChat::instance().addMessage(chat_msg); + nearby_chat->addMessage(chat_msg); } } diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 67fc9b27dc..ef6668247c 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -85,7 +85,8 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification) LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); // don't show toast if Nearby Chat is opened - if (LLNearbyChat::instance().isChatVisible()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat && nearby_chat->isChatVisible()) { return false; } diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index a2dea31d9b..71608b5280 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -33,6 +33,7 @@ #include "llviewerinventory.h" #include "sound_ids.h" // for testing +#include "llfloaterreg.h" #include "llkeyboard.h" // for key shortcuts for testing #include "llinventorymodel.h" #include "llvoavatar.h" @@ -130,7 +131,8 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) { // Don't play nodding animation, since that might not blend // with the gesture animation. - LLNearbyChat::instance().sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); + (LLFloaterReg::getTypedInstance("nearby_chat"))-> + sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); } } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 7105720eb4..f8e988bc0c 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llappviewer.h" +#include "llfloaterreg.h" #include "llviewerkeyboard.h" #include "llmath.h" #include "llagent.h" @@ -543,7 +544,7 @@ void start_gesture( EKeystate s ) if (KEYSTATE_UP == s && ! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) { - if (LLNearbyChat::instance().getCurrentChat().empty()) + if ((LLFloaterReg::getTypedInstance("nearby_chat"))->getCurrentChat().empty()) { // No existing chat in chat editor, insert '/' LLNearbyChat::startChat("/"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9abd269f0f..81cbc3b6c3 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2297,9 +2297,10 @@ void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string m // Treat like a system message and put in chat history. chat.mText = av_name.getCompleteName() + ": " + message; - if (LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if (nearby_chat) { - LLNearbyChat::instance().addMessage(chat); + nearby_chat->addMessage(chat); } } @@ -2895,7 +2896,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Note: lie to Nearby Chat, pretending that this is NOT an IM, because // IMs from obejcts don't open IM sessions. - if(!chat_from_system && LLNearbyChat::instanceExists()) + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + if(!chat_from_system && nearby_chat) { chat.mOwnerID = from_id; LLSD args; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 23d2b1633d..791cadaee4 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2493,12 +2493,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + // Traverses up the hierarchy if( keyboard_focus ) { - if (LLNearbyChat::instanceExists()) + if (nearby_chat) { - LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox(); + LLChatEntry* chat_editor = nearby_chat->getChatBox(); // arrow keys move avatar while chatting hack if (chat_editor && chat_editor->hasFocus()) @@ -2562,11 +2564,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { - LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox(); + LLChatEntry* chat_editor = nearby_chat->getChatBox(); if (chat_editor) { // passing NULL here, character will be added later when it is handled by character handler. - LLNearbyChat::instance().startChat(NULL); + nearby_chat->startChat(NULL); return TRUE; } } -- cgit v1.2.3 From 73769180f363556d5517e3070fc4a2ac61e713d6 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 31 Aug 2012 19:22:41 +0300 Subject: CHUI-298 FIXED (Conversation started as an IM and then goes to voice call does not show as call in conversation log) - Show voice icon when call is started - Added flag LLConversation::mIsConversationPast which means that this conversation is finished and any of its data can't be changed. I.e. it cannot be reused. - When session removed (i.e. finished) corresponding conversation is marked as Past conversation. I.e. mIsConversationPast is true. - Added changed(const LLUUID& session_id, U32 mask) method to LLConversationLog to notify particular conversation. This is used in LLConversationLogList to update its particular item and not to rebuild the whole list. --- indra/newview/llconversationlog.cpp | 54 ++++++++++++++++++++++++++++++- indra/newview/llconversationlog.h | 25 ++++++++++---- indra/newview/llconversationloglist.cpp | 22 +++++++++++++ indra/newview/llconversationloglist.h | 1 + indra/newview/llconversationloglistitem.h | 4 +-- indra/newview/llvoicechannel.cpp | 2 +- indra/newview/llvoicechannel.h | 2 +- 7 files changed, 99 insertions(+), 11 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 486cea4064..23ccc78a0f 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -33,7 +33,8 @@ struct Conversation_params { Conversation_params(time_t time) : mTime(time), - mTimestamp(LLConversation::createTimestamp(time)) + mTimestamp(LLConversation::createTimestamp(time)), + mIsConversationPast(true) {} time_t mTime; @@ -44,6 +45,7 @@ struct Conversation_params LLUUID mSessionID; LLUUID mParticipantID; bool mIsVoice; + bool mIsConversationPast; bool mHasOfflineIMs; }; @@ -60,6 +62,7 @@ LLConversation::LLConversation(const Conversation_params& params) mSessionID(params.mSessionID), mParticipantID(params.mParticipantID), mIsVoice(params.mIsVoice), + mIsConversationPast(params.mIsConversationPast), mHasOfflineIMs(params.mHasOfflineIMs) { setListenIMFloaterOpened(); @@ -74,6 +77,7 @@ LLConversation::LLConversation(const LLIMModel::LLIMSession& session) mSessionID(session.mSessionID), mParticipantID(session.mOtherParticipantID), mIsVoice(session.mStartedAsIMCall), + mIsConversationPast(false), mHasOfflineIMs(session.mHasOfflineMessage) { setListenIMFloaterOpened(); @@ -89,6 +93,7 @@ LLConversation::LLConversation(const LLConversation& conversation) mSessionID = conversation.getSessionID(); mParticipantID = conversation.getParticipantID(); mIsVoice = conversation.isVoice(); + mIsConversationPast = conversation.isConversationPast(); mHasOfflineIMs = conversation.hasOfflineMessages(); setListenIMFloaterOpened(); @@ -99,6 +104,14 @@ LLConversation::~LLConversation() mIMFloaterShowedConnection.disconnect(); } +void LLConversation::setIsVoice(bool is_voice) +{ + if (mIsConversationPast) + return; + + mIsVoice = is_voice; +} + void LLConversation::onIMFloaterShown(const LLUUID& session_id) { if (mSessionID == session_id) @@ -228,6 +241,21 @@ void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string { LLConversation conversation(*session); LLConversationLog::instance().logConversation(conversation); + session->mVoiceChannel->setStateChangedCallback(boost::bind(&LLConversationLog::onVoiceChannelConnected, this, _5, _2)); + } +} + +void LLConversationLog::sessionRemoved(const LLUUID& session_id) +{ + conversations_vec_t::reverse_iterator rev_iter = mConversations.rbegin(); + + for (; rev_iter != mConversations.rend(); ++rev_iter) + { + if (rev_iter->getSessionID() == session_id && !rev_iter->isConversationPast()) + { + rev_iter->setIsPast(true); + return; // return here because only one session with session_id may be active + } } } @@ -350,3 +378,27 @@ void LLConversationLog::notifyObservers() (*iter)->changed(); } } + +void LLConversationLog::notifyPrticularConversationObservers(const LLUUID& session_id, U32 mask) +{ + std::set::const_iterator iter = mObservers.begin(); + for (; iter != mObservers.end(); ++iter) + { + (*iter)->changed(session_id, mask); + } +} + +void LLConversationLog::onVoiceChannelConnected(const LLUUID& session_id, const LLVoiceChannel::EState& state) +{ + conversations_vec_t::reverse_iterator rev_iter = mConversations.rbegin(); + + for (; rev_iter != mConversations.rend(); ++rev_iter) + { + if (rev_iter->getSessionID() == session_id && !rev_iter->isConversationPast() && LLVoiceChannel::STATE_CALL_STARTED == state) + { + rev_iter->setIsVoice(true); + notifyPrticularConversationObservers(session_id, LLConversationLogObserver::VOICE_STATE); + return; // return here because only one session with session_id may be active + } + } +} diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index a7457d55e3..f2b6a67c92 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -57,8 +57,12 @@ public: const std::string& getTimestamp() const { return mTimestamp; } const time_t& getTime() const { return mTime; } bool isVoice() const { return mIsVoice; } + bool isConversationPast() const { return mIsConversationPast; } bool hasOfflineMessages() const { return mHasOfflineIMs; } + void setIsVoice(bool is_voice); + void setIsPast (bool is_past) { mIsConversationPast = is_past; } + /* * Resets flag of unread offline message to false when im floater with this conversation is opened. */ @@ -87,6 +91,7 @@ private: LLUUID mParticipantID; bool mIsVoice; bool mHasOfflineIMs; + bool mIsConversationPast; // once session is finished conversation became past forever std::string mTimestamp; // conversation start time in form of: mm/dd/yyyy hh:mm }; @@ -122,12 +127,14 @@ public: // LLIMSessionObserver triggers virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); - virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){} // Stub - virtual void sessionRemoved(const LLUUID& session_id){} // Stub - virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){} // Stub + virtual void sessionRemoved(const LLUUID& session_id); + virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){}; // Stub + virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){}; // Stub - // Triggered by LLFriendObserver change void notifyObservers(); + void notifyPrticularConversationObservers(const LLUUID& session_id, U32 mask); + + void onVoiceChannelConnected(const LLUUID& session_id, const LLVoiceChannel::EState& state); /** * public method which is called on viewer exit to save conversation log @@ -140,8 +147,7 @@ private: /** * constructs file name in which conversations log will be saved - * file name template: agentID.call_log. - * For example: a086icaa-782d-88d0-ae29-987a55c99sss.call_log + * file name is conversation.log */ std::string getFileName(); @@ -158,8 +164,15 @@ private: class LLConversationLogObserver { public: + + enum EConversationChange + { + VOICE_STATE = 1 + }; + virtual ~LLConversationLogObserver(){} virtual void changed() = 0; + virtual void changed(const LLUUID& session_id, U32 mask){}; }; #endif /* LLCONVERSATIONLOG_H_ */ diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 94be9055bd..d39e090c22 100644 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -141,6 +141,28 @@ void LLConversationLogList::changed() refresh(); } +void LLConversationLogList::changed(const LLUUID& session_id, U32 mask) +{ + if (mask & LLConversationLogObserver::VOICE_STATE) + { + std::vector panels; + LLFlatListViewEx::getItems(panels); + + std::vector::iterator iter = panels.begin(); + + for (; iter != panels.end(); ++iter) + { + LLConversationLogListItem* item = dynamic_cast(*iter); + + if (item && session_id == item->getConversation()->getSessionID() && !item->getConversation()->isConversationPast()) + { + item->initIcons(); + return; + } + } + } +} + void LLConversationLogList::addNewItem(const LLConversation* conversation) { LLConversationLogListItem* item = new LLConversationLogListItem(&*conversation); diff --git a/indra/newview/llconversationloglist.h b/indra/newview/llconversationloglist.h index dff34a74c6..5e7fc0a9fb 100644 --- a/indra/newview/llconversationloglist.h +++ b/indra/newview/llconversationloglist.h @@ -68,6 +68,7 @@ public: * Changes from LLConversationLogObserver */ virtual void changed(); + virtual void changed(const LLUUID& session_id, U32 mask); private: diff --git a/indra/newview/llconversationloglistitem.h b/indra/newview/llconversationloglistitem.h index 8943e11604..2aaafa0fba 100644 --- a/indra/newview/llconversationloglistitem.h +++ b/indra/newview/llconversationloglistitem.h @@ -64,10 +64,10 @@ public: void onDoubleClick(); -private: - void initIcons(); +private: + const LLConversation* mConversation; LLTextBox* mConversationName; diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index bd12328a6b..ceff75a0cc 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -414,7 +414,7 @@ void LLVoiceChannel::doSetState(const EState& new_state) mState = new_state; if (!mStateChangedCallback.empty()) - mStateChangedCallback(old_state, mState, mCallDirection, mCallEndedByAgent); + mStateChangedCallback(old_state, mState, mCallDirection, mCallEndedByAgent, mSessionID); } //static diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index b8597ee5cb..fed44974fd 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -52,7 +52,7 @@ public: OUTGOING_CALL } EDirection; - typedef boost::signals2::signal state_changed_signal_t; + typedef boost::signals2::signal state_changed_signal_t; // on current channel changed signal typedef boost::function channel_changed_callback_t; -- cgit v1.2.3 From eb13b2b4680ab80e8a20d341a481b8c1d62ca156 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Mon, 3 Sep 2012 17:42:20 +0300 Subject: CHUI-307 FIXED (LLInitParam::Parser::parserWarnings in log when adding conversations or deleting entries from conversation log ) - removed redundant incorrect attributes --- indra/newview/skins/default/xui/en/panel_blocked_list_item.xml | 1 - .../newview/skins/default/xui/en/panel_conversation_log_list_item.xml | 3 --- 2 files changed, 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml index 84e7e467b1..752321b949 100644 --- a/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_blocked_list_item.xml @@ -60,7 +60,6 @@ Date: Mon, 3 Sep 2012 17:52:54 +0300 Subject: CHUI-314 FIXED (Update Save IM logs on my computer setting to also control populatoin of conversation log) - Now LLConversationLog is optionally listener of IMSession, dependently on "LogInstantMessages" per account setting, saving of call log to file also depends on this setting. Which means that with the Save IM logs on my computer disabled: IM logs for the user will not be saved to their computer and conversations will not be logged to the conversation log. --- indra/newview/llappviewer.cpp | 5 ++++- indra/newview/llconversationlog.cpp | 27 +++++++++++++++++++++++++-- indra/newview/llconversationlog.h | 2 ++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 08a1a237f5..4dacde4792 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1834,7 +1834,10 @@ bool LLAppViewer::cleanup() LLMuteList::getInstance()->cache(gAgent.getID()); //save call log list - LLConversationLog::instance().cache(); + if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) + { + LLConversationLog::instance().cache(); + } if (mPurgeOnExit) { diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 23ccc78a0f..7db6a93709 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -185,11 +185,34 @@ LLConversationLog::LLConversationLog() { loadFromFile(getFileName()); - LLIMMgr::instance().addSessionObserver(this); - + LLControlVariable* ctrl = gSavedPerAccountSettings.getControl("LogInstantMessages").get(); + if (ctrl) + { + ctrl->getSignal()->connect(boost::bind(&LLConversationLog::observeIMSession, this)); + + if (ctrl->getValue().asBoolean()) + { + LLIMMgr::instance().addSessionObserver(this); + } + } + mFriendObserver = new LLConversationLogFriendObserver; LLAvatarTracker::instance().addObserver(mFriendObserver); + } + +void LLConversationLog::observeIMSession() +{ + if (gSavedPerAccountSettings.getBOOL("LogInstantMessages")) + { + LLIMMgr::instance().addSessionObserver(this); + } + else + { + LLIMMgr::instance().removeSessionObserver(this); + } +} + void LLConversationLog::logConversation(const LLConversation& conversation) { mConversations.push_back(conversation); diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index f2b6a67c92..9fd54c61c9 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -145,6 +145,8 @@ private: LLConversationLog(); + void observeIMSession(); + /** * constructs file name in which conversations log will be saved * file name is conversation.log -- cgit v1.2.3 From 681406427fab95167cb87b54e8315600176bf218 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 4 Sep 2012 20:39:49 +0300 Subject: CHUI-311 FIXED (Make conversation list panel size persist between sessions): save current width in the setting_per_account.xml --- indra/newview/llimfloatercontainer.cpp | 23 ++++++++++++++++++++++- indra/newview/llimfloatercontainer.h | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 56648d09b5..480f964939 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -52,7 +52,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) : LLMultiFloater(seed), mExpandCollapseBtn(NULL), - mConversationsRoot(NULL) + mConversationsRoot(NULL), + mInitialized(false) { mCommitCallbackRegistrar.add("IMFloaterContainer.Action", boost::bind(&LLIMFloaterContainer::onCustomAction, this, _2)); @@ -139,6 +140,16 @@ BOOL LLIMFloaterContainer::postBuild() LLAvatarNameCache::addUseDisplayNamesCallback( boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + if (! mMessagesPane->isCollapsed()) + { + S32 list_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"); + LLRect list_size = mConversationsPane->getRect(); + S32 left_pad = mConversationsListPanel->getRect().mLeft; + list_size.mRight = list_size.mLeft + list_width - left_pad; + + mConversationsPane->handleReshape(list_size, TRUE); + } + mInitialized = true; return TRUE; } @@ -514,6 +525,16 @@ void LLIMFloaterContainer::onCustomAction(const LLSD& userdata) void LLIMFloaterContainer::repositioningWidgets() { + if (!mInitialized) + { + return; + } + + if (!mConversationsPane->isCollapsed()) + { + S32 list_width = (mConversationsPane->getRect()).getWidth(); + gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", list_width); + } LLRect panel_rect = mConversationsListPanel->getRect(); S32 item_height = 16; int index = 0; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index a72a3e2221..53e3849600 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -110,6 +110,8 @@ private: LLLayoutPanel* mConversationsPane; LLLayoutStack* mConversationsStack; + bool mInitialized; + // Conversation list implementation public: void removeConversationListItem(const LLUUID& uuid, bool change_focus = true); -- cgit v1.2.3 From 5fbb161ba0a28e64474efc295b12bccffdcdb0e0 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 4 Sep 2012 13:34:33 -0700 Subject: CHUI-305: Now searching in the resident picker works. Problem: The resident picker search results were being sent to the old global resident picker. Now resident pickers are non-global and coupled to their parent floater. --- indra/newview/llfloateravatarpicker.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 2152de1035..6ada809cdb 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -460,8 +460,9 @@ class LLAvatarPickerResponder : public LLHTTPClient::Responder { public: LLUUID mQueryID; + std::string mName; - LLAvatarPickerResponder(const LLUUID& id) : mQueryID(id) { } + LLAvatarPickerResponder(const LLUUID& id, const std::string& name) : mQueryID(id), mName(name) { } /*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { @@ -474,7 +475,7 @@ public: if (isGoodStatus(status) || status == 400) { LLFloaterAvatarPicker* floater = - LLFloaterReg::findTypedInstance("avatar_picker"); + LLFloaterReg::findTypedInstance("avatar_picker", mName); if (floater) { floater->processResponse(mQueryID, content); @@ -517,7 +518,7 @@ void LLFloaterAvatarPicker::find() url += "?page_size=100&names="; url += LLURI::escape(text); llinfos << "avatar picker " << url << llendl; - LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID)); + LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID, getKey().asString())); } else { -- cgit v1.2.3 From d41202336b7c797bc3fe4feffa8be2164518e845 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 4 Sep 2012 14:21:25 -0700 Subject: CHUI-303: Problem was that the prior solution only updated (using dirtyFilter()) the inventory window that the paste occurred in. Resolution: Now each inventory window calls dirtyFilter(), which then determines visibility of the pasted item. --- indra/newview/llinventorybridge.cpp | 12 ++---------- indra/newview/llinventorymodel.cpp | 1 + 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 745375fe3d..72c54e5ce2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3193,16 +3193,8 @@ void LLFolderBridge::pasteFromClipboard() LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); llassert(vicat); if (vicat) - { - //Set the pasted folder to dirty, could do this in changeCategoryParent() but only need to set dirty - //when pasting from the clipboard. Setting dirty allows updating the filter state, which determines - //visibility in the new pasted location. - LLFolderViewFolder * folderViewItem = mInventoryPanel.get() ? mInventoryPanel.get()->getFolderByID(item_id) : NULL; - if(folderViewItem && folderViewItem->getViewModelItem()) - { - folderViewItem->getViewModelItem()->dirtyFilter(); - } - + { + //changeCategoryParent() implicity calls dirtyFilter changeCategoryParent(model, vicat, parent_id, FALSE); } } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 0673970d89..e7d59d92d9 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -986,6 +986,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) cat_array->put(old_cat); } mask |= LLInventoryObserver::STRUCTURE; + mask |= LLInventoryObserver::INTERNAL; } if(old_cat->getName() != cat->getName()) { -- cgit v1.2.3 From 8cd5d361600f34a0a7fa504a721bea3301191644 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 4 Sep 2012 22:11:28 -0700 Subject: CHUI-285 : Create participant widgets in the conversation list --- indra/newview/llconversationmodel.cpp | 12 ++++-- indra/newview/llconversationmodel.h | 14 ++++--- indra/newview/llconversationview.cpp | 38 ++++++++++++++++- indra/newview/llconversationview.h | 20 ++++++++- indra/newview/llimfloatercontainer.cpp | 75 +++++++++++++++++++++++++--------- 5 files changed, 128 insertions(+), 31 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index d7f9093a4a..aa21b08ec8 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -36,21 +36,24 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUUID(uuid) + mUUID(uuid), + mNeedsRefresh(true) { } LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID(uuid) + mUUID(uuid), + mNeedsRefresh(true) { } LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID() + mUUID(), + mNeedsRefresh(true) { } @@ -102,11 +105,13 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa { addChild(participant); mIsLoaded = true; + mNeedsRefresh = true; } void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { removeChild(participant); + mNeedsRefresh = true; } void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) @@ -122,6 +127,7 @@ void LLConversationItemSession::clearParticipants() { clearChildren(); mIsLoaded = false; + mNeedsRefresh = true; } LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id) diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 1a2e09dfab..5947055e0f 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -60,7 +60,7 @@ public: virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } virtual BOOL isItemRenameable() const { return TRUE; } - virtual BOOL renameItem(const std::string& new_name) { mName = new_name; return TRUE; } + virtual BOOL renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return TRUE; } virtual BOOL isItemMovable( void ) const { return FALSE; } virtual BOOL isItemRemovable( void ) const { return FALSE; } virtual BOOL isItemInTrash( void) const { return FALSE; } @@ -102,10 +102,14 @@ public: // bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } - + + void resetRefresh() { mNeedsRefresh = false; } + bool needsRefresh() { return mNeedsRefresh; } + protected: std::string mName; // Name of the session or the participant LLUUID mUUID; // UUID of the session or the participant + bool mNeedsRefresh; // Flag signaling to the view that something changed for this item }; class LLConversationItemSession : public LLConversationItem @@ -115,7 +119,7 @@ public: LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemSession() {} - void setSessionID(const LLUUID& session_id) { mUUID = session_id; } + void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } void addParticipant(LLConversationItemParticipant* participant); void removeParticipant(LLConversationItemParticipant* participant); void removeParticipant(const LLUUID& participant_id); @@ -142,8 +146,8 @@ public: bool isMuted() { return mIsMuted; } bool isModerator() {return mIsModerator; } - void setIsMuted(bool is_muted) { mIsMuted = is_muted; } - void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; } + void setIsMuted(bool is_muted) { mIsMuted = is_muted; mNeedsRefresh = true; } + void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; } void dumpDebugData(); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index fefb7e9cac..2f71e92a7d 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -79,12 +79,46 @@ void LLConversationViewSession::setVisibleIfDetached(BOOL visible) } } +LLConversationViewParticipant* LLConversationViewSession::findParticipant(const LLUUID& participant_id) +{ + // This is *not* a general tree parsing algorithm. We search only in the mItems list + // assuming there is no mFolders which makes sense for sessions (sessions don't contain + // sessions). + LLConversationViewParticipant* participant = NULL; + items_t::const_iterator iter; + for (iter = getItemsBegin(); iter != getItemsEnd(); iter++) + { + participant = dynamic_cast(*iter); + if (participant->hasSameValue(participant_id)) + { + break; + } + } + return (iter == getItemsEnd() ? NULL : participant); +} + +void LLConversationViewSession::refresh() +{ + // Refresh the session view from its model data + // LLConversationItemSession* vmi = dynamic_cast(getViewModelItem()); + + // Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh() + + // Do the regular upstream refresh + LLFolderViewFolder::refresh(); +} + // // Implementation of conversations list participant (avatar) widgets // -LLConversationViewParticipant::LLConversationViewParticipant( const LLFolderViewItem::Params& p ): - LLFolderViewItem(p) +LLConversationViewParticipant::Params::Params() : + participant_id() +{} + +LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ): + LLFolderViewItem(p), + mUUID(p.participant_id) { } diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 5695925f43..27ceb2af3b 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -30,6 +30,8 @@ #include "llfolderviewitem.h" class LLIMFloaterContainer; +class LLConversationViewSession; +class LLConversationViewParticipant; // Implementation of conversations list session widgets @@ -53,18 +55,34 @@ public: virtual ~LLConversationViewSession( void ) { } virtual void selectItem(); void setVisibleIfDetached(BOOL visible); + LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); + + virtual void refresh(); }; // Implementation of conversations list participant (avatar) widgets class LLConversationViewParticipant : public LLFolderViewItem { +public: + struct Params : public LLInitParam::Block + { + Optional participant_id; + + Params(); + }; + protected: friend class LLUICtrlFactory; - LLConversationViewParticipant( const LLFolderViewItem::Params& p ); + LLConversationViewParticipant( const Params& p ); public: virtual ~LLConversationViewParticipant( void ) { } + + bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } + +private: + LLUUID mUUID; // UUID of the participant }; #endif // LL_LLCONVERSATIONVIEW_H diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index aa85e5023d..dfe9e6491d 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -289,6 +289,59 @@ void LLIMFloaterContainer::setMinimized(BOOL b) void LLIMFloaterContainer::draw() { + // CHUI Notes + // Currently, the model is not responsible for creating the view which is a good thing. This means that + // the model could change substantially and the view could decide to echo only a portion of this model. + // Consequently, the participant views need to be created either by the session view or by the container panel. + // For the moment, we create them here (which makes for complicated code...) to conform to the pattern + // implemented in llinventorypanel.cpp (see LLInventoryPanel::buildNewViews()). + // The best however would be to have an observer on the model so that we would not pool on each draw to know + // if the view needs refresh. The current implementation (testing for change on draw) is less + // efficient perf wise than a listener/observer scheme. We will implement that shortly. + + // On each session in mConversationsItems + for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) + { + // Get the current session descriptors + LLConversationItem* session_model = it_session->second; + LLUUID session_id = it_session->first; + LLConversationViewSession* session_view = dynamic_cast(mConversationsWidgets[session_id]); + // If the session model has been changed, refresh the corresponding view + if (session_model->needsRefresh()) + { + session_view->refresh(); + } + // Iterate through each model participant child + LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = session_model->getChildrenBegin(); + LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = session_model->getChildrenEnd(); + while (current_participant_model != end_participant_model) + { + LLConversationItem* participant_model = dynamic_cast(*current_participant_model); + LLUUID participant_id = participant_model->getUUID(); + LLConversationViewParticipant* participant_view = session_view->findParticipant(participant_id); + // Is there a corresponding view? If not create it + if (!participant_view) + { + participant_view = createConversationViewParticipant(participant_model); + participant_view->addToFolder(session_view); + mConversationsListPanel->addChild(participant_view); + participant_view->setVisible(TRUE); + } + else + // Else, see if it needs refresh + { + if (participant_model->needsRefresh()) + { + participant_view->refresh(); + } + } + // Reset the need for refresh + session_model->resetRefresh(); + // Next participant + current_participant_model++; + } + } + if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user @@ -536,24 +589,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) participant_view->setVisible(TRUE); current_participant_model++; } - // Debugging hack : uncomment to force the creation of a dummy participant - // This hack is to be eventually deleted - if (item->getChildrenCount() == 0) - { - llinfos << "Merov debug : create dummy participant" << llendl; - // Create a dummy participant : we let that leak but that's just for debugging... - std::string name("Debug Test : "); - name += display_name; - LLUUID test_id; - test_id.generate(name); - LLConversationItemParticipant* participant_model = new LLConversationItemParticipant(name, test_id, getRootViewModel()); - // Create the dummy widget - LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); - participant_view->addToFolder(widget); - mConversationsListPanel->addChild(participant_view); - participant_view->setVisible(TRUE); - } - // End debugging hack repositioningWidgets(); @@ -610,7 +645,7 @@ LLConversationViewSession* LLIMFloaterContainer::createConversationItemWidget(LL LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParticipant(LLConversationItem* item) { - LLConversationViewSession::Params params; + LLConversationViewParticipant::Params params; params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); @@ -620,7 +655,7 @@ LLConversationViewParticipant* LLIMFloaterContainer::createConversationViewParti params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; - params.container = this; + params.participant_id = item->getUUID(); return LLUICtrlFactory::create(params); } -- cgit v1.2.3 From 3cf624b371eace5ec382796d7bd811d181d5e877 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 5 Sep 2012 18:48:07 +0300 Subject: CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved focusLost(), focusReceived and enable/disable of the call button to base class --- indra/newview/llimconversation.cpp | 42 ++++++++++++++++++++++++++++++++++++++ indra/newview/llimconversation.h | 14 +++++++++---- indra/newview/llimfloater.cpp | 39 ----------------------------------- indra/newview/llimfloater.h | 9 -------- indra/newview/llnearbychat.cpp | 23 +-------------------- indra/newview/llnearbychat.h | 7 ------- 6 files changed, 53 insertions(+), 81 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 5a5196fb7e..d8c81a7849 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -31,6 +31,8 @@ #include "llchatentry.h" #include "llchathistory.h" +#include "llchiclet.h" +#include "llchicletbar.h" #include "lldraghandle.h" #include "llfloaterreg.h" #include "llimfloater.h" @@ -53,6 +55,8 @@ LLIMConversation::LLIMConversation(const LLUUID& session_id) , mInputEditorTopPad(0) , mRefreshTimer(new LLTimer()) { + mSession = LLIMModel::getInstance()->findIMSession(mSessionID); + mCommitCallbackRegistrar.add("IMSession.Menu.Action", boost::bind(&LLIMConversation::onIMSessionMenuItemClicked, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.CompactExpandedModes.CheckItem", @@ -182,6 +186,44 @@ void LLIMConversation::draw() } } +void LLIMConversation::enableDisableCallBtn() +{ + getChildView("voice_call_btn")->setEnabled( + mSessionID.notNull() + && mSession + && mSession->mSessionInitialized + && LLVoiceClient::getInstance()->voiceEnabled() + && LLVoiceClient::getInstance()->isVoiceWorking() + && mSession->mCallBackEnabled); +} + + +void LLIMConversation::onFocusReceived() +{ + setBackgroundOpaque(true); + + if (mSessionID.notNull()) + { + LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); + + if (getVisible()) + { + // suppress corresponding toast only if this floater is visible and have focus + LLIMModel::getInstance()->setActiveSessionID(mSessionID); + LLIMModel::instance().sendNoUnreadMessages(mSessionID); + } + } + + LLTransientDockableFloater::onFocusReceived(); +} + +void LLIMConversation::onFocusLost() +{ + setBackgroundOpaque(false); + LLTransientDockableFloater::onFocusLost(); +} + + void LLIMConversation::buildParticipantList() { if (mIsNearbyChat) diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 26151ad1be..50feb12aed 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -33,6 +33,7 @@ #include "lltransientdockablefloater.h" #include "llviewercontrol.h" #include "lleventtimer.h" +#include "llimview.h" #include "llconversationmodel.h" class LLPanelChatControlPanel; @@ -87,9 +88,6 @@ protected: // refresh a visual state of the Call button void updateCallBtnState(bool callIsActive); - // set the enable/disable state for the Call button - virtual void enableDisableCallBtn() = 0; - void buildParticipantList(); void onSortMenuItemClicked(const LLSD& userdata); @@ -99,9 +97,18 @@ protected: /// Update floater header and toolbar buttons when hosted/torn off state is toggled. void updateHeaderAndToolbar(); + // set the enable/disable state for the Call button + virtual void enableDisableCallBtn(); + + // process focus events to set a currently active session + /* virtual */ void onFocusLost(); + /* virtual */ void onFocusReceived(); + bool mIsNearbyChat; bool mIsP2PChat; + LLIMModel::LLIMSession* mSession; + LLLayoutPanel* mParticipantListPanel; LLParticipantList* mParticipantList; LLUUID mSessionID; @@ -119,7 +126,6 @@ private: /// Refreshes the floater at a constant rate. virtual void refresh() = 0; - /** * Adjusts chat history height to fit vertically with input chat field * and avoid overlapping, since input chat field can be vertically expanded. diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index a601561c62..7b475c1e0b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -92,24 +92,6 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) setDocked(true); } -void LLIMFloater::onFocusLost() -{ - LLIMModel::getInstance()->resetActiveSessionID(); - - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false); -} - -void LLIMFloater::onFocusReceived() -{ - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true); - - if (getVisible()) - { - // suppress corresponding toast only if this floater is visible and have focus - LLIMModel::getInstance()->setActiveSessionID(mSessionID); - LLIMModel::instance().sendNoUnreadMessages(mSessionID); - } -} // virtual void LLIMFloater::refresh() @@ -513,27 +495,6 @@ void LLIMFloater::boundVoiceChannel() } } -void LLIMFloater::enableDisableCallBtn() -{ - bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() - && LLVoiceClient::getInstance()->isVoiceWorking(); - - if (mSession) - { - bool session_initialized = mSession->mSessionInitialized; - bool callback_enabled = mSession->mCallBackEnabled; - - BOOL enable_connect = - session_initialized && voice_enabled && callback_enabled; - getChildView("voice_call_btn")->setEnabled(enable_connect); - } - else - { - getChildView("voice_call_btn")->setEnabled(false); - } -} - - void LLIMFloater::onCallButtonClicked() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 24a8f17feb..7b2c9e7aef 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -134,10 +134,6 @@ public: private: - // process focus events to set a currently active session - /* virtual */ void onFocusLost(); - /* virtual */ void onFocusReceived(); - /*virtual*/ void refresh(); /*virtual*/ void onClickCloseBtn(); @@ -169,9 +165,6 @@ private: void onCallButtonClicked(); - // set the enable/disable state for the Call button - virtual void enableDisableCallBtn(); - void boundVoiceChannel(); // Add the "User is typing..." indicator. @@ -184,8 +177,6 @@ private: static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response); - - LLIMModel::LLIMSession* mSession; S32 mLastMessageIndex; EInstantMessage mDialog; diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 25bbc82fee..c2ad8cfda3 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -133,6 +133,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd) setIsChrome(TRUE); mKey = LLSD(); mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); + mSessionID = LLUUID(); setName("nearby_chat"); setIsSingleInstance(TRUE); } @@ -216,21 +217,6 @@ bool LLNearbyChat::onNearbyChatCheckContextMenuItem(const LLSD& userdata) return false; } -//////////////////////////////////////////////////////////////////////////////// -// -void LLNearbyChat::onFocusReceived() -{ - setBackgroundOpaque(true); - LLIMConversation::onFocusReceived(); -} - -//////////////////////////////////////////////////////////////////////////////// -// -void LLNearbyChat::onFocusLost() -{ - setBackgroundOpaque(false); - LLIMConversation::onFocusLost(); -} BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) { @@ -326,13 +312,6 @@ void LLNearbyChat::setVisible(BOOL visible) } -void LLNearbyChat::enableDisableCallBtn() -{ - // bool btn_enabled = LLAgent::isActionAllowed("speak"); - - getChildView("voice_call_btn")->setEnabled(false /*btn_enabled*/); -} - void LLNearbyChat::onTearOffClicked() { LLIMConversation::onTearOffClicked(); diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 4fc5cb7f76..1db7afc01f 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -51,10 +51,6 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - // focus overrides - /*virtual*/ void onFocusLost(); - /*virtual*/ void onFocusReceived(); - /*virtual*/ void setVisible(BOOL visible); void loadHistory(); @@ -102,9 +98,6 @@ protected: void displaySpeakingIndicator(); - // set the enable/disable state for the Call button - virtual void enableDisableCallBtn(); - // Which non-zero channel did we last chat on? static S32 sLastSpecialChatChannel; -- cgit v1.2.3 From 1229f42ade088f69164b59742305119bacc8f4de Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Sep 2012 18:55:07 -0700 Subject: CHUI-285 : Clear the needs refresh flag when refreshing, comment clean up. --- indra/newview/llconversationview.cpp | 15 ++++++++++++++- indra/newview/llconversationview.h | 1 + indra/newview/llimfloatercontainer.cpp | 1 - 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 2f71e92a7d..9f3df93aba 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -100,7 +100,8 @@ LLConversationViewParticipant* LLConversationViewSession::findParticipant(const void LLConversationViewSession::refresh() { // Refresh the session view from its model data - // LLConversationItemSession* vmi = dynamic_cast(getViewModelItem()); + LLConversationItem* vmi = dynamic_cast(getViewModelItem()); + vmi->resetRefresh(); // Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh() @@ -122,4 +123,16 @@ LLConversationViewParticipant::LLConversationViewParticipant( const LLConversati { } +void LLConversationViewParticipant::refresh() +{ + // Refresh the participant view from its model data + LLConversationItem* vmi = dynamic_cast(getViewModelItem()); + vmi->resetRefresh(); + + // Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh() + + // Do the regular upstream refresh + LLFolderViewItem::refresh(); +} + // EOF diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 27ceb2af3b..a3755d9722 100644 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -81,6 +81,7 @@ public: bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } + virtual void refresh(); private: LLUUID mUUID; // UUID of the participant }; diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1be0c5f075..56648d09b5 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -552,7 +552,6 @@ void LLIMFloaterContainer::repositioningWidgets() } } -// CHUI-137 : Temporary implementation of conversations list void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { bool is_nearby_chat = uuid.isNull(); -- cgit v1.2.3 From 1a913365b594de81de56896a9fbdfd6d8c4f21e0 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 6 Sep 2012 23:08:10 +0300 Subject: CHUI-319 FIXED ("User has said something new" text shown when navigating chat history with More History button) - Added flag to chat history whether to show notification about unread messages or not --- indra/newview/llchathistory.cpp | 5 +++-- indra/newview/llchathistory.h | 6 +++++- indra/newview/skins/default/xui/en/floater_conversation_preview.xml | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index e3d57ab7ae..3636f9e9d2 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -585,7 +585,8 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p) mBottomSeparatorPad(p.bottom_separator_pad), mTopHeaderPad(p.top_header_pad), mBottomHeaderPad(p.bottom_header_pad), - mIsLastMessageFromLog(false) + mIsLastMessageFromLog(false), + mNotifyAboutUnreadMsg(p.notify_unread_msg) { LLTextEditor::Params editor_params(p); editor_params.rect = getLocalRect(); @@ -707,7 +708,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL bool from_me = chat.mFromID == gAgent.getID(); mEditor->setPlainText(use_plain_text_chat_history); - if (!mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty()) + if (mNotifyAboutUnreadMsg && !mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty()) { mUnreadChatSources.insert(chat.mFromName); mMoreChatPanel->setVisible(TRUE); diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index 28344e6a10..990c52f31b 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -60,6 +60,8 @@ class LLChatHistory : public LLUICtrl Optional more_chat_text; + Optional notify_unread_msg; + Params() : message_header("message_header"), message_separator("message_separator"), @@ -71,7 +73,8 @@ class LLChatHistory : public LLUICtrl bottom_separator_pad("bottom_separator_pad"), top_header_pad("top_header_pad"), bottom_header_pad("bottom_header_pad"), - more_chat_text("more_chat_text") + more_chat_text("more_chat_text"), + notify_unread_msg("notify_unread_msg", true) {} }; @@ -122,6 +125,7 @@ class LLChatHistory : public LLUICtrl LLUUID mLastFromID; LLDate mLastMessageTime; bool mIsLastMessageFromLog; + bool mNotifyAboutUnreadMsg; //std::string mLastMessageTimeStr; std::string mMessageHeaderFilename; diff --git a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml index c837a0ee57..28ba03ebe9 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml @@ -45,6 +45,7 @@ visible="true" height="310" name="chat_history" + notify_unread_msg="false" parse_highlights="true" parse_urls="true" left="5" -- cgit v1.2.3 From fd17cb601465b3433b647b895baede9b0fd822dd Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 6 Sep 2012 23:16:22 +0300 Subject: CHUI-320 FIXED (Inconsistent name formatting in conversation log depending if user started conversation or not) - On P2P session started, before creating entry of conversation log, requesting avatar name in form of Display Name (user.name) --- indra/newview/llconversationlog.cpp | 23 ++++++++++++++++++++--- indra/newview/llconversationlog.h | 3 +++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 7db6a93709..e80a709203 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" #include "llagent.h" +#include "llavatarnamecache.h" #include "llconversationlog.h" #include "lltrans.h" @@ -152,6 +153,7 @@ void LLConversation::setListenIMFloaterOpened() mIMFloaterShowedConnection = LLIMFloater::setIMFloaterShowedCallback(boost::bind(&LLConversation::onIMFloaterShown, this, _1)); } } + /************************************************************************/ /* LLConversationLogFriendObserver implementation */ /************************************************************************/ @@ -262,9 +264,16 @@ void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); if (session) { - LLConversation conversation(*session); - LLConversationLog::instance().logConversation(conversation); - session->mVoiceChannel->setStateChangedCallback(boost::bind(&LLConversationLog::onVoiceChannelConnected, this, _5, _2)); + if (LLIMModel::LLIMSession::P2P_SESSION == session->mSessionType) + { + LLAvatarNameCache::get(session->mOtherParticipantID, boost::bind(&LLConversationLog::onAvatarNameCache, this, _1, _2, session)); + } + else + { + LLConversation conversation(*session); + LLConversationLog::instance().logConversation(conversation); + session->mVoiceChannel->setStateChangedCallback(boost::bind(&LLConversationLog::onVoiceChannelConnected, this, _5, _2)); + } } } @@ -425,3 +434,11 @@ void LLConversationLog::onVoiceChannelConnected(const LLUUID& session_id, const } } } + +void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, LLIMModel::LLIMSession* session) +{ + LLConversation conversation(*session); + conversation.setConverstionName(av_name.getCompleteName()); + LLConversationLog::instance().logConversation(conversation); + session->mVoiceChannel->setStateChangedCallback(boost::bind(&LLConversationLog::onVoiceChannelConnected, this, _5, _2)); +} diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 9fd54c61c9..0d7f0080e5 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -62,6 +62,7 @@ public: void setIsVoice(bool is_voice); void setIsPast (bool is_past) { mIsConversationPast = is_past; } + void setConverstionName(std::string conv_name) { mConversationName = conv_name; } /* * Resets flag of unread offline message to false when im floater with this conversation is opened. @@ -156,6 +157,8 @@ private: bool saveToFile(const std::string& filename); bool loadFromFile(const std::string& filename); + void onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, LLIMModel::LLIMSession* session); + typedef std::vector conversations_vec_t; std::vector mConversations; std::set mObservers; -- cgit v1.2.3 From 973f54ace7706c6e3b12cc3364b4c7ffb1b841c9 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 6 Sep 2012 23:18:59 +0300 Subject: CHUI-324 FIXED (No sort order field set by default in conversation log) - Corrected value in settings XML --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b98fea7032..593381cb29 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10105,7 +10105,7 @@ Type U32 Value - 2 + 1 SortFriendsFirst -- cgit v1.2.3 From 62eb7ec0301c0313cedc2fcb63df8779b22a6d26 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Thu, 6 Sep 2012 23:34:47 +0300 Subject: CHUI-318 FIXED (User cannot navigate forward in chat history viewer once the More History option is selected.) - Added spinner so that user could select desired history page. Also displaying total count of pages. --- indra/newview/llfloaterconversationpreview.cpp | 11 +++++++ indra/newview/llfloaterconversationpreview.h | 3 ++ .../xui/en/floater_conversation_preview.xml | 36 +++++++++++++++++----- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index 7083fb987d..c9d9d7aa3b 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -29,6 +29,7 @@ #include "llfloaterconversationpreview.h" #include "llimview.h" #include "lllineeditor.h" +#include "llspinctrl.h" #include "lltrans.h" LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id) @@ -69,6 +70,15 @@ BOOL LLFloaterConversationPreview::postBuild() LLLogChat::loadChatHistory(file, mMessages, true); mCurrentPage = mMessages.size() / mPageSize; + mPageSpinner = getChild("history_page_spin"); + mPageSpinner->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this)); + mPageSpinner->setMinValue(1); + mPageSpinner->setMaxValue(mCurrentPage + 1); + mPageSpinner->set(mCurrentPage + 1); + + std::string total_page_num = llformat("/ %d", mCurrentPage + 1); + getChild("page_num_label")->setValue(total_page_num); + return LLFloater::postBuild(); } @@ -128,6 +138,7 @@ void LLFloaterConversationPreview::showHistory() void LLFloaterConversationPreview::onMoreHistoryBtnClick() { + mCurrentPage = mPageSpinner->getValueF32(); if (--mCurrentPage < 0) { return; diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h index 2246a44761..0341e5d2a0 100644 --- a/indra/newview/llfloaterconversationpreview.h +++ b/indra/newview/llfloaterconversationpreview.h @@ -29,6 +29,8 @@ #include "llchathistory.h" #include "llfloater.h" +class LLSpinCtrl; + class LLFloaterConversationPreview : public LLFloater { public: @@ -45,6 +47,7 @@ private: void onMoreHistoryBtnClick(); void showHistory(); + LLSpinCtrl* mPageSpinner; LLChatHistory* mChatHistory; LLUUID mSessionID; int mCurrentPage; diff --git a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml index 28ba03ebe9..d74c2c252d 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml @@ -51,14 +51,36 @@ left="5" width="390"> - + name="page_label" + right="-110" + top_pad="7" + value="Page" + width="35"> + + + + -- cgit v1.2.3 From ee5e689331ff6ba44cebaf9e9fb48f7bc3f590c4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 6 Sep 2012 16:32:17 -0700 Subject: CHUI-285 : Completed. Update the names of the participants. --- indra/newview/llconversationmodel.cpp | 8 ++++++++ indra/newview/llconversationmodel.h | 3 +++ indra/newview/llparticipantlist.cpp | 5 ++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index aa21b08ec8..fa49987d15 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -193,6 +193,14 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, { } +void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) +{ + mName = av_name.mDisplayName; + // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername + // *TODO : we need to request or initiate a list resort + mNeedsRefresh = true; +} + void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 5947055e0f..26c7a29d76 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -29,6 +29,7 @@ #include "llfolderviewitem.h" #include "llfolderviewmodel.h" +#include "llavatarname.h" // Implementation of conversations list @@ -149,6 +150,8 @@ public: void setIsMuted(bool is_muted) { mIsMuted = is_muted; mNeedsRefresh = true; } void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; } + void onAvatarNameCache(const LLAvatarName& av_name); + void dumpDebugData(); private: diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index fa3432fc89..2282734109 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -652,6 +652,8 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel); + // Binds avatar's name update callback + LLAvatarNameCache::get(avatar_id, boost::bind(&LLConversationItemParticipant::onAvatarNameCache, participant, _2)); if (mAvatarList) { mAvatarList->getIDs().push_back(avatar_id); @@ -670,9 +672,6 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) mAvalineUpdater->watchAvalineCaller(avatar_id); } - // *TODO : Merov : need to declare and bind a name update callback on that "participant" instance. See LLAvatarListItem::updateAvatarName() for pattern. - // For the moment, we'll get the correct name only if it's already in the name cache (see call to LLAvatarNameCache::get() here above) - // *TODO : Merov : need to update the online/offline status of the participant. // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id)) -- cgit v1.2.3 From 47fe3b48fe32f9eb810a23d82eb08c11c41ac335 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 10 Sep 2012 13:48:37 +0300 Subject: CHUI-268 (Transfer the common functionality from LLNearbyChat and LLIMFloater to LLIMConversation): moved appendMessage() to base class --- indra/newview/llimconversation.cpp | 40 ++++++++++++++++++++++++++++++++++ indra/newview/llimconversation.h | 5 +++++ indra/newview/llimfloater.cpp | 19 ---------------- indra/newview/llimfloater.h | 1 - indra/newview/llnearbychat.cpp | 44 ++------------------------------------ indra/newview/llnearbychat.h | 2 -- 6 files changed, 47 insertions(+), 64 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index d8c81a7849..ef3b4f7404 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -223,6 +223,46 @@ void LLIMConversation::onFocusLost() LLTransientDockableFloater::onFocusLost(); } +std::string LLIMConversation::appendTime() +{ + time_t utc_time; + utc_time = time_corrected(); + std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"]"; + + LLSD substitution; + + substitution["datetime"] = (S32) utc_time; + LLStringUtil::format (timeStr, substitution); + + return timeStr; +} + +void LLIMConversation::appendMessage(const LLChat& chat, const LLSD &args) +{ + LLChat& tmp_chat = const_cast(chat); + + if(tmp_chat.mTimeStr.empty()) + tmp_chat.mTimeStr = appendTime(); + + if (!chat.mMuted) + { + tmp_chat.mFromName = chat.mFromName; + LLSD chat_args; + if (args) chat_args = args; + chat_args["use_plain_text_chat_history"] = + gSavedSettings.getBOOL("PlainTextChatHistory"); + chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); + chat_args["show_names_for_p2p_conv"] = + !mIsP2PChat || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); + + if (mChatHistory) + { + mChatHistory->appendMessage(chat, chat_args); + } + } +} + void LLIMConversation::buildParticipantList() { diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 50feb12aed..41a76c206e 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -104,6 +104,11 @@ protected: /* virtual */ void onFocusLost(); /* virtual */ void onFocusReceived(); + // prepare chat's params and out one message to chatHistory + void appendMessage(const LLChat& chat, const LLSD &args = 0); + + std::string appendTime(); + bool mIsNearbyChat; bool mIsP2PChat; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 7b475c1e0b..2474fe0891 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -848,25 +848,6 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) } } -void LLIMFloater::appendMessage(const LLChat& chat, const LLSD &args) -{ - LLChat& tmp_chat = const_cast(chat); - - if (!chat.mMuted) - { - tmp_chat.mFromName = chat.mFromName; - LLSD chat_args; - if (args) chat_args = args; - chat_args["use_plain_text_chat_history"] = - gSavedSettings.getBOOL("PlainTextChatHistory"); - chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = !mIsP2PChat - || gSavedSettings.getBOOL("IMShowNamesForP2PConv"); - - mChatHistory->appendMessage(chat, chat_args); - } -} - void LLIMFloater::updateMessages() { std::list messages; diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 7b2c9e7aef..e4a67a3d56 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -152,7 +152,6 @@ private: BOOL isInviteAllowed() const; BOOL inviteToSession(const uuid_vec_t& agent_ids); - void appendMessage(const LLChat& chat, const LLSD &args = 0); static void onInputEditorFocusReceived( LLFocusableElement* caller,void* userdata ); static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); static void onInputEditorKeystroke(LLTextEditor* caller, void* userdata); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index c2ad8cfda3..ddd271e23f 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -69,7 +69,7 @@ S32 LLNearbyChat::sLastSpecialChatChannel = 0; -// --- 2 functions in the global namespace :( --- +// --- function in the global namespace :( --- bool isWordsName(const std::string& name) { // checking to see if it's display name plus username in parentheses @@ -89,22 +89,6 @@ bool isWordsName(const std::string& name) } } -std::string appendTime() -{ - time_t utc_time; - utc_time = time_corrected(); - std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" - +LLTrans::getString("TimeMin")+"]"; - - LLSD substitution; - - substitution["datetime"] = (S32) utc_time; - LLStringUtil::format (timeStr, substitution); - - return timeStr; -} - - const S32 EXPANDED_HEIGHT = 266; const S32 COLLAPSED_HEIGHT = 60; const S32 EXPANDED_MIN_HEIGHT = 150; @@ -129,6 +113,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& llsd) mSpeakerMgr(NULL), mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) { + mIsP2PChat = false; mIsNearbyChat = true; setIsChrome(TRUE); mKey = LLSD(); @@ -604,31 +589,6 @@ void LLNearbyChat::sendChat( EChatType type ) } } - -void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args) -{ - LLChat& tmp_chat = const_cast(chat); - - if(tmp_chat.mTimeStr.empty()) - tmp_chat.mTimeStr = appendTime(); - - if (!chat.mMuted) - { - tmp_chat.mFromName = chat.mFromName; - LLSD chat_args; - if (args) chat_args = args; - chat_args["use_plain_text_chat_history"] = - gSavedSettings.getBOOL("PlainTextChatHistory"); - chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); - chat_args["show_names_for_p2p_conv"] = true; - - if (mChatHistory) - { - mChatHistory->appendMessage(chat, chat_args); - } - } -} - void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args) { appendMessage(chat, args); diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 1db7afc01f..2cbafbfa62 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -108,8 +108,6 @@ protected: private: - // prepare chat's params and out one message to chatHistory - void appendMessage(const LLChat& chat, const LLSD &args = 0); void onNearbySpeakers (); /*virtual*/ void refresh(); -- cgit v1.2.3 From d9309bd16334a7d76da1b02e8fc43117a06ef7b2 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 7 Sep 2012 12:34:21 +0300 Subject: CHUI-323 FIXED (Local chat message panel out of position in Conversation floater): Prevented too early creation LLNearbyChat --- indra/newview/llimconversation.cpp | 28 ++++++++++++++-------------- indra/newview/llnearbychathandler.cpp | 3 ++- indra/newview/llnotificationhandlerutil.cpp | 2 +- indra/newview/llnotificationtiphandler.cpp | 2 +- indra/newview/llviewerwindow.cpp | 6 +++--- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index ef3b4f7404..216c5bbd70 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -148,7 +148,7 @@ BOOL LLIMConversation::postBuild() updateHeaderAndToolbar(); - mSaveRect = !getHost(); + mSaveRect = isTornOff(); initRectControl(); if (isChatMultiTab()) @@ -349,11 +349,11 @@ void LLIMConversation::hideOrShowTitle() LLView* floater_contents = getChild("contents_view"); LLRect floater_rect = getLocalRect(); - S32 top_border_of_contents = floater_rect.mTop - (getHost()? 0 : floater_header_size); + S32 top_border_of_contents = floater_rect.mTop - (isTornOff()? floater_header_size : 0); LLRect handle_rect (0, floater_rect.mTop, floater_rect.mRight, top_border_of_contents); LLRect contents_rect (0, top_border_of_contents, floater_rect.mRight, floater_rect.mBottom); mDragHandle->setShape(handle_rect); - mDragHandle->setVisible(!getHost()); + mDragHandle->setVisible(isTornOff()); floater_contents->setShape(contents_rect); } @@ -371,8 +371,8 @@ void LLIMConversation::hideAllStandardButtons() void LLIMConversation::updateHeaderAndToolbar() { - bool is_hosted = !!getHost(); - if (is_hosted) + bool is_torn_off = !getHost(); + if (!is_torn_off) { hideAllStandardButtons(); } @@ -381,7 +381,7 @@ void LLIMConversation::updateHeaderAndToolbar() // Participant list should be visible only in torn off floaters. bool is_participant_list_visible = - !is_hosted + is_torn_off && gSavedSettings.getBOOL("IMShowControlPanel") && !mIsP2PChat; @@ -389,21 +389,21 @@ void LLIMConversation::updateHeaderAndToolbar() // Display collapse image (<<) if the floater is hosted // or if it is torn off but has an open control panel. - bool is_expanded = is_hosted || is_participant_list_visible; + bool is_expanded = !is_torn_off || is_participant_list_visible; mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); // toggle floater's drag handle and title visibility if (mDragHandle) { - mDragHandle->setTitleVisible(!is_hosted); + mDragHandle->setTitleVisible(is_torn_off); } // The button (>>) should be disabled for torn off P2P conversations. - mExpandCollapseBtn->setEnabled(is_hosted || !mIsP2PChat); + mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat); - mTearOffBtn->setImageOverlay(getString(is_hosted? "tear_off_icon" : "return_icon")); + mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon")); - mCloseBtn->setVisible(is_hosted && !mIsNearbyChat); + mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat); enableDisableCallBtn(); @@ -440,7 +440,7 @@ void LLIMConversation::processChatHistoryStyleUpdate() } } - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); if (nearby_chat) { nearby_chat->reloadMessages(); @@ -510,8 +510,8 @@ void LLIMConversation::onClose(bool app_quitting) void LLIMConversation::onTearOffClicked() { - setFollows(getHost()? FOLLOWS_NONE : FOLLOWS_ALL); - mSaveRect = !getHost(); + setFollows(isTornOff()? FOLLOWS_ALL : FOLLOWS_NONE); + mSaveRect = isTornOff(); initRectControl(); LLFloater::onClickTearOff(this); updateHeaderAndToolbar(); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index ca3fffeffd..f3e17ea61b 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -487,6 +487,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, if(chat_msg.mText.empty()) return;//don't process empty messages + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + // Build notification data LLSD chat; chat["message"] = chat_msg.mText; @@ -537,7 +539,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, } } - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); nearby_chat->addMessage(chat_msg, true, args); if(chat_msg.mSourceType == CHAT_SOURCE_AGENT diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 2484040ac4..9fd73746e8 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -181,7 +181,7 @@ void LLHandlerUtil::logGroupNoticeToIMGroup( // static void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type) { - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); if (nearby_chat) { LLChat chat_msg(notification->getMessage()); diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index ef6668247c..a293e6acb6 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -86,7 +86,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification) // don't show toast if Nearby Chat is opened LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); - if (nearby_chat && nearby_chat->isChatVisible()) + if (nearby_chat->isChatVisible()) { return false; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 791cadaee4..403288b2fd 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2493,7 +2493,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } - LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance("nearby_chat"); + LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); // Traverses up the hierarchy if( keyboard_focus ) @@ -2561,10 +2561,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, // no view has keyboard focus, this is a printable character key (and no modifier key is // pressed except shift), then give focus to nearby chat (STORM-560) - if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + if ( nearby_chat && gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { - LLChatEntry* chat_editor = nearby_chat->getChatBox(); + LLChatEntry* chat_editor = LLFloaterReg::findTypedInstance("nearby_chat")->getChatBox(); if (chat_editor) { // passing NULL here, character will be added later when it is handled by character handler. -- cgit v1.2.3 From 42dbf23dc56e0ab6842dd14b5701ffdb359f8bb6 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 7 Sep 2012 21:35:08 +0300 Subject: CHUI-325 FIXED (Cap conversation log to 30 days, purge older data on login) - Remove conversations older than 30 days from call log --- indra/newview/llconversationlog.cpp | 22 ++++++++++++++++++++++ indra/newview/llconversationlog.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index e80a709203..cc02e18698 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -30,6 +30,8 @@ #include "llconversationlog.h" #include "lltrans.h" +const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec + struct Conversation_params { Conversation_params(time_t time) @@ -139,6 +141,14 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time) return timeStr; } +bool LLConversation::isOlderThan(U32 days) const +{ + time_t now = time_corrected(); + U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days + + return age > days; +} + void LLConversation::setListenIMFloaterOpened() { LLIMFloater* floater = LLIMFloater::findInstance(mSessionID); @@ -394,10 +404,22 @@ bool LLConversationLog::loadFromFile(const std::string& filename) params.mHistoryFileName = std::string(history_file_name); LLConversation conversation(params); + + // CHUI-325 + // The conversation log should be capped to the last 30 days. Conversations with the last utterance + // being over 30 days old should be purged from the conversation log text file on login. + if (conversation.isOlderThan(CONVERSATION_LIFETIME)) + { + continue; + } + mConversations.push_back(conversation); } fclose(fp); + LLFile::remove(filename); + cache(); + notifyObservers(); return true; } diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 0d7f0080e5..16be37d67a 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -64,6 +64,8 @@ public: void setIsPast (bool is_past) { mIsConversationPast = is_past; } void setConverstionName(std::string conv_name) { mConversationName = conv_name; } + bool isOlderThan(U32 days) const; + /* * Resets flag of unread offline message to false when im floater with this conversation is opened. */ -- cgit v1.2.3 From c26867bb6d1226c82c11f2f386f73b6d8e3ed749 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Sep 2012 19:53:38 -0700 Subject: CHUI-285 : Implement sort, alphabetical only for the moment --- indra/newview/llconversationmodel.cpp | 38 +++++++++++++++++++++++++--------- indra/newview/llconversationmodel.h | 15 +++----------- indra/newview/llimfloatercontainer.cpp | 16 ++++++++++++-- indra/newview/llimfloatercontainer.h | 2 ++ indra/newview/llparticipantlist.cpp | 2 -- 5 files changed, 47 insertions(+), 26 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index fa49987d15..e810bac1d9 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -78,14 +78,6 @@ void LLConversationItem::showProperties(void) { } -bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const -{ - // We compare only by name for the moment - // *TODO : Implement the sorting by date - S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); - return (compare < 0); -} - // // LLConversationItemSession // @@ -197,12 +189,38 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam { mName = av_name.mDisplayName; // *TODO : we should also store that one, to be used in the tooltip : av_name.mUsername - // *TODO : we need to request or initiate a list resort mNeedsRefresh = true; + if (mParent) + { + mParent->requestSort(); + } } void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; -} +} + +// +// LLConversationSort +// + +bool LLConversationSort::operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const +{ + // For the moment, we sort only by name + // *TODO : Implement the sorting by date as well (most recent first) + // *TODO : Check the type of item (session/participants) as order should be different for both (eventually) + S32 compare = LLStringUtil::compareDict(a->getDisplayName(), b->getDisplayName()); + return (compare < 0); +} + +// +// LLConversationViewModel +// + +void LLConversationViewModel::sort(LLFolderViewFolder* folder) +{ + base_t::sort(folder); +} + // EOF diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 26c7a29d76..2775bf8186 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -208,23 +208,14 @@ private: class LLConversationSort { public: - LLConversationSort(U32 order = 0) - : mSortOrder(order), - mByDate(false), - mByName(false) - { - mByDate = (order & LLConversationFilter::SO_DATE); - mByName = (order & LLConversationFilter::SO_NAME); - } + LLConversationSort(U32 order = 0) : mSortOrder(order) { } - bool isByDate() const { return mByDate; } + bool isByDate() const { return (mSortOrder & LLConversationFilter::SO_DATE); } U32 getSortOrder() const { return mSortOrder; } bool operator()(const LLConversationItem* const& a, const LLConversationItem* const& b) const; private: U32 mSortOrder; - bool mByDate; - bool mByName; }; class LLConversationViewModel @@ -233,7 +224,7 @@ class LLConversationViewModel public: typedef LLFolderViewModel base_t; - void sort(LLFolderViewFolder* folder) { } // *TODO : implement conversation sort + void sort(LLFolderViewFolder* folder); bool contentsReady() { return true; } // *TODO : we need to check that participants names are available somewhat bool startDrag(std::vector& items) { return false; } // We do not allow drag of conversation items diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 56648d09b5..fa0750c39c 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -45,6 +45,7 @@ #include "lltransientfloatermgr.h" #include "llviewercontrol.h" #include "llconversationview.h" +#include "llcallbacklist.h" // // LLIMFloaterContainer @@ -65,6 +66,8 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed) LLIMFloaterContainer::~LLIMFloaterContainer() { + gIdleCallbacks.deleteFunction(idle, this); + mNewMessageConnection.disconnect(); LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); @@ -139,6 +142,9 @@ BOOL LLIMFloaterContainer::postBuild() LLAvatarNameCache::addUseDisplayNamesCallback( boost::bind(&LLIMConversation::processChatHistoryStyleUpdate)); + // Add callback: we'll take care of view updates on idle + gIdleCallbacks.addFunction(idle, this); + return TRUE; } @@ -290,6 +296,13 @@ void LLIMFloaterContainer::setMinimized(BOOL b) } } +//static +void LLIMFloaterContainer::idle(void* user_data) +{ + LLIMFloaterContainer* panel = (LLIMFloaterContainer*)user_data; + panel->mConversationsRoot->update(); +} + void LLIMFloaterContainer::draw() { // CHUI Notes @@ -579,7 +592,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) } if (!item) { - llinfos << "Merov debug : Couldn't create conversation session item : " << display_name << llendl; + llwarns << "Couldn't create conversation session item : " << display_name << llendl; return; } // *TODO: Should we flag LLConversationItemSession with a mIsNearbyChat? @@ -602,7 +615,6 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) // Note: usually, we do not get an updated avatar list at that point LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin(); LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd(); - llinfos << "Merov debug : create participant, children size = " << item->getChildrenCount() << llendl; while (current_participant_model != end_participant_model) { LLConversationItem* participant_model = dynamic_cast(*current_participant_model); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index a72a3e2221..c4dd386d7c 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -75,6 +75,8 @@ public: void collapseMessagesPane(bool collapse); + // Callbacks + static void idle(void* user_data); // LLIMSessionObserver observe triggers /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 2282734109..0d1a37c835 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -675,8 +675,6 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) // *TODO : Merov : need to update the online/offline status of the participant. // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id)) - llinfos << "Merov debug : added participant, name = " << participant->getName() << llendl; - // Add the participant model to the session's children list addParticipant(participant); -- cgit v1.2.3 From 6df8c2b42066efad4d46a601ecaabbc9bf1dcd91 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 9 Sep 2012 14:48:06 -0700 Subject: CHUI-285 : Complete. Fix participants repositioning. --- indra/newview/llimfloatercontainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index fa0750c39c..978b91b598 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -358,6 +358,8 @@ void LLIMFloaterContainer::draw() } } + repositioningWidgets(); + if (mTabContainer->getTabCount() == 0) { // Do not close the container when every conversation is torn off because the user @@ -365,8 +367,6 @@ void LLIMFloaterContainer::draw() collapseMessagesPane(true); } LLFloater::draw(); - - repositioningWidgets(); } void LLIMFloaterContainer::tabClose() -- cgit v1.2.3 From 913375051e2dbe3f1ec68d7b8b86cac613e26ec3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 10 Sep 2012 16:12:20 +0300 Subject: CHUI-333 (Icons overlap in message panel when maximizing width of conversation list): increaced expanded_min_dim for the message pane --- indra/newview/skins/default/xui/en/floater_im_container.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index e439fc9005..413e66738d 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -113,7 +113,7 @@ height="430" name="messages_layout_panel" width="412" - expanded_min_dim="205"> + expanded_min_dim="225"> Date: Mon, 10 Sep 2012 16:20:47 +0300 Subject: CHUI-332 (Overlap of icons in chrome when collapsing and expanding conversation list) changed expanded_min_dim of the right panel --- indra/newview/skins/default/xui/en/floater_im_container.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 413e66738d..1583add857 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -36,7 +36,7 @@ name="conversations_layout_panel" min_dim="38" width="268" - expanded_min_dim="120"> + expanded_min_dim="165"> Date: Mon, 10 Sep 2012 07:40:13 -0700 Subject: CHUI-283: Basic Implementation, just have hard coded avatar icon appearing and profile/info buttons visible. profile/info buttons do not have proper positioning or mouseclick events. --- indra/llcommon/llfoldertype.h | 4 +- indra/llui/llfolderviewitem.cpp | 8 ++- indra/llui/llfolderviewitem.h | 2 +- indra/newview/llconversationmodel.h | 4 +- indra/newview/llconversationview.cpp | 110 ++++++++++++++++++++++++++++++++- indra/newview/llconversationview.h | 42 +++++++++++-- indra/newview/llimfloatercontainer.cpp | 2 +- indra/newview/llviewerfoldertype.cpp | 2 + 8 files changed, 163 insertions(+), 11 deletions(-) mode change 100644 => 100755 indra/llcommon/llfoldertype.h mode change 100644 => 100755 indra/llui/llfolderviewitem.cpp mode change 100644 => 100755 indra/llui/llfolderviewitem.h mode change 100644 => 100755 indra/newview/llconversationmodel.h mode change 100644 => 100755 indra/newview/llconversationview.cpp mode change 100644 => 100755 indra/newview/llconversationview.h mode change 100644 => 100755 indra/newview/llimfloatercontainer.cpp mode change 100644 => 100755 indra/newview/llviewerfoldertype.cpp diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h old mode 100644 new mode 100755 index a0c847914f..6b5ae572a9 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llcommon/llfoldertype.h @@ -89,7 +89,9 @@ public: FT_COUNT, - FT_NONE = -1 + FT_NONE = -1, + + FT_PROFILE = 58 }; static EType lookup(const std::string& type_name); diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp old mode 100644 new mode 100755 index 52923389cd..c46af27a04 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -609,13 +609,14 @@ void LLFolderViewItem::draw() static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + + getViewModelItem()->update(); + const Params& default_params = LLUICtrlFactory::getDefaultParams(); const S32 TOP_PAD = default_params.item_top_pad; const S32 FOCUS_LEFT = 1; const LLFontGL* font = getLabelFontForStyle(mLabelStyle); - getViewModelItem()->update(); - //--------------------------------------------------------------------------------// // Draw open folder arrow // @@ -793,6 +794,9 @@ void LLFolderViewItem::draw() sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, filter_string_length, S32_MAX, &right_x, FALSE ); } + + + LLView::draw(); } const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h old mode 100644 new mode 100755 index 6eacbe8bd0..766d9b3fe3 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -231,7 +231,7 @@ public: virtual void onMouseLeave(S32 x, S32 y, MASK mask); - virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return NULL; } + //virtual LLView* findChildView(const std::string& name, BOOL recurse) const { return LLView::findChildView(name, recurse); } // virtual void handleDropped(); virtual void draw(); diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h old mode 100644 new mode 100755 index 1a2e09dfab..7baabf7f76 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -29,6 +29,7 @@ #include "llfolderviewitem.h" #include "llfolderviewmodel.h" +#include "llviewerfoldertype.h" // Implementation of conversations list @@ -55,7 +56,7 @@ public: virtual const std::string& getSearchableName() const { return mName; } virtual const LLUUID& getUUID() const { return mUUID; } virtual time_t getCreationDate() const { return 0; } - virtual LLPointer getIcon() const { return NULL; } + virtual LLPointer getIcon() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(LLFolderType::FT_PROFILE, FALSE)); } virtual LLPointer getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } @@ -115,6 +116,7 @@ public: LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemSession() {} + LLPointer getIcon() const { return NULL; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; } void addParticipant(LLConversationItemParticipant* participant); void removeParticipant(LLConversationItemParticipant* participant); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp old mode 100644 new mode 100755 index fefb7e9cac..d1a8478697 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -32,9 +32,15 @@ #include "llimconversation.h" #include "llimfloatercontainer.h" + +#include "lluictrlfactory.h" +#include "llavatariconctrl.h" + // // Implementation of conversations list session widgets // + + LLConversationViewSession::Params::Params() : container() @@ -83,9 +89,111 @@ void LLConversationViewSession::setVisibleIfDetached(BOOL visible) // Implementation of conversations list participant (avatar) widgets // -LLConversationViewParticipant::LLConversationViewParticipant( const LLFolderViewItem::Params& p ): +static LLDefaultChildRegistry::Register r("conversation_view_participant"); + +LLConversationViewParticipant::Params::Params() : +container(), +view_profile_button("view_profile_button"), +info_button("info_button") +{} + +LLConversationViewParticipant::LLConversationViewParticipant( const LLConversationViewParticipant::Params& p ): LLFolderViewItem(p) +{ + +} + +void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params) +{ + LLButton::Params view_profile_button_params(params.view_profile_button()); + LLButton * button = LLUICtrlFactory::create(view_profile_button_params); + addChild(button); + + LLButton::Params info_button_params(params.info_button()); + button = LLUICtrlFactory::create(info_button_params); + addChild(button); +} + +BOOL LLConversationViewParticipant::postBuild() +{ + mInfoBtn = getChild("info_btn"); + mProfileBtn = getChild("profile_btn"); + + mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); + mProfileBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onProfileBtnClick, this)); + + + LLFolderViewItem::postBuild(); + return TRUE; +} + +void LLConversationViewParticipant::onInfoBtnClick() +{ + + +} + +void LLConversationViewParticipant::onProfileBtnClick() +{ + +} + +LLButton* LLConversationViewParticipant::createProfileButton() +{ + + LLButton::Params params; + + + // -- cgit v1.2.3 From 908f8735d4d60266504c97c13d65fda74045b731 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Fri, 9 Nov 2012 16:09:06 -0800 Subject: CHUI-517: Updating the copy in Preferences for Do Not Disturb mode. --- .../newview/skins/default/xui/en/panel_preferences_chat.xml | 12 ++++++------ .../skins/default/xui/en/panel_preferences_general.xml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 5524d0e4f0..4964df53bb 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -101,7 +101,7 @@ @@ -274,13 +274,13 @@ follows="left|top" layout="topleft" left="0" - height="12" + height="13" name="notifications_alert" - width="350" + width="500" top_pad="11" visible="true" text_color="DrYellow"> - To temporarily stop all notifications, use Me > Status > Busy. + To temporarily stop all notifications, use Communicate > Do Not Disturb. @@ -288,7 +288,7 @@ @@ -299,7 +299,7 @@ left="0" name="play_sound" width="100" - top_pad="13" + top_pad="8" visible="true"> Play sound: diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 2cb063e8ee..ea0f7d8593 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -409,7 +409,7 @@ name="text_box3" top_pad="3" width="240"> - Busy mode response: + Do Not Disturb response: Date: Fri, 9 Nov 2012 16:16:06 -0800 Subject: CHUI-517: Updating the copy for the avatar in-world name bubble status for Do Not Disturb mode. --- indra/newview/skins/default/xui/en/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 79ee83969b..8310e0c62d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -295,7 +295,7 @@ Please try logging in again in a minute. (Editing Appearance) Away - Busy + Do Not Disturb Blocked -- cgit v1.2.3 From f429decb0c222b293cee4d3b27c8340262fab572 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 9 Nov 2012 17:00:43 -0800 Subject: CHUI-486: Now the new chat preferences in drop down lists and checkboxes are storable. These values are accessible globally using gSavedSettings. --- indra/llui/llcheckboxctrl.cpp | 14 +-- indra/llui/llcheckboxctrl.h | 2 - indra/newview/app_settings/settings.xml | 121 +++++++++++++++++++++ .../default/xui/en/panel_preferences_chat.xml | 46 ++++---- 4 files changed, 143 insertions(+), 40 deletions(-) diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 4fe444c1a4..5525520d78 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -107,7 +107,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p) LLButton::Params params = p.check_button; params.rect(btn_rect); //params.control_name(p.control_name); - params.click_callback.function(boost::bind(&LLCheckBoxCtrl::onButtonPress, this, _2)); + params.click_callback.function(boost::bind(&LLCheckBoxCtrl::onCommit, this)); params.commit_on_return(false); // Checkboxes only allow boolean initial values, but buttons can // take any LLSD. @@ -123,18 +123,6 @@ LLCheckBoxCtrl::~LLCheckBoxCtrl() // Children all cleaned up by default view destructor. } - -// static -void LLCheckBoxCtrl::onButtonPress( const LLSD& data ) -{ - //if (mRadioStyle) - //{ - // setValue(TRUE); - //} - - onCommit(); -} - void LLCheckBoxCtrl::onCommit() { if( getEnabled() ) diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 67d8091a97..5ce45b2135 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -103,8 +103,6 @@ public: virtual void setControlName(const std::string& control_name, LLView* context); - void onButtonPress(const LLSD& data); - virtual BOOL isDirty() const; // Returns TRUE if the user has modified this control. virtual void resetDirty(); // Clear dirty state diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5694cb9f30..bba1f4910a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4667,6 +4667,17 @@ Value 1 + KeepConversationLogTranscripts + + Comment + Keep a conversation log and transcripts + Persist + 1 + Type + Boolean + Value + 0 + LandBrushSize Comment @@ -6285,6 +6296,61 @@ Value 305 + NotificationConferenceIMOptions + + Comment + Specifies how the UI responds to Conference IM Notifications. + Persist + 1 + Type + String + Value + 0 + + NotificationFriendIMOptions + + Comment + Specifies how the UI responds to Friend IM Notifications. + Persist + 1 + Type + String + Value + 0 + + NotificationGroupChatOptions + + Comment + Specifies how the UI responds to Group Chat Notifications. + Persist + 1 + Type + String + Value + 0 + + NotificationNearbyChatOptions + + Comment + Specifies how the UI responds to Nearby Chat Notifications. + Persist + 1 + Type + String + Value + 0 + + NotificationNonFriendIMOptions + + Comment + Specifies how the UI responds to Non Friend IM Notifications. + Persist + 1 + Type + String + Value + 0 + NotificationToastLifeTime Comment @@ -6801,6 +6867,61 @@ Value 1 + PlaySoundGroupChatMessages + + Comment + Plays a sound when have a group chat message. + Persist + 1 + Type + Boolean + Value + 0 + + PlaySoundIncomingVoiceCall + + Comment + Plays a sound when have an incoming voice call. + Persist + 1 + Type + Boolean + Value + 1 + + PlaySoundInventoryOffer + + Comment + Plays a sound when have an inventory offer. + Persist + 1 + Type + Boolean + Value + 0 + + PlaySoundNewConversation + + Comment + Plays a sound when have a new conversation. + Persist + 1 + Type + Boolean + Value + 1 + + PlaySoundTeleportOffer + + Comment + Plays a sound when have a teleport offer. + Persist + 1 + Type + Boolean + Value + 1 + PluginAttachDebuggerToPlugins Comment diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 4964df53bb..f1b11e2ca8 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -37,6 +37,7 @@ top_pad="6" width="330" /> Date: Fri, 9 Nov 2012 17:19:03 -0800 Subject: CHUI-450 : Fixed how the list of speakers is updated, always add the agent avatar in it, takes voice activation into account --- indra/newview/llfloaterimcontainer.cpp | 4 ++-- indra/newview/llspeakers.cpp | 26 +++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index b20d19d0fd..2789b78c2d 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1126,7 +1126,7 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool /* widget processing */ if (select_widget) { - LLFolderViewItem* widget = mConversationsWidgets[session_id]; + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); if (widget && widget->getParentFolder()) { widget->getParentFolder()->setSelection(widget, FALSE, FALSE); @@ -1539,7 +1539,7 @@ void LLFloaterIMContainer::openNearbyChat() //(which it should be...), open it so to make the list of participants visible. This happens to be the most common case when opening the Chat floater. if(mConversationsItems.size() == 1) { - LLConversationViewSession* nearby_chat = dynamic_cast(mConversationsWidgets[LLUUID()]); + LLConversationViewSession* nearby_chat = dynamic_cast(get_ptr_in_map(mConversationsWidgets,LLUUID())); if (nearby_chat) { nearby_chat->setOpen(TRUE); diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 726199b7aa..5036334bdd 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -503,27 +503,23 @@ void LLSpeakerMgr::update(BOOL resort_ok) void LLSpeakerMgr::updateSpeakerList() { - // are we bound to the currently active voice channel? - if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel)) - { - std::set participants; - LLVoiceClient::getInstance()->getParticipantList(participants); - // add new participants to our list of known speakers - for (std::set::iterator participant_it = participants.begin(); - participant_it != participants.end(); - ++participant_it) + // Are we bound to the currently active voice channel? + if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive())) + { + std::set participants; + LLVoiceClient::getInstance()->getParticipantList(participants); + // If we are, add all voice client participants to our list of known speakers + for (std::set::iterator participant_it = participants.begin(); participant_it != participants.end(); ++participant_it) { setSpeaker(*participant_it, LLVoiceClient::getInstance()->getDisplayName(*participant_it), LLSpeaker::STATUS_VOICE_ACTIVE, (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL)); - - } } else { - // Check if the list is empty, except if it's Nearby Chat (session_id NULL). + // If not, check if the list is empty, except if it's Nearby Chat (session_id NULL). LLUUID session_id = getSessionID(); if ((mSpeakers.size() == 0) && (!session_id.isNull())) { @@ -533,16 +529,16 @@ void LLSpeakerMgr::updateSpeakerList() LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); for (uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();it!=session->mInitialTargetIDs.end();++it) { - // Allow to set buddies if they are on line. Allow any other avatar. + // Add buddies if they are on line, add any other avatar. if (!LLAvatarTracker::instance().isBuddy(*it) || LLAvatarTracker::instance().isBuddyOnline(*it)) { setSpeaker(*it, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); } } - // Also add the current agent - setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); } } + // Finally, always add the current agent (it has to be there no matter what...) + setSpeaker(gAgentID, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); } void LLSpeakerMgr::setSpeakerNotInChannel(LLSpeaker* speakerp) -- cgit v1.2.3 From 99181a9777b7e42ed6e863a074789f37aa6b43f8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 9 Nov 2012 19:06:00 -0800 Subject: CHUI-479 : WIP : Fixed the missing agent appearance in torn off dialogs by adding a consistency check and rebuild. --- indra/newview/llfloaterimsessiontab.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index a47c9177a1..c39319b373 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -263,11 +263,21 @@ void LLFloaterIMSessionTab::draw() { if (mRefreshTimer->hasExpired()) { - if (getParticipantList()) + LLParticipantList* item = getParticipantList(); + if (item) { - getParticipantList()->update(); + // Update all model items + item->update(); + // If the model and view list diverge in count, rebuild + // Note: this happens sometimes right around init (add participant events fire but get dropped) and is the cause + // of missing participants, often, the user agent itself. As there will be no other event fired, there's + // no other choice but get those inconsistencies regularly (and lightly) checked and scrubbed. + if (item->getChildrenCount() != mConversationsWidgets.size()) + { + buildConversationViewParticipant(); + } } - + refreshConversation(); // Restart the refresh timer @@ -376,7 +386,7 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() LLParticipantList* item = getParticipantList(); if (!item) { - // Nothing to do if the model list is empty + // Nothing to do if the model list is inexistent return; } @@ -470,7 +480,8 @@ void LLFloaterIMSessionTab::refreshConversation() session_name = LLIMModel::instance().getName(mSessionID); } updateSessionName(session_name); - } + } + mConversationViewModel.requestSortAll(); mConversationsRoot->arrangeAll(); mConversationsRoot->update(); -- cgit v1.2.3 From ab5a0a1d4d0a029dd92c9fc108638736a57ce7c6 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 12 Nov 2012 15:06:42 +0200 Subject: CHUI-362 FIXED (Torn off conversation name is highlighted when selected in conversation list with different conversation showing in message panel): connect new method "returnFloaterToHost" to click on quasi-URL "Bring it back" --- indra/newview/llfloaterimcontainer.cpp | 12 ++++++++++-- indra/newview/llfloaterimcontainer.h | 2 +- indra/newview/llfloaterimsessiontab.h | 2 +- indra/newview/skins/default/xui/en/floater_im_container.xml | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 994a76189a..2707e3dcbb 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -133,7 +133,6 @@ void LLFloaterIMContainer::onCurrentChannelChanged(const LLUUID& session_id) } } - BOOL LLFloaterIMContainer::postBuild() { mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLFloaterIMContainer::onNewMessageReceived, this, _1)); @@ -142,7 +141,8 @@ BOOL LLFloaterIMContainer::postBuild() setTabContainer(getChild("im_box_tab_container")); mStubPanel = getChild("stub_panel"); - mStubTextBox = getChild("stub_textbox"); + mStubTextBox = getChild("stub_textbox_2"); + mStubTextBox->setURLClickedCallback(boost::bind(&LLFloaterIMContainer::returnFloaterToHost, this)); mConversationsStack = getChild("conversations_stack"); mConversationsPane = getChild("conversations_layout_panel"); @@ -506,6 +506,14 @@ void LLFloaterIMContainer::showStub(bool stub_is_visible) mStubPanel->setVisible(stub_is_visible); } +// listener for click on mStubTextBox2 +void LLFloaterIMContainer::returnFloaterToHost() +{ + LLUUID session_id = this->getSelectedSession(); + LLFloaterIMSessionTab* floater = LLFloaterIMSessionTab::getConversation(session_id); + floater->onTearOffClicked(); +} + void LLFloaterIMContainer::setVisible(BOOL visible) { LLFloaterIMNearbyChat* nearby_chat; if (visible) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index a09cde60f5..e60576a50d 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -65,7 +65,7 @@ public: /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); - + void returnFloaterToHost(); void showConversation(const LLUUID& session_id); void selectConversation(const LLUUID& session_id); BOOL selectConversationPair(const LLUUID& session_id, bool select_widget); diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 94854ee9ee..8f5a8c2c1b 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -91,6 +91,7 @@ public: void buildConversationViewParticipant(); void setSortOrder(const LLConversationSort& order); + virtual void onTearOffClicked(); virtual void updateMessages() {} @@ -106,7 +107,6 @@ protected: bool onIMShowModesMenuItemCheck(const LLSD& userdata); bool onIMShowModesMenuItemEnable(const LLSD& userdata); static void onSlide(LLFloaterIMSessionTab *self); - virtual void onTearOffClicked(); // refresh a visual state of the Call button void updateCallBtnState(bool callIsActive); diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index e3db3d52ed..1388b9e474 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -159,9 +159,9 @@ top="40" height="20" valign="center" - parse_urls="false" + parse_urls="true" wrap="true"> - Bring it back. + [secondlife:/// Bring it back.] -- cgit v1.2.3 From 91781df3701da9852dbe87a4d5c9d5e3abf09987 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 12 Nov 2012 18:18:34 -0800 Subject: CHUI-486: Now toasts only appear when proper 'Chat Preference' setting is set to 'Pop Up Message'. --- indra/newview/llfloaterimnearbychathandler.cpp | 6 ++++ indra/newview/llimview.cpp | 45 ++++++++++++++++++-------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 0dfaa9174b..f382b65b1d 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -283,6 +283,12 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { + //Ignore Nearby Toasts + if(gSavedSettings.getString("NotificationNearbyChatOptions") != "0") + { + return; + } + //look in pool. if there is any message if(mStopProcessing) return; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 6712127750..e4b51b719b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -139,19 +139,38 @@ void toast_callback(const LLSD& msg){ return; } - // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - msg["session_id"]); - if (!gSavedSettings.getBOOL("EnableGroupChatPopups") - && session->isGroupSessionType()) - { - return; - } - if (!gSavedSettings.getBOOL("EnableIMChatPopups") - && !session->isGroupSessionType()) - { - return; - } + // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + msg["session_id"]); + + + //Ignore P2P Friend/Non-Friend toasts + if(session->isP2PSessionType()) + { + //Ignores non-friends + if(LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL && + gSavedSettings.getString("NotificationNonFriendIMOptions") != "0") + { + return; + } + //Ignores friends + else if(gSavedSettings.getString("NotificationFriendIMOptions") != "0") + { + return; + } + } + //Ignore Ad Hoc Toasts + else if(session->isAdHocSessionType() && + gSavedSettings.getString("NotificationConferenceIMOptions") != "0") + { + return; + } + //Ignore Group Toasts + else if(session->isGroupSessionType() && + gSavedSettings.getString("NotificationGroupChatOptions") != "0") + { + return; + } LLAvatarNameCache::get(msg["from_id"].asUUID(), boost::bind(&on_avatar_name_cache_toast, -- cgit v1.2.3 From 6ba822c0fffcf86c79d25c44625c2667ac23e64a Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 13 Nov 2012 13:32:24 +0200 Subject: CHUI-460 FIXED Reselect floater after toggling the participant list open or closed --- indra/newview/llconversationview.cpp | 2 +- indra/newview/llfloaterimcontainer.cpp | 12 +++++++++++- indra/newview/llfloaterimcontainer.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 295dd2ae6d..53392ac372 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -240,7 +240,7 @@ void LLConversationViewSession::toggleOpen() { getParentFolder()->setSelection(this, true); } - + mContainer->reSelectConversation(); } } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2707e3dcbb..962e9f4df6 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -334,7 +334,7 @@ void LLFloaterIMContainer::onExpandCollapseButtonClicked() { collapseConversationsPane(!mConversationsPane->isCollapsed()); } - selectConversation(mSelectedSession); + reSelectConversation(); } LLFloaterIMContainer* LLFloaterIMContainer::findInstance() @@ -1574,4 +1574,14 @@ void LLFloaterIMContainer::onNearbyChatClosed() closeFloater(); } +void LLFloaterIMContainer::reSelectConversation() +{ + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession); + if (session_floater->getHost()) + { + selectFloater(session_floater); + } + +} + // EOF diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index e60576a50d..ad1f0039e9 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -163,6 +163,7 @@ public: LLConversationItem* addConversationListItem(const LLUUID& uuid, bool isWidgetSelected = false); void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id); void setNearbyDistances(); + void reSelectConversation(); private: LLConversationViewSession* createConversationItemWidget(LLConversationItem* item); -- cgit v1.2.3 From aa2640f13ab61fa55819af26b001978fa2dd9a3f Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 13 Nov 2012 14:04:14 +0200 Subject: CHUI-447 FIXED Set session name as avatar's display name, if session is created by getting new message. --- indra/newview/llimview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 6712127750..781b0cb2ea 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2424,14 +2424,21 @@ void LLIMMgr::addMessage( //*NOTE session_name is empty in case of incoming P2P sessions std::string fixed_session_name = from; + bool name_is_setted = false; if(!session_name.empty() && session_name.size()>1) { fixed_session_name = session_name; + name_is_setted = true; } bool new_session = !hasSession(new_session_id); if (new_session) { + LLAvatarName av_name; + if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted) + { + fixed_session_name = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); + } LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg); // When we get a new IM, and if you are a god, display a bit -- cgit v1.2.3 From 5a31b5dceaeb7dd7089c7426371aac39927c5c02 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 13 Nov 2012 11:19:45 -0800 Subject: CHUI-486: Code cleanup, instead of using values such as 0, 1, 2 now using strings 'toast', 'flash', 'none'. These values are used whether to show a notification or not. --- indra/newview/app_settings/settings.xml | 10 ++++---- indra/newview/llfloaterimnearbychathandler.cpp | 2 +- indra/newview/llimview.cpp | 9 ++++--- .../default/xui/en/panel_preferences_chat.xml | 30 +++++++++++----------- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9b8c86ffc8..b703b9cc8e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6316,7 +6316,7 @@ Type String Value - 0 + toast NotificationFriendIMOptions @@ -6327,7 +6327,7 @@ Type String Value - 0 + toast NotificationGroupChatOptions @@ -6338,7 +6338,7 @@ Type String Value - 0 + toast NotificationNearbyChatOptions @@ -6349,7 +6349,7 @@ Type String Value - 0 + toast NotificationNonFriendIMOptions @@ -6360,7 +6360,7 @@ Type String Value - 0 + toast NotificationToastLifeTime diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index f382b65b1d..ab81b85d04 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -284,7 +284,7 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { //Ignore Nearby Toasts - if(gSavedSettings.getString("NotificationNearbyChatOptions") != "0") + if(gSavedSettings.getString("NotificationNearbyChatOptions") != "toast") { return; } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e4b51b719b..d57ffb9a11 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -149,29 +149,30 @@ void toast_callback(const LLSD& msg){ { //Ignores non-friends if(LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL && - gSavedSettings.getString("NotificationNonFriendIMOptions") != "0") + gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast") { return; } //Ignores friends - else if(gSavedSettings.getString("NotificationFriendIMOptions") != "0") + else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast") { return; } } //Ignore Ad Hoc Toasts else if(session->isAdHocSessionType() && - gSavedSettings.getString("NotificationConferenceIMOptions") != "0") + gSavedSettings.getString("NotificationConferenceIMOptions") != "toast") { return; } //Ignore Group Toasts else if(session->isGroupSessionType() && - gSavedSettings.getString("NotificationGroupChatOptions") != "0") + gSavedSettings.getString("NotificationGroupChatOptions") != "toast") { return; } + //Show toast LLAvatarNameCache::get(msg["from_id"].asUUID(), boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index f1b11e2ca8..8ab5c9a99c 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -137,15 +137,15 @@ + value="toast"/> + value="flash"/> + value="none"/> + value="toast"/> + value="flash"/> + value="none"/> + value="toast"/> + value="flash"/> + value="none"/> + value="toast"/> + value="flash"/> + value="none"/> + value="toast"/> + value="flash"/> + value="none"/> Date: Tue, 13 Nov 2012 21:20:05 +0200 Subject: CHUI-512 FIXED (New incoming conversations take focus in message panel only and do not show toasts). Rejected update message when floater hasn't focus --- indra/newview/llfloaterimsession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 0c622e07c4..e1dc5b91d0 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -142,7 +142,7 @@ void LLFloaterIMSession::newIMCallback(const LLSD& data) LLFloaterIMSession* floater = LLFloaterReg::findTypedInstance("impanel", session_id); // update if visible, otherwise will be updated when opened - if (floater && floater->getVisible()) + if (floater && (floater->getHost()? floater->hasFocus() : floater->getVisible())) { floater->updateMessages(); } -- cgit v1.2.3 From df1fd5d4bbe8e71389872e4cdbac3e9f165cc3f8 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 14 Nov 2012 00:07:46 +0200 Subject: CHUI-508 FIXED Attach to and Attach to HUD menus not showing in inventory floater to select attachment point --- indra/newview/llinventorybridge.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 280a1775e9..52f2897788 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5453,6 +5453,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) p.on_enable.parameter = cbparams; LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu; LLUICtrlFactory::create(p, parent); + items.push_back(p.name); } } } -- cgit v1.2.3 From d75824d520ba1965e48196f8b230ded0f15c5841 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 13 Nov 2012 16:45:56 -0800 Subject: CHUI-486: Post code review changes for last submit, just added in some parenthesis for conditional statements, thus making them more clear. --- indra/newview/llimview.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 3b217ef482..0f4bbd054a 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -148,8 +148,8 @@ void toast_callback(const LLSD& msg){ if(session->isP2PSessionType()) { //Ignores non-friends - if(LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL && - gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast") + if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL) + && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast")) { return; } @@ -160,14 +160,14 @@ void toast_callback(const LLSD& msg){ } } //Ignore Ad Hoc Toasts - else if(session->isAdHocSessionType() && - gSavedSettings.getString("NotificationConferenceIMOptions") != "toast") + else if(session->isAdHocSessionType() + && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast")) { return; } //Ignore Group Toasts - else if(session->isGroupSessionType() && - gSavedSettings.getString("NotificationGroupChatOptions") != "toast") + else if(session->isGroupSessionType() + && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast")) { return; } -- cgit v1.2.3 From 40949724345a00a22b1fae5d0645c244cbf47567 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 14 Nov 2012 15:28:05 +0200 Subject: CHUI-389 FIXED Added parameter for sessionAdded to get access to has_offline_msg value. Set UnreadIMs icon to visible if messages were sent while offline. --- indra/newview/llchiclet.h | 2 +- indra/newview/llchicletbar.cpp | 2 +- indra/newview/llchicletbar.h | 2 +- indra/newview/llconversationlog.cpp | 33 +++++++++++++++++++++++------ indra/newview/llconversationlog.h | 12 ++++++----- indra/newview/llconversationloglist.cpp | 4 ++++ indra/newview/llconversationloglistitem.cpp | 5 +++++ indra/newview/llconversationloglistitem.h | 1 + indra/newview/llfloaterimcontainer.cpp | 2 +- indra/newview/llfloaterimcontainer.h | 2 +- indra/newview/llimview.cpp | 6 +++--- indra/newview/llimview.h | 4 ++-- indra/newview/llsyswellwindow.cpp | 2 +- indra/newview/llsyswellwindow.h | 2 +- 14 files changed, 55 insertions(+), 24 deletions(-) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 3c8389e20d..d6be2df103 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -873,7 +873,7 @@ class LLIMWellChiclet : public LLSysWellChiclet, LLIMSessionObserver { friend class LLUICtrlFactory; public: - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) {} /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id) { messageCountChanged(LLSD()); } diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index ad7890b47a..c66ae1cdd0 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -84,7 +84,7 @@ LLIMChiclet* LLChicletBar::createIMChiclet(const LLUUID& session_id) } //virtual -void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) { if (!getChicletPanel()) return; diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index a9a5b61ae7..dc991ca772 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -50,7 +50,7 @@ public: LLChicletPanel* getChicletPanel() { return mChicletPanel; } // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id); diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 3d2b6a5c00..a0765f5e16 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -223,13 +223,17 @@ void LLConversationLog::enableLogging(bool enable) notifyObservers(); } -void LLConversationLog::logConversation(const LLUUID& session_id) +void LLConversationLog::logConversation(const LLUUID& session_id, BOOL has_offline_msg) { const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); LLConversation* conversation = findConversation(session); if (session && conversation) { + if(has_offline_msg) + { + updateOfflineIMs(session, has_offline_msg); + } updateConversationTimestamp(conversation); } else if (session && !conversation) @@ -265,7 +269,22 @@ void LLConversationLog::updateConversationName(const LLIMModel::LLIMSession* ses if (conversation) { conversation->setConverstionName(name); - notifyPrticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_NAME); + notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_NAME); + } +} + +void LLConversationLog::updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages) +{ + if (!session) + { + return; + } + + LLConversation* conversation = findConversation(session); + if (conversation) + { + conversation->setOfflineMessages(new_messages); + notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_OfflineIMs); } } @@ -274,7 +293,7 @@ void LLConversationLog::updateConversationTimestamp(LLConversation* conversation if (conversation) { conversation->updateTimestamp(); - notifyPrticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_TIME); + notifyParticularConversationObservers(conversation->getSessionID(), LLConversationLogObserver::CHANGED_TIME); } } @@ -337,9 +356,9 @@ void LLConversationLog::removeObserver(LLConversationLogObserver* observer) mObservers.erase(observer); } -void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) { - logConversation(session_id); + logConversation(session_id, has_offline_msg); } void LLConversationLog::cache() @@ -477,7 +496,7 @@ void LLConversationLog::notifyObservers() } } -void LLConversationLog::notifyPrticularConversationObservers(const LLUUID& session_id, U32 mask) +void LLConversationLog::notifyParticularConversationObservers(const LLUUID& session_id, U32 mask) { std::set::const_iterator iter = mObservers.begin(); for (; iter != mObservers.end(); ++iter) @@ -489,7 +508,7 @@ void LLConversationLog::notifyPrticularConversationObservers(const LLUUID& sessi void LLConversationLog::onNewMessageReceived(const LLSD& data) { const LLUUID session_id = data["session_id"].asUUID(); - logConversation(session_id); + logConversation(session_id, false); } void LLConversationLog::onAvatarNameCache(const LLUUID& participant_id, const LLAvatarName& av_name, const LLIMModel::LLIMSession* session) diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 7d0b9113c6..8f6ac3f5d1 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -59,7 +59,7 @@ public: bool hasOfflineMessages() const { return mHasOfflineIMs; } void setConverstionName(std::string conv_name) { mConversationName = conv_name; } - + void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; } bool isOlderThan(U32 days) const; /* @@ -123,7 +123,7 @@ public: void removeObserver(LLConversationLogObserver* observer); // LLIMSessionObserver triggers - virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; // Stub virtual void sessionRemoved(const LLUUID& session_id){} // Stub virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){}; // Stub @@ -147,9 +147,9 @@ private: /** * adds conversation to the conversation list and notifies observers */ - void logConversation(const LLUUID& session_id); + void logConversation(const LLUUID& session_id, BOOL has_offline_msg); - void notifyPrticularConversationObservers(const LLUUID& session_id, U32 mask); + void notifyParticularConversationObservers(const LLUUID& session_id, U32 mask); /** * constructs file name in which conversations log will be saved @@ -165,6 +165,7 @@ private: void createConversation(const LLIMModel::LLIMSession* session); void updateConversationTimestamp(LLConversation* conversation); void updateConversationName(const LLIMModel::LLIMSession* session, const std::string& name); + void updateOfflineIMs(const LLIMModel::LLIMSession* session, BOOL new_messages); LLConversation* findConversation(const LLIMModel::LLIMSession* session); @@ -184,7 +185,8 @@ public: enum EConversationChange { CHANGED_TIME = 1, // last interaction time changed - CHANGED_NAME = 2 // conversation name changed + CHANGED_NAME = 2, // conversation name changed + CHANGED_OfflineIMs = 3 }; virtual ~LLConversationLogObserver(){} diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 429e99f7ad..6dbcb7bef7 100644 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -171,6 +171,10 @@ void LLConversationLogList::changed(const LLUUID& session_id, U32 mask) mIsDirty = true; } } + else if (mask & LLConversationLogObserver::CHANGED_OfflineIMs) + { + item->updateOfflineIMs(); + } } void LLConversationLogList::addNewItem(const LLConversation* conversation) diff --git a/indra/newview/llconversationloglistitem.cpp b/indra/newview/llconversationloglistitem.cpp index 9fad0e603e..4e984d603b 100644 --- a/indra/newview/llconversationloglistitem.cpp +++ b/indra/newview/llconversationloglistitem.cpp @@ -119,6 +119,11 @@ void LLConversationLogListItem::updateName() mConversationName->setValue(mConversation->getConversationName()); } +void LLConversationLogListItem::updateOfflineIMs() +{ + getChild("unread_ims_icon")->setVisible(mConversation->hasOfflineMessages()); +} + void LLConversationLogListItem::onMouseEnter(S32 x, S32 y, MASK mask) { getChildView("hovered_icon")->setVisible(true); diff --git a/indra/newview/llconversationloglistitem.h b/indra/newview/llconversationloglistitem.h index 57f72db382..ee28456bbb 100644 --- a/indra/newview/llconversationloglistitem.h +++ b/indra/newview/llconversationloglistitem.h @@ -69,6 +69,7 @@ public: */ void updateTimestamp(); void updateName(); + void updateOfflineIMs(); private: diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 962e9f4df6..af5db13023 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -96,7 +96,7 @@ LLFloaterIMContainer::~LLFloaterIMContainer() } } -void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) { addConversationListItem(session_id); LLFloaterIMSessionTab::addToHost(session_id); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index ad1f0039e9..afc8d00174 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -85,7 +85,7 @@ public: static void idle(void* user_data); // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id); /*virtual*/ void sessionRemoved(const LLUUID& session_id); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0f4bbd054a..0bb370e6fe 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -724,7 +724,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co // When notifying observer, name of session is used instead of "name", because they may not be the // same if it is an adhoc session (in this case name is localized in LLIMSession constructor). std::string session_name = LLIMModel::getInstance()->getName(session_id); - LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, session_name, other_participant_id); + LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, session_name, other_participant_id,has_offline_msg); return true; @@ -2974,11 +2974,11 @@ void LLIMMgr::clearPendingAgentListUpdates(const LLUUID& session_id) } } -void LLIMMgr::notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLIMMgr::notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg) { for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++) { - (*it)->sessionAdded(session_id, name, other_participant_id); + (*it)->sessionAdded(session_id, name, other_participant_id, has_offline_msg); } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 054388bc6c..19b738069c 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -295,7 +295,7 @@ class LLIMSessionObserver { public: virtual ~LLIMSessionObserver() {} - virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) = 0; virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) = 0; virtual void sessionRemoved(const LLUUID& session_id) = 0; @@ -462,7 +462,7 @@ private: static void onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& name, bool is_group); - void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, bool has_offline_msg); //Triggers when a session has already been added void notifyObserverSessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); void notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id); diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 18e0d9d0d2..1b8bdf3b46 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -617,7 +617,7 @@ BOOL LLIMWellWindow::postBuild() //virtual void LLIMWellWindow::sessionAdded(const LLUUID& session_id, - const std::string& name, const LLUUID& other_participant_id) + const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) { LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); if (!session) return; diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index 378d5e0aa2..d6480f1fc6 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -170,7 +170,7 @@ public: /*virtual*/ BOOL postBuild(); // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id); -- cgit v1.2.3 From 7a088e9b2c8ffddbf5cd8dad72281a64a32d7c63 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 14 Nov 2012 19:39:50 +0200 Subject: CHUI-501 FIXED Add link to Privacy tab from Comms floater --- indra/newview/llfloaterimcontainer.cpp | 19 +++++++++++-------- indra/newview/llfloaterpreference.cpp | 20 ++++++++++++++++++++ indra/newview/llfloaterpreference.h | 4 ++++ .../skins/default/xui/en/menu_participant_view.xml | 7 +++++++ 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index af5db13023..ec1068d191 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -717,15 +717,18 @@ void LLFloaterIMContainer::onCustomAction(const LLSD& userdata) } if ("chat_preferences" == command) { - LLFloaterPreference* floater_prefs = LLFloaterReg::showTypedInstance("preferences"); - if (floater_prefs) + LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance("preferences"); + if (floater_prefp) { - LLTabContainer* tab_container = floater_prefs->getChild("pref core"); - LLPanel* chat_panel = tab_container->getPanelByName("chat"); - if (tab_container && chat_panel) - { - tab_container->selectTabPanel(chat_panel); - } + floater_prefp->selectChatPanel(); + } + } + if ("privacy_preferences" == command) + { + LLFloaterPreference * floater_prefp = LLFloaterReg::showTypedInstance("preferences"); + if (floater_prefp) + { + floater_prefp->selectPrivacyPanel(); } } } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7c5e0776a7..ffd59ba8b6 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1570,6 +1570,26 @@ void LLFloaterPreference::setCacheLocation(const LLStringExplicit& location) cache_location_editor->setToolTip(location); } +void LLFloaterPreference::selectPanel(const LLSD& name) +{ + LLTabContainer * tab_containerp = getChild("pref core"); + LLPanel * panel = tab_containerp->getPanelByName(name); + if (NULL != panel) + { + tab_containerp->selectTabPanel(panel); + } +} + +void LLFloaterPreference::selectPrivacyPanel() +{ + selectPanel("im"); +} + +void LLFloaterPreference::selectChatPanel() +{ + selectPanel("chat"); +} + //------------------------------Updater--------------------------------------- static bool handleBandwidthChanged(const LLSD& newvalue) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 10a416beb5..4c1c122fb1 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -82,6 +82,8 @@ public: void processProfileProperties(const LLAvatarData* pAvatarData ); void storeAvatarProperties( const LLAvatarData* pAvatarData ); void saveAvatarProperties( void ); + void selectPrivacyPanel(); + void selectChatPanel(); protected: void onBtnOK(); @@ -164,6 +166,8 @@ public: void buildPopupLists(); static void refreshSkin(void* data); + void selectPanel(const LLSD& name); + private: static std::string sSkin; bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml index 6fa0707eea..523ce7b35b 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_view.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml @@ -68,6 +68,13 @@ function="IMFloaterContainer.Action" parameter="chat_preferences" /> + + + Date: Wed, 14 Nov 2012 10:37:52 -0800 Subject: CHUI-479 : WIP : Small refactoring to allow participant to be added to session whether or not its parent folder is. --- indra/newview/llconversationview.cpp | 21 +++++++++++++-------- indra/newview/llconversationview.h | 1 + indra/newview/llfloaterimsessiontab.cpp | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 295dd2ae6d..ad334869fb 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -460,21 +460,26 @@ void LLConversationViewParticipant::refresh() void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder) { - //Add the item to the folder (conversation) + // Add the item to the folder (conversation) LLFolderViewItem::addToFolder(folder); - //Now retrieve the folder (conversation) UUID, which is the speaker session + // Retrieve the folder (conversation) UUID, which is also the speaker session UUID LLConversationItem* vmi = this->getParentFolder() ? dynamic_cast(this->getParentFolder()->getViewModelItem()) : NULL; - if(vmi) + if (vmi) { - //Allows speaking icon image to be loaded based on mUUID - mAvatarIcon->setValue(mUUID); - - //Allows the speaker indicator to be activated based on the user and conversation - mSpeakingIndicator->setSpeakerId(mUUID, vmi->getUUID()); + addToSession(vmi->getUUID()); } } +void LLConversationViewParticipant::addToSession(const LLUUID& session_id) +{ + //Allows speaking icon image to be loaded based on mUUID + mAvatarIcon->setValue(mUUID); + + //Allows the speaker indicator to be activated based on the user and conversation + mSpeakingIndicator->setSpeakerId(mUUID, session_id); +} + void LLConversationViewParticipant::onInfoBtnClick() { LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mUUID)); diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index cc6995c207..3610ac67de 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -121,6 +121,7 @@ public: bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } virtual void refresh(); void addToFolder(LLFolderViewFolder* folder); + void addToSession(const LLUUID& session_id); /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index c39319b373..e78422145d 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -417,6 +417,7 @@ void LLFloaterIMSessionTab::addConversationViewParticipant(LLConversationItem* p LLConversationViewParticipant* participant_view = createConversationViewParticipant(participant_model); mConversationsWidgets[uuid] = participant_view; participant_view->addToFolder(mConversationsRoot); + participant_view->addToSession(mSessionID); participant_view->setVisible(TRUE); refreshConversation(); } -- cgit v1.2.3 From 33068c6da8f079c557e4fb520b074f6e5ce40ba4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 14 Nov 2012 10:40:51 -0800 Subject: CHUI-479 : WIP : Add debug tracing into speaking indicator manager and monitors (to be deleted eventually). --- indra/newview/llconversationmodel.cpp | 10 +++++++++ indra/newview/llconversationmodel.h | 1 + indra/newview/llconversationview.cpp | 32 ++++++++++++++++++++++++++++ indra/newview/llconversationview.h | 8 +++++-- indra/newview/lloutputmonitorctrl.cpp | 29 +++++++++++++++++++++++-- indra/newview/llspeakingindicatormanager.cpp | 7 ++++++ indra/newview/llspeakingindicatormanager.h | 2 +- 7 files changed, 84 insertions(+), 5 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 47a82bfe17..8aa740e5d1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -440,6 +440,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam } } +LLConversationItemSession* LLConversationItemParticipant::getParentSession() +{ + LLConversationItemSession* parent_session = NULL; + if (hasParent()) + { + parent_session = dynamic_cast(mParent); + } + return parent_session; +} + void LLConversationItemParticipant::dumpDebugData() { llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 481d46af58..2ee21d0c16 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -195,6 +195,7 @@ public: virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); } void fetchAvatarName(); + LLConversationItemSession* getParentSession(); void dumpDebugData(); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 295dd2ae6d..11eef3f7dc 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -327,6 +327,7 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi mSpeakingIndicator->setSpeakerId(is_active ? gAgentID : LLUUID::null); } + llinfos << "Merov debug : onCurrentVoiceSessionChanged, switchIndicator is_active = " << is_active << llendl; mSpeakingIndicator->switchIndicator(is_active); mCallIconLayoutPanel->setVisible(is_active); } @@ -366,6 +367,11 @@ LLConversationViewParticipant::LLConversationViewParticipant( const LLConversati { } +LLConversationViewParticipant::~LLConversationViewParticipant() +{ + mActiveVoiceChannelConnection.disconnect(); +} + void LLConversationViewParticipant::initFromParams(const LLConversationViewParticipant::Params& params) { LLAvatarIconCtrl::Params avatar_icon_params(params.avatar_icon()); @@ -392,6 +398,7 @@ BOOL LLConversationViewParticipant::postBuild() mInfoBtn->setClickedCallback(boost::bind(&LLConversationViewParticipant::onInfoBtnClick, this)); mInfoBtn->setVisible(false); + mActiveVoiceChannelConnection = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLConversationViewParticipant::onCurrentVoiceSessionChanged, this, _1)); mSpeakingIndicator = getChild("speaking_indicator"); if (!sStaticInitialized) @@ -445,6 +452,29 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height) return arranged; } +void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& session_id) +{ + llinfos << "Merov debug : onCurrentVoiceSessionChanged begin, uuid = " << mUUID << ", session_id = " << session_id << llendl; + LLConversationItemParticipant* participant_model = dynamic_cast(getViewModelItem()); + //llinfos << "Merov debug : onCurrentVoiceSessionChanged participant_model = " << participant_model << llendl; + + if (participant_model) + { + //llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 1" << llendl; + LLConversationItemSession* parent_session = participant_model->getParentSession(); + //llinfos << "Merov debug : onCurrentVoiceSessionChanged parent_session = " << parent_session << llendl; + if (parent_session) + { + //llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 2" << llendl; + bool is_active = (parent_session->getUUID() == session_id); + //llinfos << "Merov debug : onCurrentVoiceSessionChanged, is_active = " << is_active << llendl; + mSpeakingIndicator->switchIndicator(is_active); + //llinfos << "Merov debug : onCurrentVoiceSessionChanged switchIndicator done" << llendl; + } + } + //llinfos << "Merov debug : onCurrentVoiceSessionChanged end" << llendl; +} + void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data @@ -453,6 +483,7 @@ void LLConversationViewParticipant::refresh() // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat mSpeakingIndicator->setIsMuted(vmi->isMuted()); + //mSpeakingIndicator->switchIndicator(true); // Do the regular upstream refresh LLFolderViewItem::refresh(); @@ -471,6 +502,7 @@ void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder) mAvatarIcon->setValue(mUUID); //Allows the speaker indicator to be activated based on the user and conversation +// llinfos << "Merov debug : setSpeakerId of " << mUUID << ", session id = " << vmi->getUUID() << llendl; mSpeakingIndicator->setSpeakerId(mUUID, vmi->getUUID()); } } diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index cc6995c207..4b2c9b2d76 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -94,7 +94,7 @@ private: bool mMinimizedMode; LLVoiceClientStatusObserver* mVoiceClientObserver; - + boost::signals2::connection mActiveVoiceChannelConnection; }; @@ -116,7 +116,7 @@ public: Params(); }; - virtual ~LLConversationViewParticipant( void ) { } + virtual ~LLConversationViewParticipant( void ); bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } virtual void refresh(); @@ -140,6 +140,8 @@ protected: void onInfoBtnClick(); private: + void onCurrentVoiceSessionChanged(const LLUUID& session_id); + LLAvatarIconCtrl* mAvatarIcon; LLButton * mInfoBtn; LLOutputMonitorCtrl* mSpeakingIndicator; @@ -156,6 +158,8 @@ private: static void initChildrenWidths(LLConversationViewParticipant* self); void updateChildren(); LLView* getItemChildView(EAvatarListItemChildIndex child_view_index); + + boost::signals2::connection mActiveVoiceChannelConnection; }; #endif // LL_LLCONVERSATIONVIEW_H diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 4a9a50d96a..3569516388 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -278,21 +278,45 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */) { + static LLUUID test_uuid("c684ce33-89fb-4544-8f7b-dae243c8b214"); + bool test_on = (speaker_id == test_uuid); + if (test_on) + { + llinfos << "Merov debug : setSpeakerId, this = " << this << ", session_id = " << session_id << llendl; + } if (speaker_id.isNull() && mSpeakerId.notNull()) { LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); } - if (speaker_id.isNull() || speaker_id == mSpeakerId) return; + if (speaker_id.isNull() || speaker_id == mSpeakerId) + { + if (test_on) + { + llinfos << "Merov debug : setSpeakerId, nothing done because mSpeakerId == speaker_id" << llendl; + } + return; + } if (mSpeakerId.notNull()) { + if (test_on) + { + llinfos << "Merov debug : setSpeakerId, unregisterSpeakingIndicator" << llendl; + } // Unregister previous registration to avoid crash. EXT-4782. - LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); + if (getTargetSessionID() == session_id) + { + LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); + } } mShowParticipantsSpeaking = show_other_participants_speaking; mSpeakerId = speaker_id; + if (test_on) + { + llinfos << "Merov debug : setSpeakerId, registerSpeakingIndicator" << llendl; + } LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id); //mute management @@ -320,6 +344,7 @@ void LLOutputMonitorCtrl::onChange() // virtual void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { + llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << llendl; // ensure indicator is visible in case it is not in visible chain // to be called when parent became visible next time to notify parent that visibility is changed. setVisible(TRUE); diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 900379ae1e..316a2739b8 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -155,6 +155,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id); speakers_uuids.insert(speaker_id); + llinfos << "Merov debug : registerSpeakingIndicator call switchSpeakerIndicators, switch = " << is_in_same_voice << llendl; switchSpeakerIndicators(speakers_uuids, is_in_same_voice); } @@ -195,6 +196,7 @@ SpeakingIndicatorManager::~SpeakingIndicatorManager() void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) { + llinfos << "Merov debug : sOnCurrentChannelChanged call switchSpeakerIndicators, FALSE" << llendl; switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); mSwitchedIndicatorsOn.clear(); } @@ -208,16 +210,21 @@ void SpeakingIndicatorManager::onParticipantsChanged() LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL; // switch all indicators off + llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, FALSE" << llendl; switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); + llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end FALSE switch" << llendl; mSwitchedIndicatorsOn.clear(); LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL; // then switch current voice participants indicators on + llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, TRUE" << llendl; switchSpeakerIndicators(speakers_uuids, TRUE); + llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end TRUE switch" << llendl; } void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on) { + llinfos << "Merov debug : switchSpeakerIndicators, switch_on = " << switch_on << llendl; LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); LLUUID session_id; if (voice_channel) diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h index b0a147865b..c2cf2a3702 100644 --- a/indra/newview/llspeakingindicatormanager.h +++ b/indra/newview/llspeakingindicatormanager.h @@ -37,7 +37,7 @@ public: virtual ~LLSpeakingIndicator(){} virtual void switchIndicator(bool switch_on) = 0; -private: +//private: friend class SpeakingIndicatorManager; // Accessors for target voice session UUID. // They are intended to be used only from SpeakingIndicatorManager to ensure target session is -- cgit v1.2.3 From d541d99fce104d28eac378947261297461603462 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 14 Nov 2012 21:44:58 +0200 Subject: CHUI-487, CHUI-488 W.I.P. #1 (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): build new class LLFlashTimer based on LLSysWellChiclet::FlashToLitTimer; prepared it for general purpose; replaced LLSysWellChiclet::FlashToLitTimer to LLFlashTimer --- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 4 +- indra/newview/llchiclet.cpp | 65 ++------------------------------- indra/newview/llchiclet.h | 5 ++- 4 files changed, 10 insertions(+), 66 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f652c9e50c..574fdc495a 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -178,6 +178,7 @@ set(viewer_SOURCE_FILES llfilepicker.cpp llfilteredwearablelist.cpp llfirstuse.cpp + llflashtimer.cpp llflexibleobject.cpp llfloaterabout.cpp llfloaterbvhpreview.cpp @@ -762,6 +763,7 @@ set(viewer_HEADER_FILES llfilepicker.h llfilteredwearablelist.h llfirstuse.h + llflashtimer.h llflexibleobject.h llfloaterabout.h llfloaterbvhpreview.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b703b9cc8e..14117ee47b 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13142,7 +13142,7 @@ Value 50.0 - WellIconFlashCount + FlashCount Comment Number of flashes of IM Well and Notification Well icons after which flashing buttons stay lit up. Requires restart. @@ -13153,7 +13153,7 @@ Value 3 - WellIconFlashPeriod + FlashPeriod Comment Period at which IM Well and Notification Well icons flash (seconds). Requires restart. diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 64d8a68a99..d6860640b7 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -67,60 +67,6 @@ boost::signals2::signal callback_t; - - /** - * Constructor. - * - * @param count - how many times callback should be called (twice to not change original state) - * @param period - how frequently callback should be called - * @param cb - callback to be called each tick - */ - FlashToLitTimer(S32 count, F32 period, callback_t cb) - : LLEventTimer(period) - , mCallback(cb) - , mFlashCount(2 * count) - , mCurrentFlashCount(0) - { - mEventTimer.stop(); - } - - BOOL tick() - { - mCallback(); - - if (++mCurrentFlashCount == mFlashCount) mEventTimer.stop(); - return FALSE; - } - - void flash() - { - mCurrentFlashCount = 0; - mEventTimer.start(); - } - - void stopFlashing() - { - mEventTimer.stop(); - } - -private: - callback_t mCallback; - - /** - * How many times Well will blink. - */ - S32 mFlashCount; - S32 mCurrentFlashCount; -}; LLSysWellChiclet::Params::Params() : button("button") @@ -145,13 +91,8 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) mButton = LLUICtrlFactory::create(button_params); addChild(mButton); - // use settings from settings.xml to be able change them via Debug settings. See EXT-5973. - // Due to Timer is implemented as derived class from EventTimer it is impossible to change period - // in runtime. So, both settings are made as required restart. - static S32 flash_to_lit_count = gSavedSettings.getS32("WellIconFlashCount"); - static F32 flash_period = gSavedSettings.getF32("WellIconFlashPeriod"); - mFlashToLitTimer = new FlashToLitTimer(flash_to_lit_count, flash_period, boost::bind(&LLSysWellChiclet::changeLitState, this)); + mFlashToLitTimer = new LLFlashTimer(boost::bind(&LLSysWellChiclet::changeLitState, this, _1)); } LLSysWellChiclet::~LLSysWellChiclet() @@ -191,7 +132,7 @@ void LLSysWellChiclet::setToggleState(BOOL toggled) { mButton->setToggleState(toggled); } -void LLSysWellChiclet::changeLitState() +void LLSysWellChiclet::changeLitState(bool blink) { setNewMessagesState(!mIsNewMessagesState); } @@ -320,7 +261,7 @@ void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) // we have to flash to 'Lit' state each time new unread message is coming. if (counter > mCounter && im_not_visible) { - mFlashToLitTimer->flash(); + mFlashToLitTimer->startFlashing(); } else if (counter == 0) { diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index d6be2df103..79ffad92ef 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -29,6 +29,7 @@ #include "llavatariconctrl.h" #include "llbutton.h" +#include "llflashtimer.h" #include "llpanel.h" #include "lltextbox.h" #include "lloutputmonitorctrl.h" @@ -844,7 +845,7 @@ protected: * There is an assumption that it will be called 2*N times to do not change its start state. * @see FlashToLitTimer */ - void changeLitState(); + void changeLitState(bool blink); /** * Displays menu. @@ -860,7 +861,7 @@ protected: S32 mMaxDisplayedCount; bool mIsNewMessagesState; - FlashToLitTimer* mFlashToLitTimer; + LLFlashTimer* mFlashToLitTimer; LLContextMenu* mContextMenu; }; -- cgit v1.2.3 From bd62d1d33717536e71f5fbb5ab4a477a69494c77 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 14 Nov 2012 20:00:01 -0800 Subject: CHUI-479 : WIP : More tracing --- indra/newview/llconversationmodel.cpp | 18 ++++++++++++------ indra/newview/llconversationmodel.h | 2 +- indra/newview/lloutputmonitorctrl.cpp | 8 +++++++- indra/newview/llspeakingindicatormanager.cpp | 8 ++++---- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 8aa740e5d1..1c56bd672d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -349,15 +349,21 @@ const bool LLConversationItemSession::getTime(F64& time) const return has_time; } -void LLConversationItemSession::dumpDebugData() +void LLConversationItemSession::dumpDebugData(bool dump_children) { + // Session info llinfos << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; - LLConversationItemParticipant* participant = NULL; - child_list_t::iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + // Children info + if (dump_children) { - participant = dynamic_cast(*iter); - participant->dumpDebugData(); + for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + LLConversationItemParticipant* participant = dynamic_cast(*iter); + if (participant) + { + participant->dumpDebugData(); + } + } } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 2ee21d0c16..dd849210a8 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -168,7 +168,7 @@ public: void addVoiceOptions(menuentry_vec_t& items); virtual const bool getTime(F64& time) const; - void dumpDebugData(); + void dumpDebugData(bool dump_children = false); private: bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 3569516388..063b90e76b 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -48,6 +48,8 @@ LLColor4 LLOutputMonitorCtrl::sColorBound; //F32 LLOutputMonitorCtrl::sRectWidthRatio = 0.f; //F32 LLOutputMonitorCtrl::sRectHeightRatio = 0.f; +static LLUUID test_uuid("c684ce33-89fb-4544-8f7b-dae243c8b214"); + LLOutputMonitorCtrl::Params::Params() : draw_border("draw_border"), image_mute("image_mute"), @@ -278,7 +280,6 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */) { - static LLUUID test_uuid("c684ce33-89fb-4544-8f7b-dae243c8b214"); bool test_on = (speaker_id == test_uuid); if (test_on) { @@ -345,6 +346,11 @@ void LLOutputMonitorCtrl::onChange() void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << llendl; + bool test_on = (mSpeakerId == test_uuid); + if (test_on && !switch_on) + { + llinfos << "Merov debug : switching agent off!" << llendl; + } // ensure indicator is visible in case it is not in visible chain // to be called when parent became visible next time to notify parent that visibility is changed. setVisible(TRUE); diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 316a2739b8..752218c776 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -224,13 +224,13 @@ void SpeakingIndicatorManager::onParticipantsChanged() void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on) { - llinfos << "Merov debug : switchSpeakerIndicators, switch_on = " << switch_on << llendl; LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); LLUUID session_id; if (voice_channel) { session_id = voice_channel->getSessionID(); } + llinfos << "Merov debug : switchSpeakerIndicators, switch_on = " << switch_on << ", voice channel = " << session_id << llendl; speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin(); for (; it_uuid != speakers_uuids.end(); ++it_uuid) @@ -255,17 +255,17 @@ void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& spea } was_switched_on = was_switched_on || switch_current_on; + llinfos << "Merov debug : indicator for " << *it_uuid << ", switch_current_on = " << switch_current_on << ", session = " << indicator->getTargetSessionID() << llendl; indicator->switchIndicator(switch_current_on); - } if (was_found) { - LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators where found" << LL_ENDL; + LL_DEBUGS("SpeakingIndicator") << mSpeakingIndicators.count(*it_uuid) << " indicators were found" << LL_ENDL; if (switch_on && !was_switched_on) { - LL_DEBUGS("SpeakingIndicator") << "but non of them where switched on" << LL_ENDL; + LL_DEBUGS("SpeakingIndicator") << "but none of them were switched on" << LL_ENDL; } if (was_switched_on) -- cgit v1.2.3 From dbc37f6ca74dba6c6d5194e0397d5cfe6f570c1d Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Thu, 15 Nov 2012 10:38:21 +0200 Subject: CHUI-397 (Delay in removing names from participant list in nearby chat) CHUI-440 (Nearby chat participant list does not clear after teleport when conversation floater is closed/minimized) fixed --- indra/llui/llfolderviewitem.h | 1 + indra/newview/llconversationview.cpp | 14 +++++++++++++- indra/newview/llspeakers.cpp | 8 ++++++++ indra/newview/llspeakers.h | 3 +++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index b157aabdcf..152ca242e1 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -118,6 +118,7 @@ protected: // For now assuming all colors are the same in derived classes. static LLUIColor sFgColor; + static LLUIColor sFgDisabledColor; static LLUIColor sHighlightBgColor; static LLUIColor sHighlightFgColor; static LLUIColor sFocusOutlineColor; diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 53392ac372..d1649a93b1 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -409,6 +409,7 @@ BOOL LLConversationViewParticipant::postBuild() void LLConversationViewParticipant::draw() { static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); + static LLUIColor sFgDisabledColor = LLUIColorTable::instance().getColor("MenuItemDisabledColor", DEFAULT_WHITE); static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); @@ -421,7 +422,18 @@ void LLConversationViewParticipant::draw() F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad; F32 text_left = (F32)getLabelXPos(); - LLColor4 color = mIsSelected ? sHighlightFgColor : sFgColor; + + LLColor4 color; + LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance(); + + if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID)) + { + color = sFgDisabledColor; + } + else + { + color = mIsSelected ? sHighlightFgColor : sFgColor; + } drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); drawLabel(font, text_left, y, color, right_x); diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 5036334bdd..88f29d7587 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -254,6 +254,10 @@ bool LLSpeakersDelayActionsStorage::onTimerActionCallback(const LLUUID& speaker_ return true; } +bool LLSpeakersDelayActionsStorage::isTimerStarted(const LLUUID& speaker_id) +{ + return (mActionTimersMap.size() > 0) && (mActionTimersMap.find(speaker_id) != mActionTimersMap.end()); +} // // ModerationResponder @@ -603,6 +607,10 @@ const LLUUID LLSpeakerMgr::getSessionID() return mVoiceChannel->getSessionID(); } +bool LLSpeakerMgr::isSpeakerToBeRemoved(const LLUUID& speaker_id) +{ + return mSpeakerDelayRemover && mSpeakerDelayRemover->isTimerStarted(speaker_id); +} void LLSpeakerMgr::setSpeakerTyping(const LLUUID& speaker_id, BOOL typing) { diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 8ab08661d3..7d518fe07b 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -193,6 +193,8 @@ public: void unsetActionTimer(const LLUUID& speaker_id); void removeAllTimers(); + + bool isTimerStarted(const LLUUID& speaker_id); private: /** * Callback of the each instance of LLSpeakerActionTimer. @@ -237,6 +239,7 @@ public: void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text); LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; } const LLUUID getSessionID(); + bool isSpeakerToBeRemoved(const LLUUID& speaker_id); /** * Removes avaline speaker. -- cgit v1.2.3 From 0b910871ab2935bde912314515f8b53ec3ff754e Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 15 Nov 2012 13:12:04 +0200 Subject: CHUI-487, CHUI-488 W.I.P. #2 (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): build new class LLFlashTimer based on LLSysWellChiclet::FlashToLitTimer; prepared it for general purpose; replaced LLSysWellChiclet::FlashToLitTimer to LLFlashTimer --- indra/newview/llflashtimer.cpp | 72 ++++++++++++++++++++++++++++++++++++++++++ indra/newview/llflashtimer.h | 62 ++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 indra/newview/llflashtimer.cpp create mode 100644 indra/newview/llflashtimer.h diff --git a/indra/newview/llflashtimer.cpp b/indra/newview/llflashtimer.cpp new file mode 100644 index 0000000000..f44ca9f90c --- /dev/null +++ b/indra/newview/llflashtimer.cpp @@ -0,0 +1,72 @@ +/** + * @file llflashtimer.cpp + * @brief LLFlashTimer class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "llflashtimer.h" +#include "llviewercontrol.h" + +LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) + : LLEventTimer(period) + , mCallback(cb) + , mCurrentTickCount(0) +{ + mEventTimer.stop(); + + // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. + // Due to Timer is implemented as derived class from EventTimer it is impossible to change period + // in runtime. So, both settings are made as required restart. + mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount")); + if (mPeriod<=0) + { + mPeriod = gSavedSettings.getF32("FlashPeriod"); + } +} + +BOOL LLFlashTimer::tick() +{ + bool blink = !(mCurrentTickCount % 2); + mCallback(blink); + + if (++mCurrentTickCount >= mFlashCount) + { + mEventTimer.stop(); + } + + return FALSE; +} + +void LLFlashTimer::startFlashing() +{ + mCurrentTickCount = 0; + mEventTimer.start(); +} + +void LLFlashTimer::stopFlashing() +{ + mEventTimer.stop(); +} diff --git a/indra/newview/llflashtimer.h b/indra/newview/llflashtimer.h new file mode 100644 index 0000000000..95e458dff6 --- /dev/null +++ b/indra/newview/llflashtimer.h @@ -0,0 +1,62 @@ +/** + * @file llflashtimer.h + * @brief LLFlashTimer class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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_FLASHTIMER_H +#define LL_FLASHTIMER_H + +#include "lleventtimer.h" + +class LLFlashTimer : public LLEventTimer +{ +public: + + typedef boost::function callback_t; + + /** + * Constructor. + * + * @param count - how many times callback should be called (twice to not change original state) + * @param period - how frequently callback should be called + * @param cb - callback to be called each tick + */ + LLFlashTimer(callback_t cb, S32 count = 0, F32 period = 0.0); + ~LLFlashTimer() {}; + + /*virtual*/ BOOL tick(); + + void startFlashing(); + void stopFlashing(); + +private: + callback_t mCallback; + /** + * How many times Well will blink. + */ + S32 mFlashCount; + S32 mCurrentTickCount; +}; + +#endif /* LL_FLASHTIMER_H */ -- cgit v1.2.3 From 70b9dd6ee6af483bf1c96631bb25fd6a3703b351 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 15 Nov 2012 10:41:53 -0800 Subject: CHUI-524: FIX Removing a function call that results in a circular logic loop and an eventual stack overflow crash. --- indra/newview/llfloaterimsessiontab.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 3a1cc2880a..26a97ea422 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -313,7 +313,13 @@ void LLFloaterIMSessionTab::onFocusReceived() if (container) { container->selectConversationPair(mSessionID, true); + // XXX stinson 11/15/2012 : calling show stub from this focus handler results in a circular + // logic loop of function calls that eventually result in a stack overflow. + // See CHUI-524 for documentation +#define XXX_STINSON_HACK_CHUI_524 1 +#if !XXX_STINSON_HACK_CHUI_524 container->showStub(! getHost()); +#endif } } -- cgit v1.2.3 From 4ea44918dd040520bdd8eb1e52f2b6ba6cfa6f8b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 16 Nov 2012 19:36:46 +0200 Subject: CHUI-525 FIXED Tootlips are added for Info buttons --- indra/newview/skins/default/xui/en/panel_avatar_list_item.xml | 1 + indra/newview/skins/default/xui/en/panel_group_list_item.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml index b7c58eb6ab..aa1b929412 100644 --- a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml @@ -129,6 +129,7 @@ left_pad="3" right="-53" name="info_btn" + tool_tip="More info" tab_stop="false" top_delta="0" width="16" /> diff --git a/indra/newview/skins/default/xui/en/panel_group_list_item.xml b/indra/newview/skins/default/xui/en/panel_group_list_item.xml index 12735026fa..cfe3aeb7c9 100644 --- a/indra/newview/skins/default/xui/en/panel_group_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_group_list_item.xml @@ -56,6 +56,7 @@ left_pad="3" right="-31" name="info_btn" + tool_tip="More info" tab_stop="false" top_delta="-2" width="16" /> -- cgit v1.2.3 From 16f5a67e6550c2041b69b5c8523ad9884d7110f1 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 15 Nov 2012 23:35:14 +0200 Subject: CHUI-442 FIXED Nearby chat does not open conversations floater when clicking first nearby chat toast in a session --- indra/newview/llfloaterimsessiontab.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 3a1cc2880a..da77ca0079 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -165,6 +165,11 @@ void LLFloaterIMSessionTab::addToHost(const LLUUID& session_id) || gSavedSettings.getBOOL("NearbyChatIsNotTornOff")) { floater_container->addFloater(conversp, TRUE, LLTabContainer::END); + + if (!floater_container->getVisible()) + { + LLFloaterReg::toggleInstanceOrBringToFront("im_container"); + } } else { -- cgit v1.2.3 From e89616aac812a7c6080d577f8a284f6df56a51ea Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 15 Nov 2012 15:11:22 -0800 Subject: Backed out changeset: 80bab29003f8 Removing hack fix for CHUI-524. --- indra/newview/llfloaterimsessiontab.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 26a97ea422..3a1cc2880a 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -313,13 +313,7 @@ void LLFloaterIMSessionTab::onFocusReceived() if (container) { container->selectConversationPair(mSessionID, true); - // XXX stinson 11/15/2012 : calling show stub from this focus handler results in a circular - // logic loop of function calls that eventually result in a stack overflow. - // See CHUI-524 for documentation -#define XXX_STINSON_HACK_CHUI_524 1 -#if !XXX_STINSON_HACK_CHUI_524 container->showStub(! getHost()); -#endif } } -- cgit v1.2.3 From 37d7f469055d3ba4b81815fa2ac8459022e1e3cf Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 15 Nov 2012 15:32:02 -0800 Subject: CHUI-524: The root reason of crash was in the infinity recursion in the chain of calls LLFloater::setFocus->LLFloater::setFrontmost->LLFloaterView::bringToFront. And problem was not related to CHUI-362. Reviewed by Stinson. --- indra/llui/llfloater.cpp | 10 +++++++++- indra/llui/llfloater.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0e57ba02bf..1b6e4ed0e5 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2234,7 +2234,8 @@ LLFloaterView::LLFloaterView (const Params& p) mFocusCycleMode(FALSE), mMinimizePositionVOffset(0), mSnapOffsetBottom(0), - mSnapOffsetRight(0) + mSnapOffsetRight(0), + mFrontChild(NULL) { mSnapView = getHandle(); } @@ -2383,6 +2384,13 @@ LLRect LLFloaterView::findNeighboringPosition( LLFloater* reference_floater, LLF void LLFloaterView::bringToFront(LLFloater* child, BOOL give_focus) { + if (mFrontChild == child) + { + return; + } + + mFrontChild = child; + // *TODO: make this respect floater's mAutoFocus value, instead of // using parameter if (child->getHost()) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 07b79d5523..ca0710cdc1 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -576,6 +576,7 @@ private: S32 mMinimizePositionVOffset; typedef std::vector, boost::signals2::connection> > hidden_floaters_t; hidden_floaters_t mHiddenFloaters; + LLFloater * mFrontChild; }; // -- cgit v1.2.3 From d3474c6eaf5f26986e7988f4ca773f67e034c49d Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 15 Nov 2012 15:42:22 -0800 Subject: CHUI-489: Now sounds exist for teleport and inventory offers. The sound is specified in notifications.xml. Also changes for CHUI 486, which allow the user to set preferences for hearing sounds for a New Conversation, Incoming Voice Call, Teleport Offer and Inventory Offer. --- indra/llui/llfloater.cpp | 15 ++++++++++++++- indra/llui/llnotifications.cpp | 5 +++++ indra/llui/llnotifications.h | 1 + indra/newview/llimview.cpp | 6 +++++- indra/newview/lltoastnotifypanel.cpp | 15 +++++++++++++++ indra/newview/skins/default/xui/en/notifications.xml | 6 ++++-- .../skins/default/xui/en/panel_preferences_chat.xml | 1 + 7 files changed, 45 insertions(+), 4 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 0e57ba02bf..3ab66f3321 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -64,6 +64,8 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +extern LLControlGroup gSavedSettings; + namespace LLInitParam { void TypeValues::declareValues() @@ -660,7 +662,18 @@ void LLFloater::openFloater(const LLSD& key) && !getFloaterHost() && (!getVisible() || isMinimized())) { - make_ui_sound("UISndWindowOpen"); + bool playSound = true; + + //Don't play a sound for incoming voice call based upon chat preference setting + if(getName() == "incoming call" && gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall") == FALSE) + { + playSound = false; + } + + if(playSound) + { + make_ui_sound("UISndWindowOpen"); + } } //RN: for now, we don't allow rehosting from one multifloater to another diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 929b7da081..fe84dbbdaf 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -899,6 +899,11 @@ bool LLNotification::hasFormElements() const return mTemplatep->mForm->getNumElements() != 0; } +void LLNotification::playSound() +{ + LLUI::sAudioCallback(mTemplatep->mSoundEffect); +} + LLNotification::ECombineBehavior LLNotification::getCombineBehavior() const { return mTemplatep->mCombineBehavior; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index c677dfe298..088931858a 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -524,6 +524,7 @@ public: bool canLogToIM() const; bool canShowToast() const; bool hasFormElements() const; + void playSound(); typedef enum e_combine_behavior { diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0f4bbd054a..f7b182e891 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2494,7 +2494,11 @@ void LLIMMgr::addMessage( return; } - make_ui_sound("UISndNewIncomingIMSession"); + //Play sound for new conversations + if(gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE) + { + make_ui_sound("UISndNewIncomingIMSession"); + } } bool skip_message = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index ccad49bc30..8672dc479d 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -493,6 +493,21 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) } // adjust panel's height to the text size snapToMessageHeight(mTextBox, MAX_LENGTH); + + bool playSound = true; + + if((mNotification->getName() == "UserGiveItem" + && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE) + || mNotification->getName() == "TeleportOffered" + && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE) + { + playSound = false; + } + + if(playSound) + { + mNotification->playSound(); + } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 6c2ad869ac..bf2bfaf386 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6460,7 +6460,8 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th icon="notify.tga" name="UserGiveItem" log_to_im ="true" - type="offer"> + type="offer" + sound="UISndNewIncomingIMSession"> [NAME_SLURL] has given you this [OBJECTTYPE]: [ITEM_SLURL] @@ -6517,7 +6518,8 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th name="TeleportOffered" log_to_im="true" log_to_chat="false" - type="offer"> + type="offer" + sound="UISndNewIncomingIMSession"> [NAME_SLURL] has offered to teleport you to their location: “[MESSAGE]” diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 8ab5c9a99c..712e8bff7f 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -322,6 +322,7 @@ name="incoming_voice_call" width="150" /> Date: Thu, 15 Nov 2012 17:34:34 -0800 Subject: CHUI-489: Found a bug in last commit for this issue. The sound notification (for inventory/teleport offer) would be played for the toast popup as well as once the conversations floater was opened. And also when a button was clicked in the conversation floater to 'accept' or 'deny' the offer. Now only playing the sound notification when the initial offer has been made. --- indra/newview/llnotificationofferhandler.cpp | 17 +++++++++++++++++ indra/newview/lltoastnotifypanel.cpp | 15 +-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 6e641575fa..8b7cac9f4b 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -117,6 +117,23 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) LLScreenChannel* channel = dynamic_cast(mChannel.get()); if(channel) channel->addToast(p); + + bool playSound = true; + + //Play notification sound for inventory offer and teleport offer based upon chat preference + if((notification->getName() == "UserGiveItem" + && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE) + || notification->getName() == "TeleportOffered" + && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE) + { + playSound = false; + } + + if(playSound) + { + notification->playSound(); + } + } if (notification->canLogToIM()) diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 8672dc479d..844d7314d9 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -494,20 +494,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) // adjust panel's height to the text size snapToMessageHeight(mTextBox, MAX_LENGTH); - bool playSound = true; - - if((mNotification->getName() == "UserGiveItem" - && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE) - || mNotification->getName() == "TeleportOffered" - && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE) - { - playSound = false; - } - - if(playSound) - { - mNotification->playSound(); - } + } -- cgit v1.2.3 From ec5d1e48c4071500400b885e5893373bab0e3d99 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 15 Nov 2012 18:07:57 -0800 Subject: CHUI-479 : WIP : Introduce a publicly available LLSpeakingIndicatorManager::updateSpeakingIndicators() method so to reset all indicators when creating new dialogs. --- indra/newview/llconversationview.cpp | 25 ++++++++++++------------- indra/newview/lloutputmonitorctrl.cpp | 5 ----- indra/newview/llspeakingindicatormanager.cpp | 28 ++++++++++++++++++---------- indra/newview/llspeakingindicatormanager.h | 5 +++++ 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index cc7a76e353..d971c943f0 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -307,7 +307,9 @@ void LLConversationViewSession::refresh() mSessionTitle->setText(vmi->getDisplayName()); } - // Note: for the moment, all that needs to be done is done by LLFolderViewItem::refresh() + // Update all speaking indicators + llinfos << "Merov debug : LLConversationViewSession::refresh, updateSpeakingIndicators" << llendl; + LLSpeakingIndicatorManager::updateSpeakingIndicators(); // Do the regular upstream refresh LLFolderViewFolder::refresh(); @@ -327,7 +329,6 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi mSpeakingIndicator->setSpeakerId(is_active ? gAgentID : LLUUID::null); } - llinfos << "Merov debug : onCurrentVoiceSessionChanged, switchIndicator is_active = " << is_active << llendl; mSpeakingIndicator->switchIndicator(is_active); mCallIconLayoutPanel->setVisible(is_active); } @@ -456,34 +457,32 @@ void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& s { llinfos << "Merov debug : onCurrentVoiceSessionChanged begin, uuid = " << mUUID << ", session_id = " << session_id << llendl; LLConversationItemParticipant* participant_model = dynamic_cast(getViewModelItem()); - //llinfos << "Merov debug : onCurrentVoiceSessionChanged participant_model = " << participant_model << llendl; if (participant_model) { - //llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 1" << llendl; LLConversationItemSession* parent_session = participant_model->getParentSession(); - //llinfos << "Merov debug : onCurrentVoiceSessionChanged parent_session = " << parent_session << llendl; if (parent_session) { - //llinfos << "Merov debug : onCurrentVoiceSessionChanged enter if 2" << llendl; bool is_active = (parent_session->getUUID() == session_id); - //llinfos << "Merov debug : onCurrentVoiceSessionChanged, is_active = " << is_active << llendl; mSpeakingIndicator->switchIndicator(is_active); - //llinfos << "Merov debug : onCurrentVoiceSessionChanged switchIndicator done" << llendl; } } - //llinfos << "Merov debug : onCurrentVoiceSessionChanged end" << llendl; } void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data - LLConversationItemParticipant* vmi = dynamic_cast(getViewModelItem()); - vmi->resetRefresh(); + LLConversationItemParticipant* participant_model = dynamic_cast(getViewModelItem()); + participant_model->resetRefresh(); // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat - mSpeakingIndicator->setIsMuted(vmi->isMuted()); - //mSpeakingIndicator->switchIndicator(true); + mSpeakingIndicator->setIsMuted(participant_model->isMuted()); + //LLConversationItemSession* parent_session = participant_model->getParentSession(); + //if (parent_session) + //{ + // bool is_active = (parent_session->getUUID() == session_id); + // mSpeakingIndicator->switchIndicator(is_active); + //} // Do the regular upstream refresh LLFolderViewItem::refresh(); diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 063b90e76b..536f1fbd73 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -346,11 +346,6 @@ void LLOutputMonitorCtrl::onChange() void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << llendl; - bool test_on = (mSpeakerId == test_uuid); - if (test_on && !switch_on) - { - llinfos << "Merov debug : switching agent off!" << llendl; - } // ensure indicator is visible in case it is not in visible chain // to be called when parent became visible next time to notify parent that visibility is changed. setVisible(TRUE); diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 752218c776..d9f9ed5966 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -74,6 +74,16 @@ public: */ void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator); + /** + * Callback of changing voice participant list (from LLVoiceClientParticipantObserver). + * + * Switches off indicators had been switched on and switches on indicators of current participants list. + * There is only a few indicators in lists should be switched off/on. + * So, method does not calculate difference between these list it only switches off already + * switched on indicators and switches on indicators of voice channel participants + */ + void onParticipantsChanged(); + private: typedef std::set speaker_ids_t; typedef std::multimap speaking_indicators_mmap_t; @@ -93,16 +103,6 @@ private: */ void sOnCurrentChannelChanged(const LLUUID& session_id); - /** - * Callback of changing voice participant list (from LLVoiceClientParticipantObserver). - * - * Switches off indicators had been switched on and switches on indicators of current participants list. - * There is only a few indicators in lists should be switched off/on. - * So, method does not calculate difference between these list it only switches off already - * switched on indicators and switches on indicators of voice channel participants - */ - void onParticipantsChanged(); - /** * Changes state of indicators specified by LLUUIDs * @@ -321,5 +321,13 @@ void LLSpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speak } } +void LLSpeakingIndicatorManager::updateSpeakingIndicators() +{ + if(SpeakingIndicatorManager::instanceExists()) + { + SpeakingIndicatorManager::instance().onParticipantsChanged(); + } +} + // EOF diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h index c2cf2a3702..8ee368e258 100644 --- a/indra/newview/llspeakingindicatormanager.h +++ b/indra/newview/llspeakingindicatormanager.h @@ -78,6 +78,11 @@ namespace LLSpeakingIndicatorManager * @param speaking_indicator instance of the speaker indicator to be unregistered. */ void unregisterSpeakingIndicator(const LLUUID& speaker_id, const LLSpeakingIndicator* const speaking_indicator); + + /** + * Switch on/off registered speaking indicator according to the most current voice client status + */ + void updateSpeakingIndicators(); } #endif // LL_LLSPEAKINGINDICATORMANAGER_H -- cgit v1.2.3 From 568d818ffe214c358f92717ceb86dd20cb4aed26 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 15 Nov 2012 19:08:08 -0800 Subject: CHUI-518: WIP First pass as implementing auto-reject voice calls in do not disturb mode. --- indra/newview/llimview.cpp | 16 +++++++++++----- indra/newview/llviewermessage.cpp | 4 +--- indra/newview/llviewermessage.h | 2 ++ indra/newview/skins/default/xui/en/notifications.xml | 1 + indra/newview/skins/default/xui/en/strings.xml | 3 ++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0bb370e6fe..50e2b48f30 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -64,6 +64,7 @@ #include "lltoolbarview.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" +#include "message.h" const static std::string ADHOC_NAME_SUFFIX(" Conference"); @@ -2801,12 +2802,17 @@ void LLIMMgr::inviteToSession( if (voice_invite) { - if ( // if we are rejecting group calls - (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && notify_box_type == "VoiceInviteGroup") || - // or we're rejecting non-friend voice calls and this isn't a friend - (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)) - ) + bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup")); + bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)); + bool isRejectDoNotDisturb = gAgent.isDoNotDisturb(); + if (isRejectGroupCall || isRejectNonFriendCall || isRejectDoNotDisturb) { + if (isRejectDoNotDisturb && !isRejectGroupCall && !isRejectNonFriendCall) + { + LLSD args; + LLIMMgr::getInstance()->addSystemMessage(session_id, "you_auto_rejected_call", args); + send_do_not_disturb_message(gMessageSystem, caller_id, session_id); + } // silently decline the call LLIncomingCallDialog::processCallResponse(1, payload); return; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 56c9f81259..e21db146db 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -179,8 +179,6 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = FALSE // TeleportYourAgent }; -static void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id = LLUUID::null); - bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -3240,7 +3238,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } } -static void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) +void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) { if (gAgent.isDoNotDisturb()) { diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index b298f0060b..447fdeb9c7 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -152,6 +152,8 @@ void send_group_notice(const LLUUID& group_id, const std::string& message, const LLInventoryItem* item); +void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id = LLUUID::null); + void handle_lure(const LLUUID& invitee); void handle_lure(const uuid_vec_t& ids); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 6c2ad869ac..eaa020ff49 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3695,6 +3695,7 @@ Do Not Disturb is on. You will not be notified of incoming communications. - Other residents will receive your Do Not Disturb response (set in Preferences > General). - Teleportation offers will be declined. +- Voice calls will be rejected. - Inventory offers will go to your Trash. Your call has been answered You started a voice call You joined the voice call - [NAME] started a voice call + You automatically rejected the voice call while 'Do Not Disturb' was on. + [NAME] started a voice call Joining voice call... -- cgit v1.2.3 From 987350fcb3cf2da03b70ac3fbadb0429f523d07a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 15 Nov 2012 19:24:45 -0800 Subject: CHUI-489: Code review cleanup for both CHUI-489 and CHUI-486. This should be last commit for CHUI-489. --- indra/llui/llfloater.cpp | 7 +------ indra/llui/llnotifications.cpp | 7 ++++--- indra/llui/llnotificationtemplate.h | 6 ++---- indra/newview/llnotificationofferhandler.cpp | 16 +++++----------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a3b5fb993d..ada2bde55e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -662,13 +662,8 @@ void LLFloater::openFloater(const LLSD& key) && !getFloaterHost() && (!getVisible() || isMinimized())) { - bool playSound = true; - //Don't play a sound for incoming voice call based upon chat preference setting - if(getName() == "incoming call" && gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall") == FALSE) - { - playSound = false; - } + bool playSound = !(getName() == "incoming call" && gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall") == FALSE); if(playSound) { diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index fe84dbbdaf..9618c002f5 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -413,12 +413,13 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mDefaultFunctor(p.functor.isProvided() ? p.functor() : p.name()), mLogToChat(p.log_to_chat), mLogToIM(p.log_to_im), - mShowToast(p.show_toast) + mShowToast(p.show_toast), + mSoundName("") { if (p.sound.isProvided() && LLUI::sSettingGroups["config"]->controlExists(p.sound)) { - mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound)); + mSoundName = p.sound; } BOOST_FOREACH(const LLNotificationTemplate::UniquenessContext& context, p.unique.contexts) @@ -901,7 +902,7 @@ bool LLNotification::hasFormElements() const void LLNotification::playSound() { - LLUI::sAudioCallback(mTemplatep->mSoundEffect); + make_ui_sound(mTemplatep->mSoundName.c_str()); } LLNotification::ECombineBehavior LLNotification::getCombineBehavior() const diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 9434efe1b9..906b83a400 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -323,10 +323,8 @@ struct LLNotificationTemplate LLNotificationFormPtr mForm; // default priority for notifications of this type ENotificationPriority mPriority; - // UUID of the audio file to be played when this notification arrives - // this is loaded as a name, but looked up to get the UUID upon template load. - // If null, it wasn't specified. - LLUUID mSoundEffect; + // Stores the sound name which can then be used to play the sound using make_ui_sound + std::string mSoundName; // List of tags that rules can match against. std::list mTags; diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 8b7cac9f4b..91003c7d53 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -118,22 +118,16 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) if(channel) channel->addToast(p); - bool playSound = true; - - //Play notification sound for inventory offer and teleport offer based upon chat preference - if((notification->getName() == "UserGiveItem" - && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE) - || notification->getName() == "TeleportOffered" - && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE) - { - playSound = false; - } + //Will not play a notification sound for inventory and teleport offer based upon chat preference + bool playSound = !((notification->getName() == "UserGiveItem" + && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE) + || notification->getName() == "TeleportOffered" + && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE); if(playSound) { notification->playSound(); } - } if (notification->canLogToIM()) -- cgit v1.2.3 From 50b69c3f97c0b58791f7dd67f8b2fbdc9e8ef503 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 16 Nov 2012 12:38:40 +0200 Subject: CHUI-487, CHUI-488 W.I.P. #3 (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): implemented conversation's item flashing --- indra/llui/llbutton.cpp | 6 +++++- indra/llui/llfolderviewitem.cpp | 16 ++++++++++++---- indra/llui/llfolderviewitem.h | 2 ++ indra/newview/llflashtimer.cpp | 14 ++++++++++++-- indra/newview/llflashtimer.h | 6 +++++- indra/newview/llfloaterimcontainer.cpp | 11 +++++++++++ indra/newview/llfloaterimcontainer.h | 1 + 7 files changed, 48 insertions(+), 8 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 705fe16559..3b9076ee54 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -176,7 +176,11 @@ LLButton::LLButton(const LLButton::Params& p) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); - +if (this->getName() == "chat") +{ +bool q = false; +q = !q; +} if (!p.label_selected.isProvided()) { mSelectedLabel = mUnselectedLabel; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 822534ffcf..90568f344a 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -23,9 +23,11 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + +#include "../newview/llflashtimer.h" + #include "linden_common.h" #include "llfolderviewitem.h" - #include "llfolderview.h" #include "llfolderviewmodel.h" #include "llpanel.h" @@ -142,6 +144,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mArrowSize(p.arrow_size), mMaxFolderItemOverlap(p.max_folder_item_overlap) { + mFlashTimer = new LLFlashTimer(); + sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); @@ -676,12 +680,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo const S32 focus_bottom = getRect().getHeight() - mItemHeight; const bool folder_open = (getRect().getHeight() > mItemHeight + 4); const S32 FOCUS_LEFT = 1; + bool flashing = mFlashTimer->isFlashing(); + + if (flashing? mFlashTimer->isHighlight() : mIsSelected) // always render "current" item (only render other selected items if + // mShowSingleSelection is FALSE) or flashing item - if (mIsSelected) // always render "current" item. Only render other selected items if mShowSingleSelection is FALSE { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLColor4 bg_color = bgColor; - if (!mIsCurSelection) + bool selection = flashing? mFlashTimer->isHighlight() : mIsCurSelection; + if (!selection) { // do time-based fade of extra objects F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f); @@ -701,7 +709,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo getRect().getWidth() - 2, focus_bottom, bg_color, hasKeyboardFocus); - if (mIsCurSelection) + if (selection) { gl_rect_2d(FOCUS_LEFT, focus_top, diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 152ca242e1..c16d65206f 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -29,6 +29,7 @@ #include "llview.h" #include "lluiimage.h" +class LLFlashTimer; class LLFolderView; class LLFolderViewModelItem; class LLFolderViewFolder; @@ -272,6 +273,7 @@ public: private: static std::map sFonts; // map of styles to fonts + LLFlashTimer* mFlashTimer; }; diff --git a/indra/newview/llflashtimer.cpp b/indra/newview/llflashtimer.cpp index f44ca9f90c..2feacfa218 100644 --- a/indra/newview/llflashtimer.cpp +++ b/indra/newview/llflashtimer.cpp @@ -29,11 +29,13 @@ #include "llflashtimer.h" #include "llviewercontrol.h" +#include "lleventtimer.h" LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) : LLEventTimer(period) , mCallback(cb) , mCurrentTickCount(0) + , mIsFlashing(false) { mEventTimer.stop(); @@ -49,8 +51,11 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) BOOL LLFlashTimer::tick() { - bool blink = !(mCurrentTickCount % 2); - mCallback(blink); + mIsHighlight = !(mCurrentTickCount % 2); + if (mCallback) + { + mCallback(mIsHighlight); + } if (++mCurrentTickCount >= mFlashCount) { @@ -63,10 +68,15 @@ BOOL LLFlashTimer::tick() void LLFlashTimer::startFlashing() { mCurrentTickCount = 0; + mIsFlashing = true; mEventTimer.start(); } void LLFlashTimer::stopFlashing() { + mIsFlashing = false; + mIsHighlight = false; mEventTimer.stop(); } + + diff --git a/indra/newview/llflashtimer.h b/indra/newview/llflashtimer.h index 95e458dff6..c030edfc52 100644 --- a/indra/newview/llflashtimer.h +++ b/indra/newview/llflashtimer.h @@ -42,13 +42,15 @@ public: * @param period - how frequently callback should be called * @param cb - callback to be called each tick */ - LLFlashTimer(callback_t cb, S32 count = 0, F32 period = 0.0); + LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); ~LLFlashTimer() {}; /*virtual*/ BOOL tick(); void startFlashing(); void stopFlashing(); + bool isFlashing() {return mIsFlashing;} + bool isHighlight() {return mIsHighlight;} private: callback_t mCallback; @@ -57,6 +59,8 @@ private: */ S32 mFlashCount; S32 mCurrentTickCount; + bool mIsHighlight; + bool mIsFlashing; }; #endif /* LL_FLASHTIMER_H */ diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index aebfdb5bce..da6f3a484d 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1154,6 +1154,7 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) } } + // Synchronous select the conversation item and the conversation floater BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget) { @@ -1596,4 +1597,14 @@ void LLFloaterIMContainer::reSelectConversation() } +void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id) +{ + LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); + if (widget) + { + widget->; + } + +} + // EOF diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index afc8d00174..443688668b 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -164,6 +164,7 @@ public: void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id); void setNearbyDistances(); void reSelectConversation(); + void flashConversationItemWidget(const LLUUID& session_id); private: LLConversationViewSession* createConversationItemWidget(LLConversationItem* item); -- cgit v1.2.3 From ed3f43aec48097c56d617a8948d2577624762a88 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 16 Nov 2012 11:14:12 -0800 Subject: CHUI-479 : WIP : Tracing of LLIMModel::processSessionInitializedReply (to be deleted). --- indra/newview/llfloaterimcontainer.cpp | 25 +++++++++++++++++++++++-- indra/newview/llfloaterimsessiontab.cpp | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2707e3dcbb..af090338d7 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -98,6 +98,7 @@ LLFloaterIMContainer::~LLFloaterIMContainer() void LLFloaterIMContainer::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { + llinfos << "Merov debug : sessionAdded, uuid = " << session_id << ", name = " << name << llendl; addConversationListItem(session_id); LLFloaterIMSessionTab::addToHost(session_id); } @@ -109,14 +110,33 @@ void LLFloaterIMContainer::sessionActivated(const LLUUID& session_id, const std: void LLFloaterIMContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { + llinfos << "Merov debug : sessionVoiceOrIMStarted, uuid = " << session_id << llendl; addConversationListItem(session_id); LLFloaterIMSessionTab::addToHost(session_id); } void LLFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { - // *TODO: We should do this *without* delete and recreate - addConversationListItem(new_session_id, removeConversationListItem(old_session_id)); + llinfos << "Merov debug : sessionIDUpdated, old_session_id = " << old_session_id << ", new_session_id = " << new_session_id << llendl; + // Retrieve the session LLFloaterIMSessionTab + // just close it: that should erase the mSession, close the tab and remove the list item + // *TODO : take the mSessions element (pointing to the tab) out of the list + //bool change_focus = removeConversationListItem(old_session_id); + // *TODO : detach the old tab from the host + // *TODO : delete the tab (that's one thing that's reentrant) + LLFloater* floaterp = get_ptr_in_map(mSessions, old_session_id); + if (floaterp) + { + llinfos << "Merov debug : closeFloater, start" << llendl; + floaterp->closeFloater(); + llinfos << "Merov debug : closeFloater, end" << llendl; + } + bool change_focus = false; + llinfos << "Merov debug : addConversationListItem" << llendl; + addConversationListItem(new_session_id, change_focus); + llinfos << "Merov debug : addToHost" << llendl; + LLFloaterIMSessionTab::addToHost(new_session_id); + llinfos << "Merov debug : end sessionIDUpdated" << llendl; } void LLFloaterIMContainer::sessionRemoved(const LLUUID& session_id) @@ -1300,6 +1320,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) { + llinfos << "Merov debug : removeConversationListItem, uuid = " << uuid << llendl; // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6b13f5f381..6fbc713590 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -721,6 +721,7 @@ void LLFloaterIMSessionTab::onClose(bool app_quitting) LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance(); if (im_box) { + llinfos << "Merov debug : LLFloaterIMSessionTab::onClose, mKey = " << mKey << llendl; im_box->removeConversationListItem(mKey); } } -- cgit v1.2.3 From e298c2ded8e25a28127c668cf30a74a25c139041 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 16 Nov 2012 22:36:12 +0200 Subject: CHUI-487, CHUI-488 FIXED (Enable flashing FUI button behavior and Implement Flashing Conversations panel line item behavior): implemented FUI button flashing; clean up code --- indra/llui/CMakeLists.txt | 2 + indra/llui/llbutton.cpp | 46 ++++++++---------- indra/llui/llbutton.h | 6 +-- indra/llui/llflashtimer.cpp | 80 ++++++++++++++++++++++++++++++++ indra/llui/llflashtimer.h | 67 +++++++++++++++++++++++++++ indra/llui/llfolderviewitem.cpp | 15 +++--- indra/llui/llfolderviewitem.h | 3 +- indra/llui/lltabcontainer.cpp | 4 +- indra/newview/CMakeLists.txt | 2 - indra/newview/llflashtimer.cpp | 82 --------------------------------- indra/newview/llflashtimer.h | 66 -------------------------- indra/newview/llfloaterimcontainer.cpp | 14 ++++-- indra/newview/llfloaterimcontainer.h | 2 +- indra/newview/llfloaterimsessiontab.cpp | 10 ++++ 14 files changed, 206 insertions(+), 193 deletions(-) create mode 100644 indra/llui/llflashtimer.cpp create mode 100644 indra/llui/llflashtimer.h delete mode 100644 indra/newview/llflashtimer.cpp delete mode 100644 indra/newview/llflashtimer.h diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 80cec6c9f3..ccc7aa8cec 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -47,6 +47,7 @@ set(llui_SOURCE_FILES lleditmenuhandler.cpp llf32uictrl.cpp llfiltereditor.cpp + llflashtimer.cpp llflatlistview.cpp llfloater.cpp llfloaterreg.cpp @@ -153,6 +154,7 @@ set(llui_HEADER_FILES lleditmenuhandler.h llf32uictrl.h llfiltereditor.h + llflashtimer.h llflatlistview.h llfloater.h llfloaterreg.h diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 3b9076ee54..8a34e221b1 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -170,17 +170,18 @@ LLButton::LLButton(const LLButton::Params& p) mMouseUpSignal(NULL), mHeldDownSignal(NULL), mUseDrawContextAlpha(p.use_draw_context_alpha), - mHandleRightMouse(p.handle_right_mouse), - mButtonFlashCount(p.button_flash_count), - mButtonFlashRate(p.button_flash_rate) + mHandleRightMouse(p.handle_right_mouse) { + // If optional parameter "p.button_flash_count" is not provided, LLFlashTimer will be + // used instead it a "default" value from gSavedSettings.getS32("FlashCount")). + // Likewise, missing "p.button_flash_rate" is replaced by gSavedSettings.getF32("FlashPeriod"); + S32 flash_count = p.button_flash_count || 0; + F32 flash_rate = p.button_flash_rate || 0.0; // + mFlashingTimer = new LLFlashTimer ((LLFlashTimer::callback_t)NULL, flash_count, flash_rate); + static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); -if (this->getName() == "chat") -{ -bool q = false; -q = !q; -} + if (!p.label_selected.isProvided()) { mSelectedLabel = mUnselectedLabel; @@ -271,6 +272,7 @@ LLButton::~LLButton() delete mMouseDownSignal; delete mMouseUpSignal; delete mHeldDownSignal; + delete mFlashingTimer; } // HACK: Committing a button is the same as instantly clicking it. @@ -595,22 +597,11 @@ void LLButton::draw() { static LLCachedControl sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); - bool flash = FALSE; - if( mFlashing) - { - if ( sEnableButtonFlashing) - { - F32 elapsed = mFlashingTimer.getElapsedTimeF32(); - S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f); - // flash on or off? - flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f); - } - else - { // otherwise just highlight button in flash color - flash = true; - } - } + mFlashing = mFlashingTimer->isFlashing(); + + bool flash = mFlashing && + (!sEnableButtonFlashing || mFlashingTimer->isHighlight()); bool pressed_by_keyboard = FALSE; if (hasFocus()) @@ -955,10 +946,13 @@ void LLButton::setToggleState(BOOL b) void LLButton::setFlashing( BOOL b ) { - if ((bool)b != mFlashing) + if (b) + { + mFlashingTimer->startFlashing(); + } + else { - mFlashing = b; - mFlashingTimer.reset(); + mFlashingTimer->stopFlashing(); } } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index deaa0823c6..92548298f5 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -30,6 +30,7 @@ #include "lluuid.h" #include "llbadgeowner.h" #include "llcontrol.h" +#include "llflashtimer.h" #include "lluictrl.h" #include "v4color.h" #include "llframetimer.h" @@ -201,6 +202,7 @@ public: void setHighlight(bool b); void setFlashing( BOOL b ); BOOL getFlashing() const { return mFlashing; } + LLFlashTimer* getFlashTimer() {return mFlashingTimer;} void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } LLFontGL::HAlign getHAlign() const { return mHAlign; } @@ -285,8 +287,6 @@ protected: LLFrameTimer mMouseDownTimer; bool mNeedsHighlight; - S32 mButtonFlashCount; - F32 mButtonFlashRate; void drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size); void resetMouseDownTimer(); @@ -373,7 +373,7 @@ protected: bool mForcePressedState; bool mDisplayPressedState; - LLFrameTimer mFlashingTimer; + LLFlashTimer* mFlashingTimer; bool mHandleRightMouse; }; diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp new file mode 100644 index 0000000000..c572a83ff5 --- /dev/null +++ b/indra/llui/llflashtimer.cpp @@ -0,0 +1,80 @@ +/** + * @file llflashtimer.cpp + * @brief LLFlashTimer class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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 "../newview/llviewerprecompiledheaders.h" + +#include "llflashtimer.h" +#include "../newview/llviewercontrol.h" +#include "lleventtimer.h" + +LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) + : LLEventTimer(period) + , mCallback(cb) + , mCurrentTickCount(0) + , mIsFlashing(false) +{ + mEventTimer.stop(); + + // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. + // Due to Timer is implemented as derived class from EventTimer it is impossible to change period + // in runtime. So, both settings are made as required restart. + mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount")); + if (mPeriod<=0) + { + mPeriod = gSavedSettings.getF32("FlashPeriod"); + } +} + +BOOL LLFlashTimer::tick() +{ + mIsHighlight = !(mCurrentTickCount % 2); + if (mCallback) + { + mCallback(mIsHighlight); + } + + if (++mCurrentTickCount >= mFlashCount) + { + mEventTimer.stop(); + } + + return FALSE; +} + +void LLFlashTimer::startFlashing() +{ + mCurrentTickCount = 0; + mIsFlashing = true; + mEventTimer.start(); +} + +void LLFlashTimer::stopFlashing() +{ + mIsFlashing = false; + mIsHighlight = false; + mEventTimer.stop(); +} + + diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h new file mode 100644 index 0000000000..2ef6ebcc8a --- /dev/null +++ b/indra/llui/llflashtimer.h @@ -0,0 +1,67 @@ +/** + * @file llflashtimer.h + * @brief LLFlashTimer class implementation + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, 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_FLASHTIMER_H +#define LL_FLASHTIMER_H + +#include "lleventtimer.h" + +class LLFlashTimer : public LLEventTimer +{ +public: + + typedef boost::function callback_t; + + /** + * Constructor. + * + * @param count - how many times callback should be called (twice to not change original state) + * @param period - how frequently callback should be called + * @param cb - callback to be called each tick + */ + LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); + ~LLFlashTimer() {}; + + /*virtual*/ BOOL tick(); + + void startFlashing(); + void stopFlashing(); + + bool isFlashing() {return mIsFlashing;} + bool isHighlight() {return mIsHighlight;} + +private: + callback_t mCallback; + /** + * How many times parent will blink. + */ + S32 mFlashCount; + S32 mCurrentTickCount; + bool mIsHighlight; + bool mIsFlashing; +}; + +#endif /* LL_FLASHTIMER_H */ diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 90568f344a..d65f53cd4d 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -23,8 +23,9 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ +#include "../newview/llviewerprecompiledheaders.h" -#include "../newview/llflashtimer.h" +#include "llflashtimer.h" #include "linden_common.h" #include "llfolderviewitem.h" @@ -164,17 +165,19 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) } } +// Destroys the object +LLFolderViewItem::~LLFolderViewItem() +{ + delete mFlashTimer; + mViewModelItem = NULL; +} + BOOL LLFolderViewItem::postBuild() { refresh(); return TRUE; } -// Destroys the object -LLFolderViewItem::~LLFolderViewItem( void ) -{ - mViewModelItem = NULL; -} LLFolderView* LLFolderViewItem::getRoot() { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index c16d65206f..c8d6c37b04 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -26,10 +26,10 @@ #ifndef LLFOLDERVIEWITEM_H #define LLFOLDERVIEWITEM_H +#include "llflashtimer.h" #include "llview.h" #include "lluiimage.h" -class LLFlashTimer; class LLFolderView; class LLFolderViewModelItem; class LLFolderViewFolder; @@ -163,6 +163,7 @@ public: S32 getIconPad(); S32 getTextPad(); + LLFlashTimer* getFlashTimer() {return mFlashTimer;} // If 'selection' is 'this' then note that otherwise ignore. // Returns TRUE if this item ends up being selected. virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem, BOOL take_keyboard_focus); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index c24eb2ee90..d1f77830a6 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -506,8 +506,8 @@ void LLTabContainer::draw() } } - mPrevArrowBtn->setFlashing(FALSE); - mNextArrowBtn->setFlashing(FALSE); + mPrevArrowBtn->getFlashTimer()->stopFlashing(); + mNextArrowBtn->getFlashTimer()->stopFlashing(); } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 574fdc495a..f652c9e50c 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -178,7 +178,6 @@ set(viewer_SOURCE_FILES llfilepicker.cpp llfilteredwearablelist.cpp llfirstuse.cpp - llflashtimer.cpp llflexibleobject.cpp llfloaterabout.cpp llfloaterbvhpreview.cpp @@ -763,7 +762,6 @@ set(viewer_HEADER_FILES llfilepicker.h llfilteredwearablelist.h llfirstuse.h - llflashtimer.h llflexibleobject.h llfloaterabout.h llfloaterbvhpreview.h diff --git a/indra/newview/llflashtimer.cpp b/indra/newview/llflashtimer.cpp deleted file mode 100644 index 2feacfa218..0000000000 --- a/indra/newview/llflashtimer.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file llflashtimer.cpp - * @brief LLFlashTimer class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2012, 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 "llflashtimer.h" -#include "llviewercontrol.h" -#include "lleventtimer.h" - -LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) - : LLEventTimer(period) - , mCallback(cb) - , mCurrentTickCount(0) - , mIsFlashing(false) -{ - mEventTimer.stop(); - - // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. - // Due to Timer is implemented as derived class from EventTimer it is impossible to change period - // in runtime. So, both settings are made as required restart. - mFlashCount = 2 * ((count>0)? count : gSavedSettings.getS32("FlashCount")); - if (mPeriod<=0) - { - mPeriod = gSavedSettings.getF32("FlashPeriod"); - } -} - -BOOL LLFlashTimer::tick() -{ - mIsHighlight = !(mCurrentTickCount % 2); - if (mCallback) - { - mCallback(mIsHighlight); - } - - if (++mCurrentTickCount >= mFlashCount) - { - mEventTimer.stop(); - } - - return FALSE; -} - -void LLFlashTimer::startFlashing() -{ - mCurrentTickCount = 0; - mIsFlashing = true; - mEventTimer.start(); -} - -void LLFlashTimer::stopFlashing() -{ - mIsFlashing = false; - mIsHighlight = false; - mEventTimer.stop(); -} - - diff --git a/indra/newview/llflashtimer.h b/indra/newview/llflashtimer.h deleted file mode 100644 index c030edfc52..0000000000 --- a/indra/newview/llflashtimer.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file llflashtimer.h - * @brief LLFlashTimer class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2012, 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_FLASHTIMER_H -#define LL_FLASHTIMER_H - -#include "lleventtimer.h" - -class LLFlashTimer : public LLEventTimer -{ -public: - - typedef boost::function callback_t; - - /** - * Constructor. - * - * @param count - how many times callback should be called (twice to not change original state) - * @param period - how frequently callback should be called - * @param cb - callback to be called each tick - */ - LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0); - ~LLFlashTimer() {}; - - /*virtual*/ BOOL tick(); - - void startFlashing(); - void stopFlashing(); - bool isFlashing() {return mIsFlashing;} - bool isHighlight() {return mIsHighlight;} - -private: - callback_t mCallback; - /** - * How many times Well will blink. - */ - S32 mFlashCount; - S32 mCurrentTickCount; - bool mIsHighlight; - bool mIsFlashing; -}; - -#endif /* LL_FLASHTIMER_H */ diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index da6f3a484d..90ddeef5bb 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -41,6 +41,7 @@ #include "llcallbacklist.h" #include "llgroupactions.h" #include "llgroupiconctrl.h" +#include "llflashtimer.h" #include "llfloateravatarpicker.h" #include "llfloaterpreference.h" #include "llimview.h" @@ -1594,17 +1595,22 @@ void LLFloaterIMContainer::reSelectConversation() { selectFloater(session_floater); } - } -void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id) +void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes) { LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); if (widget) { - widget->; + if (is_flashes) + { + widget->getFlashTimer()->startFlashing(); + } + else + { + widget->getFlashTimer()->stopFlashing(); + } } - } // EOF diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 443688668b..9112b54018 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -164,7 +164,7 @@ public: void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id); void setNearbyDistances(); void reSelectConversation(); - void flashConversationItemWidget(const LLUUID& session_id); + void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes); private: LLConversationViewSession* createConversationItemWidget(LLConversationItem* item); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 69b42cdd6d..42e7e6cb55 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -40,6 +40,7 @@ #include "llfloaterimsession.h" #include "llfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container #include "lllayoutstack.h" +#include "lltoolbarview.h" #include "llfloaterimnearbychat.h" const F32 REFRESH_INTERVAL = 0.2f; @@ -328,11 +329,20 @@ std::string LLFloaterIMSessionTab::appendTime() void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD &args) { + // Update the participant activity time LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance(); if (im_box) { im_box->setTimeNow(mSessionID,chat.mFromID); + + // TODO: Warning! The next two lines of code are included below only temporarily + // to demonstrate the correct format call the appropriate functions. + // They should be moved to the right places when working on CHUI-486. ~Alex ProductEngine. + // ---- start demo ---- + im_box->flashConversationItemWidget(mSessionID, true); // flashing of the conversation's item + gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat" + // ---- end demo ----- } -- cgit v1.2.3 From c6a0f0ae1dec5ef2f7657d8c1ca07d85c1fef55d Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Fri, 16 Nov 2012 16:17:11 -0800 Subject: CHUI-518: FIX Removing the LLIMMgr::getInstance() as the containing method is already a non-static member method of the same class. --- indra/newview/llimview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a38153c315..e2b678626b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2814,7 +2814,7 @@ void LLIMMgr::inviteToSession( if (isRejectDoNotDisturb && !isRejectGroupCall && !isRejectNonFriendCall) { LLSD args; - LLIMMgr::getInstance()->addSystemMessage(session_id, "you_auto_rejected_call", args); + addSystemMessage(session_id, "you_auto_rejected_call", args); send_do_not_disturb_message(gMessageSystem, caller_id, session_id); } // silently decline the call -- cgit v1.2.3 From 2d9285cddb4a48fb766b21fac2705c8873e15f93 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 16 Nov 2012 18:53:05 -0800 Subject: CHUI-529: Now the conversations floater will appear when the chat preference is set for friend, non-friend, conference, group and nearby chat. --- indra/newview/llfloaterimnearbychathandler.cpp | 50 ++++++---- indra/newview/llimview.cpp | 104 +++++++++++++-------- .../default/xui/en/panel_preferences_chat.xml | 20 ++++ 3 files changed, 116 insertions(+), 58 deletions(-) diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index ab81b85d04..2d8a6d46fe 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -41,6 +41,7 @@ #include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance #include "llviewerwindow.h"//for screen channel position #include "llfloaterimnearbychat.h" +#include "llfloaterimcontainer.h" #include "llrootview.h" #include "lllayoutstack.h" @@ -283,12 +284,6 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { - //Ignore Nearby Toasts - if(gSavedSettings.getString("NotificationNearbyChatOptions") != "toast") - { - return; - } - //look in pool. if there is any message if(mStopProcessing) return; @@ -606,19 +601,36 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, toast_msg = chat_msg.mText; } - // Add a nearby chat toast. - LLUUID id; - id.generate(); - chat["id"] = id; - std::string r_color_name = "White"; - F32 r_color_alpha = 1.0f; - LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); - - chat["text_color"] = r_color_name; - chat["color_alpha"] = r_color_alpha; - chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; - chat["message"] = toast_msg; - channel->addChat(chat); + + //Will show toast when chat preference is set + if(gSavedSettings.getString("NotificationNearbyChatOptions") == "toast") + { + // Add a nearby chat toast. + LLUUID id; + id.generate(); + chat["id"] = id; + std::string r_color_name = "White"; + F32 r_color_alpha = 1.0f; + LLViewerChat::getChatColor( chat_msg, r_color_name, r_color_alpha); + + chat["text_color"] = r_color_name; + chat["color_alpha"] = r_color_alpha; + chat["font_size"] = (S32)LLViewerChat::getChatFontSize() ; + chat["message"] = toast_msg; + channel->addChat(chat); + } + //Will show Conversations floater when chat preference is set + else if(gSavedSettings.getString("NotificationNearbyChatOptions") == "openconversations") + { + LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + + if(floaterIMContainer) + { + floaterIMContainer->setVisible(TRUE); + floaterIMContainer->setFrontmost(TRUE); + } + } + } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 818de4eaf4..106811b7e0 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -112,6 +112,55 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id, LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID())); } +//Will return true if the preference is allowed (user configures these preferences via 'Chat Preference' Dialog +bool ignoreNotification(const LLSD& msg, const char * preferenceString) +{ + //Get the session so we can find out the type of session + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + msg["session_id"]); + + const LLRelationship * relationship; + + // Skip system messages + if (msg["from_id"].asUUID() == LLUUID::null) + { + return true; + } + + //Ignore P2P Friend/Non-Friend Notification + if(session->isP2PSessionType()) + { + relationship = LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]); + + //Ignores non-friends + if(relationship == NULL + && (gSavedSettings.getString("NotificationNonFriendIMOptions") != preferenceString)) + { + return true; + } + //Ignores friends + else if(relationship + && gSavedSettings.getString("NotificationFriendIMOptions") != preferenceString) + { + return true; + } + } + //Ignore Ad Hoc Notification + else if(session->isAdHocSessionType() + && (gSavedSettings.getString("NotificationConferenceIMOptions") != preferenceString)) + { + return true; + } + //Ignore Group Notification + else if(session->isGroupSessionType() + && (gSavedSettings.getString("NotificationGroupChatOptions") != preferenceString)) + { + return true; + } + + return false; +} + void toast_callback(const LLSD& msg){ // do not show toast in do not disturb mode or it goes from agent if (gAgent.isDoNotDisturb() || gAgent.getID() == msg["from_id"]) @@ -133,55 +182,32 @@ void toast_callback(const LLSD& msg){ return; } - // Skip toasting for system messages - if (msg["from_id"].asUUID() == LLUUID::null) - { - return; - } - - // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea - LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( - msg["session_id"]); - - - //Ignore P2P Friend/Non-Friend toasts - if(session->isP2PSessionType()) - { - //Ignores non-friends - if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL) - && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast")) - { - return; - } - //Ignores friends - else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast") - { - return; - } - } - //Ignore Ad Hoc Toasts - else if(session->isAdHocSessionType() - && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast")) + //Show toast + if(ignoreNotification(msg, "toast") == false) { - return; + LLAvatarNameCache::get(msg["from_id"].asUUID(), + boost::bind(&on_avatar_name_cache_toast, + _1, _2, msg)); } - //Ignore Group Toasts - else if(session->isGroupSessionType() - && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast")) +} + +void open_conversations_callback(const LLSD& msg) +{ + LLFloaterIMContainer * floaterIMContainer = LLFloaterIMContainer::getInstance(); + + if(floaterIMContainer + && ignoreNotification(msg, "openconversations") == false) { - return; + floaterIMContainer->setVisible(TRUE); + floaterIMContainer->setFrontmost(TRUE); } - - //Show toast - LLAvatarNameCache::get(msg["from_id"].asUUID(), - boost::bind(&on_avatar_name_cache_toast, - _1, _2, msg)); } LLIMModel::LLIMModel() { addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1)); addNewMsgCallback(boost::bind(&toast_callback, _1)); + addNewMsgCallback(boost::bind(&open_conversations_callback, _1)); } LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg) diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 712e8bff7f..0c94b6b223 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -134,6 +134,10 @@ top_delta="-6" name="FriendIMOptions" width="223"> + + + + + Date: Fri, 16 Nov 2012 21:01:57 -0800 Subject: CHUI-479 : Fixed : Rebuild the root on the LLFloaterIMSession when modifying the session ID --- indra/newview/llfloaterimcontainer.cpp | 42 ++++++++----------- indra/newview/llfloaterimsessiontab.cpp | 72 +++++++++++++++++---------------- indra/newview/llfloaterimsessiontab.h | 1 + 3 files changed, 55 insertions(+), 60 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index af090338d7..bd692aa850 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -117,26 +117,20 @@ void LLFloaterIMContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) void LLFloaterIMContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) { - llinfos << "Merov debug : sessionIDUpdated, old_session_id = " << old_session_id << ", new_session_id = " << new_session_id << llendl; - // Retrieve the session LLFloaterIMSessionTab - // just close it: that should erase the mSession, close the tab and remove the list item - // *TODO : take the mSessions element (pointing to the tab) out of the list - //bool change_focus = removeConversationListItem(old_session_id); - // *TODO : detach the old tab from the host - // *TODO : delete the tab (that's one thing that's reentrant) - LLFloater* floaterp = get_ptr_in_map(mSessions, old_session_id); - if (floaterp) - { - llinfos << "Merov debug : closeFloater, start" << llendl; - floaterp->closeFloater(); - llinfos << "Merov debug : closeFloater, end" << llendl; - } - bool change_focus = false; - llinfos << "Merov debug : addConversationListItem" << llendl; + // The general strategy when a session id is modified is to delete all related objects and create them anew. + + // Note however that the LLFloaterIMSession has its session id updated through a call to sessionInitReplyReceived() + // and do not need to be deleted and recreated (trying this creates loads of problems). We do need however to suppress + // its related mSessions record as it's indexed with the wrong id. + // Grabbing the updated LLFloaterIMSession and readding it in mSessions will eventually be done by addConversationListItem(). + mSessions.erase(old_session_id); + + // Delete the model and participants related to the old session + bool change_focus = removeConversationListItem(old_session_id); + + // Create a new conversation with the new id addConversationListItem(new_session_id, change_focus); - llinfos << "Merov debug : addToHost" << llendl; LLFloaterIMSessionTab::addToHost(new_session_id); - llinfos << "Merov debug : end sessionIDUpdated" << llendl; } void LLFloaterIMContainer::sessionRemoved(const LLUUID& session_id) @@ -483,14 +477,14 @@ bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event) else if (type == "update_session") { session_view->refresh(); - if (conversation_floater) - { - conversation_floater->refreshConversation(); - } } mConversationViewModel.requestSortAll(); mConversationsRoot->arrangeAll(); + if (conversation_floater) + { + conversation_floater->refreshConversation(); + } return false; } @@ -1253,10 +1247,6 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& return item_it->second; } - // Remove the conversation item that might exist already: it'll be recreated anew further down anyway - // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(uuid,false); - // Create a conversation session model LLConversationItemSession* item = NULL; LLSpeakerMgr* speaker_manager = (is_nearby_chat ? (LLSpeakerMgr*)(LLLocalSpeakerMgr::getInstance()) : LLIMModel::getInstance()->getSpeakerManager(uuid)); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6fbc713590..22131eac49 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -52,6 +52,7 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) , mCloseBtn(NULL) , mSessionID(session_id.asUUID()) , mConversationsRoot(NULL) + , mScroller(NULL) , mChatHistory(NULL) , mInputEditor(NULL) , mInputEditorTopPad(0) @@ -68,10 +69,6 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemCheck, this, _2)); mEnableCallbackRegistrar.add("IMSession.Menu.ShowModes.Enable", boost::bind(&LLFloaterIMSessionTab::onIMShowModesMenuItemEnable, this, _2)); - - // Zero expiry time is set only once to allow initial update. - mRefreshTimer->setTimerExpirySec(0); - mRefreshTimer->start(); } LLFloaterIMSessionTab::~LLFloaterIMSessionTab() @@ -195,33 +192,16 @@ BOOL LLFloaterIMSessionTab::postBuild() mParticipantListPanel = getChild("speakers_list_panel"); - // Create a root view folder for all participants - LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel); - LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); - p.rect = LLRect(0, 0, getRect().getWidth(), 0); - p.parent_panel = mParticipantListPanel; - p.listener = base_item; - p.view_model = &mConversationViewModel; - p.root = NULL; - p.use_ellipses = true; - mConversationsRoot = LLUICtrlFactory::create(p); - mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); - // Add a scroller for the folder (participant) view LLRect scroller_view_rect = mParticipantListPanel->getRect(); scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); LLScrollContainer::Params scroller_params(LLUICtrlFactory::getDefaultParams()); scroller_params.rect(scroller_view_rect); - LLScrollContainer* scroller = LLUICtrlFactory::create(scroller_params); - scroller->setFollowsAll(); - - // Insert that scroller into the panel widgets hierarchy and folder view - mParticipantListPanel->addChild(scroller); - scroller->addChild(mConversationsRoot); - mConversationsRoot->setScrollContainer(scroller); - mConversationsRoot->setFollowsAll(); - mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); + mScroller = LLUICtrlFactory::create(scroller_params); + mScroller->setFollowsAll(); + // Insert that scroller into the panel widgets hierarchy + mParticipantListPanel->addChild(mScroller); mChatHistory = getChild("chat_history"); @@ -235,8 +215,6 @@ BOOL LLFloaterIMSessionTab::postBuild() setOpenPositioning(LLFloaterEnums::POSITIONING_RELATIVE); - buildConversationViewParticipant(); - mSaveRect = isTornOff(); initRectControl(); @@ -249,8 +227,14 @@ BOOL LLFloaterIMSessionTab::postBuild() result = LLDockableFloater::postBuild(); } + // Now ready to build the conversation and participants list + buildConversationViewParticipant(); refreshConversation(); - + + // Zero expiry time is set only once to allow initial update. + mRefreshTimer->setTimerExpirySec(0); + mRefreshTimer->start(); + return result; } @@ -276,9 +260,8 @@ void LLFloaterIMSessionTab::draw() { buildConversationViewParticipant(); } + refreshConversation(); } - - refreshConversation(); // Restart the refresh timer mRefreshTimer->setTimerExpirySec(REFRESH_INTERVAL); @@ -390,7 +373,31 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() // Nothing to do if the model list is inexistent return; } - + + // Create or recreate the root folder: this is a dummy folder (not shown) but required by the LLFolderView architecture + // We need to redo this when rebuilding as the session id (mSessionID) *may* have changed + if (mConversationsRoot) + { + // Remove the old root if any + mScroller->removeChild(mConversationsRoot); + } + // Create the root using an ad-hoc base item + LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel); + LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); + p.rect = LLRect(0, 0, getRect().getWidth(), 0); + p.parent_panel = mParticipantListPanel; + p.listener = base_item; + p.view_model = &mConversationViewModel; + p.root = NULL; + p.use_ellipses = true; + mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + // Attach that root to the scroller + mScroller->addChild(mConversationsRoot); + mConversationsRoot->setScrollContainer(mScroller); + mConversationsRoot->setFollowsAll(); + mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); + // Create the participants widgets now LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin(); LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd(); @@ -420,7 +427,6 @@ void LLFloaterIMSessionTab::addConversationViewParticipant(LLConversationItem* p participant_view->addToFolder(mConversationsRoot); participant_view->addToSession(mSessionID); participant_view->setVisible(TRUE); - refreshConversation(); } } @@ -432,7 +438,6 @@ void LLFloaterIMSessionTab::removeConversationViewParticipant(const LLUUID& part mConversationsRoot->extractItem(widget); delete widget; mConversationsWidgets.erase(participant_id); - refreshConversation(); } } @@ -443,7 +448,6 @@ void LLFloaterIMSessionTab::updateConversationViewParticipant(const LLUUID& part { widget->refresh(); } - refreshConversation(); } void LLFloaterIMSessionTab::refreshConversation() diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 8f5a8c2c1b..b765d121de 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -146,6 +146,7 @@ protected: conversations_widgets_map mConversationsWidgets; LLConversationViewModel mConversationViewModel; LLFolderView* mConversationsRoot; + LLScrollContainer* mScroller; LLChatHistory* mChatHistory; LLChatEntry* mInputEditor; -- cgit v1.2.3 From 2d25eb18adc0c2c97c63a8e02f2274362672137c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sat, 17 Nov 2012 13:24:41 -0800 Subject: CHUI-479 : Clean up unecessary tracking code --- indra/newview/llconversationview.cpp | 8 -------- indra/newview/llfloaterimcontainer.cpp | 2 -- indra/newview/llfloaterimsessiontab.cpp | 1 - indra/newview/lloutputmonitorctrl.cpp | 27 ++------------------------- indra/newview/llspeakingindicatormanager.cpp | 8 -------- indra/newview/llspeakingindicatormanager.h | 2 +- 6 files changed, 3 insertions(+), 45 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index d971c943f0..64618fabba 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -308,7 +308,6 @@ void LLConversationViewSession::refresh() } // Update all speaking indicators - llinfos << "Merov debug : LLConversationViewSession::refresh, updateSpeakingIndicators" << llendl; LLSpeakingIndicatorManager::updateSpeakingIndicators(); // Do the regular upstream refresh @@ -455,7 +454,6 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height) void LLConversationViewParticipant::onCurrentVoiceSessionChanged(const LLUUID& session_id) { - llinfos << "Merov debug : onCurrentVoiceSessionChanged begin, uuid = " << mUUID << ", session_id = " << session_id << llendl; LLConversationItemParticipant* participant_model = dynamic_cast(getViewModelItem()); if (participant_model) @@ -477,12 +475,6 @@ void LLConversationViewParticipant::refresh() // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat mSpeakingIndicator->setIsMuted(participant_model->isMuted()); - //LLConversationItemSession* parent_session = participant_model->getParentSession(); - //if (parent_session) - //{ - // bool is_active = (parent_session->getUUID() == session_id); - // mSpeakingIndicator->switchIndicator(is_active); - //} // Do the regular upstream refresh LLFolderViewItem::refresh(); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index bd692aa850..78b930984f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -110,7 +110,6 @@ void LLFloaterIMContainer::sessionActivated(const LLUUID& session_id, const std: void LLFloaterIMContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { - llinfos << "Merov debug : sessionVoiceOrIMStarted, uuid = " << session_id << llendl; addConversationListItem(session_id); LLFloaterIMSessionTab::addToHost(session_id); } @@ -1310,7 +1309,6 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) { - llinfos << "Merov debug : removeConversationListItem, uuid = " << uuid << llendl; // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 22131eac49..c2c6e739e9 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -725,7 +725,6 @@ void LLFloaterIMSessionTab::onClose(bool app_quitting) LLFloaterIMContainer* im_box = LLFloaterIMContainer::findInstance(); if (im_box) { - llinfos << "Merov debug : LLFloaterIMSessionTab::onClose, mKey = " << mKey << llendl; im_box->removeConversationListItem(mKey); } } diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 536f1fbd73..e4621a7fc3 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -48,8 +48,6 @@ LLColor4 LLOutputMonitorCtrl::sColorBound; //F32 LLOutputMonitorCtrl::sRectWidthRatio = 0.f; //F32 LLOutputMonitorCtrl::sRectHeightRatio = 0.f; -static LLUUID test_uuid("c684ce33-89fb-4544-8f7b-dae243c8b214"); - LLOutputMonitorCtrl::Params::Params() : draw_border("draw_border"), image_mute("image_mute"), @@ -280,44 +278,24 @@ BOOL LLOutputMonitorCtrl::handleMouseUp(S32 x, S32 y, MASK mask) void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id, const LLUUID& session_id/* = LLUUID::null*/, bool show_other_participants_speaking /* = false */) { - bool test_on = (speaker_id == test_uuid); - if (test_on) - { - llinfos << "Merov debug : setSpeakerId, this = " << this << ", session_id = " << session_id << llendl; - } if (speaker_id.isNull() && mSpeakerId.notNull()) { LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); } - if (speaker_id.isNull() || speaker_id == mSpeakerId) + if (speaker_id.isNull() || (speaker_id == mSpeakerId)) { - if (test_on) - { - llinfos << "Merov debug : setSpeakerId, nothing done because mSpeakerId == speaker_id" << llendl; - } return; } if (mSpeakerId.notNull()) { - if (test_on) - { - llinfos << "Merov debug : setSpeakerId, unregisterSpeakingIndicator" << llendl; - } // Unregister previous registration to avoid crash. EXT-4782. - if (getTargetSessionID() == session_id) - { - LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); - } + LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this); } mShowParticipantsSpeaking = show_other_participants_speaking; mSpeakerId = speaker_id; - if (test_on) - { - llinfos << "Merov debug : setSpeakerId, registerSpeakingIndicator" << llendl; - } LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this, session_id); //mute management @@ -345,7 +323,6 @@ void LLOutputMonitorCtrl::onChange() // virtual void LLOutputMonitorCtrl::switchIndicator(bool switch_on) { - llinfos << "Merov debug : switchIndicator, mSpeakerId = " << mSpeakerId << ", switch_on = " << switch_on << llendl; // ensure indicator is visible in case it is not in visible chain // to be called when parent became visible next time to notify parent that visibility is changed. setVisible(TRUE); diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index d9f9ed5966..76da7d1aee 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -155,7 +155,6 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id); speakers_uuids.insert(speaker_id); - llinfos << "Merov debug : registerSpeakingIndicator call switchSpeakerIndicators, switch = " << is_in_same_voice << llendl; switchSpeakerIndicators(speakers_uuids, is_in_same_voice); } @@ -196,7 +195,6 @@ SpeakingIndicatorManager::~SpeakingIndicatorManager() void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) { - llinfos << "Merov debug : sOnCurrentChannelChanged call switchSpeakerIndicators, FALSE" << llendl; switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); mSwitchedIndicatorsOn.clear(); } @@ -210,16 +208,12 @@ void SpeakingIndicatorManager::onParticipantsChanged() LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL; // switch all indicators off - llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, FALSE" << llendl; switchSpeakerIndicators(mSwitchedIndicatorsOn, FALSE); - llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end FALSE switch" << llendl; mSwitchedIndicatorsOn.clear(); LL_DEBUGS("SpeakingIndicator") << "Switching all ON, count: " << speakers_uuids.size() << LL_ENDL; // then switch current voice participants indicators on - llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, TRUE" << llendl; switchSpeakerIndicators(speakers_uuids, TRUE); - llinfos << "Merov debug : onParticipantsChanged call switchSpeakerIndicators, end TRUE switch" << llendl; } void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& speakers_uuids, BOOL switch_on) @@ -230,7 +224,6 @@ void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& spea { session_id = voice_channel->getSessionID(); } - llinfos << "Merov debug : switchSpeakerIndicators, switch_on = " << switch_on << ", voice channel = " << session_id << llendl; speaker_ids_t::const_iterator it_uuid = speakers_uuids.begin(); for (; it_uuid != speakers_uuids.end(); ++it_uuid) @@ -255,7 +248,6 @@ void SpeakingIndicatorManager::switchSpeakerIndicators(const speaker_ids_t& spea } was_switched_on = was_switched_on || switch_current_on; - llinfos << "Merov debug : indicator for " << *it_uuid << ", switch_current_on = " << switch_current_on << ", session = " << indicator->getTargetSessionID() << llendl; indicator->switchIndicator(switch_current_on); } diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h index 8ee368e258..e5afcd1cb7 100644 --- a/indra/newview/llspeakingindicatormanager.h +++ b/indra/newview/llspeakingindicatormanager.h @@ -37,7 +37,7 @@ public: virtual ~LLSpeakingIndicator(){} virtual void switchIndicator(bool switch_on) = 0; -//private: +private: friend class SpeakingIndicatorManager; // Accessors for target voice session UUID. // They are intended to be used only from SpeakingIndicatorManager to ensure target session is -- cgit v1.2.3 From 0cb67ec3762c1f1671fd01e331fe64a210098fd2 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 19 Nov 2012 07:42:39 +0200 Subject: CHUI-423 (User typing /me something in chat does not show correctly in italics on outgoing or incoming chat) --- indra/newview/llchathistory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 605e3ece51..a33bd88273 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -809,7 +809,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC) { delimiter = LLStringUtil::null; - name_params.font.style = "ITALIC"; + body_message_params.font.style = "ITALIC"; } bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY; -- cgit v1.2.3 From f043bc32fd202de88d6823bb938128147ab4a04c Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 19 Nov 2012 09:08:02 +0200 Subject: CHUI-434 (Don't display phone icon and disable phone button when voice isn't enabled) --- indra/newview/llconversationview.cpp | 20 +++++++------------- indra/newview/llconversationview.h | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 4c52794e4c..b9d62e85c4 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -57,14 +57,11 @@ public: virtual void onChange(EStatusType status, const std::string &channelURI, bool proximal) { - if (conversation - && status != STATUS_JOINING - && status != STATUS_LEFT_CHANNEL - && LLVoiceClient::getInstance()->voiceEnabled() - && LLVoiceClient::getInstance()->isVoiceWorking()) - { - conversation->showVoiceIndicator(); - } + conversation->showVoiceIndicator(conversation + && status != STATUS_JOINING + && status != STATUS_LEFT_CHANNEL + && LLVoiceClient::getInstance()->voiceEnabled() + && LLVoiceClient::getInstance()->isVoiceWorking()); } private: @@ -288,12 +285,9 @@ LLConversationViewParticipant* LLConversationViewSession::findParticipant(const return (iter == getItemsEnd() ? NULL : participant); } -void LLConversationViewSession::showVoiceIndicator() +void LLConversationViewSession::showVoiceIndicator(bool visible) { - if (LLVoiceChannel::getCurrentVoiceChannel()->getSessionID().isNull()) - { - mCallIconLayoutPanel->setVisible(true); - } + mCallIconLayoutPanel->setVisible(visible && LLVoiceChannel::getCurrentVoiceChannel()->getSessionID().isNull()); } void LLConversationViewSession::refresh() diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 1baa8bb5ec..8156b746b2 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -78,7 +78,7 @@ public: void setVisibleIfDetached(BOOL visible); LLConversationViewParticipant* findParticipant(const LLUUID& participant_id); - void showVoiceIndicator(); + void showVoiceIndicator(bool visible); virtual void refresh(); -- cgit v1.2.3 From c48f8c2b28253786ada02d0a57d3a8e005fe9101 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 19 Nov 2012 16:47:40 +0200 Subject: CHUI-487 ADD. FIX (Revised comments) --- indra/newview/app_settings/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 14117ee47b..be793a344c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13145,7 +13145,7 @@ FlashCount Comment - Number of flashes of IM Well and Notification Well icons after which flashing buttons stay lit up. Requires restart. + Number of flashes of item. Requires restart. Persist 1 Type @@ -13156,7 +13156,7 @@ FlashPeriod Comment - Period at which IM Well and Notification Well icons flash (seconds). Requires restart. + Period at which item flash (seconds). Requires restart. Persist 1 Type -- cgit v1.2.3 From 48a683af70fe359f4b4b6fdf6486208fc34dc2a9 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 19 Nov 2012 17:40:46 +0200 Subject: CHUI-488 ADD. fIX Clean up code --- indra/llui/llbutton.cpp | 7 ++++--- indra/newview/skins/default/xui/en/widgets/toolbar.xml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 8a34e221b1..8ac55b2eb4 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -174,9 +174,10 @@ LLButton::LLButton(const LLButton::Params& p) { // If optional parameter "p.button_flash_count" is not provided, LLFlashTimer will be // used instead it a "default" value from gSavedSettings.getS32("FlashCount")). - // Likewise, missing "p.button_flash_rate" is replaced by gSavedSettings.getF32("FlashPeriod"); - S32 flash_count = p.button_flash_count || 0; - F32 flash_rate = p.button_flash_rate || 0.0; // + // Likewise, missing "p.button_flash_rate" is replaced by gSavedSettings.getF32("FlashPeriod"). + // Note: flashing should be allowed in settings.xml (boolean key "EnableButtonFlashing"). + S32 flash_count = p.button_flash_count.isProvided()? p.button_flash_count : 0; + F32 flash_rate = p.button_flash_rate.isProvided()? p.button_flash_rate : 0.0; mFlashingTimer = new LLFlashTimer ((LLFlashTimer::callback_t)NULL, flash_count, flash_rate); static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 0aa478ace9..55ae158c00 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -30,8 +30,8 @@ image_overlay_alignment="left" use_ellipses="true" auto_resize="true" - button_flash_count="99999" - button_flash_rate="1.0" + button_flash_count="3" + button_flash_rate="0.25" flash_color="EmphasisColor"/> Date: Mon, 19 Nov 2012 17:14:18 -0800 Subject: CHUI-495: Ensuring that a user in do-not-disturb mode can receive voice calls from current conversations. --- indra/newview/llimview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e2b678626b..b5dc4a7967 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2808,7 +2808,7 @@ void LLIMMgr::inviteToSession( { bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup")); bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)); - bool isRejectDoNotDisturb = gAgent.isDoNotDisturb(); + bool isRejectDoNotDisturb = (gAgent.isDoNotDisturb() && !hasSession(session_id)); if (isRejectGroupCall || isRejectNonFriendCall || isRejectDoNotDisturb) { if (isRejectDoNotDisturb && !isRejectGroupCall && !isRejectNonFriendCall) -- cgit v1.2.3 From 2c2e8b83d02efcdec9ccd3216e64073b4e8e1d57 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 19 Nov 2012 19:26:00 +0200 Subject: CHUI-362 ADD. FIX (When the "Bring back" panel is there, it is not possible to collapse the right side of the conversation dialog: the toolbar is completely missing and the "<<" chevrons are not there): This was because the button "<<" belonged session's floater and not the container. Therefore, when all the floaters in the stack becomes invisible, their buttons also become invisible. Solution: Added additional button "<<" in the stub_panel of the container. --- indra/newview/llfloaterimcontainer.cpp | 7 +++++++ indra/newview/llfloaterimcontainer.h | 2 ++ .../skins/default/xui/en/floater_im_container.xml | 17 +++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 90ddeef5bb..39cd16acfa 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -205,6 +205,8 @@ BOOL LLFloaterIMContainer::postBuild() mExpandCollapseBtn = getChild("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onExpandCollapseButtonClicked, this)); + mStubCollapseBtn = getChild("stub_collapse_btn"); + mStubCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onStubCollapseButtonClicked, this)); childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this)); @@ -335,6 +337,11 @@ void LLFloaterIMContainer::onNewMessageReceived(const LLSD& data) } } +void LLFloaterIMContainer::onStubCollapseButtonClicked() +{ + collapseMessagesPane(true); +} + void LLFloaterIMContainer::onExpandCollapseButtonClicked() { if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed() diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 9112b54018..9cd6b9bc5d 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -109,6 +109,7 @@ private: void onNewMessageReceived(const LLSD& data); void onExpandCollapseButtonClicked(); + void onStubCollapseButtonClicked(); void processParticipantsStyleUpdate(); void collapseConversationsPane(bool collapse); @@ -147,6 +148,7 @@ private: void openNearbyChat(); LLButton* mExpandCollapseBtn; + LLButton* mStubCollapseBtn; LLPanel* mStubPanel; LLTextBox* mStubTextBox; LLLayoutPanel* mMessagesPane; diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 1388b9e474..4aa7c88312 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -134,6 +134,19 @@ left="0" height="430" width="412"> + - - Date: Wed, 28 Nov 2012 19:40:06 -0800 Subject: CHUI-552 : Fixed : Do not update the avatars sorting when updating the speaking indicator, let the conversation list do that. --- indra/newview/llfloaterimnearbychat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 7b97295703..a20fce876c 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -572,7 +572,7 @@ void LLFloaterIMNearbyChat::displaySpeakingIndicator() LLUUID id; id.setNull(); - mSpeakerMgr->update(TRUE); + mSpeakerMgr->update(FALSE); mSpeakerMgr->getSpeakerList(&speaker_list, FALSE); for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) -- cgit v1.2.3 From 611797543a917f1596be73e9e79974578748086e Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 29 Nov 2012 15:03:35 -0800 Subject: CHUI-489: Removed the 'Group Messages' checkbox. This was a design change in the spec. --- indra/newview/app_settings/settings.xml | 11 ----------- indra/newview/skins/default/xui/en/panel_preferences_chat.xml | 11 +---------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 253ac3b836..ece711a128 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6867,17 +6867,6 @@ Value 1 - PlaySoundGroupChatMessages - - Comment - Plays a sound when have a group chat message. - Persist - 1 - Type - Boolean - Value - 0 - PlaySoundIncomingVoiceCall Comment diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 0c94b6b223..37bfbae991 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -341,22 +341,13 @@ top_pad="6" name="incoming_voice_call" width="150" /> - Date: Thu, 29 Nov 2012 20:33:17 -0800 Subject: CHUI-552 : Fixed : Filter out participant creation with the same id than the session id --- indra/newview/llparticipantlist.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 9f89b5f809..6c838f8a45 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -366,8 +366,11 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer event void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) { - // Do not add if already in there or excluded for some reason - if (findParticipant(avatar_id)) return; + // Do not add if already in there, is the session id (hence not an avatar) or excluded for some reason + if (findParticipant(avatar_id) || (avatar_id == mUUID)) + { + return; + } bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id); @@ -391,7 +394,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) // *TODO : Need to update the online/offline status of the participant // Hack for this: LLAvatarTracker::instance().isBuddyOnline(avatar_id)) - + // Add the participant model to the session's children list addParticipant(participant); @@ -413,12 +416,12 @@ void LLParticipantList::adjustParticipant(const LLUUID& speaker_id) bool LLParticipantList::SpeakerAddListener::handleEvent(LLPointer event, const LLSD& userdata) { /** - * We need to filter speaking objects. These objects shouldn't appear in the list + * We need to filter speaking objects. These objects shouldn't appear in the list. * @see LLFloaterChat::addChat() in llviewermessage.cpp to get detailed call hierarchy */ const LLUUID& speaker_id = event->getValue().asUUID(); LLPointer speaker = mParent.mSpeakerMgr->findSpeaker(speaker_id); - if(speaker.isNull() || speaker->mType == LLSpeaker::SPEAKER_OBJECT) + if (speaker.isNull() || (speaker->mType == LLSpeaker::SPEAKER_OBJECT)) { return false; } -- cgit v1.2.3 From 47a1a0468156153155f5e9b6c720b9b6cb62c263 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 14:12:46 -0800 Subject: CHUI-570 : Fixed : Take the typing state when updating the title, also make refresh update less frequent (perf). --- indra/newview/llfloaterimsession.cpp | 26 +++++++++++--------------- indra/newview/llfloaterimsession.h | 1 - indra/newview/llfloaterimsessiontab.cpp | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index e1dc5b91d0..0162b0ecd0 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -66,7 +66,6 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) : LLFloaterIMSessionTab(session_id), mLastMessageIndex(-1), mDialog(IM_NOTHING_SPECIAL), - mSavedTitle(), mTypingStart(), mShouldSendTypingState(false), mMeTyping(false), @@ -504,9 +503,13 @@ void LLFloaterIMSession::onVoiceChannelStateChanged( void LLFloaterIMSession::updateSessionName(const std::string& name) { - LLFloaterIMSessionTab::updateSessionName(name); - setTitle(name); - mTypingStart.setArg("[NAME]", name); + if (!name.empty()) + { + LLFloaterIMSessionTab::updateSessionName(name); + mTypingStart.setArg("[NAME]", name); + setTitle (mOtherTyping ? mTypingStart.getString() : name); + } + llinfos << "Merov debug : updateSessionName, title = " << name << ", typing title = " << mTypingStart.getString() << llendl; } //static @@ -1095,14 +1098,10 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) void LLFloaterIMSession::addTypingIndicator(const LLIMInfo* im_info) { // We may have lost a "stop-typing" packet, don't add it twice - if ( im_info && !mOtherTyping ) + if (im_info && !mOtherTyping) { mOtherTyping = true; - // Save and set new title - mSavedTitle = getTitle(); - setTitle (mTypingStart); - // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); if ( speaker_mgr ) @@ -1114,18 +1113,15 @@ void LLFloaterIMSession::addTypingIndicator(const LLIMInfo* im_info) void LLFloaterIMSession::removeTypingIndicator(const LLIMInfo* im_info) { - if ( mOtherTyping ) + if (mOtherTyping) { mOtherTyping = false; - // Revert the title to saved one - setTitle(mSavedTitle); - - if ( im_info ) + if (im_info) { // Update speaker LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionID); - if ( speaker_mgr ) + if (speaker_mgr) { speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); } diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index f4ec2d457d..72a320041f 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -174,7 +174,6 @@ private: LLUUID mOtherParticipantUUID; bool mPositioned; - std::string mSavedTitle; LLUIString mTypingStart; bool mMeTyping; bool mOtherTyping; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6e58a66bcd..d43381041b 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -43,7 +43,7 @@ #include "lltoolbarview.h" #include "llfloaterimnearbychat.h" -const F32 REFRESH_INTERVAL = 0.2f; +const F32 REFRESH_INTERVAL = 1.0f; LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) : LLTransientDockableFloater(NULL, true, session_id) -- cgit v1.2.3 From eab0ec402e7ea1eb151408b913c6f4e14c9c8cbe Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 14:34:23 -0800 Subject: CHUI-570 : Delete a stray debug comment log. --- indra/newview/llfloaterimsession.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 0162b0ecd0..212b0df712 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -509,7 +509,6 @@ void LLFloaterIMSession::updateSessionName(const std::string& name) mTypingStart.setArg("[NAME]", name); setTitle (mOtherTyping ? mTypingStart.getString() : name); } - llinfos << "Merov debug : updateSessionName, title = " << name << ", typing title = " << mTypingStart.getString() << llendl; } //static -- cgit v1.2.3 From e53577c32db1a8d5e7e15cb33357c68da87acc44 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 17:12:52 -0800 Subject: CHUI-404, CHUI-406 : Fixed : update ad-hoc conversation when participant logs off, update title of ad-hoc and P2P to be consistent with torn off and input field --- indra/newview/llconversationmodel.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0837a49095..ba92022673 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" +#include "llagent.h" #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" @@ -161,8 +162,8 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) { - // We modify the session name only in the case of an ad-hoc session, exit otherwise (nothing to do) - if (getType() != CONV_SESSION_AD_HOC) + // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) + if ((getType() != CONV_SESSION_AD_HOC) && (getType() != CONV_SESSION_1_ON_1)) { return; } @@ -171,26 +172,26 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } - // Build a string containing the participants names and check if ready for display (we don't want "(waiting)" in there) - bool all_names_resolved = true; + // Build a string containing the participants names (minus own agent) and check if ready for display (we don't want "(waiting)" in there) + // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by + // onAvatarNameCache() which is itself attached to the same event. uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string child_list_t::iterator iter = mChildren.begin(); while (iter != mChildren.end()) { LLConversationItemParticipant* current_participant = dynamic_cast(*iter); - temp_uuids.push_back(current_participant->getUUID()); - LLAvatarName av_name; - if (!LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) - { - // If the name is not in the cache yet, bail out - // Note: we don't bind ourselves to the LLAvatarNameCache event as we are called by - // onAvatarNameCache() which is itself attached to the same event. - all_names_resolved = false; - break; + // Add the avatar uuid to the list (except if it's the own agent uuid) + if (current_participant->getUUID() != gAgentID) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + { + temp_uuids.push_back(current_participant->getUUID()); + } } iter++; } - if (all_names_resolved) + if (temp_uuids.size() != 0) { std::string new_session_name; LLAvatarActions::buildResidentsString(temp_uuids, new_session_name); @@ -203,6 +204,7 @@ void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* { removeChild(participant); mNeedsRefresh = true; + updateParticipantName(participant); postEvent("remove_participant", this, participant); } -- cgit v1.2.3 From d48357f54765f84a35b73bbf28e88b978bcb5013 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 30 Nov 2012 19:07:58 -0800 Subject: CHUI-406 : Fixed again : Update of the P2P session name when not initiating a session was wrong. Add getting the participant name from the session. --- indra/newview/llconversationmodel.cpp | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index ba92022673..728b1a3f4c 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -31,6 +31,7 @@ #include "llavatarnamecache.h" #include "llavataractions.h" #include "llevents.h" +#include "llfloaterimsession.h" #include "llsdutil.h" #include "llconversationmodel.h" #include "llimview.h" //For LLIMModel @@ -162,8 +163,9 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) { + EConversationType conversation_type = getType(); // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) - if ((getType() != CONV_SESSION_AD_HOC) && (getType() != CONV_SESSION_1_ON_1)) + if ((conversation_type != CONV_SESSION_AD_HOC) && (conversation_type != CONV_SESSION_1_ON_1)) { return; } @@ -172,24 +174,35 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } - // Build a string containing the participants names (minus own agent) and check if ready for display (we don't want "(waiting)" in there) - // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by - // onAvatarNameCache() which is itself attached to the same event. uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string - child_list_t::iterator iter = mChildren.begin(); - while (iter != mChildren.end()) + if (conversation_type == CONV_SESSION_AD_HOC) { - LLConversationItemParticipant* current_participant = dynamic_cast(*iter); - // Add the avatar uuid to the list (except if it's the own agent uuid) - if (current_participant->getUUID() != gAgentID) + // Build a string containing the participants UUIDs (minus own agent) and check if ready for display (we don't want "(waiting)" in there) + // Note: we don't bind ourselves to the LLAvatarNameCache event as updateParticipantName() is called by + // onAvatarNameCache() which is itself attached to the same event. + child_list_t::iterator iter = mChildren.begin(); + while (iter != mChildren.end()) { - LLAvatarName av_name; - if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + LLConversationItemParticipant* current_participant = dynamic_cast(*iter); + // Add the avatar uuid to the list (except if it's the own agent uuid) + if (current_participant->getUUID() != gAgentID) { - temp_uuids.push_back(current_participant->getUUID()); + LLAvatarName av_name; + if (LLAvatarNameCache::get(current_participant->getUUID(), &av_name)) + { + temp_uuids.push_back(current_participant->getUUID()); + } } + iter++; } - iter++; + } + else if (conversation_type == CONV_SESSION_1_ON_1) + { + // In the case of a P2P conversersation, we need to grab the name of the other participant in the session instance itself + // as we do not create participants for such a session. + LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(mUUID); + LLUUID participantID = conversationFloater->getOtherParticipantUUID(); + temp_uuids.push_back(participantID); } if (temp_uuids.size() != 0) { -- cgit v1.2.3 From 168c1d5a85e8f4f4975ee4501e3dbb8f10d85334 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 3 Dec 2012 15:37:11 +0200 Subject: CHUI-432 (User that is muted in group call does not show as muted to other users in conversation list) --- indra/newview/llconversationview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 1b1d61e6d6..7988cd1a03 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -448,6 +448,7 @@ void LLConversationViewParticipant::draw() drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); drawLabel(font, text_left, y, color, right_x); + refresh(); LLView::draw(); } -- cgit v1.2.3 From f888a3fd00ca32275ab2da6437cb011b3ab78f89 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Mon, 3 Dec 2012 16:21:48 +0200 Subject: CHUI-556 (Tooltip on call button incorrect when call is active) --- indra/newview/llfloaterimsessiontab.cpp | 7 ++++++- indra/newview/skins/default/xui/en/floater_im_session.xml | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d43381041b..08c2b951df 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -691,8 +691,13 @@ void LLFloaterIMSessionTab::processChatHistoryStyleUpdate() void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive) { - getChild("voice_call_btn")->setImageOverlay( + LLButton* voiceButton = getChild("voice_call_btn"); + voiceButton->setImageOverlay( callIsActive? getString("call_btn_stop") : getString("call_btn_start")); + + voiceButton->setToolTip( + callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip")); + enableDisableCallBtn(); } diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 1d74f1bc25..faf54774f6 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -43,6 +43,12 @@ + + Date: Mon, 3 Dec 2012 19:20:11 +0200 Subject: CHUI-532 FIXED (Viewer crash when user in conversation is removed from participant list because they logged out or teleported away) delayed destroy of the timer --- indra/llui/llbutton.cpp | 2 +- indra/llui/llflashtimer.cpp | 9 ++++++++- indra/llui/llflashtimer.h | 6 ++++++ indra/newview/llconversationview.cpp | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 97547208ec..f82cdc64a9 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -286,7 +286,7 @@ LLButton::~LLButton() if (mFlashingTimer) { - delete mFlashingTimer; + mFlashingTimer->unset(); } } diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index de7a4ab265..e49628acd5 100644 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -35,6 +35,7 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) , mCurrentTickCount(0) , mIsFlashingInProgress(false) , mIsCurrentlyHighlighted(false) + , mUnset(false) { mEventTimer.stop(); @@ -48,6 +49,12 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) } } +void LLFlashTimer::unset() +{ + mUnset = true; + mCallback = NULL; +} + BOOL LLFlashTimer::tick() { mIsCurrentlyHighlighted = !mIsCurrentlyHighlighted; @@ -62,7 +69,7 @@ BOOL LLFlashTimer::tick() stopFlashing(); } - return FALSE; + return mUnset; } void LLFlashTimer::startFlashing() diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index 5c8860b097..c60f99a8ea 100644 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -52,6 +52,11 @@ public: bool isFlashingInProgress(); bool isCurrentlyHighlighted(); + /* + * Use this instead of deleting this object. + * The next call to tick() will return true and that will destroy this object. + */ + void unset(); private: callback_t mCallback; @@ -62,6 +67,7 @@ private: S32 mCurrentTickCount; bool mIsCurrentlyHighlighted; bool mIsFlashingInProgress; + bool mUnset; }; #endif /* LL_FLASHTIMER_H */ diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 1b1d61e6d6..40900dce54 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -95,7 +95,7 @@ LLConversationViewSession::~LLConversationViewSession() LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver); } - delete mFlashTimer; + mFlashTimer->unset(); } bool LLConversationViewSession::isHighlightAllowed() -- cgit v1.2.3 From 2ee6bcab371a08791bccad3a4fa072c1d60cd6c9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 3 Dec 2012 16:19:46 -0800 Subject: CHUI-571: Now when the 'Chat Preference' is set to 'Open Conversations window' the conversation line item with flash. The only time it does not flash is when the the conversation line item is already focused. Also fixed various focusing bugs when navigating between conversations and participants. --- indra/llui/llfolderviewitem.cpp | 7 ++++++- indra/newview/llconversationview.cpp | 18 ++++++++++++++---- indra/newview/llfloaterimcontainer.cpp | 26 +++++++++++++++++--------- indra/newview/llfloaterimnearbychathandler.cpp | 5 ----- indra/newview/llfloaterimsessiontab.cpp | 2 +- indra/newview/llimview.cpp | 6 ++++++ 6 files changed, 44 insertions(+), 20 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 261f53d6b6..9b54a7a467 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -501,7 +501,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) // No handler needed for focus lost since this class has no // state that depends on it. gFocusMgr.setMouseCapture( this ); - + if (!mIsSelected) { if(mask & MASK_CONTROL) @@ -518,6 +518,11 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) } make_ui_sound("UISndClick"); } + //Just re-select the item since it is clicked without ctrl or shift + else if(!(mask & (MASK_CONTROL | MASK_SHIFT))) + { + getRoot()->setSelection(this, FALSE); + } else { mSelectPending = TRUE; diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 1b1d61e6d6..a696fbdb47 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -218,9 +218,15 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) { LLConversationItem* item = dynamic_cast(getViewModelItem()); LLUUID session_id = item? item->getUUID() : LLUUID(); + //Will try to select a child node and then itself (if a child was not selected) BOOL result = LLFolderViewFolder::handleMouseDown(x, y, mask); - (LLFloaterReg::getTypedInstance("im_container"))-> - selectConversationPair(session_id, false); + + //This node (conversation) was selected and a child (participant) was not + if(result && getRoot()->getCurSelectedItem() == this) + { + (LLFloaterReg::getTypedInstance("im_container"))-> + selectConversationPair(session_id, false); + } return result; } @@ -548,8 +554,12 @@ BOOL LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask ) } LLUUID session_id = item? item->getUUID() : LLUUID(); BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask); - (LLFloaterReg::getTypedInstance("im_container"))-> - selectConversationPair(session_id, false); + + if(result) + { + (LLFloaterReg::getTypedInstance("im_container"))-> + selectConversationPair(session_id, false); + } return result; } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index a04b8d79d6..3a80491dae 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1165,21 +1165,16 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id) selectConversation(session_id); } -// Will select only the conversation item void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) { - LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id); - if (widget) - { - (widget->getRoot())->setSelection(widget, FALSE, FALSE); + selectConversationPair(session_id, true); } -} - // Synchronous select the conversation item and the conversation floater BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget) { BOOL handled = TRUE; + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); /* widget processing */ if (select_widget) @@ -1198,7 +1193,7 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool // Store the active session setSelectedSession(session_id); - LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + if (session_floater->getHost()) { @@ -1207,13 +1202,13 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool // Switch to the conversation floater that is being selected selectFloater(session_floater); } + } // Set the focus on the selected floater if (!session_floater->hasFocus()) { session_floater->setFocus(TRUE); } - } return handled; } @@ -1627,13 +1622,26 @@ void LLFloaterIMContainer::reSelectConversation() void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes) { + //Finds the conversation line item to flash using the session_id LLConversationViewSession * widget = dynamic_cast(get_ptr_in_map(mConversationsWidgets,session_id)); + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + if (widget) { + //Start flash if (is_flashes) { + //Only flash when conversation is not active + if(session_floater + && (!session_floater->isInVisibleChain()) //conversation floater not displayed + || + (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus + + { widget->getFlashTimer()->startFlashing(); } + } + //Stop flash else { widget->getFlashTimer()->stopFlashing(); diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index d9c461e836..903c903381 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -619,11 +619,6 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, chat["message"] = toast_msg; channel->addChat(chat); } - //Will show Conversations floater when chat preference is set - else if(gSavedSettings.getString("NotificationNearbyChatOptions") == "openconversations") - { - LLFloaterReg::showInstance("im_container"); - } } } diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6e58a66bcd..efc7be6dd6 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -306,7 +306,7 @@ void LLFloaterIMSessionTab::onFocusReceived() LLFloaterIMContainer* container = LLFloaterReg::getTypedInstance("im_container"); if (container) { - container->selectConversationPair(mSessionID, true); + container->selectConversationPair(mSessionID, ! getHost()); container->showStub(! getHost()); } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e5dda7e8d8..b6fd3ec9c8 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -191,6 +191,12 @@ void on_new_message(const LLSD& msg) } else if("openconversations" == action) { + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); + if (im_box) + { + im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item + } + LLFloaterReg::showInstance("im_container"); } } -- cgit v1.2.3 From f1155c4fa5e9a4eaa5b4d452fc46a2246fb305bd Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 4 Dec 2012 04:14:51 +0200 Subject: CHUI-573 FIXED Notification chiclet shown when object chiclets are shown --- indra/newview/llchiclet.cpp | 882 +-------------------- indra/newview/llchiclet.h | 555 +------------ indra/newview/llchicletbar.cpp | 104 +-- indra/newview/llchicletbar.h | 16 - indra/newview/llfloaterimsession.cpp | 10 +- indra/newview/llscriptfloater.cpp | 121 ++- indra/newview/llsyswellwindow.cpp | 289 +------ indra/newview/llsyswellwindow.h | 66 +- .../default/textures/bottomtray/Notices_Unread.png | Bin 3693 -> 0 bytes .../textures/bottomtray/VoicePTT_Lvl1_Dark.png | Bin 602 -> 0 bytes .../textures/bottomtray/VoicePTT_Lvl2_Dark.png | Bin 669 -> 0 bytes .../textures/bottomtray/VoicePTT_Lvl3_Dark.png | Bin 639 -> 0 bytes .../textures/bottomtray/VoicePTT_Off_Dark.png | Bin 547 -> 0 bytes .../textures/bottomtray/VoicePTT_On_Dark.png | Bin 526 -> 0 bytes indra/newview/skins/default/textures/textures.xml | 8 - .../skins/default/xui/da/menu_im_well_button.xml | 4 - .../xui/da/menu_notification_well_button.xml | 4 - .../skins/default/xui/de/menu_im_well_button.xml | 4 - .../xui/de/menu_notification_well_button.xml | 4 - .../xui/en/menu_notification_well_button.xml | 16 - .../skins/default/xui/en/panel_activeim_row.xml | 97 --- .../skins/default/xui/en/panel_chiclet_bar.xml | 44 - .../default/xui/en/widgets/chiclet_im_adhoc.xml | 55 -- .../default/xui/en/widgets/chiclet_im_group.xml | 56 -- .../default/xui/en/widgets/chiclet_im_p2p.xml | 56 -- .../skins/default/xui/es/menu_im_well_button.xml | 4 - .../xui/es/menu_notification_well_button.xml | 4 - .../skins/default/xui/fr/menu_im_well_button.xml | 4 - .../xui/fr/menu_notification_well_button.xml | 4 - .../skins/default/xui/it/menu_im_well_button.xml | 4 - .../xui/it/menu_notification_well_button.xml | 4 - .../skins/default/xui/ja/menu_im_well_button.xml | 4 - .../xui/ja/menu_notification_well_button.xml | 4 - .../skins/default/xui/pl/menu_im_well_button.xml | 4 - .../xui/pl/menu_notification_well_button.xml | 4 - .../skins/default/xui/pt/menu_im_well_button.xml | 4 - .../xui/pt/menu_notification_well_button.xml | 4 - .../skins/default/xui/ru/menu_im_well_button.xml | 4 - .../xui/ru/menu_notification_well_button.xml | 4 - .../skins/default/xui/tr/menu_im_well_button.xml | 4 - .../xui/tr/menu_notification_well_button.xml | 4 - .../skins/default/xui/zh/menu_im_well_button.xml | 4 - .../xui/zh/menu_notification_well_button.xml | 4 - 43 files changed, 100 insertions(+), 2363 deletions(-) delete mode 100644 indra/newview/skins/default/textures/bottomtray/Notices_Unread.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png delete mode 100644 indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png delete mode 100644 indra/newview/skins/default/xui/da/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/da/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/de/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/de/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/en/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/en/panel_activeim_row.xml delete mode 100644 indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml delete mode 100644 indra/newview/skins/default/xui/en/widgets/chiclet_im_group.xml delete mode 100644 indra/newview/skins/default/xui/en/widgets/chiclet_im_p2p.xml delete mode 100644 indra/newview/skins/default/xui/es/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/es/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/fr/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/fr/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/it/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/it/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/ja/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/ja/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/pl/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/pl/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/pt/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/pt/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/ru/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/ru/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/tr/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/tr/menu_notification_well_button.xml delete mode 100644 indra/newview/skins/default/xui/zh/menu_im_well_button.xml delete mode 100644 indra/newview/skins/default/xui/zh/menu_notification_well_button.xml diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index a665aeb6bd..1acbdd32b7 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -27,35 +27,15 @@ #include "llviewerprecompiledheaders.h" // must be first include #include "llchiclet.h" -#include "llagent.h" -#include "llavataractions.h" -#include "llchicletbar.h" -#include "lleventtimer.h" -#include "llgroupactions.h" -#include "lliconctrl.h" #include "llfloaterimsession.h" #include "llfloaterimcontainer.h" -#include "llimview.h" #include "llfloaterreg.h" #include "lllocalcliprect.h" -#include "llmenugl.h" #include "llnotifications.h" -#include "llnotificationsutil.h" -#include "lloutputmonitorctrl.h" #include "llscriptfloater.h" -#include "llspeakers.h" -#include "lltextbox.h" -#include "llvoiceclient.h" -#include "llgroupmgr.h" -#include "llnotificationmanager.h" -#include "lltransientfloatermgr.h" -#include "llsyswellwindow.h" +#include "llsingleton.h" static LLDefaultChildRegistry::Register t1("chiclet_panel"); -static LLDefaultChildRegistry::Register t2("chiclet_notification"); -static LLDefaultChildRegistry::Register t3("chiclet_im_p2p"); -static LLDefaultChildRegistry::Register t4("chiclet_im_group"); -static LLDefaultChildRegistry::Register t5("chiclet_im_adhoc"); static LLDefaultChildRegistry::Register t6("chiclet_script"); static LLDefaultChildRegistry::Register t7("chiclet_offer"); @@ -66,192 +46,6 @@ boost::signals2::signal(button_params); - addChild(mButton); - - - mFlashToLitTimer = new LLFlashTimer(boost::bind(&LLSysWellChiclet::changeLitState, this, _1)); -} - -LLSysWellChiclet::~LLSysWellChiclet() -{ - delete mFlashToLitTimer; -} - -void LLSysWellChiclet::setCounter(S32 counter) -{ - // do nothing if the same counter is coming. EXT-3678. - if (counter == mCounter) return; - - // note same code in LLChicletNotificationCounterCtrl::setCounter(S32 counter) - std::string s_count; - if(counter != 0) - { - static std::string more_messages_exist("+"); - std::string more_messages(counter > mMaxDisplayedCount ? more_messages_exist : ""); - s_count = llformat("%d%s" - , llmin(counter, mMaxDisplayedCount) - , more_messages.c_str() - ); - } - - mButton->setLabel(s_count); - - mCounter = counter; -} - -boost::signals2::connection LLSysWellChiclet::setClickCallback( - const commit_callback_t& cb) -{ - return mButton->setClickedCallback(cb); -} - -void LLSysWellChiclet::setToggleState(BOOL toggled) { - mButton->setToggleState(toggled); -} - -void LLSysWellChiclet::changeLitState(bool blink) -{ - setNewMessagesState(!mIsNewMessagesState); -} - -void LLSysWellChiclet::setNewMessagesState(bool new_messages) -{ - /* - Emulate 4 states of button by background images, see detains in EXT-3147 - xml attribute Description - image_unselected "Unlit" - there are no new messages - image_selected "Unlit" + "Selected" - there are no new messages and the Well is open - image_pressed "Lit" - there are new messages - image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open - */ - mButton->setForcePressedState(new_messages); - - mIsNewMessagesState = new_messages; -} - -void LLSysWellChiclet::updateWidget(bool is_window_empty) -{ - mButton->setEnabled(!is_window_empty); - - if (LLChicletBar::instanceExists()) - { - LLChicletBar::getInstance()->showWellButton(getName(), !is_window_empty); - } -} -// virtual -BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - if(!mContextMenu) - { - createMenu(); - } - if (mContextMenu) - { - mContextMenu->show(x, y); - LLMenuGL::showPopup(this, mContextMenu, x, y); - } - return TRUE; -} - -/************************************************************************/ -/* LLNotificationChiclet implementation */ -/************************************************************************/ -LLNotificationChiclet::LLNotificationChiclet(const Params& p) -: LLSysWellChiclet(p), - mUreadSystemNotifications(0) -{ - mNotificationChannel.reset(new ChicletNotificationChannel(this)); - // ensure that notification well window exists, to synchronously - // handle toast add/delete events. - LLNotificationWellWindow::getInstance()->setSysWellChiclet(this); -} - -void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data) -{ - std::string action = user_data.asString(); - if("close all" == action) - { - LLNotificationWellWindow::getInstance()->closeAll(); - } -} - -bool LLNotificationChiclet::enableMenuItem(const LLSD& user_data) -{ - std::string item = user_data.asString(); - if (item == "can close all") - { - return mUreadSystemNotifications != 0; - } - return true; -} - -void LLNotificationChiclet::createMenu() -{ - if(mContextMenu) - { - llwarns << "Menu already exists" << llendl; - return; - } - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - registrar.add("NotificationWellChicletMenu.Action", - boost::bind(&LLNotificationChiclet::onMenuItemClicked, this, _2)); - - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; - enable_registrar.add("NotificationWellChicletMenu.EnableItem", - boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2)); - - mContextMenu = LLUICtrlFactory::getInstance()->createFromFile - ("menu_notification_well_button.xml", - LLMenuGL::sMenuContainer, - LLViewerMenuHolderGL::child_registry_t::instance()); -} - -/*virtual*/ -void LLNotificationChiclet::setCounter(S32 counter) -{ - LLSysWellChiclet::setCounter(counter); - updateWidget(getCounter() == 0); - -} - -bool LLNotificationChiclet::ChicletNotificationChannel::filterNotification( LLNotificationPtr notification ) -{ - if( !(notification->canLogToIM() && notification->hasFormElements()) - && (!notification->getPayload().has("give_inventory_notification") - || notification->getPayload()["give_inventory_notification"])) - { - return true; - } - return false; -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - LLChiclet::Params::Params() : show_counter("show_counter", true) , enable_counter("enable_counter", false) @@ -303,7 +97,9 @@ LLSD LLChiclet::getValue() const void LLChiclet::setValue(const LLSD& value) { if(value.isUUID()) + { setSessionId(value.asUUID()); + } } ////////////////////////////////////////////////////////////////////////// @@ -315,12 +111,9 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p) , mShowSpeaker(false) , mDefaultWidth(p.rect().getWidth()) , mNewMessagesIcon(NULL) -, mSpeakerCtrl(NULL) -, mCounterCtrl(NULL) , mChicletButton(NULL) , mPopupMenu(NULL) { - enableCounterControl(p.enable_counter); } /* virtual*/ @@ -331,107 +124,14 @@ BOOL LLIMChiclet::postBuild() mChicletButton->setDoubleClickCallback(boost::bind(&LLIMChiclet::onMouseDown, this)); return TRUE; } -void LLIMChiclet::setShowSpeaker(bool show) -{ - bool needs_resize = getShowSpeaker() != show; - if(needs_resize) - { - mShowSpeaker = show; - } - - toggleSpeakerControl(); -} - -void LLIMChiclet::enableCounterControl(bool enable) -{ - mCounterEnabled = enable; - if(!enable) - { - LLChiclet::setShowCounter(false); - } -} - -void LLIMChiclet::setShowCounter(bool show) -{ - if(!mCounterEnabled) - { - return; - } - - bool needs_resize = getShowCounter() != show; - if(needs_resize) - { - LLChiclet::setShowCounter(show); - toggleCounterControl(); - } -} - -void LLIMChiclet::initSpeakerControl() -{ - // virtual -} void LLIMChiclet::setRequiredWidth() { - bool show_speaker = getShowSpeaker(); - bool show_counter = getShowCounter(); S32 required_width = mDefaultWidth; - - if (show_counter) - { - required_width += mCounterCtrl->getRect().getWidth(); - } - if (show_speaker) - { - required_width += mSpeakerCtrl->getRect().getWidth(); - } - reshape(required_width, getRect().getHeight()); - onChicletSizeChanged(); } -void LLIMChiclet::toggleSpeakerControl() -{ - if(getShowSpeaker()) - { - // move speaker to the right of chiclet icon - LLRect speaker_rc = mSpeakerCtrl->getRect(); - speaker_rc.setLeftTopAndSize(mDefaultWidth, speaker_rc.mTop, speaker_rc.getWidth(), speaker_rc.getHeight()); - mSpeakerCtrl->setRect(speaker_rc); - - if(getShowCounter()) - { - // move speaker to the right of counter - mSpeakerCtrl->translate(mCounterCtrl->getRect().getWidth(), 0); - } - - initSpeakerControl(); - } - - setRequiredWidth(); - mSpeakerCtrl->setSpeakerId(LLUUID::null); - mSpeakerCtrl->setVisible(getShowSpeaker()); -} - -void LLIMChiclet::setCounter(S32 counter) -{ - if (mCounterCtrl->getCounter() == counter) - { - return; - } - - mCounterCtrl->setCounter(counter); - setShowCounter(counter); - setShowNewMessagesIcon(counter); -} - -void LLIMChiclet::toggleCounterControl() -{ - setRequiredWidth(); - mCounterCtrl->setVisible(getShowCounter()); -} - void LLIMChiclet::setShowNewMessagesIcon(bool show) { if(mNewMessagesIcon) @@ -449,7 +149,6 @@ bool LLIMChiclet::getShowNewMessagesIcon() void LLIMChiclet::onMouseDown() { LLFloaterIMSession::toggle(getSessionId()); - setCounter(0); } void LLIMChiclet::setToggleState(bool toggle) @@ -457,52 +156,6 @@ void LLIMChiclet::setToggleState(bool toggle) mChicletButton->setToggleState(toggle); } -void LLIMChiclet::draw() -{ - LLUICtrl::draw(); -} - -// static -LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id) -{ - EType type = TYPE_UNKNOWN; - - if(session_id.isNull()) - return type; - - EInstantMessage im_type = LLIMModel::getInstance()->getType(session_id); - if (IM_COUNT == im_type) - { - llassert_always(0 && "IM session not found"); // should never happen - return type; - } - - switch(im_type) - { - case IM_NOTHING_SPECIAL: - case IM_SESSION_P2P_INVITE: - type = TYPE_IM; - break; - case IM_SESSION_GROUP_START: - case IM_SESSION_INVITE: - if (gAgent.isInGroup(session_id)) - { - type = TYPE_GROUP; - } - else - { - type = TYPE_AD_HOC; - } - break; - case IM_SESSION_CONFERENCE_START: - type = TYPE_AD_HOC; - default: - break; - } - - return type; -} - BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { if(!mPopupMenu) @@ -534,382 +187,6 @@ bool LLIMChiclet::canCreateMenu() return true; } -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLIMP2PChiclet::Params::Params() -: avatar_icon("avatar_icon") -, chiclet_button("chiclet_button") -, unread_notifications("unread_notifications") -, speaker("speaker") -, new_message_icon("new_message_icon") -, show_speaker("show_speaker") -{ -} - -LLIMP2PChiclet::LLIMP2PChiclet(const Params& p) -: LLIMChiclet(p) -, mChicletIconCtrl(NULL) -{ - LLButton::Params button_params = p.chiclet_button; - mChicletButton = LLUICtrlFactory::create(button_params); - addChild(mChicletButton); - - LLIconCtrl::Params new_msg_params = p.new_message_icon; - mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); - addChild(mNewMessagesIcon); - - LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon; - mChicletIconCtrl = LLUICtrlFactory::create(avatar_params); - addChild(mChicletIconCtrl); - - LLChicletNotificationCounterCtrl::Params unread_params = p.unread_notifications; - mCounterCtrl = LLUICtrlFactory::create(unread_params); - addChild(mCounterCtrl); - - setCounter(getCounter()); - setShowCounter(getShowCounter()); - - LLChicletSpeakerCtrl::Params speaker_params = p.speaker; - mSpeakerCtrl = LLUICtrlFactory::create(speaker_params); - addChild(mSpeakerCtrl); - - sendChildToFront(mNewMessagesIcon); - setShowSpeaker(p.show_speaker); -} - -void LLIMP2PChiclet::initSpeakerControl() -{ - mSpeakerCtrl->setSpeakerId(getOtherParticipantId()); -} - -void LLIMP2PChiclet::setOtherParticipantId(const LLUUID& other_participant_id) -{ - LLIMChiclet::setOtherParticipantId(other_participant_id); - mChicletIconCtrl->setValue(getOtherParticipantId()); -} - -void LLIMP2PChiclet::updateMenuItems() -{ - if(!mPopupMenu) - return; - if(getSessionId().isNull()) - return; - - LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(getSessionId()); - bool open_window_exists = open_im_floater && open_im_floater->getVisible(); - mPopupMenu->getChild("Send IM")->setEnabled(!open_window_exists); - - bool is_friend = LLAvatarActions::isFriend(getOtherParticipantId()); - mPopupMenu->getChild("Add Friend")->setEnabled(!is_friend); -} - -void LLIMP2PChiclet::createPopupMenu() -{ - if(!canCreateMenu()) - return; - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - registrar.add("IMChicletMenu.Action", boost::bind(&LLIMP2PChiclet::onMenuItemClicked, this, _2)); - - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile - ("menu_imchiclet_p2p.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -} - -void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data) -{ - std::string level = user_data.asString(); - LLUUID other_participant_id = getOtherParticipantId(); - - if("profile" == level) - { - LLAvatarActions::showProfile(other_participant_id); - } - else if("im" == level) - { - LLAvatarActions::startIM(other_participant_id); - } - else if("add" == level) - { - LLAvatarActions::requestFriendshipDialog(other_participant_id); - } - else if("end" == level) - { - LLAvatarActions::endIM(other_participant_id); - } -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLAdHocChiclet::Params::Params() -: avatar_icon("avatar_icon") -, chiclet_button("chiclet_button") -, unread_notifications("unread_notifications") -, speaker("speaker") -, new_message_icon("new_message_icon") -, show_speaker("show_speaker") -, avatar_icon_color("avatar_icon_color", LLColor4::green) -{ -} - -LLAdHocChiclet::LLAdHocChiclet(const Params& p) -: LLIMChiclet(p) -, mChicletIconCtrl(NULL) -{ - LLButton::Params button_params = p.chiclet_button; - mChicletButton = LLUICtrlFactory::create(button_params); - addChild(mChicletButton); - - LLIconCtrl::Params new_msg_params = p.new_message_icon; - mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); - addChild(mNewMessagesIcon); - - LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon; - mChicletIconCtrl = LLUICtrlFactory::create(avatar_params); - //Make the avatar modified - mChicletIconCtrl->setColor(p.avatar_icon_color); - addChild(mChicletIconCtrl); - - LLChicletNotificationCounterCtrl::Params unread_params = p.unread_notifications; - mCounterCtrl = LLUICtrlFactory::create(unread_params); - addChild(mCounterCtrl); - - setCounter(getCounter()); - setShowCounter(getShowCounter()); - - LLChicletSpeakerCtrl::Params speaker_params = p.speaker; - mSpeakerCtrl = LLUICtrlFactory::create(speaker_params); - addChild(mSpeakerCtrl); - - sendChildToFront(mNewMessagesIcon); - setShowSpeaker(p.show_speaker); -} - -void LLAdHocChiclet::setSessionId(const LLUUID& session_id) -{ - LLChiclet::setSessionId(session_id); - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id); - mChicletIconCtrl->setValue(im_session->mOtherParticipantID); -} - -void LLAdHocChiclet::draw() -{ - switchToCurrentSpeaker(); - LLIMChiclet::draw(); -} - -void LLAdHocChiclet::initSpeakerControl() -{ - switchToCurrentSpeaker(); -} - -void LLAdHocChiclet::switchToCurrentSpeaker() -{ - LLUUID speaker_id; - LLSpeakerMgr::speaker_list_t speaker_list; - - LLIMModel::getInstance()->findIMSession(getSessionId())->mSpeakers->getSpeakerList(&speaker_list, FALSE); - for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) - { - LLPointer s = *i; - if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING) - { - speaker_id = s->mID; - break; - } - } - - mSpeakerCtrl->setSpeakerId(speaker_id); -} - -void LLAdHocChiclet::createPopupMenu() -{ - if(!canCreateMenu()) - return; - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - registrar.add("IMChicletMenu.Action", boost::bind(&LLAdHocChiclet::onMenuItemClicked, this, _2)); - - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile - ("menu_imchiclet_adhoc.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -} - -void LLAdHocChiclet::onMenuItemClicked(const LLSD& user_data) -{ - std::string level = user_data.asString(); - LLUUID group_id = getSessionId(); - - if("end" == level) - { - LLGroupActions::endIM(group_id); - } -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLIMGroupChiclet::Params::Params() -: group_icon("group_icon") -, chiclet_button("chiclet_button") -, unread_notifications("unread_notifications") -, speaker("speaker") -, new_message_icon("new_message_icon") -, show_speaker("show_speaker") -{ -} - -LLIMGroupChiclet::LLIMGroupChiclet(const Params& p) -: LLIMChiclet(p) -, LLGroupMgrObserver(LLUUID::null) -, mChicletIconCtrl(NULL) -{ - LLButton::Params button_params = p.chiclet_button; - mChicletButton = LLUICtrlFactory::create(button_params); - addChild(mChicletButton); - - LLIconCtrl::Params new_msg_params = p.new_message_icon; - mNewMessagesIcon = LLUICtrlFactory::create(new_msg_params); - addChild(mNewMessagesIcon); - - LLChicletGroupIconCtrl::Params avatar_params = p.group_icon; - mChicletIconCtrl = LLUICtrlFactory::create(avatar_params); - addChild(mChicletIconCtrl); - - LLChicletNotificationCounterCtrl::Params unread_params = p.unread_notifications; - mCounterCtrl = LLUICtrlFactory::create(unread_params); - addChild(mCounterCtrl); - - setCounter(getCounter()); - setShowCounter(getShowCounter()); - - LLChicletSpeakerCtrl::Params speaker_params = p.speaker; - mSpeakerCtrl = LLUICtrlFactory::create(speaker_params); - addChild(mSpeakerCtrl); - - sendChildToFront(mNewMessagesIcon); - setShowSpeaker(p.show_speaker); -} - -LLIMGroupChiclet::~LLIMGroupChiclet() -{ - LLGroupMgr::getInstance()->removeObserver(this); -} - -void LLIMGroupChiclet::draw() -{ - if(getShowSpeaker()) - { - switchToCurrentSpeaker(); - } - LLIMChiclet::draw(); -} - -void LLIMGroupChiclet::initSpeakerControl() -{ - switchToCurrentSpeaker(); -} - -void LLIMGroupChiclet::switchToCurrentSpeaker() -{ - LLUUID speaker_id; - LLSpeakerMgr::speaker_list_t speaker_list; - - LLIMModel::getInstance()->findIMSession(getSessionId())->mSpeakers->getSpeakerList(&speaker_list, FALSE); - for (LLSpeakerMgr::speaker_list_t::iterator i = speaker_list.begin(); i != speaker_list.end(); ++i) - { - LLPointer s = *i; - if (s->mSpeechVolume > 0 || s->mStatus == LLSpeaker::STATUS_SPEAKING) - { - speaker_id = s->mID; - break; - } - } - - mSpeakerCtrl->setSpeakerId(speaker_id); -} - -void LLIMGroupChiclet::setSessionId(const LLUUID& session_id) -{ - LLChiclet::setSessionId(session_id); - - LLGroupMgr* grp_mgr = LLGroupMgr::getInstance(); - LLGroupMgrGroupData* group_data = grp_mgr->getGroupData(session_id); - if (group_data && group_data->mInsigniaID.notNull()) - { - mChicletIconCtrl->setValue(group_data->mInsigniaID); - } - else - { - if(getSessionId() != mID) - { - grp_mgr->removeObserver(this); - mID = getSessionId(); - grp_mgr->addObserver(this); - } - grp_mgr->sendGroupPropertiesRequest(session_id); - } -} - -void LLIMGroupChiclet::changed(LLGroupChange gc) -{ - if (GC_PROPERTIES == gc) - { - LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(getSessionId()); - if (group_data) - { - mChicletIconCtrl->setValue(group_data->mInsigniaID); - } - } -} - -void LLIMGroupChiclet::updateMenuItems() -{ - if(!mPopupMenu) - return; - if(getSessionId().isNull()) - return; - - LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(getSessionId()); - bool open_window_exists = open_im_floater && open_im_floater->getVisible(); - mPopupMenu->getChild("Chat")->setEnabled(!open_window_exists); -} - -void LLIMGroupChiclet::createPopupMenu() -{ - if(!canCreateMenu()) - return; - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - registrar.add("IMChicletMenu.Action", boost::bind(&LLIMGroupChiclet::onMenuItemClicked, this, _2)); - - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile - ("menu_imchiclet_group.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -} - -void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data) -{ - std::string level = user_data.asString(); - LLUUID group_id = getSessionId(); - - if("group chat" == level) - { - LLGroupActions::startIM(group_id); - } - else if("info" == level) - { - LLGroupActions::show(group_id); - } - else if("end" == level) - { - LLGroupActions::endIM(group_id); - } -} - - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -964,20 +241,6 @@ void LLChicletPanel::onMessageCountChanged(const LLSD& data) { unread = 0; } - - std::list chiclets = LLIMChiclet::sFindChicletsSignal(session_id); - std::list::iterator iter; - for (iter = chiclets.begin(); iter != chiclets.end(); iter++) { - LLChiclet* chiclet = *iter; - if (chiclet != NULL) - { - chiclet->setCounter(unread); - } - else - { - llwarns << "Unable to set counter for chiclet " << session_id << llendl; - } - } } void LLChicletPanel::objectChicletCallback(const LLSD& data) @@ -992,10 +255,6 @@ void LLChicletPanel::objectChicletCallback(const LLSD& data) LLIMChiclet* chiclet = dynamic_cast(*iter); if (chiclet != NULL) { - if(data.has("unread")) - { - chiclet->setCounter(data["unread"]); - } chiclet->setShowNewMessagesIcon(new_message); } } @@ -1037,7 +296,6 @@ void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id) LLIMChiclet* chiclet = dynamic_cast(*it); if(chiclet) { - chiclet->setShowSpeaker(true); if (gSavedSettings.getBOOL("OpenIMOnVoice")) { LLFloaterIMContainer::getInstance()->showConversation(session_id); @@ -1045,20 +303,6 @@ void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id) } } - if(!s_previous_active_voice_session_id.isNull() && s_previous_active_voice_session_id != session_id) - { - chiclets = LLIMChiclet::sFindChicletsSignal(s_previous_active_voice_session_id); - - for(std::list::iterator it = chiclets.begin(); it != chiclets.end(); ++it) - { - LLIMChiclet* chiclet = dynamic_cast(*it); - if(chiclet) - { - chiclet->setShowSpeaker(false); - } - } - } - s_previous_active_voice_session_id = session_id; } @@ -1544,85 +788,6 @@ bool LLChicletPanel::isAnyIMFloaterDoked() return res; } -S32 LLChicletPanel::getTotalUnreadIMCount() -{ - S32 count = 0; - chiclet_list_t::const_iterator it = mChicletList.begin(); - for( ; mChicletList.end() != it; ++it) - { - LLIMChiclet* chiclet = dynamic_cast(*it); - if(chiclet) - { - count += chiclet->getCounter(); - } - } - return count; -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -LLChicletNotificationCounterCtrl::Params::Params() -: max_displayed_count("max_displayed_count", 99) -{ -} - -LLChicletNotificationCounterCtrl::LLChicletNotificationCounterCtrl(const Params& p) - : LLTextBox(p) - , mCounter(0) - , mInitialWidth(0) - , mMaxDisplayedCount(p.max_displayed_count) -{ - mInitialWidth = getRect().getWidth(); -} - -void LLChicletNotificationCounterCtrl::setCounter(S32 counter) -{ - mCounter = counter; - - // note same code in LLSysWellChiclet::setCounter(S32 counter) - std::string s_count; - if(counter != 0) - { - static std::string more_messages_exist("+"); - std::string more_messages(counter > mMaxDisplayedCount ? more_messages_exist : ""); - s_count = llformat("%d%s" - , llmin(counter, mMaxDisplayedCount) - , more_messages.c_str() - ); - } - - if(mCounter != 0) - { - setText(s_count); - } - else - { - setText(std::string("")); - } -} - -LLRect LLChicletNotificationCounterCtrl::getRequiredRect() -{ - LLRect rc; - S32 text_width = getTextPixelWidth(); - - rc.mRight = rc.mLeft + llmax(text_width, mInitialWidth); - - return rc; -} - -void LLChicletNotificationCounterCtrl::setValue(const LLSD& value) -{ - if(value.isInteger()) - setCounter(value.asInteger()); -} - -LLSD LLChicletNotificationCounterCtrl::getValue() const -{ - return LLSD(getCounter()); -} - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -1632,28 +797,6 @@ LLChicletAvatarIconCtrl::LLChicletAvatarIconCtrl(const Params& p) { } -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLChicletGroupIconCtrl::LLChicletGroupIconCtrl(const Params& p) -: LLIconCtrl(p) -, mDefaultIcon(p.default_icon) -{ - setValue(LLUUID::null); -} - -void LLChicletGroupIconCtrl::setValue(const LLSD& value ) -{ - if(value.asUUID().isNull()) - { - LLIconCtrl::setValue(mDefaultIcon); - } - else - { - LLIconCtrl::setValue(value); - } -} ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -1681,15 +824,6 @@ void LLChicletInvOfferIconCtrl::setValue(const LLSD& value ) ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p) - : LLOutputMonitorCtrl(p) -{ -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - LLScriptChiclet::Params::Params() : icon("icon") , chiclet_button("chiclet_button") @@ -1725,11 +859,6 @@ void LLScriptChiclet::setSessionId(const LLUUID& session_id) setToolTip(LLScriptFloaterManager::getObjectName(session_id)); } -void LLScriptChiclet::setCounter(S32 counter) -{ - setShowNewMessagesIcon( counter > 0 ); -} - void LLScriptChiclet::onMouseDown() { LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId()); @@ -1808,11 +937,6 @@ void LLInvOfferChiclet::setSessionId(const LLUUID& session_id) } } -void LLInvOfferChiclet::setCounter(S32 counter) -{ - setShowNewMessagesIcon( counter > 0 ); -} - void LLInvOfferChiclet::onMouseDown() { LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId()); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 7f72c7f9e2..bd6c1a3e71 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -29,75 +29,10 @@ #include "llavatariconctrl.h" #include "llbutton.h" -#include "llflashtimer.h" -#include "llpanel.h" -#include "lltextbox.h" -#include "lloutputmonitorctrl.h" -#include "llgroupmgr.h" -#include "llimview.h" -#include "llnotifications.h" class LLMenuGL; class LLFloaterIMSession; -/** - * Class for displaying amount of messages/notifications(unread). - */ -class LLChicletNotificationCounterCtrl : public LLTextBox -{ -public: - - struct Params : public LLInitParam::Block - { - /** - * Contains maximum displayed count of unread messages. Default value is 9. - * - * If count is less than "max_unread_count" will be displayed as is. - * Otherwise 9+ will be shown (for default value). - */ - Optional max_displayed_count; - - Params(); - }; - - /** - * Sets number of notifications - */ - virtual void setCounter(S32 counter); - - /** - * Returns number of notifications - */ - virtual S32 getCounter() const { return mCounter; } - - /** - * Returns width, required to display amount of notifications in text form. - * Width is the only valid value. - */ - /*virtual*/ LLRect getRequiredRect(); - - /** - * Sets number of notifications using LLSD - */ - /*virtual*/ void setValue(const LLSD& value); - - /** - * Returns number of notifications wrapped in LLSD - */ - /*virtual*/ LLSD getValue() const; - -protected: - - LLChicletNotificationCounterCtrl(const Params& p); - friend class LLUICtrlFactory; - -private: - - S32 mCounter; - S32 mInitialWidth; - S32 mMaxDisplayedCount; -}; - /** * Class for displaying avatar's icon in P2P chiclet. */ @@ -121,35 +56,6 @@ protected: friend class LLUICtrlFactory; }; -/** - * Class for displaying group's icon in Group chiclet. - */ -class LLChicletGroupIconCtrl : public LLIconCtrl -{ -public: - - struct Params : public LLInitParam::Block - { - Optional default_icon; - - Params() - : default_icon("default_icon", "Generic_Group") - {} - }; - - /** - * Sets icon, if value is LLUUID::null - default icon will be set. - */ - virtual void setValue(const LLSD& value ); - -protected: - - LLChicletGroupIconCtrl(const Params& p); - friend class LLUICtrlFactory; - - std::string mDefaultIcon; -}; - /** * Class for displaying icon in inventory offer chiclet. */ @@ -183,23 +89,6 @@ private: std::string mDefaultIcon; }; -/** - * Class for displaying of speaker's voice indicator - */ -class LLChicletSpeakerCtrl : public LLOutputMonitorCtrl -{ -public: - - struct Params : public LLInitParam::Block - { - Params(){}; - }; -protected: - - LLChicletSpeakerCtrl(const Params&p); - friend class LLUICtrlFactory; -}; - /** * Base class for all chiclets. */ @@ -227,26 +116,6 @@ public: */ virtual const LLUUID& getSessionId() const { return mSessionId; } - /** - * Sets number of unread notifications. - */ - virtual void setCounter(S32 counter) = 0; - - /** - * Returns number of unread notifications. - */ - virtual S32 getCounter() = 0; - - /** - * Sets show counter state. - */ - virtual void setShowCounter(bool show) { mShowCounter = show; } - - /** - * Returns show counter state. - */ - virtual bool getShowCounter() {return mShowCounter;}; - /** * Connects chiclet clicked event with callback. */ @@ -324,62 +193,6 @@ public: * It is used for default setting up of chicklet:click handler, etc. */ BOOL postBuild(); - /** - * Sets IM session name. This name will be displayed in chiclet tooltip. - */ - virtual void setIMSessionName(const std::string& name) { setToolTip(name); } - - /** - * Sets id of person/group user is chatting with. - * Session id should be set before calling this - */ - virtual void setOtherParticipantId(const LLUUID& other_participant_id) { mOtherParticipantId = other_participant_id; } - - /** - * Gets id of person/group user is chatting with. - */ - virtual LLUUID getOtherParticipantId() { return mOtherParticipantId; } - - /** - * Init Speaker Control with speaker's ID - */ - virtual void initSpeakerControl(); - - /** - * set status (Shows/Hide) for voice control. - */ - virtual void setShowSpeaker(bool show); - - /** - * Returns voice chat status control visibility. - */ - virtual bool getShowSpeaker() {return mShowSpeaker;}; - - /** - * Shows/Hides for voice control for a chiclet. - */ - virtual void toggleSpeakerControl(); - - /** - * Sets number of unread messages. Will update chiclet's width if number text - * exceeds size of counter and notify it's parent about size change. - */ - virtual void setCounter(S32); - - /** - * Enables/disables the counter control for a chiclet. - */ - virtual void enableCounterControl(bool enable); - - /** - * Sets show counter state. - */ - virtual void setShowCounter(bool show); - - /** - * Shows/Hides for counter control for a chiclet. - */ - virtual void toggleCounterControl(); /** * Sets required width for a chiclet according to visible controls. @@ -396,21 +209,6 @@ public: */ virtual bool getShowNewMessagesIcon(); - virtual void draw(); - - /** - * Determine whether given ID refers to a group or an IM chat session. - * - * This is used when we need to chose what IM chiclet (P2P/group) - * class to instantiate. - * - * @param session_id session ID. - * @return TYPE_GROUP in case of group chat session, - * TYPE_IM in case of P2P session, - * TYPE_UNKNOWN otherwise. - */ - static EType getIMSessionType(const LLUUID& session_id); - /** * The action taken on mouse down event. * @@ -452,8 +250,6 @@ protected: S32 mDefaultWidth; LLIconCtrl* mNewMessagesIcon; - LLChicletNotificationCounterCtrl* mCounterCtrl; - LLChicletSpeakerCtrl* mSpeakerCtrl; LLButton* mChicletButton; /** the id of another participant, either an avatar id or a group id*/ @@ -481,137 +277,6 @@ public: sFindChicletsSignal; }; -/** - * Implements P2P chiclet. - */ -class LLIMP2PChiclet : public LLIMChiclet -{ -public: - struct Params : public LLInitParam::Block - { - Optional chiclet_button; - - Optional avatar_icon; - - Optional unread_notifications; - - Optional speaker; - - Optional new_message_icon; - - Optional show_speaker; - - Params(); - }; - - /* virtual */ void setOtherParticipantId(const LLUUID& other_participant_id); - - /** - * Init Speaker Control with speaker's ID - */ - /*virtual*/ void initSpeakerControl(); - - /** - * Returns number of unread messages. - */ - /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); } - -protected: - LLIMP2PChiclet(const Params& p); - friend class LLUICtrlFactory; - - /** - * Creates chiclet popup menu. Will create P2P or Group IM Chat menu - * based on other participant's id. - */ - virtual void createPopupMenu(); - - /** - * Processes clicks on chiclet popup menu. - */ - virtual void onMenuItemClicked(const LLSD& user_data); - - /** - * Enables/disables menus based on relationship with other participant. - * Enables/disables "show session" menu item depending on visible IM floater existence. - */ - virtual void updateMenuItems(); - -private: - - LLChicletAvatarIconCtrl* mChicletIconCtrl; -}; - -/** - * Implements AD-HOC chiclet. - */ -class LLAdHocChiclet : public LLIMChiclet -{ -public: - struct Params : public LLInitParam::Block - { - Optional chiclet_button; - - Optional avatar_icon; - - Optional unread_notifications; - - Optional speaker; - - Optional new_message_icon; - - Optional show_speaker; - - Optional avatar_icon_color; - - Params(); - }; - - /** - * Sets session id. - * Session ID for group chat is actually Group ID. - */ - /*virtual*/ void setSessionId(const LLUUID& session_id); - - /** - * Keep Speaker Control with actual speaker's ID - */ - /*virtual*/ void draw(); - - /** - * Init Speaker Control with speaker's ID - */ - /*virtual*/ void initSpeakerControl(); - - /** - * Returns number of unread messages. - */ - /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); } - -protected: - LLAdHocChiclet(const Params& p); - friend class LLUICtrlFactory; - - /** - * Creates chiclet popup menu. Will create AdHoc Chat menu - * based on other participant's id. - */ - virtual void createPopupMenu(); - - /** - * Processes clicks on chiclet popup menu. - */ - virtual void onMenuItemClicked(const LLSD& user_data); - - /** - * Finds a current speaker and resets the SpeakerControl with speaker's ID - */ - /*virtual*/ void switchToCurrentSpeaker(); - -private: - - LLChicletAvatarIconCtrl* mChicletIconCtrl; -}; /** * Chiclet for script floaters. @@ -633,10 +298,6 @@ public: /*virtual*/ void setSessionId(const LLUUID& session_id); - /*virtual*/ void setCounter(S32 counter); - - /*virtual*/ S32 getCounter() { return 0; } - /** * Toggle script floater */ @@ -682,10 +343,6 @@ public: /*virtual*/ void setSessionId(const LLUUID& session_id); - /*virtual*/ void setCounter(S32 counter); - - /*virtual*/ S32 getCounter() { return 0; } - /** * Toggle script floater */ @@ -709,214 +366,6 @@ private: LLChicletInvOfferIconCtrl* mChicletIconCtrl; }; -/** - * Implements Group chat chiclet. - */ -class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver -{ -public: - - struct Params : public LLInitParam::Block - { - Optional chiclet_button; - - Optional group_icon; - - Optional unread_notifications; - - Optional speaker; - - Optional new_message_icon; - - Optional show_speaker; - - Params(); - }; - - /** - * Sets session id. - * Session ID for group chat is actually Group ID. - */ - /*virtual*/ void setSessionId(const LLUUID& session_id); - - /** - * Keep Speaker Control with actual speaker's ID - */ - /*virtual*/ void draw(); - - /** - * Callback for LLGroupMgrObserver, we get this when group data is available or changed. - * Sets group icon. - */ - /*virtual*/ void changed(LLGroupChange gc); - - /** - * Init Speaker Control with speaker's ID - */ - /*virtual*/ void initSpeakerControl(); - - /** - * Returns number of unread messages. - */ - /*virtual*/ S32 getCounter() { return mCounterCtrl->getCounter(); } - - ~LLIMGroupChiclet(); - -protected: - LLIMGroupChiclet(const Params& p); - friend class LLUICtrlFactory; - - /** - * Finds a current speaker and resets the SpeakerControl with speaker's ID - */ - /*virtual*/ void switchToCurrentSpeaker(); - - /** - * Creates chiclet popup menu. Will create P2P or Group IM Chat menu - * based on other participant's id. - */ - virtual void createPopupMenu(); - - /** - * Processes clicks on chiclet popup menu. - */ - virtual void onMenuItemClicked(const LLSD& user_data); - - /** - * Enables/disables "show session" menu item depending on visible IM floater existence. - */ - virtual void updateMenuItems(); - -private: - - LLChicletGroupIconCtrl* mChicletIconCtrl; -}; - -/** - * Implements notification chiclet. Used to display total amount of unread messages - * across all IM sessions, total amount of system notifications. See EXT-3147 for details - */ -class LLSysWellChiclet : public LLChiclet -{ -public: - - struct Params : public LLInitParam::Block - { - Optional button; - - Optional unread_notifications; - - /** - * Contains maximum displayed count of unread messages. Default value is 9. - * - * If count is less than "max_unread_count" will be displayed as is. - * Otherwise 9+ will be shown (for default value). - */ - Optional max_displayed_count; - - Params(); - }; - - /*virtual*/ void setCounter(S32 counter); - - // *TODO: mantipov: seems getCounter is not necessary for LLNotificationChiclet - // but inherited interface requires it to implement. - // Probably it can be safe removed. - /*virtual*/S32 getCounter() { return mCounter; } - - boost::signals2::connection setClickCallback(const commit_callback_t& cb); - - /*virtual*/ ~LLSysWellChiclet(); - - void setToggleState(BOOL toggled); - - void setNewMessagesState(bool new_messages); - //this method should change a widget according to state of the SysWellWindow - virtual void updateWidget(bool is_window_empty); - -protected: - - LLSysWellChiclet(const Params& p); - friend class LLUICtrlFactory; - - /** - * Change Well 'Lit' state from 'Lit' to 'Unlit' and vice-versa. - * - * There is an assumption that it will be called 2*N times to do not change its start state. - * @see FlashToLitTimer - */ - void changeLitState(bool blink); - - /** - * Displays menu. - */ - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - - virtual void createMenu() = 0; - -protected: - class FlashToLitTimer; - LLButton* mButton; - S32 mCounter; - S32 mMaxDisplayedCount; - bool mIsNewMessagesState; - - LLFlashTimer* mFlashToLitTimer; - LLContextMenu* mContextMenu; -}; - -class LLNotificationChiclet : public LLSysWellChiclet -{ - LOG_CLASS(LLNotificationChiclet); - - friend class LLUICtrlFactory; -public: - struct Params : public LLInitParam::Block{}; - -protected: - struct ChicletNotificationChannel : public LLNotificationChannel - { - ChicletNotificationChannel(LLNotificationChiclet* chiclet) - : LLNotificationChannel(LLNotificationChannel::Params().filter(filterNotification).name(chiclet->getSessionId().asString())), - mChiclet(chiclet) - { - // connect counter handlers to the signals - connectToChannel("Group Notifications"); - connectToChannel("Offer"); - connectToChannel("Notifications"); - } - - static bool filterNotification(LLNotificationPtr notify); - // connect counter updaters to the corresponding signals - /*virtual*/ void onAdd(LLNotificationPtr p) { mChiclet->setCounter(++mChiclet->mUreadSystemNotifications); } - /*virtual*/ void onDelete(LLNotificationPtr p) { mChiclet->setCounter(--mChiclet->mUreadSystemNotifications); } - - LLNotificationChiclet* const mChiclet; - }; - - boost::scoped_ptr mNotificationChannel; - - LLNotificationChiclet(const Params& p); - - /** - * Processes clicks on chiclet menu. - */ - void onMenuItemClicked(const LLSD& user_data); - - /** - * Enables chiclet menu items. - */ - bool enableMenuItem(const LLSD& user_data); - - /** - * Creates menu. - */ - /*virtual*/ void createMenu(); - - /*virtual*/ void setCounter(S32 counter); - S32 mUreadSystemNotifications; -}; - /** * Storage class for all IM chiclets. Provides mechanism to display, * scroll, create, remove chiclets. @@ -1018,9 +467,7 @@ public: S32 getMinWidth() const { return mMinWidth; } - S32 getTotalUnreadIMCount(); - - S32 notifyParent(const LLSD& info); + /*virtual*/ S32 notifyParent(const LLSD& info); /** * Toggle chiclet by session id ON and toggle OFF all other chiclets. diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index cfcde64e7b..fde7764129 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -25,18 +25,11 @@ */ #include "llviewerprecompiledheaders.h" // must be first include - #include "llchicletbar.h" -// library includes -#include "llfloaterreg.h" -#include "lllayoutstack.h" - -// newview includes #include "llchiclet.h" -#include "llfloaterimsession.h" // for LLFloaterIMSession +#include "lllayoutstack.h" #include "llpaneltopinfobar.h" -#include "llsyswellwindow.h" namespace { @@ -60,106 +53,11 @@ LLChicletBar::LLChicletBar(const LLSD&) buildFromFile("panel_chiclet_bar.xml"); } -LLChicletBar::~LLChicletBar() -{ -} - -LLIMChiclet* LLChicletBar::createIMChiclet(const LLUUID& session_id) -{ - LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(session_id); - - switch (im_chiclet_type) - { - case LLIMChiclet::TYPE_IM: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_GROUP: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_AD_HOC: - return getChicletPanel()->createChiclet(session_id); - case LLIMChiclet::TYPE_UNKNOWN: - break; - } - - return NULL; -} - -//virtual -void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) -{ - if (!getChicletPanel()) return; - - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); - if (!session) return; - - // no need to spawn chiclets for participants in P2P calls called through Avaline - if (session->isP2P() && session->isOtherParticipantAvaline()) return; - - // Do not spawn chiclet when using the new multitab conversation UI - if (LLFloaterIMSessionTab::isChatMultiTab()) - { - LLFloaterIMSessionTab::addToHost(session_id); - return; - } - - if (getChicletPanel()->findChiclet(session_id)) return; - - LLIMChiclet* chiclet = createIMChiclet(session_id); - if(chiclet) - { - chiclet->setIMSessionName(name); - chiclet->setOtherParticipantId(other_participant_id); - - LLFloaterIMSession::onIMChicletCreated(session_id); - - } - else - { - llwarns << "Could not create chiclet" << llendl; - } -} - -//virtual -void LLChicletBar::sessionRemoved(const LLUUID& session_id) -{ - if(getChicletPanel()) - { - // IM floater should be closed when session removed and associated chiclet closed - LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance("impanel", session_id); - if (im_floater != NULL && !im_floater->getStartConferenceInSameFloater()) - { - // Close the IM floater only if we are not planning to close the P2P chat - // and start a new conference in the same floater. - im_floater->closeFloater(); - } - - getChicletPanel()->removeChiclet(session_id); - } -} - -void LLChicletBar::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -{ - //this is only needed in case of outgoing ad-hoc/group chat sessions - LLChicletPanel* chiclet_panel = getChicletPanel(); - if (chiclet_panel) - { - //it should be ad-hoc im chiclet or group im chiclet - LLChiclet* chiclet = chiclet_panel->findChiclet(old_session_id); - if (chiclet) chiclet->setSessionId(new_session_id); - } -} - -S32 LLChicletBar::getTotalUnreadIMCount() -{ - return getChicletPanel()->getTotalUnreadIMCount(); -} - BOOL LLChicletBar::postBuild() { mToolbarStack = getChild("toolbar_stack"); mChicletPanel = getChild("chiclet_list"); - showWellButton("notification_well", !LLNotificationWellWindow::getInstance()->isWindowEmpty()); - LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index dc991ca772..956c82cb77 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -28,7 +28,6 @@ #define LL_LLCHICLETBAR_H #include "llpanel.h" -#include "llimview.h" class LLChicletPanel; class LLIMChiclet; @@ -38,32 +37,17 @@ class LLLayoutStack; class LLChicletBar : public LLSingleton , public LLPanel - , public LLIMSessionObserver { LOG_CLASS(LLChicletBar); friend class LLSingleton; public: - ~LLChicletBar(); BOOL postBuild(); LLChicletPanel* getChicletPanel() { return mChicletPanel; } - // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); - /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; - /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; - /*virtual*/ void sessionRemoved(const LLUUID& session_id); - /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); - - S32 getTotalUnreadIMCount(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); - /** - * Creates IM Chiclet based on session type (IM chat or Group chat) - */ - LLIMChiclet* createIMChiclet(const LLUUID& session_id); /** * Shows/hides panel with specified well button (IM or Notification) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 212b0df712..9829ae713c 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -616,10 +616,14 @@ void LLFloaterIMSession::setVisible(BOOL visible) if(!visible) { - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(mSessionID); - if(chiclet) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - chiclet->setToggleState(false); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet(mSessionID); + if(NULL != chicletp) + { + chicletp->setToggleState(false); + } } } diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index dc12192697..0e0da6bdc7 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -95,7 +95,12 @@ bool LLScriptFloater::toggle(const LLUUID& notification_id) show(notification_id); } - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(notification_id, true); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(notification_id, true); + } + return true; } @@ -206,10 +211,14 @@ void LLScriptFloater::setVisible(BOOL visible) if(!visible) { - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(getNotificationId()); - if(chiclet) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - chiclet->setToggleState(false); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet(getNotificationId()); + if(NULL != chicletp) + { + chicletp->setToggleState(false); + } } } } @@ -218,15 +227,19 @@ void LLScriptFloater::onMouseDown() { if(getNotificationId().notNull()) { - // Remove new message icon - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(getNotificationId()); - if (chiclet == NULL) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - llerror("Dock chiclet for LLScriptFloater doesn't exist", 0); - } - else - { - chiclet->setShowNewMessagesIcon(false); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet(getNotificationId()); + // Remove new message icon + if (NULL == chicletp) + { + llerror("Dock chiclet for LLScriptFloater doesn't exist", 0); + } + else + { + chicletp->setShowNewMessagesIcon(false); + } } } } @@ -262,7 +275,11 @@ void LLScriptFloater::onFocusLost() { if(getNotificationId().notNull()) { - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(getNotificationId(), false); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(getNotificationId(), false); + } } } @@ -271,7 +288,11 @@ void LLScriptFloater::onFocusReceived() // first focus will be received before setObjectId() call - don't toggle chiclet if(getNotificationId().notNull()) { - LLChicletBar::getInstance()->getChicletPanel()->setChicletToggleState(getNotificationId(), true); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->setChicletToggleState(getNotificationId(), true); + } } } @@ -279,28 +300,30 @@ void LLScriptFloater::dockToChiclet(bool dock) { if (getDockControl() == NULL) { - LLChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(getNotificationId()); - if (chiclet == NULL) - { - llwarns << "Dock chiclet for LLScriptFloater doesn't exist" << llendl; - return; - } - else + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - LLChicletBar::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); - } + LLChiclet * chicletp = chiclet_panelp->findChiclet(getNotificationId()); + if (NULL == chicletp) + { + llwarns << "Dock chiclet for LLScriptFloater doesn't exist" << llendl; + return; + } - // Stop saving position while we dock floater - bool save = getSavePosition(); - setSavePosition(false); + chiclet_panelp->scrollToChiclet(chicletp); - setDockControl(new LLDockControl(chiclet, this, getDockTongue(), - LLDockControl::BOTTOM)); + // Stop saving position while we dock floater + bool save = getSavePosition(); + setSavePosition(false); - setDocked(dock); + setDockControl(new LLDockControl(chicletp, this, getDockTongue(), + LLDockControl::BOTTOM)); - // Restore saving - setSavePosition(save); + setDocked(dock); + + // Restore saving + setSavePosition(save); + } } } @@ -347,11 +370,15 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) script_notification_map_t::const_iterator it = findUsingObjectId(object_id); if(it != mNotifications.end()) { - LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet(it->first); - if(chiclet) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - // Pass the new_message icon state further. - set_new_message = chiclet->getShowNewMessagesIcon(); + LLIMChiclet * chicletp = chiclet_panelp->findChiclet(it->first); + if(NULL != chicletp) + { + // Pass the new_message icon state further. + set_new_message = chicletp->getShowNewMessagesIcon(); + } } LLScriptFloater* floater = LLFloaterReg::findTypedInstance("script_floater", it->first); @@ -367,14 +394,18 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) mNotifications.insert(std::make_pair(notification_id, object_id)); - // Create inventory offer chiclet for offer type notifications - if( OBJ_GIVE_INVENTORY == obj_type ) + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) { - LLChicletBar::instance().getChicletPanel()->createChiclet(notification_id); - } - else - { - LLChicletBar::getInstance()->getChicletPanel()->createChiclet(notification_id); + // Create inventory offer chiclet for offer type notifications + if( OBJ_GIVE_INVENTORY == obj_type ) + { + chiclet_panelp->createChiclet(notification_id); + } + else + { + chiclet_panelp->createChiclet(notification_id); + } } LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message); @@ -410,7 +441,11 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) // remove related chiclet if (LLChicletBar::instanceExists()) { - LLChicletBar::getInstance()->getChicletPanel()->removeChiclet(notification_id); + LLChicletPanel * chiclet_panelp = LLChicletBar::getInstance()->getChicletPanel(); + if (NULL != chiclet_panelp) + { + chiclet_panelp->removeChiclet(notification_id); + } } LLIMWellWindow* im_well_window = LLIMWellWindow::findInstance(); diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 3605129d48..8a43855a7d 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -23,35 +23,23 @@ * $/LicenseInfo$ */ - #include "llviewerprecompiledheaders.h" // must be first include - #include "llsyswellwindow.h" -#include "llagent.h" -#include "llavatarnamecache.h" - -#include "llflatlistview.h" -#include "llfloaterreg.h" -#include "llnotifications.h" - -#include "llscriptfloater.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" - #include "llchiclet.h" #include "llchicletbar.h" -#include "lltoastpanel.h" +#include "llflatlistview.h" +#include "llfloaterreg.h" #include "llnotificationmanager.h" #include "llnotificationsutil.h" +#include "llscriptfloater.h" #include "llspeakers.h" -#include "lltoolbarview.h" +#include "lltoastpanel.h" //--------------------------------------------------------------------------------- LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(NULL, true, key), mChannel(NULL), mMessageList(NULL), - mSysWellChiclet(NULL), NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"), IM_WELL_ANCHOR_NAME("im_well_panel"), mIsReshapedByUser(false) @@ -68,10 +56,6 @@ BOOL LLSysWellWindow::postBuild() // get a corresponding channel initChannel(); - // click on SysWell Window should clear "new message" state (and 'Lit' status). EXT-3147. - // mouse up callback is not called in this case. - setMouseDownCallback(boost::bind(&LLSysWellWindow::releaseNewMessagesState, this)); - return LLTransientDockableFloater::postBuild(); } @@ -95,14 +79,6 @@ void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask) setVisible(TRUE); } -void LLSysWellWindow::setSysWellChiclet(LLSysWellChiclet* chiclet) -{ - mSysWellChiclet = chiclet; - if(NULL != mSysWellChiclet) - { - mSysWellChiclet->updateWidget(isWindowEmpty()); - } -} //--------------------------------------------------------------------------------- LLSysWellWindow::~LLSysWellWindow() { @@ -113,10 +89,6 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id) { if(mMessageList->removeItemByValue(id)) { - if (NULL != mSysWellChiclet) - { - mSysWellChiclet->updateWidget(isWindowEmpty()); - } reshapeWindow(); } else @@ -170,11 +142,6 @@ void LLSysWellWindow::setVisible(BOOL visible) mChannel->updateShowToastsState(); mChannel->redrawToasts(); } - - if (visible) - { - releaseNewMessagesState(); - } } //--------------------------------------------------------------------------------- @@ -224,135 +191,12 @@ void LLSysWellWindow::reshapeWindow() } } -void LLSysWellWindow::releaseNewMessagesState() -{ - if (NULL != mSysWellChiclet) - { - mSysWellChiclet->setNewMessagesState(false); - } -} - //--------------------------------------------------------------------------------- bool LLSysWellWindow::isWindowEmpty() { return mMessageList->size() == 0; } -/************************************************************************/ -/* RowPanel implementation */ -/************************************************************************/ - -//--------------------------------------------------------------------------------- -LLIMWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, - S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId) : - LLPanel(LLPanel::Params()), mChiclet(NULL), mParent(parent) -{ - buildFromFile( "panel_activeim_row.xml"); - - // Choose which of the pre-created chiclets (IM/group) to use. - // The other one gets hidden. - - LLIMChiclet::EType im_chiclet_type = LLIMChiclet::getIMSessionType(sessionId); - switch (im_chiclet_type) - { - case LLIMChiclet::TYPE_GROUP: - mChiclet = getChild("group_chiclet"); - break; - case LLIMChiclet::TYPE_AD_HOC: - mChiclet = getChild("adhoc_chiclet"); - break; - case LLIMChiclet::TYPE_UNKNOWN: // assign mChiclet a non-null value anyway - case LLIMChiclet::TYPE_IM: - mChiclet = getChild("p2p_chiclet"); - break; - } - - // Initialize chiclet. - mChiclet->setChicletSizeChangedCallback(boost::bind(&LLIMWellWindow::RowPanel::onChicletSizeChanged, this, mChiclet, _2)); - mChiclet->enableCounterControl(true); - mChiclet->setCounter(chicletCounter); - mChiclet->setSessionId(sessionId); - mChiclet->setIMSessionName(name); - mChiclet->setOtherParticipantId(otherParticipantId); - mChiclet->setVisible(true); - - if (im_chiclet_type == LLIMChiclet::TYPE_IM) - { - LLAvatarNameCache::get(otherParticipantId, - boost::bind(&LLIMWellWindow::RowPanel::onAvatarNameCache, - this, _1, _2)); - } - else - { - LLTextBox* contactName = getChild("contact_name"); - contactName->setValue(name); - } - - mCloseBtn = getChild("hide_btn"); - mCloseBtn->setCommitCallback(boost::bind(&LLIMWellWindow::RowPanel::onClosePanel, this)); -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::RowPanel::onAvatarNameCache(const LLUUID& agent_id, - const LLAvatarName& av_name) -{ - LLTextBox* contactName = getChild("contact_name"); - contactName->setValue( av_name.getCompleteName() ); -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::RowPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param) -{ - LLTextBox* text = getChild("contact_name"); - S32 new_text_left = mChiclet->getRect().mRight + CHICLET_HPAD; - LLRect text_rect = text->getRect(); - text_rect.mLeft = new_text_left; - text->setShape(text_rect); -} - -//--------------------------------------------------------------------------------- -LLIMWellWindow::RowPanel::~RowPanel() -{ -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::RowPanel::onClosePanel() -{ - gIMMgr->leaveSession(mChiclet->getSessionId()); - // This row panel will be removed from the list in LLSysWellWindow::sessionRemoved(). -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::RowPanel::onMouseEnter(S32 x, S32 y, MASK mask) -{ - setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemSelected")); -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::RowPanel::onMouseLeave(S32 x, S32 y, MASK mask) -{ - setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemUnselected")); -} - -//--------------------------------------------------------------------------------- -// virtual -BOOL LLIMWellWindow::RowPanel::handleMouseDown(S32 x, S32 y, MASK mask) -{ - // Pass the mouse down event to the chiclet (EXT-596). - if (!mChiclet->pointInView(x, y) && !mCloseBtn->getRect().pointInRect(x, y)) // prevent double call of LLIMChiclet::onMouseDown() - { - mChiclet->onMouseDown(); - return TRUE; - } - - return LLPanel::handleMouseDown(x, y, mask); -} - -// virtual -BOOL LLIMWellWindow::RowPanel::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - return mChiclet->handleRightMouseDown(x, y, mask); -} /************************************************************************/ /* ObjectRowPanel implementation */ /************************************************************************/ @@ -490,9 +334,7 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p) 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)); } @@ -576,9 +418,6 @@ void LLNotificationWellWindow::onAdd( LLNotificationPtr notify ) removeItemByID(notify->getID()); } - - - /************************************************************************/ /* LLIMWellWindow implementation */ /************************************************************************/ @@ -588,12 +427,10 @@ void LLNotificationWellWindow::onAdd( LLNotificationPtr notify ) LLIMWellWindow::LLIMWellWindow(const LLSD& key) : LLSysWellWindow(key) { - LLIMMgr::getInstance()->addSessionObserver(this); } LLIMWellWindow::~LLIMWellWindow() { - LLIMMgr::getInstance()->removeSessionObserver(this); } // static @@ -614,47 +451,11 @@ BOOL LLIMWellWindow::postBuild() BOOL rv = LLSysWellWindow::postBuild(); setTitle(getString("title_im_well_window")); - LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findIMChiclet, this, _1)); LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLIMWellWindow::findObjectChiclet, this, _1)); return rv; } -//virtual -void LLIMWellWindow::sessionAdded(const LLUUID& session_id, - const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) -{ - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); - if (!session) return; - - // no need to spawn chiclets for participants in P2P calls called through Avaline - if (session->isP2P() && session->isOtherParticipantAvaline()) return; - - if (mMessageList->getItemByValue(session_id)) return; - - addIMRow(session_id, 0, name, other_participant_id); - reshapeWindow(); -} - -//virtual -void LLIMWellWindow::sessionRemoved(const LLUUID& sessionId) -{ - delIMRow(sessionId); - reshapeWindow(); -} - -//virtual -void LLIMWellWindow::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) -{ - //for outgoing ad-hoc and group im sessions only - LLChiclet* chiclet = findIMChiclet(old_session_id); - if (chiclet) - { - chiclet->setSessionId(new_session_id); - mMessageList->updateValue(old_session_id, new_session_id); - } -} - LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id) { if (!mMessageList) return NULL; @@ -671,66 +472,6 @@ LLChiclet* LLIMWellWindow::findObjectChiclet(const LLUUID& notification_id) ////////////////////////////////////////////////////////////////////////// // PRIVATE METHODS -LLChiclet* LLIMWellWindow::findIMChiclet(const LLUUID& sessionId) -{ - if (!mMessageList) return NULL; - - LLChiclet* res = NULL; - RowPanel* panel = mMessageList->getTypedItemByValue(sessionId); - if (panel != NULL) - { - res = panel->mChiclet; - } - - return res; -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::addIMRow(const LLUUID& sessionId, S32 chicletCounter, - const std::string& name, const LLUUID& otherParticipantId) -{ - RowPanel* item = new RowPanel(this, sessionId, chicletCounter, name, otherParticipantId); - if (!mMessageList->addItem(item, sessionId)) - { - llwarns << "Unable to add IM Row into the list, sessionID: " << sessionId - << ", name: " << name - << ", other participant ID: " << otherParticipantId - << llendl; - - item->die(); - } -} - -//--------------------------------------------------------------------------------- -void LLIMWellWindow::delIMRow(const LLUUID& sessionId) -{ - //fix for EXT-3252 - //without this line LLIMWellWindow receive onFocusLost - //and hide itself. It was becaue somehow LLIMChicklet was in focus group for - //LLIMWellWindow... - //But I didn't find why this happen.. - gFocusMgr.clearLastFocusForGroup(this); - - if (!mMessageList->removeItemByValue(sessionId)) - { - llwarns << "Unable to remove IM Row from the list, sessionID: " << sessionId - << llendl; - } - - // remove all toasts that belong to this session from a screen - if(mChannel) - mChannel->removeToastsBySessionID(sessionId); - - // hide chiclet window if there are no items left - if(isWindowEmpty()) - { - setVisible(FALSE); - } - else - { - setFocus(true); - } -} void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_message/* = false*/) { @@ -761,21 +502,6 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id) } } - -void LLIMWellWindow::addIMRow(const LLUUID& session_id) -{ - if (hasIMRow(session_id)) return; - - LLIMModel* im_model = LLIMModel::getInstance(); - addIMRow(session_id, 0, im_model->getName(session_id), im_model->getOtherParticipantID(session_id)); - reshapeWindow(); -} - -bool LLIMWellWindow::hasIMRow(const LLUUID& session_id) -{ - return mMessageList->getItemByValue(session_id); -} - void LLIMWellWindow::closeAll() { // Generate an ignorable alert dialog if there is an active voice IM sesion @@ -820,13 +546,6 @@ void LLIMWellWindow::closeAllImpl() { LLPanel* panel = mMessageList->getItemByValue(*iter); - RowPanel* im_panel = dynamic_cast (panel); - if (im_panel) - { - gIMMgr->leaveSession(*iter); - continue; - } - ObjectRowPanel* obj_panel = dynamic_cast (panel); if (obj_panel) { diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index d6480f1fc6..406ab1b59e 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -27,32 +27,26 @@ #ifndef LL_LLSYSWELLWINDOW_H #define LL_LLSYSWELLWINDOW_H -#include "llsyswellitem.h" - -#include "lltransientdockablefloater.h" -#include "llbutton.h" -#include "llscreenchannel.h" -#include "llscrollcontainer.h" #include "llimview.h" #include "llnotifications.h" - -#include "boost/shared_ptr.hpp" +#include "llscreenchannel.h" +#include "llsyswellitem.h" +#include "lltransientdockablefloater.h" class LLAvatarName; -class LLFlatListView; class LLChiclet; +class LLFlatListView; class LLIMChiclet; class LLScriptChiclet; class LLSysWellChiclet; - class LLSysWellWindow : public LLTransientDockableFloater { public: LOG_CLASS(LLSysWellWindow); LLSysWellWindow(const LLSD& key); - ~LLSysWellWindow(); + virtual ~LLSysWellWindow(); BOOL postBuild(); // other interface functions @@ -72,8 +66,6 @@ public: void onStartUpToastClick(S32 x, S32 y, MASK mask); - void setSysWellChiclet(LLSysWellChiclet* chiclet); - // size constants for the window and for its elements static const S32 MAX_WINDOW_HEIGHT = 200; static const S32 MIN_WINDOW_WIDTH = 318; @@ -87,17 +79,11 @@ protected: virtual const std::string& getAnchorViewName() = 0; void reshapeWindow(); - void releaseNewMessagesState(); // pointer to a corresponding channel's instance LLNotificationsUI::LLScreenChannel* mChannel; LLFlatListView* mMessageList; - /** - * Reference to an appropriate Well chiclet to release "new message" state. EXT-3147 - */ - LLSysWellChiclet* mSysWellChiclet; - bool mIsReshapedByUser; }; @@ -157,7 +143,7 @@ private: * * It contains a list list of all active IM sessions. */ -class LLIMWellWindow : public LLSysWellWindow, LLIMSessionObserver, LLInitClass +class LLIMWellWindow : public LLSysWellWindow, LLInitClass { public: LLIMWellWindow(const LLSD& key); @@ -169,59 +155,19 @@ public: /*virtual*/ BOOL postBuild(); - // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); - /*virtual*/ void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} - /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; - /*virtual*/ void sessionRemoved(const LLUUID& session_id); - /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); - void addObjectRow(const LLUUID& notification_id, bool new_message = false); void removeObjectRow(const LLUUID& notification_id); - - void addIMRow(const LLUUID& session_id); - bool hasIMRow(const LLUUID& session_id); - void closeAll(); protected: /*virtual*/ const std::string& getAnchorViewName() { return IM_WELL_ANCHOR_NAME; } private: - LLChiclet * findIMChiclet(const LLUUID& sessionId); LLChiclet* findObjectChiclet(const LLUUID& notification_id); - void addIMRow(const LLUUID& sessionId, S32 chicletCounter, const std::string& name, const LLUUID& otherParticipantId); - void delIMRow(const LLUUID& sessionId); bool confirmCloseAll(const LLSD& notification, const LLSD& response); void closeAllImpl(); - /** - * Scrolling row panel. - */ - class RowPanel: public LLPanel - { - public: - RowPanel(const LLSysWellWindow* parent, const LLUUID& sessionId, S32 chicletCounter, - const std::string& name, const LLUUID& otherParticipantId); - virtual ~RowPanel(); - void onMouseEnter(S32 x, S32 y, MASK mask); - void onMouseLeave(S32 x, S32 y, MASK mask); - BOOL handleMouseDown(S32 x, S32 y, MASK mask); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - - private: - static const S32 CHICLET_HPAD = 10; - void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); - void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param); - void onClosePanel(); - public: - LLIMChiclet* mChiclet; - private: - LLButton* mCloseBtn; - const LLSysWellWindow* mParent; - }; - class ObjectRowPanel: public LLPanel { public: diff --git a/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png b/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png deleted file mode 100644 index 0ac5b72b8f..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png deleted file mode 100644 index 857fa1e047..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl1_Dark.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png deleted file mode 100644 index 453bb53673..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl2_Dark.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png deleted file mode 100644 index 135a66ca0d..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Lvl3_Dark.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png deleted file mode 100644 index a63aec5e6d..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_Off_Dark.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png b/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png deleted file mode 100644 index 1719eb3e84..0000000000 Binary files a/indra/newview/skins/default/textures/bottomtray/VoicePTT_On_Dark.png and /dev/null differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 8d9fa52309..bf6e933dfd 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -365,8 +365,6 @@ with the same filename but different name - - @@ -654,12 +652,6 @@ with the same filename but different name - - - - - - diff --git a/indra/newview/skins/default/xui/da/menu_im_well_button.xml b/indra/newview/skins/default/xui/da/menu_im_well_button.xml deleted file mode 100644 index 4889230919..0000000000 --- a/indra/newview/skins/default/xui/da/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/da/menu_notification_well_button.xml b/indra/newview/skins/default/xui/da/menu_notification_well_button.xml deleted file mode 100644 index 40b35b5fdd..0000000000 --- a/indra/newview/skins/default/xui/da/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/de/menu_im_well_button.xml b/indra/newview/skins/default/xui/de/menu_im_well_button.xml deleted file mode 100644 index f464b71f4a..0000000000 --- a/indra/newview/skins/default/xui/de/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/de/menu_notification_well_button.xml b/indra/newview/skins/default/xui/de/menu_notification_well_button.xml deleted file mode 100644 index 0f2784f160..0000000000 --- a/indra/newview/skins/default/xui/de/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/en/menu_notification_well_button.xml b/indra/newview/skins/default/xui/en/menu_notification_well_button.xml deleted file mode 100644 index 263ac40f4e..0000000000 --- a/indra/newview/skins/default/xui/en/menu_notification_well_button.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_activeim_row.xml b/indra/newview/skins/default/xui/en/panel_activeim_row.xml deleted file mode 100644 index 9369d1b5cf..0000000000 --- a/indra/newview/skins/default/xui/en/panel_activeim_row.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - TestString PleaseIgnore - - - - diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml deleted file mode 100644 index 0e29ed0d0b..0000000000 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_adhoc.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_group.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_group.xml deleted file mode 100644 index 77011139bf..0000000000 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_group.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_im_p2p.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_im_p2p.xml deleted file mode 100644 index 8b56a8f0f6..0000000000 --- a/indra/newview/skins/default/xui/en/widgets/chiclet_im_p2p.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - diff --git a/indra/newview/skins/default/xui/es/menu_im_well_button.xml b/indra/newview/skins/default/xui/es/menu_im_well_button.xml deleted file mode 100644 index c8f6c217cc..0000000000 --- a/indra/newview/skins/default/xui/es/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/es/menu_notification_well_button.xml b/indra/newview/skins/default/xui/es/menu_notification_well_button.xml deleted file mode 100644 index 0562d35be7..0000000000 --- a/indra/newview/skins/default/xui/es/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/fr/menu_im_well_button.xml b/indra/newview/skins/default/xui/fr/menu_im_well_button.xml deleted file mode 100644 index 8ef1529e6b..0000000000 --- a/indra/newview/skins/default/xui/fr/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml b/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml deleted file mode 100644 index 323bfdbf16..0000000000 --- a/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/it/menu_im_well_button.xml b/indra/newview/skins/default/xui/it/menu_im_well_button.xml deleted file mode 100644 index 9e471b771c..0000000000 --- a/indra/newview/skins/default/xui/it/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/it/menu_notification_well_button.xml b/indra/newview/skins/default/xui/it/menu_notification_well_button.xml deleted file mode 100644 index 8c82e30f0e..0000000000 --- a/indra/newview/skins/default/xui/it/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/ja/menu_im_well_button.xml b/indra/newview/skins/default/xui/ja/menu_im_well_button.xml deleted file mode 100644 index 3397004bd7..0000000000 --- a/indra/newview/skins/default/xui/ja/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml b/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml deleted file mode 100644 index 913bae8958..0000000000 --- a/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/pl/menu_im_well_button.xml b/indra/newview/skins/default/xui/pl/menu_im_well_button.xml deleted file mode 100644 index 207bc2211b..0000000000 --- a/indra/newview/skins/default/xui/pl/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml b/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml deleted file mode 100644 index bd3d42f9b1..0000000000 --- a/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/pt/menu_im_well_button.xml b/indra/newview/skins/default/xui/pt/menu_im_well_button.xml deleted file mode 100644 index 2d37cefd6f..0000000000 --- a/indra/newview/skins/default/xui/pt/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml b/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml deleted file mode 100644 index 43ad4134ec..0000000000 --- a/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/ru/menu_im_well_button.xml b/indra/newview/skins/default/xui/ru/menu_im_well_button.xml deleted file mode 100644 index 5a5bde61b9..0000000000 --- a/indra/newview/skins/default/xui/ru/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml b/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml deleted file mode 100644 index 4d067e232a..0000000000 --- a/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/tr/menu_im_well_button.xml b/indra/newview/skins/default/xui/tr/menu_im_well_button.xml deleted file mode 100644 index c3e559a723..0000000000 --- a/indra/newview/skins/default/xui/tr/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml b/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml deleted file mode 100644 index 39c66268f5..0000000000 --- a/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/zh/menu_im_well_button.xml b/indra/newview/skins/default/xui/zh/menu_im_well_button.xml deleted file mode 100644 index 4b9b4b2758..0000000000 --- a/indra/newview/skins/default/xui/zh/menu_im_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml b/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml deleted file mode 100644 index b629f73584..0000000000 --- a/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - -- cgit v1.2.3 From 60c72c85e2360284ecc3326871dcc76fcce0e945 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Mon, 3 Dec 2012 19:06:52 -0800 Subject: Cleaning up some unreferenced member variables and related types from LLNotifications. --- indra/llui/CMakeLists.txt | 2 - indra/llui/llnotifications.cpp | 3 - indra/llui/llnotifications.h | 4 - indra/llui/llnotificationslistener.cpp | 354 --------------------------------- indra/llui/llnotificationslistener.h | 69 ------- indra/llui/llnotificationtemplate.h | 1 - 6 files changed, 433 deletions(-) delete mode 100644 indra/llui/llnotificationslistener.cpp delete mode 100644 indra/llui/llnotificationslistener.h diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index ccc7aa8cec..9c961d67d6 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -71,7 +71,6 @@ set(llui_SOURCE_FILES llmultislider.cpp llmultisliderctrl.cpp llnotifications.cpp - llnotificationslistener.cpp llnotificationsutil.cpp llpanel.cpp llprogressbar.cpp @@ -181,7 +180,6 @@ set(llui_HEADER_FILES llmultislider.h llnotificationptr.h llnotifications.h - llnotificationslistener.h llnotificationsutil.h llnotificationtemplate.h llnotificationvisibilityrule.h diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 66144671c9..61d5dcf12c 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -39,7 +39,6 @@ #include "lldir.h" #include "llsdserialize.h" #include "lltrans.h" -#include "llnotificationslistener.h" #include "llstring.h" #include "llsdparam.h" #include "llsdutil.h" @@ -1167,8 +1166,6 @@ LLNotifications::LLNotifications() mIgnoreAllNotifications(false) { LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Notification.Show", boost::bind(&LLNotifications::addFromCallback, this, _2)); - - mListener.reset(new LLNotificationsListener(*this)); } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 088931858a..a41e9fa5a3 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -92,7 +92,6 @@ #include "llevents.h" #include "llfunctorregistry.h" #include "llinitparam.h" -#include "llnotificationslistener.h" #include "llnotificationptr.h" #include "llpointer.h" #include "llrefcount.h" @@ -672,7 +671,6 @@ namespace LLNotificationComparators }; typedef boost::function LLNotificationFilter; -typedef boost::function LLNotificationComparator; typedef std::set LLNotificationSet; typedef std::multimap LLNotificationMap; @@ -822,7 +820,6 @@ public: private: std::string mName; std::string mParent; - LLNotificationComparator mComparator; }; // An interface class to provide a clean linker seam to the LLNotifications class. @@ -942,7 +939,6 @@ private: bool mIgnoreAllNotifications; - boost::scoped_ptr mListener; std::vector mDefaultChannels; }; diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp deleted file mode 100644 index e4e127336b..0000000000 --- a/indra/llui/llnotificationslistener.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/** - * @file llnotificationslistener.cpp - * @author Brad Kittenbrink - * @date 2009-07-08 - * @brief Implementation for llnotificationslistener. - * - * $LicenseInfo:firstyear=2009&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 "linden_common.h" -#include "llnotificationslistener.h" -#include "llnotifications.h" -#include "llnotificationtemplate.h" -#include "llsd.h" -#include "llui.h" - -LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : - LLEventAPI("LLNotifications", - "LLNotifications listener to (e.g.) pop up a notification"), - mNotifications(notifications) -{ - add("requestAdd", - "Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n" - "If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.", - &LLNotificationsListener::requestAdd); - add("listChannels", - "Post to [\"reply\"] a map of info on existing channels", - &LLNotificationsListener::listChannels, - LLSD().with("reply", LLSD())); - add("listChannelNotifications", - "Post to [\"reply\"] an array of info on notifications in channel [\"channel\"]", - &LLNotificationsListener::listChannelNotifications, - LLSD().with("reply", LLSD()).with("channel", LLSD())); - add("respond", - "Respond to notification [\"uuid\"] with data in [\"response\"]", - &LLNotificationsListener::respond, - LLSD().with("uuid", LLSD())); - add("cancel", - "Cancel notification [\"uuid\"]", - &LLNotificationsListener::cancel, - LLSD().with("uuid", LLSD())); - add("ignore", - "Ignore future notification [\"name\"]\n" - "(from in notifications.xml)\n" - "according to boolean [\"ignore\"].\n" - "If [\"name\"] is omitted or undefined, [un]ignore all future notifications.\n" - "Note that ignored notifications are not forwarded unless intercepted before\n" - "the \"Ignore\" channel.", - &LLNotificationsListener::ignore); - add("forward", - "Forward to [\"pump\"] future notifications on channel [\"channel\"]\n" - "according to boolean [\"forward\"]. When enabled, only types matching\n" - "[\"types\"] are forwarded, as follows:\n" - "omitted or undefined: forward all notifications\n" - "string: forward only the specific named [sig]type\n" - "array of string: forward any notification matching any named [sig]type.\n" - "When boolean [\"respond\"] is true, we auto-respond to each forwarded\n" - "notification.", - &LLNotificationsListener::forward, - LLSD().with("channel", LLSD())); -} - -// This is here in the .cpp file so we don't need the definition of class -// Forwarder in the header file. -LLNotificationsListener::~LLNotificationsListener() -{ -} - -void LLNotificationsListener::requestAdd(const LLSD& event_data) const -{ - if(event_data.has("reply")) - { - mNotifications.add(event_data["name"], - event_data["substitutions"], - event_data["payload"], - boost::bind(&LLNotificationsListener::NotificationResponder, - this, - event_data["reply"].asString(), - _1, _2 - ) - ); - } - else - { - mNotifications.add(event_data["name"], - event_data["substitutions"], - event_data["payload"]); - } -} - -void LLNotificationsListener::NotificationResponder(const std::string& reply_pump, - const LLSD& notification, - const LLSD& response) const -{ - LLSD reponse_event; - reponse_event["notification"] = notification; - reponse_event["response"] = response; - LLEventPumps::getInstance()->obtain(reply_pump).post(reponse_event); -} - -void LLNotificationsListener::listChannels(const LLSD& params) const -{ - LLReqID reqID(params); - LLSD response(reqID.makeResponse()); - for (LLNotificationChannel::instance_iter cmi(LLNotificationChannel::beginInstances()), - cmend(LLNotificationChannel::endInstances()); - cmi != cmend; ++cmi) - { - LLSD channelInfo; - //channelInfo["parent"] = cmi->second->getParentChannelName(); - response[cmi->getName()] = channelInfo; - } - LLEventPumps::instance().obtain(params["reply"]).post(response); -} - -void LLNotificationsListener::listChannelNotifications(const LLSD& params) const -{ - LLReqID reqID(params); - LLSD response(reqID.makeResponse()); - LLNotificationChannelPtr channel(mNotifications.getChannel(params["channel"])); - if (channel) - { - LLSD notifications(LLSD::emptyArray()); - for (LLNotificationChannel::Iterator ni(channel->begin()), nend(channel->end()); - ni != nend; ++ni) - { - notifications.append(asLLSD(*ni)); - } - response["notifications"] = notifications; - } - LLEventPumps::instance().obtain(params["reply"]).post(response); -} - -void LLNotificationsListener::respond(const LLSD& params) const -{ - LLNotificationPtr notification(mNotifications.find(params["uuid"])); - if (notification) - { - notification->respond(params["response"]); - } -} - -void LLNotificationsListener::cancel(const LLSD& params) const -{ - LLNotificationPtr notification(mNotifications.find(params["uuid"])); - if (notification) - { - mNotifications.cancel(notification); - } -} - -void LLNotificationsListener::ignore(const LLSD& params) const -{ - // Calling a method named "ignore", but omitting its "ignore" Boolean - // argument, should by default cause something to be ignored. Explicitly - // pass ["ignore"] = false to cancel ignore. - bool ignore = true; - if (params.has("ignore")) - { - ignore = params["ignore"].asBoolean(); - } - // This method can be used to affect either a single notification name or - // all future notifications. The two use substantially different mechanisms. - if (params["name"].isDefined()) - { - // ["name"] was passed: ignore just that notification - LLNotificationTemplatePtr templatep = mNotifications.getTemplate(params["name"]); - if (templatep) - { - templatep->mForm->setIgnored(ignore); - } - } - else - { - // no ["name"]: ignore all future notifications - mNotifications.setIgnoreAllNotifications(ignore); - } -} - -class LLNotificationsListener::Forwarder: public LLEventTrackable -{ - LOG_CLASS(LLNotificationsListener::Forwarder); -public: - Forwarder(LLNotifications& llnotifications, const std::string& channel): - mNotifications(llnotifications), - mRespond(false) - { - // Connect to the specified channel on construction. Because - // LLEventTrackable is a base, we should automatically disconnect when - // destroyed. - LLNotificationChannelPtr channelptr(llnotifications.getChannel(channel)); - if (channelptr) - { - // Insert our processing as a "passed filter" listener. This way - // we get to run before all the "changed" listeners, and we get to - // swipe it (hide it from the other listeners) if desired. - channelptr->connectPassedFilter(boost::bind(&Forwarder::handle, this, _1)); - } - } - - void setPumpName(const std::string& name) { mPumpName = name; } - void setTypes(const LLSD& types) { mTypes = types; } - void setRespond(bool respond) { mRespond = respond; } - -private: - bool handle(const LLSD& notification) const; - bool matchType(const LLSD& filter, const std::string& type) const; - - LLNotifications& mNotifications; - std::string mPumpName; - LLSD mTypes; - bool mRespond; -}; - -void LLNotificationsListener::forward(const LLSD& params) -{ - std::string channel(params["channel"]); - // First decide whether we're supposed to start forwarding or stop it. - // Default to true. - bool forward = true; - if (params.has("forward")) - { - forward = params["forward"].asBoolean(); - } - if (! forward) - { - // This is a request to stop forwarding notifications on the specified - // channel. The rest of the params don't matter. - // Because mForwarders contains scoped_ptrs, erasing the map entry - // DOES delete the heap Forwarder object. Because Forwarder derives - // from LLEventTrackable, destroying it disconnects it from the - // channel. - mForwarders.erase(channel); - return; - } - // From here on, we know we're being asked to start (or modify) forwarding - // on the specified channel. Find or create an appropriate Forwarder. - ForwarderMap::iterator - entry(mForwarders.insert(ForwarderMap::value_type(channel, ForwarderMap::mapped_type())).first); - if (! entry->second) - { - entry->second.reset(new Forwarder(mNotifications, channel)); - } - // Now, whether this Forwarder is brand-new or not, update it with the new - // request info. - Forwarder& fwd(*entry->second); - fwd.setPumpName(params["pump"]); - fwd.setTypes(params["types"]); - fwd.setRespond(params["respond"]); -} - -bool LLNotificationsListener::Forwarder::handle(const LLSD& notification) const -{ - LL_INFOS("LLNotificationsListener") << "handle(" << notification << ")" << LL_ENDL; - if (notification["sigtype"].asString() == "delete") - { - LL_INFOS("LLNotificationsListener") << "ignoring delete" << LL_ENDL; - // let other listeners see the "delete" operation - return false; - } - LLNotificationPtr note(mNotifications.find(notification["id"])); - if (! note) - { - LL_INFOS("LLNotificationsListener") << notification["id"] << " not found" << LL_ENDL; - return false; - } - if (! matchType(mTypes, note->getType())) - { - LL_INFOS("LLNotificationsListener") << "didn't match types " << mTypes << LL_ENDL; - // We're not supposed to intercept this particular notification. Let - // other listeners process it. - return false; - } - LL_INFOS("LLNotificationsListener") << "sending via '" << mPumpName << "'" << LL_ENDL; - // This is a notification we care about. Forward it through specified - // LLEventPump. - LLEventPumps::instance().obtain(mPumpName).post(asLLSD(note)); - // Are we also being asked to auto-respond? - if (mRespond) - { - LL_INFOS("LLNotificationsListener") << "should respond" << LL_ENDL; - note->respond(LLSD::emptyMap()); - // Did that succeed in removing the notification? Only cancel() if - // it's still around -- otherwise we get an LL_ERRS crash! - note = mNotifications.find(notification["id"]); - if (note) - { - LL_INFOS("LLNotificationsListener") << "respond() didn't clear, canceling" << LL_ENDL; - mNotifications.cancel(note); - } - } - // If we've auto-responded to this notification, then it's going to be - // deleted. Other listeners would get the change operation, try to look it - // up and be baffled by lookup failure. So when we auto-respond, suppress - // this notification: don't pass it to other listeners. - return mRespond; -} - -bool LLNotificationsListener::Forwarder::matchType(const LLSD& filter, const std::string& type) const -{ - // Decide whether this notification matches filter: - // undefined: forward all notifications - if (filter.isUndefined()) - { - return true; - } - // array of string: forward any notification matching any named type - if (filter.isArray()) - { - for (LLSD::array_const_iterator ti(filter.beginArray()), tend(filter.endArray()); - ti != tend; ++ti) - { - if (ti->asString() == type) - { - return true; - } - } - // Didn't match any entry in the array - return false; - } - // string: forward only the specific named type - return (filter.asString() == type); -} - -LLSD LLNotificationsListener::asLLSD(LLNotificationPtr note) -{ - LLSD notificationInfo(note->asLLSD()); - // For some reason the following aren't included in LLNotification::asLLSD(). - notificationInfo["summary"] = note->summarize(); - notificationInfo["id"] = note->id(); - notificationInfo["type"] = note->getType(); - notificationInfo["message"] = note->getMessage(); - notificationInfo["label"] = note->getLabel(); - return notificationInfo; -} diff --git a/indra/llui/llnotificationslistener.h b/indra/llui/llnotificationslistener.h deleted file mode 100644 index f9f7641de6..0000000000 --- a/indra/llui/llnotificationslistener.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @file llnotificationslistener.h - * @author Brad Kittenbrink - * @date 2009-07-08 - * @brief Wrap subset of LLNotifications API in event API for test scripts. - * - * $LicenseInfo:firstyear=2009&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_LLNOTIFICATIONSLISTENER_H -#define LL_LLNOTIFICATIONSLISTENER_H - -#include "lleventapi.h" -#include "llnotificationptr.h" -#include -#include -#include - -class LLNotifications; -class LLSD; - -class LLNotificationsListener : public LLEventAPI -{ -public: - LLNotificationsListener(LLNotifications & notifications); - ~LLNotificationsListener(); - -private: - void requestAdd(LLSD const & event_data) const; - - void NotificationResponder(const std::string& replypump, - const LLSD& notification, - const LLSD& response) const; - - void listChannels(const LLSD& params) const; - void listChannelNotifications(const LLSD& params) const; - void respond(const LLSD& params) const; - void cancel(const LLSD& params) const; - void ignore(const LLSD& params) const; - void forward(const LLSD& params); - - static LLSD asLLSD(LLNotificationPtr); - - class Forwarder; - typedef std::map > ForwarderMap; - ForwarderMap mForwarders; - LLNotifications & mNotifications; -}; - -#endif // LL_LLNOTIFICATIONSLISTENER_H diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 906b83a400..18a82190b5 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -49,7 +49,6 @@ //#include "llfunctorregistry.h" //#include "llpointer.h" #include "llinitparam.h" -//#include "llnotificationslistener.h" //#include "llnotificationptr.h" //#include "llcachename.h" #include "llnotifications.h" -- cgit v1.2.3 From 8c24cc8e3635888b766e30001749966eddc0dc7e Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 4 Dec 2012 14:38:19 +0200 Subject: CHUI-527 FIXED Changed term to "Multi-person chat" --- indra/newview/skins/default/xui/en/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index a884ac94d6..c75bd98c38 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3400,7 +3400,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Connecting... - Ad-hoc Conference + Multi-person chat Conference with [AGENT_NAME] -- cgit v1.2.3 From ed9e48bf6bd440a004c0d82da79503de34261610 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 4 Dec 2012 14:48:59 +0200 Subject: CHUI-530 FIXED Using selectConversationPair will show appropriate session floater. --- indra/newview/llfloaterimcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 3a80491dae..c1daea0aeb 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1162,7 +1162,7 @@ bool LLFloaterIMContainer::checkContextMenuItem(const std::string& item, uuid_ve void LLFloaterIMContainer::showConversation(const LLUUID& session_id) { setVisibleAndFrontmost(false); - selectConversation(session_id); + selectConversationPair(session_id, true); } void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) -- cgit v1.2.3 From 7527431bedce5529d33add21ec53336800f48fd0 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 5 Dec 2012 13:54:55 +0200 Subject: CHUI-572 FIXED Changed initial position for floaters according to description. --- indra/newview/skins/default/xui/en/floater_camera.xml | 2 +- indra/newview/skins/default/xui/en/floater_destinations.xml | 7 ++++--- indra/newview/skins/default/xui/en/floater_im_container.xml | 9 +++++---- indra/newview/skins/default/xui/en/floater_moveview.xml | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 22bc488a92..4b4821a383 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -1,7 +1,7 @@ + width="550"> diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 4aa7c88312..152c897120 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -3,7 +3,7 @@ can_close="true" can_minimize="true" can_resize="true" - height="430" + height="230" layout="topleft" min_height="50" name="floater_im_box" @@ -13,7 +13,8 @@ single_instance="true" reuse_instance="true" title="CONVERSATIONS" - width="680"> + bottom="-80" + width="450"> @@ -23,13 +24,13 @@ + width="450"> Date: Tue, 4 Dec 2012 20:49:42 +0200 Subject: CHUI-504 FIXED Open Conversation floater on first login. added toggleInstanceOrBringToFront("im_container") to LLStartup; typo corr. --- indra/newview/llstartup.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 1704ad9055..34259658ea 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1520,7 +1520,7 @@ bool idle_startup() } //--------------------------------------------------------------------- - // Agent Send + // World Wait //--------------------------------------------------------------------- if(STATE_WORLD_WAIT == LLStartUp::getStartupState()) { @@ -1846,6 +1846,10 @@ bool idle_startup() // Set the show start location to true, now that the user has logged // on with this install. gSavedSettings.setBOOL("ShowStartLocation", TRUE); + + // Open Conversation floater on first login. + LLFloaterReg::toggleInstanceOrBringToFront("im_container"); + } display_startup(); @@ -2167,7 +2171,6 @@ bool idle_startup() LLStartUp::setStartupState( STATE_STARTED ); display_startup(); - // Unmute audio if desired and setup volumes. // Unmute audio if desired and setup volumes. // This is a not-uncommon crash site, so surround it with // llinfos output to aid diagnosis. -- cgit v1.2.3 From b43c8afc36a11c34fa76443be85430cac6c72c42 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 4 Dec 2012 14:51:33 -0800 Subject: CHUI-550, CHUI-551 : Fixed : Changed conversation sorting according to designer's desires. --- indra/newview/llconversationmodel.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 728b1a3f4c..0b7c3939df 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -528,12 +528,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL { // If both are sessions U32 sort_order = getSortOrderSessions(); - if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) - { - // If one is the nearby session, put nearby session *always* first - return (type_a == LLConversationItem::CONV_SESSION_NEARBY); - } - else if (sort_order == LLConversationFilter::SO_DATE) + + if (sort_order == LLConversationFilter::SO_DATE) { // Sort by time F64 time_a = 0.0; @@ -552,14 +548,22 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL } // If no time available, we'll default to sort by name at the end of this method } - else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) + else { - if (type_a != type_b) + if ((type_a == LLConversationItem::CONV_SESSION_NEARBY) || (type_b == LLConversationItem::CONV_SESSION_NEARBY)) { - // Lowest types come first. See LLConversationItem definition of types - return (type_a < type_b); + // If one is the nearby session, put nearby session *always* last + return (type_b == LLConversationItem::CONV_SESSION_NEARBY); } + else if (sort_order == LLConversationFilter::SO_SESSION_TYPE) + { + if (type_a != type_b) + { + // Lowest types come first. See LLConversationItem definition of types + return (type_a < type_b); + } // If types are identical, we'll default to sort by name at the end of this method + } } } else -- cgit v1.2.3 From 8642088d65ec340b50661e2a3bf74820ec595010 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 4 Dec 2012 19:23:36 -0800 Subject: CHUI-571: Fixed bug where when the converation floater was torn off and a new im received, the incorrect conversation would be displayed and focused. In order to do this removed the conversation floater panels from being focused immediately when set visible. Also there was a bug when showing the stub panel for torn off conversations. The tab container was not setting the stub panel index properly to 0, which is where the stub panel existed in the tab container's list. This is post code review submit. Will submit another with minor code review changes. --- indra/llui/lltabcontainer.cpp | 3 ++- indra/newview/llfloaterimcontainer.cpp | 14 +++----------- indra/newview/llfloaterimnearbychat.cpp | 1 - indra/newview/llfloaterimsession.cpp | 1 - indra/newview/llfloaterimsessiontab.cpp | 2 +- indra/newview/llimview.cpp | 20 ++++++++++++++++---- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 3c1dfc1184..0dd63c2632 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1559,7 +1559,8 @@ BOOL LLTabContainer::setTab(S32 which) void LLTabContainer::hideAllTabs() { - setCurrentPanelIndex(-1); + + setCurrentPanelIndex(0); for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { (* iter)->mTabPanel->setVisible(FALSE); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index c1daea0aeb..d50581a314 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -546,8 +546,10 @@ void LLFloaterIMContainer::setVisible(BOOL visible) // *TODO: find a way to move this to XML as a default panel or something like that LLSD name("nearby_chat"); LLFloaterReg::toggleInstanceOrBringToFront(name); + setSelectedSession(LLUUID(NULL)); } openNearbyChat(); + selectConversationPair(getSelectedSession(), false); } nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); @@ -571,7 +573,6 @@ void LLFloaterIMContainer::setVisible(BOOL visible) // Now, do the normal multifloater show/hide LLMultiFloater::setVisible(visible); - } void LLFloaterIMContainer::collapseMessagesPane(bool collapse) @@ -1624,22 +1625,13 @@ void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, { //Finds the conversation line item to flash using the session_id LLConversationViewSession * widget = dynamic_cast(get_ptr_in_map(mConversationsWidgets,session_id)); - LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); if (widget) { //Start flash if (is_flashes) { - //Only flash when conversation is not active - if(session_floater - && (!session_floater->isInVisibleChain()) //conversation floater not displayed - || - (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus - - { - widget->getFlashTimer()->startFlashing(); - } + widget->getFlashTimer()->startFlashing(); } //Stop flash else diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index a20fce876c..80a41e2f37 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -228,7 +228,6 @@ void LLFloaterIMNearbyChat::setVisible(BOOL visible) { removeScreenChat(); } - setFocus(visible); } // virtual diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index 212b0df712..cb730c6237 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -629,7 +629,6 @@ void LLFloaterIMSession::setVisible(BOOL visible) } - setFocus(visible); } BOOL LLFloaterIMSession::getVisible() diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d04fa2674d..da25f95ffe 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -60,6 +60,7 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) , mRefreshTimer(new LLTimer()) , mIsHostAttached(false) { + setAutoFocus(FALSE); mSession = LLIMModel::getInstance()->findIMSession(mSessionID); mCommitCallbackRegistrar.add("IMSession.Menu.Action", @@ -124,7 +125,6 @@ void LLFloaterIMSessionTab::setVisible(BOOL visible) { LLFloaterIMSessionTab::addToHost(mSessionID); } - setFocus(visible); } /*virtual*/ diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b6fd3ec9c8..821e62c4e6 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -192,12 +192,24 @@ void on_new_message(const LLSD& msg) else if("openconversations" == action) { LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); - if (im_box) + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + + //Don't flash and show conversation floater when conversation already active (has focus) + if(session_floater + && (!session_floater->isInVisibleChain()) //conversation floater not displayed + || + (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus + { - im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item + //Flash line item + if (im_box) + { + im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item + } + + //Surface conversations floater + LLFloaterReg::showInstance("im_container"); } - - LLFloaterReg::showInstance("im_container"); } } -- cgit v1.2.3 From e1b7153b4782ec4d1f8b028b435e7e4f0cf98dc2 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 5 Dec 2012 17:08:38 +0200 Subject: CHUI-530 Additional fix --- indra/newview/llfloaterimcontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index c1daea0aeb..36eb9435e9 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1599,6 +1599,7 @@ void LLFloaterIMContainer::openNearbyChat() LLConversationViewSession* nearby_chat = dynamic_cast(get_ptr_in_map(mConversationsWidgets,LLUUID())); if (nearby_chat) { + selectConversation(LLUUID()); nearby_chat->setOpen(TRUE); } } -- cgit v1.2.3 From e0b1b063c14081a7c53ab5620db20385e1f2bbbd Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 5 Dec 2012 20:03:15 +0200 Subject: CHUI-577 FIXED "Mute text" and "Block voice" items are added to context menu instead of "Block\unblock" --- indra/newview/llconversationmodel.cpp | 1 + indra/newview/llfloaterimcontainer.cpp | 29 ++++++++++++++++++++-- indra/newview/llfloaterimcontainer.h | 1 + .../skins/default/xui/en/menu_conversation.xml | 11 ++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0b7c3939df..4328c60b1a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -115,6 +115,7 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) items.push_back(std::string("share")); items.push_back(std::string("pay")); items.push_back(std::string("block_unblock")); + items.push_back(std::string("MuteText")); if(this->getType() != CONV_SESSION_1_ON_1) { diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 8e7edba0c0..a5b93f3692 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -926,7 +926,11 @@ void LLFloaterIMContainer::doToParticipants(const std::string& command, uuid_vec } else if ("block_unblock" == command) { - LLAvatarActions::toggleBlock(userID); + toggleMute(userID, LLMute::flagVoiceChat); + } + else if ("mute_unmute" == command) + { + toggleMute(userID, LLMute::flagTextChat); } else if ("selected" == command || "mute_all" == command || "unmute_all" == command) { @@ -1144,8 +1148,12 @@ bool LLFloaterIMContainer::checkContextMenuItem(const std::string& item, uuid_ve { if ("is_blocked" == item) { - return LLAvatarActions::isBlocked(uuids.front()); + return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagVoiceChat); } + else if (item == "is_muted") + { + return LLMuteList::getInstance()->isMuted(uuids.front(), LLMute::flagTextChat); + } else if ("is_allowed_text_chat" == item) { const LLSpeaker * speakerp = getSpeakerOfSelectedParticipant(getSpeakerMgrForSelectedParticipant()); @@ -1591,6 +1599,23 @@ void LLFloaterIMContainer::toggleAllowTextChat(const LLUUID& participant_uuid) } } +void LLFloaterIMContainer::toggleMute(const LLUUID& participant_id, U32 flags) +{ + BOOL is_muted = LLMuteList::getInstance()->isMuted(participant_id, flags); + std::string name; + gCacheName->getFullName(participant_id, name); + LLMute mute(participant_id, name, LLMute::AGENT); + + if (!is_muted) + { + LLMuteList::getInstance()->add(mute, flags); + } + else + { + LLMuteList::getInstance()->remove(mute, flags); + } +} + void LLFloaterIMContainer::openNearbyChat() { // If there's only one conversation in the container and that conversation is the nearby chat diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 1badce0d2d..c9987bffe8 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -150,6 +150,7 @@ private: void moderateVoiceAllParticipants(bool unmute); void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); void toggleAllowTextChat(const LLUUID& participant_uuid); + void toggleMute(const LLUUID& participant_id, U32 flags); void openNearbyChat(); LLButton* mExpandCollapseBtn; diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml index 908b2c174f..e8265fe482 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation.xml @@ -105,14 +105,21 @@ - + + + + -- cgit v1.2.3 From fc000880b40143534c47c475a7a0aba6ab75039e Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 5 Dec 2012 20:47:21 +0200 Subject: CHUI-519 FIXED Do not put offered items into the trash while in Busy / DND mode --- indra/llui/llnotifications.cpp | 3 ++- indra/llui/llnotifications.h | 13 +++++++++++-- indra/newview/llnotificationofferhandler.cpp | 1 + indra/newview/llviewermessage.cpp | 5 ++++- indra/newview/skins/default/xui/en/menu_conversation.xml | 3 ++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 66144671c9..fd9bfec203 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -475,7 +475,8 @@ LLNotification::LLNotification(const LLSDParamAdapter& p) : mCancelled(false), mIgnored(false), mResponderObj(NULL), - mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()) + mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()), + mOfferFromAgent(p.offer_from_agent) { if (p.functor.name.isChosen()) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 088931858a..372b9ce46f 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -316,6 +316,7 @@ public: expiry; Optional context; Optional responder; + Optional offer_from_agent; struct Functor : public LLInitParam::ChoiceBlock { @@ -339,7 +340,8 @@ public: payload("payload"), form_elements("form"), substitutions("substitutions"), - expiry("expiry") + expiry("expiry"), + offer_from_agent("offer_from_agent", false) { time_stamp = LLDate::now(); responder = NULL; @@ -352,7 +354,8 @@ public: payload("payload"), form_elements("form"), substitutions("substitutions"), - expiry("expiry") + expiry("expiry"), + offer_from_agent("offer_from_agent", false) { functor.name = _name; name = _name; @@ -378,6 +381,7 @@ private: LLNotificationFormPtr mForm; void* mResponderObj; // TODO - refactor/remove this field LLNotificationResponderPtr mResponder; + bool mOfferFromAgent; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -513,6 +517,11 @@ public: return mTimestamp; } + bool getOfferFromAgent() const + { + return mOfferFromAgent; + } + std::string getType() const; std::string getMessage() const; std::string getFooter() const; diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 91003c7d53..ff5b5e21f7 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -113,6 +113,7 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification) p.panel = notify_box; // we not save offer notifications to the syswell floater that should be added to the IM floater p.can_be_stored = !add_notif_to_im; + p.force_show = notification->getOfferFromAgent(); LLScreenChannel* channel = dynamic_cast(mChannel.get()); if(channel) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dc8192105f..ea804508c8 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1971,6 +1971,7 @@ void inventory_offer_handler(LLOfferInfo* info) p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info)); info->mPersist = true; p.name = "UserGiveItem"; + p.offer_from_agent = true; // Prefetch the item into your local inventory. LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); @@ -2738,7 +2739,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Same as closing window info->forceResponse(IOR_DECLINE); } - else if (is_do_not_disturb && dialog != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565) + // old logic: busy mode must not affect interaction with objects (STORM-565) + // new logic: inventory offers from in-world objects should be auto-declined (CHUI-519) + else if (is_do_not_disturb && dialog == IM_TASK_INVENTORY_OFFERED) { // Until throttling is implemented, do not disturb mode should reject inventory instead of silently // accepting it. SEE SL-39554 diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml index e8265fe482..01ef8ebdb5 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation.xml @@ -116,9 +116,10 @@ label="Block Text" layout="topleft" name="MuteText"> - + + Date: Wed, 5 Dec 2012 12:40:44 -0800 Subject: CHUI 571: Code review changes, now LLFloaterIMContainer::showStub inlines code for hiding all tab panels and then showing the stub panel. Before the function would call hideAllTabs() --- indra/llui/lltabcontainer.cpp | 12 ------------ indra/llui/lltabcontainer.h | 4 +--- indra/newview/llfloaterimcontainer.cpp | 27 +++++++++++++++++++++++---- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 0dd63c2632..91527c68f2 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1556,18 +1556,6 @@ BOOL LLTabContainer::setTab(S32 which) return is_visible; } - -void LLTabContainer::hideAllTabs() -{ - - setCurrentPanelIndex(0); - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) - { - (* iter)->mTabPanel->setVisible(FALSE); - } -} - - BOOL LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index a9cdf22b16..57862fc626 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -192,7 +192,7 @@ public: BOOL selectTabPanel( LLPanel* child ); BOOL selectTab(S32 which); BOOL selectTabByName(const std::string& title); - void hideAllTabs(); + void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } BOOL getTabPanelFlashing(LLPanel* child); void setTabPanelFlashing(LLPanel* child, BOOL state); @@ -243,8 +243,6 @@ private: void setTabsHidden(BOOL hidden) { mTabsHidden = hidden; } BOOL getTabsHidden() const { return mTabsHidden; } - - void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; } void scrollPrev() { mScrollPos = llmax(0, mScrollPos-1); } // No wrap void scrollNext() { mScrollPos = llmin(mScrollPos+1, mMaxScrollPos); } // No wrap diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index a5b93f3692..23c21d5309 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -516,13 +516,32 @@ void LLFloaterIMContainer::tabClose() } } +//Shows/hides the stub panel when a conversation floater is torn off void LLFloaterIMContainer::showStub(bool stub_is_visible) { - if (stub_is_visible) - { - mTabContainer->hideAllTabs(); - } + S32 tabCount = 0; + LLPanel * tabPanel = NULL; + + if(stub_is_visible) + { + tabCount = mTabContainer->getTabCount(); + + //Hide all tabs even stub + for(S32 i = 0; i < tabCount; ++i) + { + tabPanel = mTabContainer->getPanelByIndex(i); + + if(tabPanel) + { + tabPanel->setVisible(false); + } + } + + //Set the index to the stub panel since we will be showing the stub + mTabContainer->setCurrentPanelIndex(0); + } + //Now show/hide the stub mStubPanel->setVisible(stub_is_visible); } -- cgit v1.2.3 From a4a2cc62c3411f0391b90d9720a13b49b0e123ef Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Dec 2012 16:08:17 -0800 Subject: CHUI-509 : Fixed : Add params to inventory widgets to control font colors (required for library items and links). --- indra/llui/llfolderviewitem.cpp | 39 ++++++++++++++++++------------------- indra/llui/llfolderviewitem.h | 10 +++++++--- indra/newview/llinventorybridge.cpp | 5 +++++ indra/newview/llinventorybridge.h | 1 + indra/newview/llinventorypanel.cpp | 24 +++++++++++++++++++++++ indra/newview/llinventorypanel.h | 7 +++++++ 6 files changed, 63 insertions(+), 23 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9b54a7a467..60a6d3e3ea 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -47,16 +47,14 @@ static LLDefaultChildRegistry::Register r("folder_view_item"); // statics std::map LLFolderViewItem::sFonts; // map of styles to fonts +bool LLFolderViewItem::sColorSetInitialized = false; LLUIColor LLFolderViewItem::sFgColor; LLUIColor LLFolderViewItem::sHighlightBgColor; -LLUIColor LLFolderViewItem::sHighlightFgColor; LLUIColor LLFolderViewItem::sFocusOutlineColor; LLUIColor LLFolderViewItem::sMouseOverColor; LLUIColor LLFolderViewItem::sFilterBGColor; LLUIColor LLFolderViewItem::sFilterTextColor; LLUIColor LLFolderViewItem::sSuffixColor; -LLUIColor LLFolderViewItem::sLibraryColor; -LLUIColor LLFolderViewItem::sLinkColor; LLUIColor LLFolderViewItem::sSearchStatusColor; // only integers can be initialized in header @@ -106,6 +104,8 @@ LLFolderViewItem::Params::Params() item_top_pad("item_top_pad"), creation_date(), allow_open("allow_open", true), + font_color("font_color"), + font_highlight_color("font_highlight_color"), left_pad("left_pad", 0), icon_pad("icon_pad", 0), icon_width("icon_width", 0), @@ -113,7 +113,7 @@ LLFolderViewItem::Params::Params() text_pad_right("text_pad_right", 0), arrow_size("arrow_size", 0), max_folder_item_overlap("max_folder_item_overlap", 0) -{} +{ } // Default constructor LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) @@ -137,6 +137,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mViewModelItem(p.listener), mIsMouseOverTitle(false), mAllowOpen(p.allow_open), + mFontColor(p.font_color), + mFontHighlightColor(p.font_highlight_color), mLeftPad(p.left_pad), mIconPad(p.icon_pad), mIconWidth(p.icon_width), @@ -145,17 +147,18 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mArrowSize(p.arrow_size), mMaxFolderItemOverlap(p.max_folder_item_overlap) { - sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); - sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); - sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); - sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); - sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); - sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); - sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); - sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); - sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); - sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); - sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); + if (!sColorSetInitialized) + { + sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); + sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); + sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); + sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); + sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); + sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); + sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE); + sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); + sColorSetInitialized = true; + } if (mViewModelItem) { @@ -785,10 +788,6 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x) { - //TODO RN: implement this in terms of getColor() - //if (highlight_link) color = sLinkColor; - //if (gInventory.isObjectDescendentOf(getViewModelItem()->getUUID(), gInventory.getLibraryRootFolderID())) color = sLibraryColor; - //--------------------------------------------------------------------------------// // Draw the actual label text // @@ -857,7 +856,7 @@ void LLFolderViewItem::draw() box_image->draw(box_rect, sFilterBGColor); } - LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor; + LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor; drawLabel(font, text_left, y, color, right_x); //--------------------------------------------------------------------------------// diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 2e633a39e5..f33f21c8f8 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -61,6 +61,9 @@ public: Optional creation_date; Optional allow_open; + Optional font_color; + Optional font_highlight_color; + Optional left_pad, icon_pad, icon_width, @@ -116,19 +119,20 @@ protected: mIsMouseOverTitle, mAllowOpen, mSelectPending; + + LLUIColor mFontColor; + LLUIColor mFontHighlightColor; // For now assuming all colors are the same in derived classes. + static bool sColorSetInitialized; static LLUIColor sFgColor; static LLUIColor sFgDisabledColor; static LLUIColor sHighlightBgColor; - static LLUIColor sHighlightFgColor; static LLUIColor sFocusOutlineColor; static LLUIColor sMouseOverColor; static LLUIColor sFilterBGColor; static LLUIColor sFilterTextColor; static LLUIColor sSuffixColor; - static LLUIColor sLibraryColor; - static LLUIColor sLinkColor; static LLUIColor sSearchStatusColor; // this is an internal method used for adding items to folders. A diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 73631f4ba8..cf8253ca4d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -255,6 +255,11 @@ BOOL LLInvFVBridge::isLink() const return mIsLink; } +BOOL LLInvFVBridge::isLibraryItem() const +{ + return gInventory.isObjectDescendentOf(getUUID(),gInventory.getLibraryRootFolderID()); +} + /*virtual*/ /** * @brief Adds this item into clipboard storage diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 5e96f00920..5c6cf0f0f0 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -107,6 +107,7 @@ public: virtual BOOL isItemMovable() const; virtual BOOL isItemInTrash() const; virtual BOOL isLink() const; + virtual BOOL isLibraryItem() const; //virtual BOOL removeItem() = 0; virtual void removeBatch(std::vector& batch); virtual void move(LLFolderViewModelItem* new_parent_bridge) {} diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 098a44b9d8..81e7f166e1 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -57,6 +57,15 @@ const std::string LLInventoryPanel::RECENTITEMS_SORT_ORDER = std::string("Recent const std::string LLInventoryPanel::INHERIT_SORT_ORDER = std::string(""); static const LLInventoryFolderViewModelBuilder INVENTORY_BRIDGE_BUILDER; +// statics +bool LLInventoryPanel::sColorSetInitialized = false; +LLUIColor LLInventoryPanel::sDefaultColor; +LLUIColor LLInventoryPanel::sDefaultHighlightColor; +LLUIColor LLInventoryPanel::sLibraryColor; +LLUIColor LLInventoryPanel::sLinkColor; + +const LLColor4U DEFAULT_WHITE(255, 255, 255); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryPanelObserver // @@ -140,6 +149,15 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : { mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER; + if (!sColorSetInitialized) + { + sDefaultColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); + sDefaultHighlightColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); + sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE); + sLinkColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); + sColorSetInitialized = true; + } + // context menu callbacks mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLInventoryPanel::doToSelected, this, _2)); mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); @@ -705,6 +723,9 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br params.listener = bridge; params.tool_tip = params.name; + params.font_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultColor)); + params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultHighlightColor)); + return LLUICtrlFactory::create(params); } @@ -718,6 +739,9 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge params.listener = bridge; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; + + params.font_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultColor)); + params.font_highlight_color = (bridge->isLibraryItem() ? sLibraryColor : (bridge->isLink() ? sLinkColor : sDefaultHighlightColor)); return LLUICtrlFactory::create(params); } diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index c4f3c1b47d..9639086c11 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -275,6 +275,13 @@ protected: // Builds the UI. Call this once the inventory is usable. void initializeViews(); + // Specific inventory colors + static bool sColorSetInitialized; + static LLUIColor sDefaultColor; + static LLUIColor sDefaultHighlightColor; + static LLUIColor sLibraryColor; + static LLUIColor sLinkColor; + LLFolderViewItem* buildNewViews(const LLUUID& id); BOOL getIsHiddenFolderType(LLFolderType::EType folder_type) const; -- cgit v1.2.3 From 3a49beed0e96a797a6d663bcae5e932437ca3661 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Dec 2012 20:25:46 -0800 Subject: CHUI-580 : WIP : Change the display name cache system, deprecating the old protocol and using the cap (People API) whenever available. Still has occurence of Resident as last name to clean up. --- indra/llcommon/llavatarname.cpp | 69 ++++++++++++++++++++++++++++++- indra/llcommon/llavatarname.h | 57 ++++++++++++++++++------- indra/llmessage/llavatarnamecache.cpp | 56 ++++++++----------------- indra/llmessage/llavatarnamecache.h | 2 + indra/llmessage/llcachename.cpp | 6 ++- indra/llui/llscrolllistctrl.cpp | 2 +- indra/llui/llurlentry.cpp | 4 +- indra/newview/llavataractions.cpp | 16 +++---- indra/newview/llavatariconctrl.cpp | 2 +- indra/newview/llavatarlist.cpp | 9 ++-- indra/newview/llavatarlistitem.cpp | 4 +- indra/newview/llcallingcard.cpp | 6 +-- indra/newview/llchathistory.cpp | 14 +++---- indra/newview/llconversationmodel.cpp | 4 +- indra/newview/llfavoritesbar.cpp | 10 ++--- indra/newview/llfloateravatarpicker.cpp | 12 ++---- indra/newview/llfloaterdisplayname.cpp | 10 ++--- indra/newview/llfloaterimnearbychat.cpp | 2 +- indra/newview/llfloaterscriptlimits.cpp | 15 +------ indra/newview/llfloatersellland.cpp | 2 +- indra/newview/llfloatertopobjects.cpp | 14 ++----- indra/newview/llfloatervoicevolume.cpp | 2 +- indra/newview/llfriendcard.cpp | 2 +- indra/newview/llimview.cpp | 20 +++------ indra/newview/llinspectavatar.cpp | 6 +-- indra/newview/llinventorybridge.cpp | 5 +-- indra/newview/llnamelistctrl.cpp | 4 +- indra/newview/llpanelblockedlist.cpp | 2 +- indra/newview/llpanelgroupinvite.cpp | 4 +- indra/newview/llpanelgroupnotices.cpp | 5 +-- indra/newview/llpanelgrouproles.cpp | 4 +- indra/newview/llparticipantlist.cpp | 2 +- indra/newview/lltoastgroupnotifypanel.cpp | 6 +-- indra/newview/lltoolpie.cpp | 3 +- indra/newview/llviewerdisplayname.cpp | 6 +-- indra/newview/llviewermenu.cpp | 6 +-- indra/newview/llviewermessage.cpp | 15 ++----- indra/newview/llvoavatar.cpp | 24 +++++------ indra/newview/llvoicevivox.cpp | 4 +- 39 files changed, 224 insertions(+), 212 deletions(-) diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 3206843bf4..b49e6a7aac 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -30,6 +30,7 @@ #include "llavatarname.h" #include "lldate.h" +#include "llframetimer.h" #include "llsd.h" // Store these in pre-built std::strings to avoid memory allocations in @@ -42,6 +43,8 @@ static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); +bool LLAvatarName::sUseDisplayNames = true; + LLAvatarName::LLAvatarName() : mUsername(), mDisplayName(), @@ -61,6 +64,17 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const return mUsername < rhs.mUsername; } +//static +void LLAvatarName::setUseDisplayNames(bool use) +{ + sUseDisplayNames = use; +} +//static +bool LLAvatarName::useDisplayNames() +{ + return sUseDisplayNames; +} + LLSD LLAvatarName::asLLSD() const { LLSD sd; @@ -85,6 +99,33 @@ void LLAvatarName::fromLLSD(const LLSD& sd) mExpires = expires.secondsSinceEpoch(); LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; mNextUpdate = next_update.secondsSinceEpoch(); + + // Some avatars don't have explicit display names set. Force a legible display name here. + if (mDisplayName.empty()) + { + mDisplayName = mUsername; + } +} + +void LLAvatarName::fromString(const std::string& full_name, F64 expires) +{ + mDisplayName = full_name; + std::string::size_type index = full_name.find(' '); + if (index != std::string::npos) + { + mLegacyFirstName = full_name.substr(0, index); + mLegacyLastName = full_name.substr(index+1); + mUsername = mLegacyFirstName + " " + mLegacyLastName; + } + else + { + mLegacyFirstName = full_name; + mLegacyLastName = ""; + mUsername = full_name; + } + mIsDisplayNameDefault = true; + mIsTemporaryName = true; + mExpires = LLFrameTimer::getTotalSeconds() + expires; } std::string LLAvatarName::getCompleteName() const @@ -104,9 +145,22 @@ std::string LLAvatarName::getCompleteName() const return name; } -std::string LLAvatarName::getLegacyName() const +std::string LLAvatarName::getDisplayName() const +{ + if (sUseDisplayNames) + { + return mDisplayName; + } + else + { + return getUserName(); + } +} + +std::string LLAvatarName::getUserName() const { - if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled? + // If we cannot create a user name from the legacy strings, use the display name + if (mLegacyFirstName.empty() && mLegacyLastName.empty()) { return mDisplayName; } @@ -118,3 +172,14 @@ std::string LLAvatarName::getLegacyName() const name += mLegacyLastName; return name; } + +void LLAvatarName::dump() const +{ + llinfos << "Merov debug : display = " << mDisplayName << ", user = " << mUsername << ", complete = " << getCompleteName() << ", legacy = " << getUserName() << " first = " << mLegacyFirstName << " last = " << mLegacyLastName << llendl; + LL_DEBUGS("AvNameCache") << "LLAvatarName: " + << "user '" << mUsername << "' " + << "display '" << mDisplayName << "' " + << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" + << LL_ENDL; +} + diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index ba258d6d52..cf9eb27b03 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -43,19 +43,50 @@ public: void fromLLSD(const LLSD& sd); + // Used only in legacy mode when the display name capability is not provided server side + void fromString(const std::string& full_name, F64 expires = 0.0f); + + static void setUseDisplayNames(bool use); + static bool useDisplayNames(); + + // Name is valid if not temporary and not yet expired + bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } + + // + bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } + // For normal names, returns "James Linden (james.linden)" // When display names are disabled returns just "James Linden" std::string getCompleteName() const; - - // Returns "James Linden" or "bobsmith123 Resident" for backwards - // compatibility with systems like voice and muting - // *TODO: Eliminate this in favor of username only - std::string getLegacyName() const; - + + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode + // Takes the display name preference into account. This is truly the name that should + // be used for all UI where an avatar name has to be used unless we truly want something else (rare) + std::string getDisplayName() const; + + // Returns "James Linden" or "bobsmith123 Resident" + // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name + // Also used for backwards compatibility with systems like voice and muting + std::string getUserName() const; + + // Debug print of the object + void dump() const; + + // Names can change, so need to keep track of when name was + // last checked. + // Unix time-from-epoch seconds for efficiency + F64 mExpires; + + // You can only change your name every N hours, so record + // when the next update is allowed + // Unix time-from-epoch seconds + F64 mNextUpdate; + +private: // "bobsmith123" or "james.linden", US-ASCII only std::string mUsername; - // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode // Contains data whether or not user has explicitly set // a display name; may duplicate their username. std::string mDisplayName; @@ -81,15 +112,9 @@ public: // shown in UI, but are not serialized. bool mIsTemporaryName; - // Names can change, so need to keep track of when name was - // last checked. - // Unix time-from-epoch seconds for efficiency - F64 mExpires; - - // You can only change your name every N hours, so record - // when the next update is allowed - // Unix time-from-epoch seconds - F64 mNextUpdate; + // Global flag indicating if display name should be used or not + // This will affect the output of the high level "get" methods + static bool sUseDisplayNames; }; #endif diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 700525e1fa..329871d8eb 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -43,10 +43,6 @@ namespace LLAvatarNameCache { use_display_name_signal_t mUseDisplayNamesSignal; - // Manual override for display names - can disable even if the region - // supports it. - bool sUseDisplayNames = true; - // Cache starts in a paused state until we can determine if the // current region supports display names. bool sRunning = false; @@ -209,17 +205,8 @@ public: // Use expiration time from header av_name.mExpires = expires; - // Some avatars don't have explicit display names set - if (av_name.mDisplayName.empty()) - { - av_name.mDisplayName = av_name.mUsername; - } - - LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " " - << "user '" << av_name.mUsername << "' " - << "display '" << av_name.mDisplayName << "' " - << "expires in " << expires - now << " seconds" - << LL_ENDL; + LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << LL_ENDL; + av_name.dump(); // cache it and fire signals LLAvatarNameCache::processName(agent_id, av_name, true); @@ -291,12 +278,9 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id) LLAvatarNameCache::sPendingQueue.erase(agent_id); LLAvatarName& av_name = existing->second; - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " - << agent_id - << "user '" << av_name.mUsername << "' " - << "display '" << av_name.mDisplayName << "' " - << "expires in " << av_name.mExpires - LLFrameTimer::getTotalSeconds() << " seconds" - << LL_ENDL; + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL; + av_name.dump(); + av_name.mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; // reset expiry time so we don't constantly rerequest. } } @@ -476,7 +460,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr) const LLUUID& agent_id = it->first; const LLAvatarName& av_name = it->second; // Do not write temporary or expired entries to the stored cache - if (!av_name.mIsTemporaryName && av_name.mExpires >= max_unrefreshed) + if (av_name.isValidName(max_unrefreshed)) { // key must be a string agents[agent_id.asString()] = av_name.asLLSD(); @@ -513,7 +497,7 @@ void LLAvatarNameCache::idle() if (!sAskQueue.empty()) { - if (useDisplayNames()) + if (hasNameLookupURL()) { requestNamesViaCapability(); } @@ -565,7 +549,7 @@ void LLAvatarNameCache::eraseUnrefreshed() { const LLUUID& agent_id = it->first; LL_DEBUGS("AvNameCache") << agent_id - << " user '" << av_name.mUsername << "' " + << " user '" << av_name.getUserName() << "' " << "expired " << now - av_name.mExpires << " secs ago" << LL_ENDL; sCache.erase(it++); @@ -583,14 +567,12 @@ void LLAvatarNameCache::buildLegacyName(const std::string& full_name, LLAvatarName* av_name) { llassert(av_name); - av_name->mUsername = ""; - av_name->mDisplayName = full_name; - av_name->mIsDisplayNameDefault = true; - av_name->mIsTemporaryName = true; - av_name->mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; + av_name->fromString(full_name,TEMP_CACHE_ENTRY_LIFETIME); LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName " << full_name << LL_ENDL; + // DEBUG ONLY!!! DO NOT COMMIT!!! + av_name->dump(); } // fills in av_name if it has it in the cache, even if expired (can check expiry time) @@ -600,7 +582,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) if (sRunning) { // ...only do immediate lookups when cache is running - if (useDisplayNames()) + if (hasNameLookupURL()) { // ...use display names cache std::map::iterator it = sCache.find(agent_id); @@ -662,7 +644,7 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag if (sRunning) { // ...only do immediate lookups when cache is running - if (useDisplayNames()) + if (hasNameLookupURL()) { // ...use new cache std::map::iterator it = sCache.find(agent_id); @@ -720,20 +702,16 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag void LLAvatarNameCache::setUseDisplayNames(bool use) { - if (use != sUseDisplayNames) + if (use != LLAvatarName::useDisplayNames()) { - sUseDisplayNames = use; - // flush our cache - sCache.clear(); - + LLAvatarName::setUseDisplayNames(use); mUseDisplayNamesSignal(); } } -bool LLAvatarNameCache::useDisplayNames() +void LLAvatarNameCache::flushCache() { - // Must be both manually set on and able to look up names. - return sUseDisplayNames && !sNameLookupURL.empty(); + sCache.clear(); } void LLAvatarNameCache::erase(const LLUUID& agent_id) diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 79f170f7c8..e172601432 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -81,6 +81,8 @@ namespace LLAvatarNameCache void setUseDisplayNames(bool use); bool useDisplayNames(); + void flushCache(); + void erase(const LLUUID& agent_id); /// Provide some fallback for agents that return errors diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 479efabb5f..da07c9ae42 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -524,6 +524,7 @@ std::string LLCacheName::cleanFullName(const std::string& full_name) } //static +// Transform hard-coded name provided by server to a more legible username std::string LLCacheName::buildUsername(const std::string& full_name) { // rare, but handle hard-coded error names returned from server @@ -549,8 +550,9 @@ std::string LLCacheName::buildUsername(const std::string& full_name) return username; } - // if the input wasn't a correctly formatted legacy name just return it unchanged - return full_name; + // if the input wasn't a correctly formatted legacy name, just return it + // cleaned up from a potential terminal "Resident" + return cleanFullName(full_name); } //static diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 3e0653e9a4..7ed7042aff 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1832,7 +1832,7 @@ void LLScrollListCtrl::copyNameToClipboard(std::string id, bool is_group) { LLAvatarName av_name; LLAvatarNameCache::get(LLUUID(id), &av_name); - name = av_name.getLegacyName(); + name = av_name.getUserName(); } LLUrlAction::copyURLToClipboard(name); } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index a9e8fbb4e4..fd2635c73a 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -597,7 +597,7 @@ LLUrlEntryAgentDisplayName::LLUrlEntryAgentDisplayName() std::string LLUrlEntryAgentDisplayName::getName(const LLAvatarName& avatar_name) { - return avatar_name.mDisplayName; + return avatar_name.getDisplayName(); } // @@ -613,7 +613,7 @@ LLUrlEntryAgentUserName::LLUrlEntryAgentUserName() std::string LLUrlEntryAgentUserName::getName(const LLAvatarName& avatar_name) { - return avatar_name.mUsername.empty() ? avatar_name.getLegacyName() : avatar_name.mUsername; + return avatar_name.getUserName(); } // diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 1969a0bc5f..59b862503c 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -135,7 +135,7 @@ void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) LLAvatarName av_name; if(LLAvatarNameCache::get(agent_id, &av_name)) { - args["NAME"] = av_name.mDisplayName; + args["NAME"] = av_name.getDisplayName(); } msgType = "RemoveFromFriends"; @@ -180,7 +180,7 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) static void on_avatar_name_cache_start_im(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name = av_name.mDisplayName; + std::string name = av_name.getDisplayName(); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id); if (session_id != LLUUID::null) { @@ -215,7 +215,7 @@ void LLAvatarActions::endIM(const LLUUID& id) static void on_avatar_name_cache_start_call(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name = av_name.mDisplayName; + std::string name = av_name.getDisplayName(); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true); if (session_id != LLUUID::null) { @@ -315,11 +315,7 @@ static const char* get_profile_floater_name(const LLUUID& avatar_id) static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string username = av_name.mUsername; - if (username.empty()) - { - username = LLCacheName::buildUsername(av_name.mDisplayName); - } + std::string username = av_name.getUserName(); llinfos << "opening web profile for " << username << llendl; std::string url = getProfileURL(username); @@ -379,7 +375,7 @@ void LLAvatarActions::showOnMap(const LLUUID& id) return; } - gFloaterWorldMap->trackAvatar(id, av_name.mDisplayName); + gFloaterWorldMap->trackAvatar(id, av_name.getDisplayName()); LLFloaterReg::showInstance("world_map"); } @@ -709,7 +705,7 @@ void LLAvatarActions::buildResidentsString(std::vector avatar_name const std::string& separator = LLTrans::getString("words_separator"); for (std::vector::const_iterator it = avatar_names.begin(); ; ) { - residents_string.append((*it).mDisplayName); + residents_string.append((*it).getDisplayName()); if (++it == avatar_names.end()) { break; diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index b7278d4a3a..0db38c947c 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -318,7 +318,7 @@ void LLAvatarIconCtrl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarN { // Most avatar icon controls are next to a UI element that shows // a display name, so only show username. - mFullName = av_name.mUsername; + mFullName = av_name.getUserName(); if (mDrawTooltip) { diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 771419f60a..e54e47180f 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -278,7 +278,7 @@ void LLAvatarList::refresh() LLAvatarName av_name; have_names &= LLAvatarNameCache::get(buddy_id, &av_name); - if (!have_filter || findInsensitive(av_name.mDisplayName, mNameFilter)) + if (!have_filter || findInsensitive(av_name.getDisplayName(), mNameFilter)) { if (nadded >= ADD_LIMIT) { @@ -296,8 +296,9 @@ void LLAvatarList::refresh() } else { + std::string display_name = av_name.getDisplayName(); addNewItem(buddy_id, - av_name.mDisplayName.empty() ? waiting_str : av_name.mDisplayName, + display_name.empty() ? waiting_str : display_name, LLAvatarTracker::instance().isBuddyOnline(buddy_id)); } @@ -325,7 +326,7 @@ void LLAvatarList::refresh() const LLUUID& buddy_id = it->asUUID(); LLAvatarName av_name; have_names &= LLAvatarNameCache::get(buddy_id, &av_name); - if (!findInsensitive(av_name.mDisplayName, mNameFilter)) + if (!findInsensitive(av_name.getDisplayName(), mNameFilter)) { removeItemByUUID(buddy_id); modified = true; @@ -398,7 +399,7 @@ bool LLAvatarList::filterHasMatches() // If name has not been loaded yet we consider it as a match. // When the name will be loaded the filter will be applied again(in refresh()). - if (have_name && !findInsensitive(av_name.mDisplayName, mNameFilter)) + if (have_name && !findInsensitive(av_name.getDisplayName(), mNameFilter)) { continue; } diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 7ff1b39573..84e177d4a4 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -449,8 +449,8 @@ void LLAvatarListItem::setNameInternal(const std::string& name, const std::strin void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name) { - setAvatarName(av_name.mDisplayName); - setAvatarToolTip(av_name.mUsername); + setAvatarName(av_name.getDisplayName()); + setAvatarToolTip(av_name.getUserName()); //requesting the list to resort notifyParent(LLSD().with("sort", LLSD())); diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 60d60abd45..9a295faa73 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -723,7 +723,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, // Popup a notify box with online status of this agent // Use display name only because this user is your friend LLSD args; - args["NAME"] = av_name.mDisplayName; + args["NAME"] = av_name.getDisplayName(); args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus"); LLNotificationPtr notification; @@ -869,7 +869,7 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship { LLAvatarName av_name; LLAvatarNameCache::get( buddy_id, &av_name); - buddy_map_t::value_type value(av_name.mDisplayName, buddy_id); + buddy_map_t::value_type value(av_name.getDisplayName(), buddy_id); if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) { mMappable.insert(value); @@ -892,7 +892,7 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud { LLAvatarName av_name; LLAvatarNameCache::get(buddy_id, &av_name); - mFullName = av_name.mDisplayName; + mFullName = av_name.getDisplayName(); buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline()) { diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index a33bd88273..3e25d9c457 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -553,15 +553,15 @@ private: void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - mFrom = av_name.mDisplayName; + mFrom = av_name.getDisplayName(); LLTextBox* user_name = getChild("user_name"); - user_name->setValue( LLSD(av_name.mDisplayName ) ); - user_name->setToolTip( av_name.mUsername ); + user_name->setValue( LLSD(av_name.getDisplayName() ) ); + user_name->setToolTip( av_name.getUserName() ); if (gSavedSettings.getBOOL("NameTagShowUsernames") && - LLAvatarNameCache::useDisplayNames() && - !av_name.mIsDisplayNameDefault) + av_name.useDisplayNames() && + !av_name.isDisplayNameDefault()) { LLStyle::Params style_params_name; LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor"); @@ -569,9 +569,9 @@ private: style_params_name.font.name("SansSerifSmall"); style_params_name.font.style("NORMAL"); style_params_name.readonly_color(userNameColor); - user_name->appendText(" - " + av_name.mUsername, FALSE, style_params_name); + user_name->appendText(" - " + av_name.getUserName(), FALSE, style_params_name); } - setToolTip( av_name.mUsername ); + setToolTip( av_name.getUserName() ); // name might have changed, update width updateMinUserNameWidth(); } diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 728b1a3f4c..76c422f34d 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -443,8 +443,8 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mName = (av_name.mUsername.empty() ? av_name.mDisplayName : av_name.mUsername); - mDisplayName = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); + mName = av_name.getUserName(); + mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; if(mParent != NULL) { diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index c68577db75..ff0e01a200 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1520,8 +1520,8 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() LLAvatarName av_name; LLAvatarNameCache::get( gAgentID, &av_name ); - lldebugs << "Saved favorites for " << av_name.getLegacyName() << llendl; - fav_llsd[av_name.getLegacyName()] = user_llsd; + lldebugs << "Saved favorites for " << av_name.getUserName() << llendl; + fav_llsd[av_name.getUserName()] = user_llsd; llofstream file; file.open(filename); @@ -1539,10 +1539,10 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() LLAvatarName av_name; LLAvatarNameCache::get( gAgentID, &av_name ); - lldebugs << "Removed favorites for " << av_name.getLegacyName() << llendl; - if (fav_llsd.has(av_name.getLegacyName())) + lldebugs << "Removed favorites for " << av_name.getUserName() << llendl; + if (fav_llsd.has(av_name.getUserName())) { - fav_llsd.erase(av_name.getLegacyName()); + fav_llsd.erase(av_name.getUserName()); } llofstream out_file; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 6ada809cdb..f7dd4a4a6b 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -307,9 +307,9 @@ void LLFloaterAvatarPicker::populateNearMe() else { element["columns"][0]["column"] = "name"; - element["columns"][0]["value"] = av_name.mDisplayName; + element["columns"][0]["value"] = av_name.getDisplayName(); element["columns"][1]["column"] = "username"; - element["columns"][1]["value"] = av_name.mUsername; + element["columns"][1]["value"] = av_name.getUserName(); sAvatarNameMap[av] = av_name; } @@ -505,9 +505,7 @@ void LLFloaterAvatarPicker::find() LLViewerRegion* region = gAgent.getRegion(); url = region->getCapability("AvatarPickerSearch"); // Prefer use of capabilities to search on both SLID and display name - // but allow display name search to be manually turned off for test - if (!url.empty() - && LLAvatarNameCache::useDisplayNames()) + if (!url.empty()) { // capability urls don't end in '/', but we need one to parse // query parameters correctly @@ -679,9 +677,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* found_one = TRUE; LLAvatarName av_name; - av_name.mLegacyFirstName = first_name; - av_name.mLegacyLastName = last_name; - av_name.mDisplayName = avatar_name; + av_name.fromString(avatar_name); const LLUUID& agent_id = avatar_id; sAvatarNameMap[agent_id] = av_name; diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index ac8f107928..be1ee77152 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -164,10 +164,9 @@ void LLFloaterDisplayName::onCancel() void LLFloaterDisplayName::onReset() { - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarNameCache::hasNameLookupURL()) { - LLViewerDisplayName::set("", - boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); + LLViewerDisplayName::set("",boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); } else { @@ -199,10 +198,9 @@ void LLFloaterDisplayName::onSave() return; } - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarNameCache::hasNameLookupURL()) { - LLViewerDisplayName::set(display_name_utf8, - boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); + LLViewerDisplayName::set(display_name_utf8,boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); } else { diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index a20fce876c..24b0355fca 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -545,7 +545,7 @@ void LLFloaterIMNearbyChat::addMessage(const LLChat& chat,bool archive,const LLS LLAvatarName av_name; LLAvatarNameCache::get(chat.mFromID, &av_name); - if (!av_name.mIsDisplayNameDefault) + if (!av_name.isDisplayNameDefault()) { from_name = av_name.getCompleteName(); } diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index a50907601c..8d8bba7b17 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -602,15 +602,7 @@ void LLPanelScriptLimitsRegionMemory::onNameCache( return; } - std::string name; - if (LLAvatarNameCache::useDisplayNames()) - { - name = LLCacheName::buildUsername(full_name); - } - else - { - name = full_name; - } + std::string name = LLCacheName::buildUsername(full_name); std::vector::iterator id_itor; for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor) @@ -713,10 +705,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) else { name_is_cached = gCacheName->getFullName(owner_id, owner_buf); // username - if (LLAvatarNameCache::useDisplayNames()) - { - owner_buf = LLCacheName::buildUsername(owner_buf); - } + owner_buf = LLCacheName::buildUsername(owner_buf); } if(!name_is_cached) { diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 484ecbcd04..c97a6792f3 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -238,7 +238,7 @@ void LLFloaterSellLandUI::updateParcelInfo() void LLFloaterSellLandUI::onBuyerNameCache(const LLAvatarName& av_name) { getChild("sell_to_agent")->setValue(av_name.getCompleteName()); - getChild("sell_to_agent")->setToolTip(av_name.mUsername); + getChild("sell_to_agent")->setToolTip(av_name.getUserName()); } void LLFloaterSellLandUI::setBadge(const char* id, Badge badge) diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 2d91a61b54..7530c72dd2 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -199,17 +199,9 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) // Owner names can have trailing spaces sent from server LLStringUtil::trim(owner_buf); - if (LLAvatarNameCache::useDisplayNames()) - { - // ...convert hard-coded name from server to a username - // *TODO: Send owner_id from server and look up display name - owner_buf = LLCacheName::buildUsername(owner_buf); - } - else - { - // ...just strip out legacy "Resident" name - owner_buf = LLCacheName::cleanFullName(owner_buf); - } + // *TODO: Send owner_id from server and look up display name + owner_buf = LLCacheName::buildUsername(owner_buf); + columns[column_num]["column"] = "owner"; columns[column_num]["value"] = owner_buf; columns[column_num++]["font"] = "SANSSERIF"; diff --git a/indra/newview/llfloatervoicevolume.cpp b/indra/newview/llfloatervoicevolume.cpp index 87b388b30a..a1df73a065 100644 --- a/indra/newview/llfloatervoicevolume.cpp +++ b/indra/newview/llfloatervoicevolume.cpp @@ -151,7 +151,7 @@ void LLFloaterVoiceVolume::updateVolumeControls() // By convention, we only display and toggle voice mutes, not all mutes bool is_muted = LLAvatarActions::isVoiceMuted(mAvatarID); - bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden"); + bool is_linden = LLStringUtil::endsWith(mAvatarName.getUserName(), " Linden"); mute_btn->setEnabled(!is_linden); mute_btn->setValue(is_muted); diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index a64ddd185d..0e72fab32c 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -533,7 +533,7 @@ void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID) bool shouldBeAdded = true; LLAvatarName av_name; LLAvatarNameCache::get(avatarID, &av_name); - const std::string& name = av_name.mUsername; + const std::string& name = av_name.getUserName(); lldebugs << "Processing buddy name: " << name << ", id: " << avatarID diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e5dda7e8d8..0de8f124ee 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -306,7 +306,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) { - if (av_name.mIsTemporaryName) + if (!av_name.isValidName()) { S32 separator_index = mName.rfind(" "); std::string name = mName.substr(0, separator_index); @@ -626,15 +626,7 @@ void LLIMModel::LLIMSession::buildHistoryFileName() // so no need for a callback in LLAvatarNameCache::get() if (LLAvatarNameCache::get(mOtherParticipantID, &av_name)) { - if (av_name.mUsername.empty()) - { - // Display names are off, use mDisplayName which will be the legacy name - mHistoryFileName = LLCacheName::buildUsername(av_name.mDisplayName); - } - else - { - mHistoryFileName = av_name.mUsername; - } + mHistoryFileName = LLCacheName::buildUsername(av_name.getUserName()); } else { @@ -836,7 +828,7 @@ bool LLIMModel::logToFile(const std::string& file_name, const std::string& from, LLAvatarName av_name; if (!from_id.isNull() && LLAvatarNameCache::get(from_id, &av_name) && - !av_name.mIsDisplayNameDefault) + !av_name.isDisplayNameDefault()) { from_name = av_name.getCompleteName(); } @@ -1926,7 +1918,7 @@ void LLOutgoingCallDialog::show(const LLSD& key) LLAvatarName av_name; if (LLAvatarNameCache::get(callee_id, &av_name)) { - final_callee_name = av_name.mDisplayName; + final_callee_name = av_name.getDisplayName(); title = av_name.getCompleteName(); } } @@ -2464,7 +2456,7 @@ void LLIMMgr::addMessage( LLAvatarName av_name; if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted) { - fixed_session_name = (av_name.mDisplayName.empty() ? av_name.mUsername : av_name.mDisplayName); + fixed_session_name = av_name.getDisplayName(); } LLIMModel::getInstance()->newSession(new_session_id, fixed_session_name, dialog, other_participant_id, false, is_offline_msg); @@ -3110,7 +3102,7 @@ void LLIMMgr::noteOfflineUsers( { LLUIString offline = LLTrans::getString("offline_message"); // Use display name only because this user is your friend - offline.setArg("[NAME]", av_name.mDisplayName); + offline.setArg("[NAME]", av_name.getDisplayName()); im_model.proccessOnlineOfflineNotification(session_id, offline); } } diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 8a15cd279f..3507b729be 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -263,9 +263,9 @@ void LLInspectAvatar::onAvatarNameCache( { if (agent_id == mAvatarID) { - getChild("user_name")->setValue(av_name.mDisplayName); - getChild("user_name_small")->setValue(av_name.mDisplayName); - getChild("user_slid")->setValue(av_name.mUsername); + getChild("user_name")->setValue(av_name.getDisplayName()); + getChild("user_name_small")->setValue(av_name.getDisplayName()); + getChild("user_slid")->setValue(av_name.getUserName()); mAvatarName = av_name; // show smaller display name if too long to display in regular size diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 73631f4ba8..bad4e8c231 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4712,10 +4712,9 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act gCacheName->getFullName(item->getCreatorUUID(), callingcard_name); // IDEVO LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() - && LLAvatarNameCache::get(item->getCreatorUUID(), &av_name)) + if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name)) { - callingcard_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; + callingcard_name = av_name.getCompleteName(); } LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID()); if (session_id != LLUUID::null) diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index b0fbad33b0..855007e403 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -320,7 +320,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( else if (LLAvatarNameCache::get(id, &av_name)) { if (mShortNames) - fullname = av_name.mDisplayName; + fullname = av_name.getDisplayName(); else fullname = av_name.getCompleteName(); } @@ -390,7 +390,7 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, { std::string name; if (mShortNames) - name = av_name.mDisplayName; + name = av_name.getDisplayName(); else name = av_name.getCompleteName(); diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 7612af8f5e..b4deb7a920 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -224,7 +224,7 @@ void LLPanelBlockedList::onFilterEdit(const std::string& search_string) void LLPanelBlockedList::callbackBlockPicked(const uuid_vec_t& ids, const std::vector names) { if (names.empty() || ids.empty()) return; - LLMute mute(ids[0], names[0].getLegacyName(), LLMute::AGENT); + LLMute mute(ids[0], names[0].getUserName(), LLMute::AGENT); LLMuteList::getInstance()->add(mute); showPanelAndSelect(mute.mID); } diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 7efeb77e23..a2bbc5400c 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -482,7 +482,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) } else { - names.push_back(av_name.getLegacyName()); + names.push_back(av_name.getUserName()); } } } @@ -495,7 +495,7 @@ void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& a std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(id); - names.push_back(av_name.getLegacyName()); + names.push_back(av_name.getUserName()); mImplementation->addUsers(names, agent_ids); } diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 31c0e3d01a..93b108efcc 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -543,10 +543,7 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) msg->getU32("Data","Timestamp",timestamp,i); // we only have the legacy name here, convert it to a username - if (LLAvatarNameCache::useDisplayNames()) - { - name = LLCacheName::buildUsername(name); - } + name = LLCacheName::buildUsername(name); LLSD row; row["id"] = id; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 5720168f81..7ad7e7149b 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1616,7 +1616,7 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb } // trying to avoid unnecessary hash lookups - if (matchesSearchFilter(av_name.getLegacyName())) + if (matchesSearchFilter(av_name.getUserName())) { addMemberToList(id, member); if(!mMembersList->getEnabled()) @@ -1670,7 +1670,7 @@ void LLPanelGroupMembersSubTab::updateMembers() LLAvatarName av_name; if (LLAvatarNameCache::get(mMemberProgress->first, &av_name)) { - if (matchesSearchFilter(av_name.getLegacyName())) + if (matchesSearchFilter(av_name.getUserName())) { addMemberToList(mMemberProgress->first, mMemberProgress->second); } diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 6c838f8a45..c53760bca1 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -381,7 +381,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) // Create a participant view model instance LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); - participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.mDisplayName , avatar_id, mRootViewModel); + participant = new LLConversationItemParticipant(!has_name ? LLTrans::getString("AvatarNameWaiting") : avatar_name.getDisplayName() , avatar_id, mRootViewModel); participant->fetchAvatarName(); } else diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index ed350ea144..4dc0d424ac 100644 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -69,10 +69,8 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi //header title std::string from_name = payload["sender_name"].asString(); - if (LLAvatarNameCache::useDisplayNames()) - { - from_name = LLCacheName::buildUsername(from_name); - } + from_name = LLCacheName::buildUsername(from_name); + std::stringstream from; from << from_name << "/" << groupData.mName; LLTextBox* pTitleText = getChild("title"); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 3cd761b73b..c81f6ace70 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -991,8 +991,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l } LLAvatarName av_name; - if (LLAvatarNameCache::useDisplayNames() && - LLAvatarNameCache::get(hover_object->getID(), &av_name)) + if (LLAvatarNameCache::get(hover_object->getID(), &av_name)) { final_name = av_name.getCompleteName(); } diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index 5741fab29a..4bd38562bc 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -97,7 +97,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl // People API expects array of [ "old value", "new value" ] LLSD change_array = LLSD::emptyArray(); - change_array.append(av_name.mDisplayName); + change_array.append(av_name.getDisplayName()); change_array.append(display_name); llinfos << "Set name POST to " << cap_url << llendl; @@ -189,8 +189,8 @@ class LLDisplayNameUpdate : public LLHTTPNode LLSD args; args["OLD_NAME"] = old_display_name; - args["SLID"] = av_name.mUsername; - args["NEW_NAME"] = av_name.mDisplayName; + args["SLID"] = av_name.getUserName(); + args["NEW_NAME"] = av_name.getDisplayName(); LLNotificationsUtil::add("DisplayNameUpdate", args); if (agent_id == gAgent.getID()) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 511807ec2f..5284d2650e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8080,11 +8080,7 @@ class LLWorldPostProcess : public view_listener_t void handle_flush_name_caches() { - // Toggle display names on and off to flush - bool use_display_names = LLAvatarNameCache::useDisplayNames(); - LLAvatarNameCache::setUseDisplayNames(!use_display_names); - LLAvatarNameCache::setUseDisplayNames(use_display_names); - + LLAvatarNameCache::flushCache(); if (gCacheName) gCacheName->clear(); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dc8192105f..6397ef7961 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2245,16 +2245,7 @@ static std::string clean_name_from_task_im(const std::string& msg, // Don't try to clean up group names if (!from_group) { - if (LLAvatarNameCache::useDisplayNames()) - { - // ...just convert to username - final += LLCacheName::buildUsername(name); - } - else - { - // ...strip out legacy "Resident" name - final += LLCacheName::cleanFullName(name); - } + final += LLCacheName::buildUsername(name); } final += match[3].str(); return final; @@ -2268,7 +2259,7 @@ void notification_display_name_callback(const LLUUID& id, LLSD& substitutions, const LLSD& payload) { - substitutions["NAME"] = av_name.mDisplayName; + substitutions["NAME"] = av_name.getDisplayName(); LLNotificationsUtil::add(name, substitutions, payload); } @@ -3452,7 +3443,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLAvatarName av_name; if (LLAvatarNameCache::get(from_id, &av_name)) { - chat.mFromName = av_name.mDisplayName; + chat.mFromName = av_name.getDisplayName(); } else { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 220c4ef59a..7cc4e3ed04 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3188,29 +3188,27 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) static LLUICachedControl show_display_names("NameTagShowDisplayNames"); static LLUICachedControl show_usernames("NameTagShowUsernames"); - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarName::useDisplayNames()) { LLAvatarName av_name; if (!LLAvatarNameCache::get(getID(), &av_name)) { - // ...call this function back when the name arrives - // and force a rebuild - LLAvatarNameCache::get(getID(), - boost::bind(&LLVOAvatar::clearNameTag, this)); + // ...call this function back when the name arrives and force a rebuild + LLAvatarNameCache::get(getID(),boost::bind(&LLVOAvatar::clearNameTag, this)); } // Might be blank if name not available yet, that's OK if (show_display_names) { - addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerif()); } // Suppress SLID display if display name matches exactly (ugh) - if (show_usernames && !av_name.mIsDisplayNameDefault) + if (show_usernames && !av_name.isDisplayNameDefault()) { // *HACK: Desaturate the color LLColor4 username_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, + addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall()); } } @@ -3421,20 +3419,18 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) { color_name = "NameTagFriend"; } - else if (LLAvatarNameCache::useDisplayNames()) + else if (LLAvatarName::useDisplayNames()) { - // ...color based on whether username "matches" a computed display - // name + // ...color based on whether username "matches" a computed display name LLAvatarName av_name; - if (LLAvatarNameCache::get(getID(), &av_name) - && av_name.mIsDisplayNameDefault) + if (LLAvatarNameCache::get(getID(), &av_name) && av_name.isDisplayNameDefault()) { color_name = "NameTagMatch"; } else { color_name = "NameTagMismatch"; - } + } } else { diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 37491e5b58..6fdda12a1c 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2668,7 +2668,7 @@ void LLVivoxVoiceClient::checkFriend(const LLUUID& id) // *NOTE: For now, we feed legacy names to Vivox because I don't know // if their service can support a mix of new and old clients with // different sorts of names. - std::string name = av_name.getLegacyName(); + std::string name = av_name.getUserName(); const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id); bool canSeeMeOnline = false; @@ -6200,7 +6200,7 @@ void LLVivoxVoiceClient::lookupName(const LLUUID &id) void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string display_name = av_name.mDisplayName; + std::string display_name = av_name.getDisplayName(); avatarNameResolved(agent_id, display_name); } -- cgit v1.2.3 From 5f6d55eb1b264780fbb703b115e9b4428cc4ee2b Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Thu, 6 Dec 2012 15:19:10 +0200 Subject: CHUI-444 (Click target off when conversation list is minimized to icons) --- indra/llui/llfolderviewitem.cpp | 4 ++-- indra/llui/llfolderviewitem.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9b54a7a467..9facf65802 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1863,7 +1863,7 @@ BOOL LLFolderViewFolder::handleMouseDown( S32 x, S32 y, MASK mask ) } if( !handled ) { - if(mIndentation < x && x < mIndentation + (isMinimized() ? 0 : mArrowSize) + mTextPad) + if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad) { toggleOpen(); handled = TRUE; @@ -1887,7 +1887,7 @@ BOOL LLFolderViewFolder::handleDoubleClick( S32 x, S32 y, MASK mask ) } if( !handled ) { - if(mIndentation < x && x < mIndentation + (isMinimized() ? 0 : mArrowSize) + mTextPad) + if(mIndentation < x && x < mIndentation + (isCollapsed() ? 0 : mArrowSize) + mTextPad) { // don't select when user double-clicks plus sign // so as not to contradict single-click behavior diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 2e633a39e5..a35193f948 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -292,7 +292,7 @@ protected: friend class LLUICtrlFactory; void updateLabelRotation(); - virtual bool isMinimized() { return FALSE; } + virtual bool isCollapsed() { return FALSE; } public: typedef std::list items_t; -- cgit v1.2.3 From 272d438ce299fab146e9a30046b7591de7467511 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Thu, 6 Dec 2012 18:23:30 +0200 Subject: CHUI-576 (Group moderation menus do not work in torn off dialogs) --- indra/newview/llfloaterimcontainer.cpp | 20 +++++++++++++------- indra/newview/llfloaterimsessiontab.cpp | 12 ++++++++++++ indra/newview/llfloaterimsessiontab.h | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index c1daea0aeb..257c17a058 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -850,8 +850,16 @@ const LLConversationItem * LLFloaterIMContainer::getCurSelectedViewModelItem() mConversationsRoot->getCurSelectedItem() && mConversationsRoot->getCurSelectedItem()->getViewModelItem()) { - conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); - } + LLFloaterIMSessionTab *selectedSession = LLFloaterIMSessionTab::getConversation(mSelectedSession); + if (selectedSession && selectedSession->isTornOff()) + { + conversationItem = selectedSession->getCurSelectedViewModelItem(); + } + else + { + conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()); + } + } return conversationItem; } @@ -1532,21 +1540,19 @@ void LLFloaterIMContainer::moderateVoiceParticipant(const LLUUID& avatar_id, boo LLSpeakerMgr * LLFloaterIMContainer::getSpeakerMgrForSelectedParticipant() { - LLFolderViewItem * selected_folder_itemp = mConversationsRoot->getCurSelectedItem(); - if (NULL == selected_folder_itemp) + LLFolderViewItem *selectedItem = mConversationsRoot->getCurSelectedItem(); + if (NULL == selectedItem) { llwarns << "Current selected item is null" << llendl; return NULL; } - LLFolderViewFolder * conversation_itemp = selected_folder_itemp->getParentFolder(); - conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin(); conversations_widgets_map::const_iterator end = mConversationsWidgets.end(); const LLUUID * conversation_uuidp = NULL; while(iter != end) { - if (iter->second == conversation_itemp) + if (iter->second == selectedItem || iter->second == selectedItem->getParentFolder()) { conversation_uuidp = &iter->first; break; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index d04fa2674d..85d1b1fb49 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -831,4 +831,16 @@ void LLFloaterIMSessionTab::getSelectedUUIDs(uuid_vec_t& selected_uuids) } } +LLConversationItem* LLFloaterIMSessionTab::getCurSelectedViewModelItem() +{ + LLConversationItem *conversationItem = NULL; + if(mConversationsRoot && + mConversationsRoot->getCurSelectedItem() && + mConversationsRoot->getCurSelectedItem()->getViewModelItem()) + { + conversationItem = static_cast(mConversationsRoot->getCurSelectedItem()->getViewModelItem()) ; + } + + return conversationItem; +} diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 8efa0955fc..4851904074 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -94,6 +94,7 @@ public: virtual void onTearOffClicked(); virtual void updateMessages() {} + LLConversationItem* getCurSelectedViewModelItem(); protected: -- cgit v1.2.3 From e2c080b5582d08302d1deaf1fb64cab1a67c138a Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 6 Dec 2012 19:26:52 +0200 Subject: CHUI-505 FIXED Open Call Log if user has new events while out: force open Conversation Log Floater when received a saved offline message --- indra/newview/llimview.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 821e62c4e6..ea123d3f15 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -30,6 +30,7 @@ #include "llavatarnamecache.h" // IDEVO #include "llavataractions.h" +#include "llfloaterconversationlog.h" #include "llfloaterreg.h" #include "llfontgl.h" #include "llgl.h" @@ -2467,6 +2468,18 @@ void LLIMMgr::addMessage( new_session_id = computeSessionID(dialog, other_participant_id); } + // Open conversation log if offline messages are present + if (is_offline_msg) + { + LLFloaterConversationLog* floater_log = + LLFloaterReg::getTypedInstance("conversation"); + if (floater_log && !(floater_log->isFrontmost())) + { + floater_log->openFloater(); + floater_log->setFrontmost(TRUE); + } + } + //*NOTE session_name is empty in case of incoming P2P sessions std::string fixed_session_name = from; bool name_is_setted = false; -- cgit v1.2.3 From 218cbebbd8bdbfadc954731ee54f6472ed847139 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 6 Dec 2012 15:52:55 -0800 Subject: CHUI-579: When the 'Pop up message' preference is set the conversation line item and/or FUI button flash depending on what is focused. Also when the 'Flash the toolbar button' preference is set the FUI button will flash or the line item will flash depending upon what is focused. --- indra/newview/llimview.cpp | 65 ++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 821e62c4e6..1a2632f921 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -155,57 +155,72 @@ void on_new_message(const LLSD& msg) // execution of the action + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); + LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); + + bool sessionFloaterInActive = session_floater + && (!session_floater->isInVisibleChain()) //conversation floater not displayed + || + (session_floater->isInVisibleChain() && session_floater->hasFocus() == false); //conversation floater is displayed but doesn't have focus + if ("toast" == action) { // Skip toasting if we have open window of IM with this session id - LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(session_id); if ( - open_im_floater - && open_im_floater->isInVisibleChain() - && open_im_floater->hasFocus() - && !open_im_floater->isMinimized() - && !(open_im_floater->getHost() - && open_im_floater->getHost()->isMinimized()) + session_floater + && session_floater->isInVisibleChain() + && session_floater->hasFocus() + && !session_floater->isMinimized() + && !(session_floater->getHost() + && session_floater->getHost()->isMinimized()) ) { return; } // Skip toasting for system messages and for nearby chat - if (participant_id.isNull() || session_id.isNull()) + if (participant_id.isNull()) { return; } - //Show toast - LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + //Show IM toasts (upper right toasts) + if(session_id.notNull()) + { + LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + } + + //Session floater has focus, so don't need to show notification flashes + if(sessionFloaterInActive) + { + //Flash converstation line item anytime that conversation doesn't have focus + im_box->flashConversationItemWidget(session_id, true); + + //Only flash the 'Chat' FUI button when the conversation floater isn't focused (implies not front most floater) + if(!im_box->hasFocus()) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } + } } else if ("flash" == action) { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); - if (im_box) + if(sessionFloaterInActive && !im_box->hasFocus()) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat" + } + else if(sessionFloaterInActive) { im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item } - gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat" } else if("openconversations" == action) { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); - LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); - //Don't flash and show conversation floater when conversation already active (has focus) - if(session_floater - && (!session_floater->isInVisibleChain()) //conversation floater not displayed - || - (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus - + if(sessionFloaterInActive) { //Flash line item - if (im_box) - { - im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item - } + im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item //Surface conversations floater LLFloaterReg::showInstance("im_container"); -- cgit v1.2.3 From 9da625d439a9a911733564177e32facc3669dc58 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 6 Dec 2012 20:28:25 -0800 Subject: CHUI-494: WIP First pass at getting the suppression of events in DND working. --- indra/newview/llbrowsernotification.cpp | 5 + indra/newview/llfloateroutbox.cpp | 17 +-- indra/newview/llimhandler.cpp | 2 +- indra/newview/llnotificationalerthandler.cpp | 28 ++++- indra/newview/llnotificationgrouphandler.cpp | 2 +- indra/newview/llnotificationhandler.h | 145 ++++++++++++++++---------- indra/newview/llnotificationhandlerutil.cpp | 12 ++- indra/newview/llnotificationhinthandler.cpp | 27 ++++- indra/newview/llnotificationofferhandler.cpp | 2 +- indra/newview/llnotificationscripthandler.cpp | 2 +- indra/newview/llnotificationtiphandler.cpp | 2 +- indra/newview/llviewerwindow.cpp | 31 ++---- indra/newview/llviewerwindow.h | 9 +- 13 files changed, 184 insertions(+), 100 deletions(-) diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp index 9e608d2c8b..19747757db 100644 --- a/indra/newview/llbrowsernotification.cpp +++ b/indra/newview/llbrowsernotification.cpp @@ -35,6 +35,11 @@ using namespace LLNotificationsUI; +LLBrowserNotification::LLBrowserNotification() + : LLSystemNotificationHandler("Browser", "browser") +{ +} + bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification) { LLUUID media_id = notification->getPayload()["media_id"].asUUID(); diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index 18ed36d0f3..29a3e6ac3a 100644 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -49,6 +49,11 @@ /// LLOutboxNotification class ///---------------------------------------------------------------------------- +LLNotificationsUI::LLOutboxNotification::LLOutboxNotification() + : LLSystemNotificationHandler("Outbox", "outbox") +{ +} + bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotificationPtr& notify) { LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance("outbox"); @@ -60,10 +65,10 @@ bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotifi void LLNotificationsUI::LLOutboxNotification::onDelete(LLNotificationPtr p) { - LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast(LLNotifications::instance().getChannel("AlertModal").get()); - if (sys_handler) + LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast(LLNotifications::instance().getChannel("AlertModal").get()); + if (notification_handler) { - sys_handler->onDelete(p); + notification_handler->onDelete(p); } } @@ -524,9 +529,9 @@ void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content) void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification) { - LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast(LLNotifications::instance().getChannel("AlertModal").get()); - llassert(sys_handler); + LLNotificationsUI::LLNotificationHandler * notification_handler = dynamic_cast(LLNotifications::instance().getChannel("AlertModal").get()); + llassert(notification_handler); - sys_handler->processNotification(notification); + notification_handler->processNotification(notification); } diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp index 047472a282..72967eb6c7 100644 --- a/indra/newview/llimhandler.cpp +++ b/indra/newview/llimhandler.cpp @@ -38,7 +38,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLIMHandler::LLIMHandler() -: LLSysHandler("IM Notifications", "notifytoast") +: LLCommunicationNotificationHandler("IM Notifications", "notifytoast") { // Getting a Channel for our notifications mChannel = LLChannelManager::getInstance()->createNotificationChannel()->getHandle(); diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp index 2bc9cdd3c1..58a9b01a45 100644 --- a/indra/newview/llnotificationalerthandler.cpp +++ b/indra/newview/llnotificationalerthandler.cpp @@ -29,6 +29,7 @@ #include "llnotificationhandler.h" +#include "llagentcamera.h" #include "llnotifications.h" #include "llprogressview.h" #include "lltoastnotifypanel.h" @@ -41,7 +42,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal) -: LLSysHandler(name, notification_type), +: LLSystemNotificationHandler(name, notification_type), mIsModal(is_modal) { LLScreenChannelBase::Params p; @@ -123,3 +124,28 @@ void LLAlertHandler::onChange( LLNotificationPtr notification ) if(channel) channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog); } + +//-------------------------------------------------------------------------- +LLViewerAlertHandler::LLViewerAlertHandler(const std::string& name, const std::string& notification_type) + : LLSystemNotificationHandler(name, notification_type) +{ +} + +bool LLViewerAlertHandler::processNotification(const LLNotificationPtr& p) +{ + if (gHeadlessClient) + { + LL_INFOS("LLViewerAlertHandler") << "Alert: " << p->getName() << LL_ENDL; + } + + // If we're in mouselook, the mouse is hidden and so the user can't click + // the dialog buttons. In that case, change to First Person instead. + if( gAgentCamera.cameraMouselook() ) + { + gAgentCamera.changeCameraToDefault(); + } + + return false; +} + + diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp index 18cd94e685..8fef102cf8 100644 --- a/indra/newview/llnotificationgrouphandler.cpp +++ b/indra/newview/llnotificationgrouphandler.cpp @@ -38,7 +38,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLGroupHandler::LLGroupHandler() -: LLSysHandler("Group Notifications", "groupnotify") +: LLCommunicationNotificationHandler("Group Notifications", "groupnotify") { // Getting a Channel for our notifications LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel(); diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 4bded6ab30..98b0eecd0d 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -27,6 +27,7 @@ #ifndef LL_LLNOTIFICATIONHANDLER_H #define LL_LLNOTIFICATIONHANDLER_H +#include #include "llwindow.h" @@ -86,23 +87,39 @@ protected: /** * Handler for system notifications. */ -class LLSysHandler : public LLEventHandler, public LLNotificationChannel +class LLNotificationHandler : public LLEventHandler, public LLNotificationChannel { public: - LLSysHandler(const std::string& name, const std::string& notification_type); - virtual ~LLSysHandler() {}; + LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName); + virtual ~LLNotificationHandler() {}; // base interface functions - /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());} + virtual void onAdd(LLNotificationPtr p) { processNotification(p); } + virtual void onChange(LLNotificationPtr p) { processNotification(p); } + virtual void onLoad(LLNotificationPtr p) { processNotification(p); } + virtual void onDelete(LLNotificationPtr p) { if (mChannel.get()) mChannel.get()->removeToastByNotificationID(p->getID());} - virtual bool processNotification(const LLNotificationPtr& notify)=0; + virtual bool processNotification(const LLNotificationPtr& notify) = 0; +}; + +class LLSystemNotificationHandler : public LLNotificationHandler +{ +public: + LLSystemNotificationHandler(const std::string& name, const std::string& notification_type); + virtual ~LLSystemNotificationHandler() {}; +}; + +class LLCommunicationNotificationHandler : public LLNotificationHandler +{ +public: + LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type); + virtual ~LLCommunicationNotificationHandler() {}; }; /** - * Handler for chat message notifications. + * Handler for chat message notifications. */ +// XXX stinson 12/06/2012 : can I just remove the LLChatHandler class? class LLChatHandler : public LLEventHandler { public: @@ -115,67 +132,62 @@ public: * Handler for IM notifications. * It manages life time of IMs, group messages. */ -class LLIMHandler : public LLSysHandler +class LLIMHandler : public LLCommunicationNotificationHandler { public: LLIMHandler(); virtual ~LLIMHandler(); + bool processNotification(const LLNotificationPtr& p); protected: - bool processNotification(const LLNotificationPtr& p); - /*virtual*/ void initChannel(); + virtual void initChannel(); }; /** * Handler for system informational notices. * It manages life time of tip notices. */ -class LLTipHandler : public LLSysHandler +class LLTipHandler : public LLSystemNotificationHandler { public: LLTipHandler(); virtual ~LLTipHandler(); - // base interface functions - /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ bool processNotification(const LLNotificationPtr& p); + virtual bool processNotification(const LLNotificationPtr& p); protected: - /*virtual*/ void initChannel(); + virtual void initChannel(); }; /** * Handler for system informational notices. * It manages life time of script notices. */ -class LLScriptHandler : public LLSysHandler +class LLScriptHandler : public LLSystemNotificationHandler { public: LLScriptHandler(); virtual ~LLScriptHandler(); - /*virtual*/ void onDelete(LLNotificationPtr p); - // base interface functions - /*virtual*/ bool processNotification(const LLNotificationPtr& p); + virtual void onDelete(LLNotificationPtr p); + virtual bool processNotification(const LLNotificationPtr& p); protected: - /*virtual*/ void onDeleteToast(LLToast* toast); - /*virtual*/ void initChannel(); + virtual void onDeleteToast(LLToast* toast); + virtual void initChannel(); }; /** * Handler for group system notices. */ -class LLGroupHandler : public LLSysHandler +class LLGroupHandler : public LLCommunicationNotificationHandler { public: LLGroupHandler(); virtual ~LLGroupHandler(); - // base interface functions - /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ bool processNotification(const LLNotificationPtr& p); + virtual bool processNotification(const LLNotificationPtr& p); protected: virtual void initChannel(); @@ -184,15 +196,14 @@ protected: /** * Handler for alert system notices. */ -class LLAlertHandler : public LLSysHandler +class LLAlertHandler : public LLSystemNotificationHandler { public: LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal); virtual ~LLAlertHandler(); - /*virtual*/ void onChange(LLNotificationPtr p); - /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ bool processNotification(const LLNotificationPtr& p); + virtual void onChange(LLNotificationPtr p); + virtual bool processNotification(const LLNotificationPtr& p); protected: virtual void initChannel(); @@ -200,67 +211,87 @@ protected: bool mIsModal; }; +class LLViewerAlertHandler : public LLSystemNotificationHandler +{ + LOG_CLASS(LLViewerAlertHandler); +public: + LLViewerAlertHandler(const std::string& name, const std::string& notification_type); + virtual ~LLViewerAlertHandler() {}; + + virtual void onDelete(LLNotificationPtr p) {}; + virtual bool processNotification(const LLNotificationPtr& p); + +protected: + virtual void initChannel() {}; +}; + +typedef boost::intrusive_ptr LLViewerAlertHandlerPtr; + /** * Handler for offers notices. * It manages life time of offer notices. */ -class LLOfferHandler : public LLSysHandler +class LLOfferHandler : public LLCommunicationNotificationHandler { public: LLOfferHandler(); virtual ~LLOfferHandler(); - // base interface functions - /*virtual*/ void onChange(LLNotificationPtr p); - /*virtual*/ void onDelete(LLNotificationPtr notification); - /*virtual*/ bool processNotification(const LLNotificationPtr& p); + virtual void onChange(LLNotificationPtr p); + virtual void onDelete(LLNotificationPtr notification); + virtual bool processNotification(const LLNotificationPtr& p); protected: - /*virtual*/ void initChannel(); + virtual void initChannel(); }; /** * Handler for UI hints. */ -class LLHintHandler : public LLNotificationChannel +class LLHintHandler : public LLSystemNotificationHandler { public: - LLHintHandler() : LLNotificationChannel("Hints", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "hint")) - {} + LLHintHandler(); virtual ~LLHintHandler() {} - /*virtual*/ void onAdd(LLNotificationPtr p); - /*virtual*/ void onLoad(LLNotificationPtr p); - /*virtual*/ void onDelete(LLNotificationPtr p); + virtual void onAdd(LLNotificationPtr p); + virtual void onLoad(LLNotificationPtr p); + virtual void onDelete(LLNotificationPtr p); + virtual bool processNotification(const LLNotificationPtr& p); + +protected: + virtual void initChannel() {}; }; /** * Handler for browser notifications */ -class LLBrowserNotification : public LLNotificationChannel +class LLBrowserNotification : public LLSystemNotificationHandler { public: - LLBrowserNotification() - : LLNotificationChannel("Browser", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "browser")) - {} - /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } - bool processNotification(const LLNotificationPtr& p); + LLBrowserNotification(); + virtual ~LLBrowserNotification() {} + + virtual bool processNotification(const LLNotificationPtr& p); + +protected: + virtual void initChannel() {}; }; /** * Handler for outbox notifications */ -class LLOutboxNotification : public LLNotificationChannel +class LLOutboxNotification : public LLSystemNotificationHandler { public: - LLOutboxNotification() - : LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "outbox")) - {} - /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onChange(LLNotificationPtr p) { } - /*virtual*/ void onDelete(LLNotificationPtr p); - bool processNotification(const LLNotificationPtr& p); + LLOutboxNotification(); + virtual ~LLOutboxNotification() {}; + virtual void onChange(LLNotificationPtr p) { } + virtual void onDelete(LLNotificationPtr p); + virtual bool processNotification(const LLNotificationPtr& p); + +protected: + virtual void initChannel() {}; }; class LLHandlerUtil diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 7f1216ff40..f0175d677c 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -41,8 +41,16 @@ using namespace LLNotificationsUI; -LLSysHandler::LLSysHandler(const std::string& name, const std::string& notification_type) -: LLNotificationChannel(name, "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, notification_type)) +LLNotificationHandler::LLNotificationHandler(const std::string& name, const std::string& notification_type, const std::string& parentName) +: LLNotificationChannel(name, parentName, LLNotificationFilters::filterBy(&LLNotification::getType, notification_type)) +{} + +LLSystemNotificationHandler::LLSystemNotificationHandler(const std::string& name, const std::string& notification_type) + : LLNotificationHandler(name, notification_type, "System") +{} + +LLCommunicationNotificationHandler::LLCommunicationNotificationHandler(const std::string& name, const std::string& notification_type) + : LLNotificationHandler(name, notification_type, "Communication") {} // static diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp index 271f418507..f40369a2e0 100644 --- a/indra/newview/llnotificationhinthandler.cpp +++ b/indra/newview/llnotificationhinthandler.cpp @@ -33,6 +33,27 @@ using namespace LLNotificationsUI; -void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); } -void LLHintHandler::onLoad(LLNotificationPtr p) { LLHints::show(p); } -void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); } +LLHintHandler::LLHintHandler() + : LLSystemNotificationHandler("Hints", "hint") +{ +} + +void LLHintHandler::onAdd(LLNotificationPtr p) +{ + LLHints::show(p); +} + +void LLHintHandler::onLoad(LLNotificationPtr p) +{ + LLHints::show(p); +} + +void LLHintHandler::onDelete(LLNotificationPtr p) +{ + LLHints::hide(p); +} + +bool LLHintHandler::processNotification(const LLNotificationPtr& p) +{ + return false; +} diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index ff5b5e21f7..da38c9063b 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -41,7 +41,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLOfferHandler::LLOfferHandler() -: LLSysHandler("Offer", "offer") +: LLCommunicationNotificationHandler("Offer", "offer") { // Getting a Channel for our notifications LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel(); diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index 290a81f91c..e2d4e9f8ce 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -39,7 +39,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLScriptHandler::LLScriptHandler() -: LLSysHandler("Notifications", "notify") +: LLSystemNotificationHandler("Notifications", "notify") { // Getting a Channel for our notifications LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel(); diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index faa67b5ea4..a85335f1ba 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -42,7 +42,7 @@ using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLTipHandler::LLTipHandler() -: LLSysHandler("NotificationTips", "notifytip") +: LLSystemNotificationHandler("NotificationTips", "notifytip") { // Getting a Channel for our notifications LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1b45e6f85d..7b1cf6e180 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -39,6 +39,7 @@ #include "llagentcamera.h" #include "llfloaterreg.h" #include "llmeshrepository.h" +#include "llnotificationhandler.h" #include "llpanellogin.h" #include "llviewerkeyboard.h" #include "llviewermenu.h" @@ -127,6 +128,7 @@ #include "llmorphview.h" #include "llmoveview.h" #include "llnavigationbar.h" +#include "llnotificationhandler.h" #include "llpanelpathfindingrebakenavmesh.h" #include "llpaneltopinfobar.h" #include "llpopupview.h" @@ -1554,11 +1556,13 @@ LLViewerWindow::LLViewerWindow(const Params& p) mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard))); mViewerWindowListener.reset(new LLViewerWindowListener(this)); - mAlertsChannel.reset(new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alert"))); - mModalAlertsChannel.reset(new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "alertmodal"))); + mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything)); + mCommunicationChannel.reset(new LLNotificationChannel("Communication", "Visible", boost::bind(&LLAgent::isDoNotDisturb, &gAgent))); + mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert")); + mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal")); - mAlertsChannel->connectChanged(&LLViewerWindow::onAlert); - mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert); + //mAlertsChannel->connectChanged(&LLViewerWindow::onAlert); + //mModalAlertsChannel->connectChanged(&LLViewerWindow::onAlert); bool ignore = gSavedSettings.getBOOL("IgnoreAllNotifications"); LLNotifications::instance().setIgnoreAllNotifications(ignore); if (ignore) @@ -5001,25 +5005,6 @@ LLRect LLViewerWindow::getChatConsoleRect() //---------------------------------------------------------------------------- -//static -bool LLViewerWindow::onAlert(const LLSD& notify) -{ - LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - - if (gHeadlessClient) - { - llinfos << "Alert: " << notification->getName() << llendl; - } - - // If we're in mouselook, the mouse is hidden and so the user can't click - // the dialog buttons. In that case, change to First Person instead. - if( gAgentCamera.cameraMouselook() ) - { - gAgentCamera.changeCameraToDefault(); - } - return false; -} - void LLViewerWindow::setUIVisibility(bool visible) { mUIVisible = visible; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index ee6a7793f8..b828a05384 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -43,6 +43,8 @@ #include "lltimer.h" #include "llstat.h" #include "llmousehandler.h" +#include "llnotifications.h" +#include "llnotificationhandler.h" #include "llhandle.h" #include "llinitparam.h" @@ -401,7 +403,6 @@ public: private: bool shouldShowToolTipFor(LLMouseHandler *mh); - static bool onAlert(const LLSD& notify); void switchToolByMask(MASK mask); void destroyWindow(); @@ -418,8 +419,10 @@ private: bool mActive; bool mUIVisible; - boost::shared_ptr mAlertsChannel, - mModalAlertsChannel; + LLNotificationChannelPtr mSystemChannel; + LLNotificationChannelPtr mCommunicationChannel; + LLNotificationsUI::LLViewerAlertHandlerPtr mAlertsChannel; + LLNotificationsUI::LLViewerAlertHandlerPtr mModalAlertsChannel; LLRect mWindowRectRaw; // whole window, including UI LLRect mWindowRectScaled; // whole window, scaled by UI size -- cgit v1.2.3 From bb322a1cccd3fab28951ad4e11b5edcfc4e48140 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 7 Dec 2012 00:10:50 -0800 Subject: CHUI-580 : Fixed : Clean up the use of display name. Allow the use of the legacy protocol in settings.xml --- indra/llcommon/llavatarname.cpp | 75 ++++++++++---- indra/llcommon/llavatarname.h | 13 ++- indra/llmessage/llavatarnamecache.cpp | 170 +++++++++++--------------------- indra/llmessage/llavatarnamecache.h | 32 +++--- indra/llmessage/llcachename.h | 2 +- indra/llui/tests/llurlentry_stub.cpp | 5 - indra/newview/app_settings/settings.xml | 11 +++ indra/newview/llstartup.cpp | 2 +- indra/newview/llviewermenu.cpp | 2 +- 9 files changed, 154 insertions(+), 158 deletions(-) diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index b49e6a7aac..95ecce509b 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -45,6 +45,12 @@ static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); bool LLAvatarName::sUseDisplayNames = true; +// Minimum time-to-live (in seconds) for a name entry. +// Avatar name should always guarantee to expire reasonably soon by default +// so if the failure to get a valid expiration time was due to something temporary +// we will eventually request and get the right data. +const F64 MIN_ENTRY_LIFETIME = 60.0; + LLAvatarName::LLAvatarName() : mUsername(), mDisplayName(), @@ -107,40 +113,67 @@ void LLAvatarName::fromLLSD(const LLSD& sd) } } -void LLAvatarName::fromString(const std::string& full_name, F64 expires) +// Transform a string (typically provided by the legacy service) into a decent +// avatar name instance. +void LLAvatarName::fromString(const std::string& full_name) { mDisplayName = full_name; std::string::size_type index = full_name.find(' '); if (index != std::string::npos) { + // The name is in 2 parts (first last) mLegacyFirstName = full_name.substr(0, index); mLegacyLastName = full_name.substr(index+1); - mUsername = mLegacyFirstName + " " + mLegacyLastName; + if (mLegacyLastName != "Resident") + { + mUsername = mLegacyFirstName + "." + mLegacyLastName; + mDisplayName = full_name; + LLStringUtil::toLower(mUsername); + } + else + { + // Very old names do have a dummy "Resident" last name + // that we choose to hide from users. + mUsername = mLegacyFirstName; + mDisplayName = mLegacyFirstName; + } } else { mLegacyFirstName = full_name; mLegacyLastName = ""; mUsername = full_name; + mDisplayName = full_name; } mIsDisplayNameDefault = true; mIsTemporaryName = true; + setExpires(MIN_ENTRY_LIFETIME); +} + +void LLAvatarName::setExpires(F64 expires) +{ mExpires = LLFrameTimer::getTotalSeconds() + expires; } std::string LLAvatarName::getCompleteName() const { std::string name; - if (mUsername.empty() || mIsDisplayNameDefault) - // If the display name feature is off - // OR this particular display name is defaulted (i.e. based on user name), - // then display only the easier to read instance of the person's name. + if (sUseDisplayNames) { - name = mDisplayName; + if (mUsername.empty() || mIsDisplayNameDefault) + { + // If this particular display name is defaulted (i.e. based on user name), + // then display only the easier to read instance of the person's name. + name = mDisplayName; + } + else + { + name = mDisplayName + " (" + mUsername + ")"; + } } else { - name = mDisplayName + " (" + mUsername + ")"; + name = getUserName(); } return name; } @@ -159,23 +192,29 @@ std::string LLAvatarName::getDisplayName() const std::string LLAvatarName::getUserName() const { - // If we cannot create a user name from the legacy strings, use the display name - if (mLegacyFirstName.empty() && mLegacyLastName.empty()) + std::string name; + if (mLegacyLastName.empty() || (mLegacyLastName == "Resident")) { - return mDisplayName; + if (mLegacyFirstName.empty()) + { + // If we cannot create a user name from the legacy strings, use the display name + name = mDisplayName; + } + else + { + // The last name might be empty if it defaulted to "Resident" + name = mLegacyFirstName; + } + } + else + { + name = mLegacyFirstName + " " + mLegacyLastName; } - - std::string name; - name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); - name = mLegacyFirstName; - name += " "; - name += mLegacyLastName; return name; } void LLAvatarName::dump() const { - llinfos << "Merov debug : display = " << mDisplayName << ", user = " << mUsername << ", complete = " << getCompleteName() << ", legacy = " << getUserName() << " first = " << mLegacyFirstName << " last = " << mLegacyLastName << llendl; LL_DEBUGS("AvNameCache") << "LLAvatarName: " << "user '" << mUsername << "' " << "display '" << mDisplayName << "' " diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index cf9eb27b03..2f8c534974 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -39,20 +39,25 @@ public: bool operator<(const LLAvatarName& rhs) const; + // Conversion to and from LLSD (cache file or server response) LLSD asLLSD() const; - void fromLLSD(const LLSD& sd); // Used only in legacy mode when the display name capability is not provided server side - void fromString(const std::string& full_name, F64 expires = 0.0f); + // or to otherwise create a temporary valid item. + void fromString(const std::string& full_name); + // Set the name object to become invalid in "expires" seconds from now + void setExpires(F64 expires); + + // Set and get the display name flag set by the user in preferences. static void setUseDisplayNames(bool use); static bool useDisplayNames(); - // Name is valid if not temporary and not yet expired + // A name object is valid if not temporary and not yet expired (default is expiration not checked) bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } - // + // Return true if the name is made up from legacy or temporary data bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } // For normal names, returns "James Linden (james.linden)" diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 329871d8eb..15c4f2a207 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -47,18 +47,22 @@ namespace LLAvatarNameCache // current region supports display names. bool sRunning = false; + // Use the People API (modern) for fetching name if true. Use the old legacy protocol if false. + // For testing, there's a UsePeopleAPI setting that can be flipped (must restart viewer). + bool sUsePeopleAPI = true; + // Base lookup URL for name service. // On simulator, loaded from indra.xml // On viewer, usually a simulator capability (at People API team's request) // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/" std::string sNameLookupURL; - // accumulated agent IDs for next query against service + // Accumulated agent IDs for next query against service typedef std::set ask_queue_t; ask_queue_t sAskQueue; - // agent IDs that have been requested, but with no reply - // maps agent ID to frame time request was made + // Agent IDs that have been requested, but with no reply. + // Maps agent ID to frame time request was made. typedef std::map pending_queue_t; pending_queue_t sPendingQueue; @@ -69,21 +73,21 @@ namespace LLAvatarNameCache typedef std::map signal_map_t; signal_map_t sSignalMap; - // names we know about + // The cache at last, i.e. avatar names we know about. typedef std::map cache_t; cache_t sCache; - // Send bulk lookup requests a few times a second at most - // only need per-frame timing resolution + // Send bulk lookup requests a few times a second at most. + // Only need per-frame timing resolution. LLFrameTimer sRequestTimer; - /// Maximum time an unrefreshed cache entry is allowed + // Maximum time an unrefreshed cache entry is allowed. const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0; - /// Time when unrefreshed cached names were checked last + // Time when unrefreshed cached names were checked last. static F64 sLastExpireCheck; - /// Time-to-live for a temp cache entry. + // Time-to-live for a temp cache entry. const F64 TEMP_CACHE_ENTRY_LIFETIME = 60.0; //----------------------------------------------------------------------- @@ -91,26 +95,18 @@ namespace LLAvatarNameCache //----------------------------------------------------------------------- // Handle name response off network. - // Optionally skip adding to cache, used when this is a fallback to the - // legacy name system. void processName(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool add_to_cache); + const LLAvatarName& av_name); void requestNamesViaCapability(); // Legacy name system callback void legacyNameCallback(const LLUUID& agent_id, const std::string& full_name, - bool is_group - ); + bool is_group); void requestNamesViaLegacy(); - // Fill in an LLAvatarName with the legacy name data - void buildLegacyName(const std::string& full_name, - LLAvatarName* av_name); - // Do a single callback to a given slot void fireSignal(const LLUUID& agent_id, const callback_slot_t& slot, @@ -209,7 +205,7 @@ public: av_name.dump(); // cache it and fire signals - LLAvatarNameCache::processName(agent_id, av_name, true); + LLAvatarNameCache::processName(agent_id, av_name); } // Same logic as error response case @@ -271,7 +267,7 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id) } else { - // we have a chached (but probably expired) entry - since that would have + // we have a cached (but probably expired) entry - since that would have // been returned by the get method, there is no need to signal anyone // Clear this agent from the pending list @@ -281,22 +277,20 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id) LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL; av_name.dump(); - av_name.mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; // reset expiry time so we don't constantly rerequest. + // Reset expiry time so we don't constantly rerequest. + av_name.setExpires(TEMP_CACHE_ENTRY_LIFETIME); } } -void LLAvatarNameCache::processName(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool add_to_cache) +void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName& av_name) { - if (add_to_cache) - { - sCache[agent_id] = av_name; - } + // Add to the cache + sCache[agent_id] = av_name; + // Suppress request from the queue sPendingQueue.erase(agent_id); - // signal everyone waiting on this name + // Signal everyone waiting on this name signal_map_t::iterator sig_it = sSignalMap.find(agent_id); if (sig_it != sSignalMap.end()) { @@ -373,22 +367,20 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id, const std::string& full_name, bool is_group) { - // Construct a dummy record for this name. By convention, SLID is blank - // Never expires, but not written to disk, so lasts until end of session. - LLAvatarName av_name; LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameCallback " << "agent " << agent_id << " " << "full name '" << full_name << "'" << ( is_group ? " [group]" : "" ) << LL_ENDL; - buildLegacyName(full_name, &av_name); + + // Construct an av_name record from this name. + LLAvatarName av_name; + av_name.fromString(full_name); + av_name.dump(); // Add to cache, because if we don't we'll keep rerequesting the - // same record forever. buildLegacyName should always guarantee - // that these records expire reasonably soon - // (in TEMP_CACHE_ENTRY_LIFETIME seconds), so if the failure was due - // to something temporary we will eventually request and get the right data. - processName(agent_id, av_name, true); + // same record forever. + processName(agent_id, av_name); } void LLAvatarNameCache::requestNamesViaLegacy() @@ -410,18 +402,19 @@ void LLAvatarNameCache::requestNamesViaLegacy() LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL; gCacheName->get(agent_id, false, // legacy compatibility - boost::bind(&LLAvatarNameCache::legacyNameCallback, - _1, _2, _3)); + boost::bind(&LLAvatarNameCache::legacyNameCallback, _1, _2, _3)); } } -void LLAvatarNameCache::initClass(bool running) +void LLAvatarNameCache::initClass(bool running, bool usePeopleAPI) { sRunning = running; + sUsePeopleAPI = usePeopleAPI; } void LLAvatarNameCache::cleanupClass() { + sCache.clear(); } void LLAvatarNameCache::importFile(std::istream& istr) @@ -481,6 +474,11 @@ bool LLAvatarNameCache::hasNameLookupURL() return !sNameLookupURL.empty(); } +bool LLAvatarNameCache::usePeopleAPI() +{ + return hasNameLookupURL() && sUsePeopleAPI; +} + void LLAvatarNameCache::idle() { // By convention, start running at first idle() call @@ -497,13 +495,12 @@ void LLAvatarNameCache::idle() if (!sAskQueue.empty()) { - if (hasNameLookupURL()) + if (usePeopleAPI()) { requestNamesViaCapability(); } else { - // ...fall back to legacy name cache system requestNamesViaLegacy(); } } @@ -563,18 +560,6 @@ void LLAvatarNameCache::eraseUnrefreshed() } } -void LLAvatarNameCache::buildLegacyName(const std::string& full_name, - LLAvatarName* av_name) -{ - llassert(av_name); - av_name->fromString(full_name,TEMP_CACHE_ENTRY_LIFETIME); - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName " - << full_name - << LL_ENDL; - // DEBUG ONLY!!! DO NOT COMMIT!!! - av_name->dump(); -} - // fills in av_name if it has it in the cache, even if expired (can check expiry time) // returns bool specifying if av_name was filled, false otherwise bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) @@ -582,38 +567,24 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) if (sRunning) { // ...only do immediate lookups when cache is running - if (hasNameLookupURL()) + std::map::iterator it = sCache.find(agent_id); + if (it != sCache.end()) { - // ...use display names cache - std::map::iterator it = sCache.find(agent_id); - if (it != sCache.end()) - { - *av_name = it->second; + *av_name = it->second; - // re-request name if entry is expired - if (av_name->mExpires < LLFrameTimer::getTotalSeconds()) + // re-request name if entry is expired + if (av_name->mExpires < LLFrameTimer::getTotalSeconds()) + { + if (!isRequestPending(agent_id)) { - if (!isRequestPending(agent_id)) - { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " - << "refresh agent " << agent_id - << LL_ENDL; - sAskQueue.insert(agent_id); - } + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " + << "refresh agent " << agent_id + << LL_ENDL; + sAskQueue.insert(agent_id); } - - return true; - } - } - else - { - // ...use legacy names cache - std::string full_name; - if (gCacheName->getFullName(agent_id, full_name)) - { - buildLegacyName(full_name, av_name); - return true; } + + return true; } } @@ -644,30 +615,14 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag if (sRunning) { // ...only do immediate lookups when cache is running - if (hasNameLookupURL()) - { - // ...use new cache - std::map::iterator it = sCache.find(agent_id); - if (it != sCache.end()) - { - const LLAvatarName& av_name = it->second; - - if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) - { - // ...name already exists in cache, fire callback now - fireSignal(agent_id, slot, av_name); - return connection; - } - } - } - else + std::map::iterator it = sCache.find(agent_id); + if (it != sCache.end()) { - // ...use old name system - std::string full_name; - if (gCacheName->getFullName(agent_id, full_name)) + const LLAvatarName& av_name = it->second; + + if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) { - LLAvatarName av_name; - buildLegacyName(full_name, &av_name); + // ...name already exists in cache, fire callback now fireSignal(agent_id, slot, av_name); return connection; } @@ -709,11 +664,6 @@ void LLAvatarNameCache::setUseDisplayNames(bool use) } } -void LLAvatarNameCache::flushCache() -{ - sCache.clear(); -} - void LLAvatarNameCache::erase(const LLUUID& agent_id) { sCache.erase(agent_id); diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index e172601432..2a8eb46187 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -37,33 +37,33 @@ class LLUUID; namespace LLAvatarNameCache { - typedef boost::signals2::signal use_display_name_signal_t; // Until the cache is set running, immediate lookups will fail and // async lookups will be queued. This allows us to block requests // until we know if the first region supports display names. - void initClass(bool running); + void initClass(bool running, bool usePeopleAPI); void cleanupClass(); + // Import/export the name cache to file. void importFile(std::istream& istr); void exportFile(std::ostream& ostr); - // On the viewer, usually a simulator capabilitity - // If empty, name cache will fall back to using legacy name - // lookup system + // On the viewer, usually a simulator capabilitity. + // If empty, name cache will fall back to using legacy name lookup system. void setNameLookupURL(const std::string& name_lookup_url); - // Do we have a valid lookup URL, hence are we trying to use the - // new display name lookup system? + // Do we have a valid lookup URL, i.e. are we trying to use the + // more recent display name lookup system? bool hasNameLookupURL(); + bool usePeopleAPI(); // Periodically makes a batch request for display names not already in - // cache. Call once per frame. + // cache. Called once per frame. void idle(); // If name is in cache, returns true and fills in provided LLAvatarName - // otherwise returns false + // otherwise returns false. bool get(const LLUUID& agent_id, LLAvatarName *av_name); // Callback types for get() below @@ -73,23 +73,19 @@ namespace LLAvatarNameCache typedef callback_signal_t::slot_type callback_slot_t; typedef boost::signals2::connection callback_connection_t; - // Fetches name information and calls callback. - // If name information is in cache, callback will be called immediately. + // Fetches name information and calls callbacks. + // If name information is in cache, callbacks will be called immediately. callback_connection_t get(const LLUUID& agent_id, callback_slot_t slot); - // Allow display names to be explicitly disabled for testing. + // Set display name: flips the switch and triggers the callbacks. void setUseDisplayNames(bool use); - bool useDisplayNames(); - - void flushCache(); + void insert(const LLUUID& agent_id, const LLAvatarName& av_name); void erase(const LLUUID& agent_id); - /// Provide some fallback for agents that return errors + /// Provide some fallback for agents that return errors. void handleAgentError(const LLUUID& agent_id); - void insert(const LLUUID& agent_id, const LLAvatarName& av_name); - // Compute name expiration time from HTTP Cache-Control header, // or return default value, in seconds from epoch. F64 nameExpirationFromHeaders(LLSD headers); diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index b108e37157..d238c3a247 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -40,7 +40,7 @@ typedef boost::signals2::signal LLCacheNameSignal; typedef LLCacheNameSignal::slot_type LLCacheNameCallback; -// Old callback with user data for compatability +// Old callback with user data for compatibility typedef void (*old_callback_t)(const LLUUID&, const std::string&, bool, void*); // Here's the theory: diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index f8797fd257..5d3f9ac327 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -46,11 +46,6 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag return connection; } -bool LLAvatarNameCache::useDisplayNames() -{ - return false; -} - // // Stub implementation for LLCacheName // diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ece711a128..423e5a00df 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12648,6 +12648,17 @@ Value 1 + UsePeopleAPI + + Comment + Use the people API cap for avatar name fetching, use old legacy protocol if false. Requires restart. + Persist + 1 + Type + Boolean + Value + 1 + UseStartScreen Comment diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 34259658ea..66a2e6dbda 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2806,7 +2806,7 @@ void LLStartUp::initNameCache() // Start cache in not-running state until we figure out if we have // capabilities for display name lookup - LLAvatarNameCache::initClass(false); + LLAvatarNameCache::initClass(false,gSavedSettings.getBOOL("UsePeopleAPI")); LLAvatarNameCache::setUseDisplayNames(gSavedSettings.getBOOL("UseDisplayNames")); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5284d2650e..7ae717cb42 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8080,7 +8080,7 @@ class LLWorldPostProcess : public view_listener_t void handle_flush_name_caches() { - LLAvatarNameCache::flushCache(); + LLAvatarNameCache::cleanupClass(); if (gCacheName) gCacheName->clear(); } -- cgit v1.2.3 From 935b3326254f75af876b6c9aeb1648ac3a9802cf Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Fri, 7 Dec 2012 15:03:32 +0200 Subject: CHUI-427 FIXED Voice button is added to Conversations floater. --- indra/newview/llfloaterimcontainer.cpp | 13 +++++++++++++ indra/newview/llfloaterimcontainer.h | 2 ++ indra/newview/llfloaterimsessiontab.cpp | 3 ++- .../newview/skins/default/xui/en/floater_im_container.xml | 15 ++++++++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index b8a37da3fa..bd99e88a9d 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -206,6 +206,7 @@ BOOL LLFloaterIMContainer::postBuild() mExpandCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onExpandCollapseButtonClicked, this)); mStubCollapseBtn = getChild("stub_collapse_btn"); mStubCollapseBtn->setClickedCallback(boost::bind(&LLFloaterIMContainer::onStubCollapseButtonClicked, this)); + getChild("speak_btn")->setClickedCallback(boost::bind(&LLFloaterIMContainer::onSpeakButtonClicked, this)); childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this)); @@ -341,6 +342,11 @@ void LLFloaterIMContainer::onStubCollapseButtonClicked() collapseMessagesPane(true); } +void LLFloaterIMContainer::onSpeakButtonClicked() +{ + LLAgent::toggleMicrophone("speak"); + updateSpeakBtnState(); +} void LLFloaterIMContainer::onExpandCollapseButtonClicked() { if (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed() @@ -1672,6 +1678,13 @@ void LLFloaterIMContainer::reSelectConversation() } } +void LLFloaterIMContainer::updateSpeakBtnState() +{ + LLButton* mSpeakBtn = getChild("speak_btn"); + mSpeakBtn->setToggleState(LLVoiceClient::getInstance()->getUserPTTState()); + mSpeakBtn->setEnabled(LLAgent::isActionAllowed("speak")); +} + void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id, bool is_flashes) { //Finds the conversation line item to flash using the session_id diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index c9987bffe8..92985c036a 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -117,6 +117,7 @@ private: void onExpandCollapseButtonClicked(); void onStubCollapseButtonClicked(); void processParticipantsStyleUpdate(); + void onSpeakButtonClicked(); void collapseConversationsPane(bool collapse); @@ -172,6 +173,7 @@ public: void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id); void setNearbyDistances(); void reSelectConversation(); + void updateSpeakBtnState(); void flashConversationItemWidget(const LLUUID& session_id, bool is_flashes); private: diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index b50b8c2d32..0567ea3d8a 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -698,7 +698,8 @@ void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive) voiceButton->setToolTip( callIsActive? getString("end_call_button_tooltip") : getString("start_call_button_tooltip")); - enableDisableCallBtn(); + LLFloaterIMContainer::getInstance()->updateSpeakBtnState(); + enableDisableCallBtn(); } diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 152c897120..a3648f3c9d 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -73,13 +73,26 @@ image_hover_unselected="Toolbar_Middle_Over" image_overlay="Conv_toolbar_plus" image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_unselected="Toolbar_Middle_Off" layout="topleft" top="5" left_pad="4" name="add_btn" tool_tip="Start a new conversation" width="31"/> + + + diff --git a/indra/newview/skins/default/xui/es/menu_notification_well_button.xml b/indra/newview/skins/default/xui/es/menu_notification_well_button.xml new file mode 100644 index 0000000000..0562d35be7 --- /dev/null +++ b/indra/newview/skins/default/xui/es/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml b/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml new file mode 100644 index 0000000000..323bfdbf16 --- /dev/null +++ b/indra/newview/skins/default/xui/fr/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/it/menu_notification_well_button.xml b/indra/newview/skins/default/xui/it/menu_notification_well_button.xml new file mode 100644 index 0000000000..8c82e30f0e --- /dev/null +++ b/indra/newview/skins/default/xui/it/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml b/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml new file mode 100644 index 0000000000..913bae8958 --- /dev/null +++ b/indra/newview/skins/default/xui/ja/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml b/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml new file mode 100644 index 0000000000..bd3d42f9b1 --- /dev/null +++ b/indra/newview/skins/default/xui/pl/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml b/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml new file mode 100644 index 0000000000..43ad4134ec --- /dev/null +++ b/indra/newview/skins/default/xui/pt/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml b/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml new file mode 100644 index 0000000000..4d067e232a --- /dev/null +++ b/indra/newview/skins/default/xui/ru/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml b/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml new file mode 100644 index 0000000000..39c66268f5 --- /dev/null +++ b/indra/newview/skins/default/xui/tr/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml b/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml new file mode 100644 index 0000000000..b629f73584 --- /dev/null +++ b/indra/newview/skins/default/xui/zh/menu_notification_well_button.xml @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3 From 13a619cb5fc8da621d4e7becbf95ca2a8014deb3 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 18 Dec 2012 18:15:28 -0800 Subject: CHUI-385: Problem: When the new session was created with multiple participants the old conversation floater was being recycled. When the conversation floater was re-initialized it did not remove and update the chat messages. Resolution: When the conversation floater is recycled simply call reloadMessages(). --- indra/newview/llfloaterimsession.cpp | 5 +---- indra/newview/llfloaterimsession.h | 4 ---- indra/newview/llimview.cpp | 3 ++- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index f2afe9d7bb..ff07ddfcbf 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -73,8 +73,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) mTypingTimer(), mTypingTimeoutTimer(), mPositioned(false), - mSessionInitialized(false), - mStartConferenceInSameFloater(false) + mSessionInitialized(false) { mIsNearbyChat = false; @@ -462,8 +461,6 @@ void LLFloaterIMSession::addP2PSessionParticipants(const LLSD& notification, con return; } - mStartConferenceInSameFloater = true; - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); // first check whether this is a voice session diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 43d84eb8c0..6a2f4b29eb 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -127,8 +127,6 @@ public: //used as a callback on receiving new IM message static void sRemoveTypingIndicator(const LLSD& data); static void onIMChicletCreated(const LLUUID& session_id); - - bool getStartConferenceInSameFloater() const { return mStartConferenceInSameFloater; } const LLUUID& getOtherParticipantUUID() {return mOtherParticipantUUID;} static boost::signals2::connection setIMFloaterShowedCallback(const floater_showed_signal_t::slot_type& cb); @@ -188,8 +186,6 @@ private: bool mSessionInitialized; LLSD mQueuedMsgsForInit; - bool mStartConferenceInSameFloater; - uuid_vec_t mInvitedParticipants; // connection to voice channel state change signal diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index da3d2e89bf..868dba9687 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2699,12 +2699,13 @@ LLUUID LLIMMgr::addSession( { LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(floater_id); - if (im_floater && im_floater->getStartConferenceInSameFloater()) + if (im_floater) { // The IM floater should be initialized with a new session_id // so that it is found by that id when creating a chiclet in LLFloaterIMSession::onIMChicletCreated, // and a new floater is not created. im_floater->initIMSession(session_id); + im_floater->reloadMessages(); } } -- cgit v1.2.3 From c73947ac1fc6c48bca75ea7d6beeda63eb695b2b Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 18 Dec 2012 18:48:15 -0800 Subject: CHUI-499: Adding ability to serialize the communication notifications to local disk per user. --- indra/llui/llnotifications.cpp | 2 + indra/llui/llnotifications.h | 3 + indra/newview/CMakeLists.txt | 4 + indra/newview/llchannelmanager.cpp | 2 + indra/newview/llcommunicationchannel.cpp | 73 ++++++++++++++ indra/newview/llcommunicationchannel.h | 59 ++++++++++++ .../newview/lldonotdisturbnotificationstorage.cpp | 106 +++++++++++++++++++++ indra/newview/lldonotdisturbnotificationstorage.h | 57 +++++++++++ indra/newview/llimview.cpp | 6 +- indra/newview/llnotificationhandler.h | 1 - indra/newview/llviewerwindow.cpp | 3 +- 11 files changed, 311 insertions(+), 5 deletions(-) create mode 100644 indra/newview/llcommunicationchannel.cpp create mode 100644 indra/newview/llcommunicationchannel.h create mode 100644 indra/newview/lldonotdisturbnotificationstorage.cpp create mode 100644 indra/newview/lldonotdisturbnotificationstorage.h diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 937dcf0afc..c9b4399bef 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -992,10 +992,12 @@ bool LLNotificationChannelBase::updateItem(const LLSD& payload, LLNotificationPt bool abortProcessing = false; if (passesFilter) { + onFilterPass(pNotification); abortProcessing = mPassedFilter(payload); } else { + onFilterFail(pNotification); abortProcessing = mFailedFilter(payload); } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 8bb79b57e3..42dee4c3e9 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -774,6 +774,9 @@ protected: virtual void onDelete(LLNotificationPtr p) {} virtual void onChange(LLNotificationPtr p) {} + virtual void onFilterPass(LLNotificationPtr p) {} + virtual void onFilterFail(LLNotificationPtr p) {} + bool updateItem(const LLSD& payload, LLNotificationPtr pNotification); LLNotificationFilter mFilter; }; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index da1d96414b..d43f9e9988 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -137,6 +137,7 @@ set(viewer_SOURCE_FILES llcommanddispatcherlistener.cpp llcommandhandler.cpp llcommandlineparser.cpp + llcommunicationchannel.cpp llcompilequeue.cpp llconfirmationmanager.cpp llconversationlog.cpp @@ -152,6 +153,7 @@ set(viewer_SOURCE_FILES lldebugview.cpp lldelayedgestureerror.cpp lldirpicker.cpp + lldonotdisturbnotificationstorage.cpp lldndbutton.cpp lldrawable.cpp lldrawpool.cpp @@ -723,6 +725,7 @@ set(viewer_HEADER_FILES llcommanddispatcherlistener.h llcommandhandler.h llcommandlineparser.h + llcommunicationchannel.h llcompilequeue.h llconfirmationmanager.h llconversationlog.h @@ -738,6 +741,7 @@ set(viewer_HEADER_FILES lldebugview.h lldelayedgestureerror.h lldirpicker.h + lldonotdisturbnotificationstorage.h lldndbutton.h lldrawable.h lldrawpool.h diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index 79e2d376ea..dd2bcc742b 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -29,6 +29,7 @@ #include "llchannelmanager.h" #include "llappviewer.h" +#include "lldonotdisturbnotificationstorage.h" #include "llpersistentnotificationstorage.h" #include "llviewercontrol.h" #include "llviewerwindow.h" @@ -138,6 +139,7 @@ void LLChannelManager::onLoginCompleted() } LLPersistentNotificationStorage::getInstance()->loadNotifications(); + LLDoNotDisturbNotificationStorage::getInstance()->initialize(); } //-------------------------------------------------------------------------- diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp new file mode 100644 index 0000000000..353447e4b6 --- /dev/null +++ b/indra/newview/llcommunicationchannel.cpp @@ -0,0 +1,73 @@ +/** +* @file llcommunicationchannel.cpp +* @brief Implementation of llcommunicationchannel +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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" // must be first include + +#include "llcommunicationchannel.h" + +#include +#include + +#include "llagent.h" +#include "lldate.h" +#include "llnotifications.h" + + +LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName) + : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus) +{ +} + +LLCommunicationChannel::~LLCommunicationChannel() +{ +} + +bool LLCommunicationChannel::filterByDoNotDisturbStatus(LLNotificationPtr) +{ + return !gAgent.isDoNotDisturb(); +} + +LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::beginHistory() const +{ + return mHistory.begin(); +} + +LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::endHistory() const +{ + return mHistory.end(); +} + +void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) +{ + std::string notificationType = pNotificationPtr->getType(); + if ((notificationType == "groupnotify") + || (notificationType == "offer") + || (notificationType == "notifytoast")) + { + mHistory.insert(std::make_pair(pNotificationPtr->getDate(), pNotificationPtr)); + } +} diff --git a/indra/newview/llcommunicationchannel.h b/indra/newview/llcommunicationchannel.h new file mode 100644 index 0000000000..a4756b8993 --- /dev/null +++ b/indra/newview/llcommunicationchannel.h @@ -0,0 +1,59 @@ +/** +* @file llcommunicationchannel.h +* @brief Header file for llcommunicationchannel +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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_LLCOMMUNICATIONCHANNEL_H +#define LL_LLCOMMUNICATIONCHANNEL_H + +#include +#include + +#include "lldate.h" +#include "llerror.h" +#include "llnotifications.h" + +class LLCommunicationChannel : public LLNotificationChannel +{ + LOG_CLASS(LLCommunicationChannel); +public: + LLCommunicationChannel(const std::string& pName, const std::string& pParentName); + virtual ~LLCommunicationChannel(); + + static bool filterByDoNotDisturbStatus(LLNotificationPtr); + + typedef std::multimap history_list_t; + history_list_t::const_iterator beginHistory() const; + history_list_t::const_iterator endHistory() const; + +protected: + virtual void onFilterFail(LLNotificationPtr pNotificationPtr); + +private: + + history_list_t mHistory; +}; + +#endif // LL_LLCOMMUNICATIONCHANNEL_H + diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp new file mode 100644 index 0000000000..472a0dd9ee --- /dev/null +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -0,0 +1,106 @@ +/** +* @file lldonotdisturbnotificationstorage.cpp +* @brief Implementation of lldonotdisturbnotificationstorage +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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 "lldonotdisturbnotificationstorage.h" + +#include "llcommunicationchannel.h" +#include "lldir.h" +#include "llerror.h" +#include "llfasttimer_class.h" +#include "llnotifications.h" +#include "llnotificationstorage.h" +#include "llsd.h" +#include "llsingleton.h" + +LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage() + : LLSingleton() + , LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml")) +{ +} + +LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage() +{ +} + +void LLDoNotDisturbNotificationStorage::initialize() +{ + getCommunicationChannel()->connectFailedFilter(boost::bind(&LLDoNotDisturbNotificationStorage::onChannelChanged, this, _1)); +} + +static LLFastTimer::DeclareTimer FTM_SAVE_DND_NOTIFICATIONS("Save DND Notifications"); + +void LLDoNotDisturbNotificationStorage::saveNotifications() +{ + LLFastTimer _(FTM_SAVE_DND_NOTIFICATIONS); + + LLNotificationChannelPtr channelPtr = getCommunicationChannel(); + const LLCommunicationChannel *commChannel = dynamic_cast(channelPtr.get()); + llassert(commChannel != NULL); + + LLSD output = LLSD::emptyMap(); + LLSD& data = output["data"]; + data = LLSD::emptyArray(); + + for (LLCommunicationChannel::history_list_t::const_iterator historyIter = commChannel->beginHistory(); + historyIter != commChannel->endHistory(); ++historyIter) + { + LLNotificationPtr notificationPtr = historyIter->second; + + if (!notificationPtr->isRespondedTo() && !notificationPtr->isCancelled() && !notificationPtr->isExpired()) + { + data.append(notificationPtr->asLLSD()); + } + } + + writeNotifications(output); +} + +static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notifications"); + +void LLDoNotDisturbNotificationStorage::loadNotifications() +{ +} + +LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const +{ + LLNotificationChannelPtr channelPtr = LLNotifications::getInstance()->getChannel("Communication"); + llassert(channelPtr); + return channelPtr; +} + + +bool LLDoNotDisturbNotificationStorage::onChannelChanged(const LLSD& pPayload) +{ + if (pPayload["sigtype"].asString() != "load") + { + saveNotifications(); + } + + return false; +} diff --git a/indra/newview/lldonotdisturbnotificationstorage.h b/indra/newview/lldonotdisturbnotificationstorage.h new file mode 100644 index 0000000000..60bcd89ec3 --- /dev/null +++ b/indra/newview/lldonotdisturbnotificationstorage.h @@ -0,0 +1,57 @@ +/** +* @file lldonotdisturbnotificationstorage.h +* @brief Header file for lldonotdisturbnotificationstorage +* @author Stinson@lindenlab.com +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, 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_LLDONOTDISTURBNOTIFICATIONSTORAGE_H +#define LL_LLDONOTDISTURBNOTIFICATIONSTORAGE_H + +#include "llerror.h" +#include "llnotifications.h" +#include "llnotificationstorage.h" +#include "llsingleton.h" + +class LLSD; + +class LLDoNotDisturbNotificationStorage : public LLSingleton, public LLNotificationStorage +{ + LOG_CLASS(LLDoNotDisturbNotificationStorage); +public: + LLDoNotDisturbNotificationStorage(); + ~LLDoNotDisturbNotificationStorage(); + + void initialize(); + + void saveNotifications(); + void loadNotifications(); + +protected: + +private: + LLNotificationChannelPtr getCommunicationChannel() const; + bool onChannelChanged(const LLSD& pPayload); +}; + +#endif // LL_LLDONOTDISTURBNOTIFICATIONSTORAGE_H + diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index c9672413bf..26be7f6bbf 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -149,7 +149,7 @@ void on_new_message(const LLSD& msg) } // do not show notification in "do not disturb" mode or it goes from agent - if (gAgent.isDoNotDisturb() || gAgent.getID() == participant_id) + if (gAgent.getID() == participant_id) { return; } @@ -2500,7 +2500,7 @@ void LLIMMgr::addMessage( } bool new_session = !hasSession(new_session_id); - if (new_session && !gAgent.isDoNotDisturb()) + if (new_session) { LLAvatarName av_name; if (LLAvatarNameCache::get(other_participant_id, &av_name) && !name_is_setted) @@ -2543,7 +2543,7 @@ void LLIMMgr::addMessage( } //Play sound for new conversations - if(gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE)) { make_ui_sound("UISndNewIncomingIMSession"); } diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index a78f0c067b..bff4efa9ea 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -119,7 +119,6 @@ public: /** * Handler for chat message notifications. */ -// XXX stinson 12/06/2012 : can I just remove the LLChatHandler class? class LLChatHandler : public LLEventHandler { public: diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 424898536e..1c463015e2 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llagentcamera.h" +#include "llcommunicationchannel.h" #include "llfloaterreg.h" #include "llmeshrepository.h" #include "llnotificationhandler.h" @@ -1557,7 +1558,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) mViewerWindowListener.reset(new LLViewerWindowListener(this)); mSystemChannel.reset(new LLNotificationChannel("System", "Visible", LLNotificationFilters::includeEverything)); - mCommunicationChannel.reset(new LLNotificationChannel("Communication", "Visible", !boost::bind(&LLAgent::isDoNotDisturb, &gAgent))); + mCommunicationChannel.reset(new LLCommunicationChannel("Communication", "Visible")); mAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alerts", "alert")); mModalAlertsChannel.reset(new LLNotificationsUI::LLViewerAlertHandler("VW_alertmodal", "alertmodal")); -- cgit v1.2.3 From a4975ace20faa3b6de952f26865dca53dcb9060c Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 18 Dec 2012 19:10:19 -0800 Subject: CHUI-569: Ensure that we create a friend request notification even in the case of do-not-disturb mode. The DND mode will log it to a file to be re-created when DND mode is exited. --- indra/newview/llviewermessage.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5bb7db5c0d..04dd7c911b 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3169,17 +3169,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["online"] = (offline == IM_ONLINE); payload["sender"] = msg->getSender().getIPandPort(); - if (is_do_not_disturb) - { - send_do_not_disturb_message(msg, from_id); - LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); - } - else if (is_muted) + if (is_muted) { LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); } else { + if (is_do_not_disturb) + { + send_do_not_disturb_message(msg, from_id); + } args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); if(message.empty()) { -- cgit v1.2.3 From da59ef8013801eac3695cea0ae8c1097275b6832 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 18 Dec 2012 19:22:21 -0800 Subject: Removing copy from the DoNotDisturbModeSet notification as we are no longer auto deleting inventory offers. --- indra/newview/skins/default/xui/en/notifications.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 94307d2f93..35ce787847 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3696,7 +3696,6 @@ Do Not Disturb is on. You will not be notified of incoming communications. - Other residents will receive your Do Not Disturb response (set in Preferences > General). - Teleportation offers will be declined. - Voice calls will be rejected. -- Inventory offers will go to your Trash. Date: Tue, 18 Dec 2012 22:57:56 -0800 Subject: CHUI-600 : WIP : Flash conversation item in different color than select and start flashing only when shown --- indra/llui/llfolderviewitem.cpp | 46 +++++++++++++++++++++------------- indra/llui/llfolderviewitem.h | 5 +++- indra/newview/llconversationview.cpp | 20 ++++++++++++--- indra/newview/llconversationview.h | 5 +++- indra/newview/skins/default/colors.xml | 6 +++++ 5 files changed, 60 insertions(+), 22 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 0a06ce66aa..100904c5a2 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -50,6 +50,7 @@ std::map LLFolderViewItem::sFonts; // map of styles to fonts bool LLFolderViewItem::sColorSetInitialized = false; LLUIColor LLFolderViewItem::sFgColor; LLUIColor LLFolderViewItem::sHighlightBgColor; +LLUIColor LLFolderViewItem::sFlashBgColor; LLUIColor LLFolderViewItem::sFocusOutlineColor; LLUIColor LLFolderViewItem::sMouseOverColor; LLUIColor LLFolderViewItem::sFilterBGColor; @@ -151,6 +152,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) { sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); + sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE); sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE); @@ -686,26 +688,31 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L return mIsCurSelection; } -void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &bgColor, +void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor) { - - //--------------------------------------------------------------------------------// - // Draw highlight for selected items - // - const S32 focus_top = getRect().getHeight(); const S32 focus_bottom = getRect().getHeight() - mItemHeight; const bool folder_open = (getRect().getHeight() > mItemHeight + 4); const S32 FOCUS_LEFT = 1; + + // Determine which background color to use for highlighting + LLUIColor bgColor = (isFlashing() ? flashColor : selectColor); - if (isHighlightAllowed()) // always render "current" item (only render other selected items if - // mShowSingleSelection is FALSE) or flashing item + //--------------------------------------------------------------------------------// + // Draw highlight for selected items + // Note: Always render "current" item or flashing item, only render other selected + // items if mShowSingleSelection is FALSE. + // + if (isHighlightAllowed()) + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLColor4 bg_color = bgColor; - if (!isHighlightActive()) + + // Highlight for selected but not current items + if (!isHighlightActive() && !isFlashing()) { + LLColor4 bg_color = bgColor; // do time-based fade of extra objects F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f); if (getRoot() && getRoot()->getShowSingleSelection()) @@ -718,25 +725,30 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo // fading in bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]); } + gl_rect_2d(FOCUS_LEFT, + focus_top, + getRect().getWidth() - 2, + focus_bottom, + bg_color, hasKeyboardFocus); } - if (isHighlightAllowed() || isHighlightActive()) + // Highlight for currently selected or flashing item + if (isHighlightActive()) { + // Background gl_rect_2d(FOCUS_LEFT, focus_top, getRect().getWidth() - 2, focus_bottom, - bg_color, hasKeyboardFocus); - } - - if (isHighlightActive()) - { + bgColor, hasKeyboardFocus); + // Outline gl_rect_2d(FOCUS_LEFT, focus_top, getRect().getWidth() - 2, focus_bottom, focusOutlineColor, FALSE); } + if (folder_open) { gl_rect_2d(FOCUS_LEFT, @@ -810,7 +822,7 @@ void LLFolderViewItem::draw() drawOpenFolderArrow(default_params, sFgColor); - drawHighlight(show_context, filled, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); + drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); //--------------------------------------------------------------------------------// // Draw open icon diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index d7f5e86aea..ca31931e19 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -128,6 +128,7 @@ protected: static LLUIColor sFgColor; static LLUIColor sFgDisabledColor; static LLUIColor sHighlightBgColor; + static LLUIColor sFlashBgColor; static LLUIColor sFocusOutlineColor; static LLUIColor sMouseOverColor; static LLUIColor sFilterBGColor; @@ -141,6 +142,8 @@ protected: virtual void addFolder(LLFolderViewFolder*) { } virtual bool isHighlightAllowed(); virtual bool isHighlightActive(); + virtual bool isFlashing() { return false; } + virtual void setFlashState(bool) { } static LLFontGL* getLabelFontForStyle(U8 style); @@ -269,7 +272,7 @@ public: // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color); - void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &bgColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); + void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index c0a209f22d..d3a0e882f5 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -101,7 +101,17 @@ LLConversationViewSession::~LLConversationViewSession() void LLConversationViewSession::setFlashState(bool flash_state) { mFlashStateOn = flash_state; - (flash_state ? mFlashTimer->startFlashing() : mFlashTimer->stopFlashing()); + mFlashStarted = false; + mFlashTimer->stopFlashing(); +} + +void LLConversationViewSession::startFlashing() +{ + if (mFlashStateOn && !mFlashStarted) + { + mFlashStarted = true; + mFlashTimer->startFlashing(); + } } bool LLConversationViewSession::isHighlightAllowed() @@ -198,8 +208,11 @@ void LLConversationViewSession::draw() drawOpenFolderArrow(default_params, sFgColor); } + // Indicate that flash can start (moot operation if already started, done or not flashing) + startFlashing(); + // draw highlight for selected items - drawHighlight(show_context, true, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); + drawHighlight(show_context, true, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); // Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap. bool draw_children = getRoot() == static_cast(this) || isOpen(); @@ -427,6 +440,7 @@ void LLConversationViewParticipant::draw() static LLUIColor sFgDisabledColor = LLUIColorTable::instance().getColor("MenuItemDisabledColor", DEFAULT_WHITE); static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE); static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE); + static LLUIColor sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE); static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE); static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE); @@ -450,7 +464,7 @@ void LLConversationViewParticipant::draw() color = mIsSelected ? sHighlightFgColor : sFgColor; } - drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor); + drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); drawLabel(font, text_left, y, color, right_x); refresh(); diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 1e20fb8b7e..74443e1d88 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -58,6 +58,7 @@ protected: /*virtual*/ bool isHighlightAllowed(); /*virtual*/ bool isHighlightActive(); + /*virtual*/ bool isFlashing() { return mFlashStateOn; } LLFloaterIMContainer* mContainer; @@ -83,11 +84,12 @@ public: virtual void refresh(); - void setFlashState(bool flash_state); + /*virtual*/ void setFlashState(bool flash_state); private: void onCurrentVoiceSessionChanged(const LLUUID& session_id); + void startFlashing(); LLPanel* mItemPanel; LLPanel* mCallIconLayoutPanel; @@ -95,6 +97,7 @@ private: LLOutputMonitorCtrl* mSpeakingIndicator; LLFlashTimer* mFlashTimer; bool mFlashStateOn; + bool mFlashStarted; bool mCollapsedMode; bool mHasArrow; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index 05230b8bd5..becdbda067 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -11,6 +11,9 @@ + @@ -522,6 +525,9 @@ + -- cgit v1.2.3 From 6b9ead91459d702727b54ab7e51614c2d5959f5f Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 18 Dec 2012 23:07:27 -0800 Subject: CHUI-499: Refactoring the LLPersistentNotificationStorage implementation for shared usage with the new LLDoNotDisturbNotificationStorage class. --- indra/newview/llnotificationstorage.cpp | 69 +++++++++++++++++++++++ indra/newview/llnotificationstorage.h | 3 + indra/newview/llpersistentnotificationstorage.cpp | 67 +--------------------- 3 files changed, 73 insertions(+), 66 deletions(-) diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index d25a212059..4746e4bbd4 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -29,14 +29,39 @@ #include "llnotificationstorage.h" #include +#include #include "llerror.h" #include "llfile.h" +#include "llnotifications.h" #include "llpointer.h" #include "llsd.h" #include "llsdserialize.h" +#include "llsingleton.h" +#include "llviewermessage.h" +class LLResponderRegistry : public LLSingleton +{ +public: + LLResponderRegistry(); + ~LLResponderRegistry(); + + LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams); + +protected: + +private: + template static LLNotificationResponderInterface* create(const LLSD& pParams); + + typedef boost::function responder_constructor_t; + + void add(const std::string& pNotificationName, const responder_constructor_t& pConstructor); + + typedef std::map build_map_t; + build_map_t mBuildMap; +}; + LLNotificationStorage::LLNotificationStorage(std::string pFileName) : mFileName(pFileName) { @@ -90,3 +115,47 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData) const return didFileRead; } + +LLNotificationResponderInterface* LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const +{ + return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams); +} + +LLResponderRegistry::LLResponderRegistry() + : LLSingleton() + , mBuildMap() +{ + add("ObjectGiveItem", &create); + add("UserGiveItem", &create); +} + +LLResponderRegistry::~LLResponderRegistry() +{ +} + +LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& pNotificationName, const LLSD& pParams) +{ + build_map_t::const_iterator it = mBuildMap.find(pNotificationName); + if(mBuildMap.end() == it) + { + return NULL; + } + responder_constructor_t ctr = it->second; + return ctr(pParams); +} + +template LLNotificationResponderInterface* LLResponderRegistry::create(const LLSD& pParams) +{ + RESPONDER_TYPE* responder = new RESPONDER_TYPE(); + responder->fromLLSD(pParams); + return responder; +} + +void LLResponderRegistry::add(const std::string& pNotificationName, const responder_constructor_t& pConstructor) +{ + if (mBuildMap.find(pNotificationName) != mBuildMap.end()) + { + LL_ERRS("LLResponderRegistry") << "Responder is already registered : " << pNotificationName << LL_ENDL; + } + mBuildMap.insert(std::make_pair(pNotificationName, pConstructor)); +} diff --git a/indra/newview/llnotificationstorage.h b/indra/newview/llnotificationstorage.h index ab4da4e73f..7aabf7d09e 100644 --- a/indra/newview/llnotificationstorage.h +++ b/indra/newview/llnotificationstorage.h @@ -31,6 +31,7 @@ #include "llerror.h" +class LLNotificationResponderInterface; class LLSD; class LLNotificationStorage @@ -44,6 +45,8 @@ protected: bool writeNotifications(const LLSD& pNotificationData) const; bool readNotifications(LLSD& pNotificationData) const; + LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const; + private: std::string mFileName; }; diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp index 7aaad64fd7..224aaa2146 100644 --- a/indra/newview/llpersistentnotificationstorage.cpp +++ b/indra/newview/llpersistentnotificationstorage.cpp @@ -36,34 +36,6 @@ #include "llscriptfloater.h" #include "llviewermessage.h" -class LLResponderRegistry -{ -public: - - static void registerResponders(); - - static LLNotificationResponderInterface* createResponder(const std::string& notification_name, const LLSD& params); - -protected: - -private: - template - static LLNotificationResponderInterface* create(const LLSD& params) - { - RESPONDER_TYPE* responder = new RESPONDER_TYPE(); - responder->fromLLSD(params); - return responder; - } - - typedef boost::function responder_constructor_t; - - static void add(const std::string& notification_name, const responder_constructor_t& ctr); - - typedef std::map build_map_t; - - static build_map_t sBuildMap; -}; - LLPersistentNotificationStorage::LLPersistentNotificationStorage() : LLSingleton() , LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml")) @@ -114,7 +86,6 @@ static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications"); void LLPersistentNotificationStorage::loadNotifications() { LLFastTimer _(FTM_LOAD_NOTIFICATIONS); - LLResponderRegistry::registerResponders(); LLNotifications::instance().getChannel("Persistent")-> connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); @@ -144,8 +115,7 @@ void LLPersistentNotificationStorage::loadNotifications() LLSD notification_params = *notification_it; LLNotificationPtr notification(new LLNotification(notification_params)); - LLNotificationResponderPtr responder(LLResponderRegistry:: - createResponder(notification_params["name"], notification_params["responder"])); + LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"])); notification->setResponseFunctor(responder); instance.add(notification); @@ -172,39 +142,4 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay return false; } -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - -LLResponderRegistry::build_map_t LLResponderRegistry::sBuildMap; - -void LLResponderRegistry::registerResponders() -{ - sBuildMap.clear(); - - add("ObjectGiveItem", &create); - add("UserGiveItem", &create); -} - -LLNotificationResponderInterface* LLResponderRegistry::createResponder(const std::string& notification_name, const LLSD& params) -{ - build_map_t::const_iterator it = sBuildMap.find(notification_name); - if(sBuildMap.end() == it) - { - return NULL; - } - responder_constructor_t ctr = it->second; - return ctr(params); -} - -void LLResponderRegistry::add(const std::string& notification_name, const responder_constructor_t& ctr) -{ - if(sBuildMap.find(notification_name) != sBuildMap.end()) - { - llwarns << "Responder is already registered : " << notification_name << llendl; - llassert(!"Responder already registered"); - } - sBuildMap[notification_name] = ctr; -} - // EOF -- cgit v1.2.3 From bd6d34d312c3e3322ab62f3a60253fb88fcbc9e3 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 19 Dec 2012 01:48:37 -0800 Subject: CHUI-499: Loading the DND notifications upon exit from DND mode and after login. --- indra/newview/llagent.cpp | 14 ++-- indra/newview/llchannelmanager.cpp | 2 + indra/newview/llcommunicationchannel.cpp | 6 ++ indra/newview/llcommunicationchannel.h | 2 + .../newview/lldonotdisturbnotificationstorage.cpp | 76 ++++++++++++++++++++++ 5 files changed, 96 insertions(+), 4 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 49c570c30b..fc3be9ca21 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -41,6 +41,7 @@ #include "llchannelmanager.h" #include "llchicletbar.h" #include "llconsole.h" +#include "lldonotdisturbnotificationstorage.h" #include "llenvmanager.h" #include "llfirstuse.h" #include "llfloatercamera.h" @@ -1389,11 +1390,16 @@ BOOL LLAgent::getAFK() const //----------------------------------------------------------------------------- // setDoNotDisturb() //----------------------------------------------------------------------------- -void LLAgent::setDoNotDisturb(bool pIsDotNotDisturb) +void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb) { - mIsDoNotDisturb = pIsDotNotDisturb; - sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDotNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP)); - LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDotNotDisturb); + bool isDoNotDisturbSwitchedOff = (mIsDoNotDisturb && !pIsDoNotDisturb); + mIsDoNotDisturb = pIsDoNotDisturb; + sendAnimationRequest(ANIM_AGENT_DO_NOT_DISTURB, (pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP)); + LLNotificationsUI::LLChannelManager::getInstance()->muteAllChannels(pIsDoNotDisturb); + if (isDoNotDisturbSwitchedOff) + { + LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications(); + } } //----------------------------------------------------------------------------- diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index dd2bcc742b..43757d0174 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -139,7 +139,9 @@ void LLChannelManager::onLoginCompleted() } LLPersistentNotificationStorage::getInstance()->loadNotifications(); + LLDoNotDisturbNotificationStorage::getInstance()->initialize(); + LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications(); } //-------------------------------------------------------------------------- diff --git a/indra/newview/llcommunicationchannel.cpp b/indra/newview/llcommunicationchannel.cpp index 353447e4b6..4b0a70ffd8 100644 --- a/indra/newview/llcommunicationchannel.cpp +++ b/indra/newview/llcommunicationchannel.cpp @@ -39,6 +39,7 @@ LLCommunicationChannel::LLCommunicationChannel(const std::string& pName, const std::string& pParentName) : LLNotificationChannel(pName, pParentName, filterByDoNotDisturbStatus) + , mHistory() { } @@ -61,6 +62,11 @@ LLCommunicationChannel::history_list_t::const_iterator LLCommunicationChannel::e return mHistory.end(); } +void LLCommunicationChannel::clearHistory() +{ + mHistory.clear(); +} + void LLCommunicationChannel::onFilterFail(LLNotificationPtr pNotificationPtr) { std::string notificationType = pNotificationPtr->getType(); diff --git a/indra/newview/llcommunicationchannel.h b/indra/newview/llcommunicationchannel.h index a4756b8993..0e15e1cd15 100644 --- a/indra/newview/llcommunicationchannel.h +++ b/indra/newview/llcommunicationchannel.h @@ -46,6 +46,8 @@ public: typedef std::multimap history_list_t; history_list_t::const_iterator beginHistory() const; history_list_t::const_iterator endHistory() const; + + void clearHistory(); protected: virtual void onFilterFail(LLNotificationPtr pNotificationPtr); diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 472a0dd9ee..43fd7705aa 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -29,14 +29,25 @@ #include "lldonotdisturbnotificationstorage.h" +#define XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT 0 + +#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT +#include "llchannelmanager.h" +#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT #include "llcommunicationchannel.h" #include "lldir.h" #include "llerror.h" #include "llfasttimer_class.h" #include "llnotifications.h" +#include "llnotificationhandler.h" #include "llnotificationstorage.h" +#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT +#include "llscreenchannel.h" +#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT +#include "llscriptfloater.h" #include "llsd.h" #include "llsingleton.h" +#include "lluuid.h" LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage() : LLSingleton() @@ -85,6 +96,71 @@ static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notificati void LLDoNotDisturbNotificationStorage::loadNotifications() { + LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS); + + LL_INFOS("stinsonDebug") << "STINSON DEBUG: loading notifiations" << LL_ENDL; + + LLSD input; + if (!readNotifications(input) ||input.isUndefined()) + { + return; + } + + LLSD& data = input["data"]; + if (data.isUndefined()) + { + return; + } + +#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT + LLNotificationsUI::LLScreenChannel* notification_channel = + dynamic_cast(LLNotificationsUI::LLChannelManager::getInstance()-> + findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); +#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT + + LLNotifications& instance = LLNotifications::instance(); + + for (LLSD::array_const_iterator notification_it = data.beginArray(); + notification_it != data.endArray(); + ++notification_it) + { + LLSD notification_params = *notification_it; + LLNotificationPtr notification(new LLNotification(notification_params)); + + LL_INFOS("stinsonDebug") << "STINSON DEBUG: loading notification of type '" << notification->getType() << "'" << LL_ENDL; + + const LLUUID& notificationID = notification->id(); + if (instance.find(notificationID)) + { + instance.update(notification); + } + else + { + LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"])); + notification->setResponseFunctor(responder); + + instance.add(notification); + } + +#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT + // hide script floaters so they don't confuse the user and don't overlap startup toast + LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); + + if(notification_channel) + { + // hide saved toasts so they don't confuse the user + notification_channel->hideToast(notification->getID()); + } +#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT + } + + // Clear the communication channel history and rewrite the save file to empty it as well + LLNotificationChannelPtr channelPtr = getCommunicationChannel(); + LLCommunicationChannel *commChannel = dynamic_cast(channelPtr.get()); + llassert(commChannel != NULL); + commChannel->clearHistory(); + + saveNotifications(); } LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChannel() const -- cgit v1.2.3 From ca4c5d3bcb18afefc181bdc164d1c338abef7488 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 19 Dec 2012 11:28:38 -0800 Subject: Switching some notification types from "offer" to be "notify" as the notifications were not offers. --- indra/newview/skins/default/xui/en/notifications.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 35ce787847..05798da8e2 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6583,7 +6583,7 @@ However, this region contains content accessible to adults only. log_to_im="true" log_to_chat="false" show_toast="false" - type="offer"> + type="notify"> Teleport offer sent to [TO_NAME] @@ -6636,7 +6636,7 @@ However, this region contains content accessible to adults only. name="FriendshipOffered" log_to_im="true" show_toast="false" - type="offer"> + type="notify"> friendship You have offered friendship to [TO_NAME] @@ -6666,7 +6666,7 @@ However, this region contains content accessible to adults only. icon="notify.tga" name="FriendshipAccepted" log_to_im="true" - type="offer"> + type="notify"> friendship <nolink>[NAME]</nolink> accepted your friendship offer. @@ -6686,7 +6686,7 @@ However, this region contains content accessible to adults only. name="FriendshipAcceptedByMe" log_to_im="true" show_toast="false" - type="offer"> + type="notify"> friendship Friendship offer accepted. @@ -6696,7 +6696,7 @@ Friendship offer accepted. name="FriendshipDeclinedByMe" log_to_im="true" show_toast="false" - type="offer"> + type="notify"> friendship Friendship offer declined. -- cgit v1.2.3 From dcfcc191dd3caaa84d0f789a928a83adf55c13b1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 19 Dec 2012 12:45:59 -0800 Subject: Pull merge from richard/viewer-chui --- indra/newview/llconversationview.cpp | 1 + indra/newview/llimview.cpp | 14 +++++++------- indra/newview/skins/default/colors.xml | 3 --- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index d3a0e882f5..fdba5b7289 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -109,6 +109,7 @@ void LLConversationViewSession::startFlashing() { if (mFlashStateOn && !mFlashStarted) { + llinfos << "Merov debug : Start the flashing for " << getName() << llendl; mFlashStarted = true; mFlashTimer->startFlashing(); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 5b4d5466a1..39f54dfd4d 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -155,6 +155,8 @@ void on_new_message(const LLSD& msg) } // execution of the action + llinfos << "Merov debug : on_new_message action = " << action << llendl; + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); @@ -174,13 +176,11 @@ void on_new_message(const LLSD& msg) if ("toast" == action) { // Skip toasting if we have open window of IM with this session id - if ( - session_floater + if (session_floater && session_floater->isInVisibleChain() && session_floater->hasFocus() && !session_floater->isMinimized() - && !(session_floater->getHost() - && session_floater->getHost()->isMinimized()) + && !(session_floater->getHost() && session_floater->getHost()->isMinimized()) ) { return; @@ -222,10 +222,10 @@ void on_new_message(const LLSD& msg) gToolBarView->flashCommand(LLCommandId("chat"), true); } //conversation floater is open but a different conversation is focused - else - { + //else + //{ im_box->flashConversationItemWidget(session_id, true); - } + //} } } diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index c3df04d0a6..becdbda067 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -11,9 +11,6 @@ - -- cgit v1.2.3 From ef6121cba1c72549cca10763645254ae3aaf2887 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Wed, 19 Dec 2012 15:37:12 -0800 Subject: CHUI-499: Code clean-up and adding some more types badly defined. --- indra/newview/lldonotdisturbnotificationstorage.cpp | 17 +++++++++++------ indra/newview/llnotificationstorage.cpp | 6 ++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 43fd7705aa..bf3dcae1f3 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -98,8 +98,6 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() { LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS); - LL_INFOS("stinsonDebug") << "STINSON DEBUG: loading notifiations" << LL_ENDL; - LLSD input; if (!readNotifications(input) ||input.isUndefined()) { @@ -127,8 +125,6 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() LLSD notification_params = *notification_it; LLNotificationPtr notification(new LLNotification(notification_params)); - LL_INFOS("stinsonDebug") << "STINSON DEBUG: loading notification of type '" << notification->getType() << "'" << LL_ENDL; - const LLUUID& notificationID = notification->id(); if (instance.find(notificationID)) { @@ -136,8 +132,17 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() } else { - LLNotificationResponderPtr responder(createResponder(notification_params["name"], notification_params["responder"])); - notification->setResponseFunctor(responder); + LLNotificationResponderInterface* responder = createResponder(notification_params["name"], notification_params["responder"]); + if (responder == NULL) + { + LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '" + << notification->getType() << "'" << LL_ENDL; + } + else + { + LLNotificationResponderPtr responderPtr(responder); + notification->setResponseFunctor(responderPtr); + } instance.add(notification); } diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 4746e4bbd4..b797775369 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -126,7 +126,13 @@ LLResponderRegistry::LLResponderRegistry() , mBuildMap() { add("ObjectGiveItem", &create); + add("OwnObjectGiveItem", &create); add("UserGiveItem", &create); + + add("TeleportOffered", &create); + add("TeleportOffered_MaturityExceeded", &create); + + add("OfferFriendship", &create); } LLResponderRegistry::~LLResponderRegistry() -- cgit v1.2.3 From c81cf89086b0282121c6577b6fde75e050c1a0e8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 19 Dec 2012 17:10:31 -0800 Subject: CHUI-600 : Fix the orange (provided by Leo), fix the conversation item flashing (when shown) --- indra/newview/llconversationview.cpp | 6 ++++-- indra/newview/llfloaterimcontainer.cpp | 25 ++++++++++++++----------- indra/newview/llfloaterimcontainer.h | 1 + indra/newview/llimview.cpp | 3 --- indra/newview/skins/default/colors.xml | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index fdba5b7289..e51efd48f5 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -81,7 +81,9 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes mSpeakingIndicator(NULL), mVoiceClientObserver(NULL), mCollapsedMode(false), - mHasArrow(true) + mHasArrow(true), + mFlashStateOn(false), + mFlashStarted(false) { mFlashTimer = new LLFlashTimer(); } @@ -109,7 +111,6 @@ void LLConversationViewSession::startFlashing() { if (mFlashStateOn && !mFlashStarted) { - llinfos << "Merov debug : Start the flashing for " << getName() << llendl; mFlashStarted = true; mFlashTimer->startFlashing(); } @@ -245,6 +246,7 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask ) if(result && getRoot()->getCurSelectedItem() == this) { LLFloaterIMContainer *im_container = LLFloaterReg::getTypedInstance("im_container"); + im_container->clearAllFlashStates(); im_container->selectConversationPair(session_id, false); im_container->collapseMessagesPane(false); } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 390eec84f6..58ba186b57 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1229,6 +1229,20 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id) selectConversationPair(session_id, true); } +void LLFloaterIMContainer::clearAllFlashStates() +{ + llinfos << "Merov debug : clear all flash states" << llendl; + conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); + for (;widget_it != mConversationsWidgets.end(); ++widget_it) + { + LLConversationViewSession* widget = dynamic_cast(widget_it->second); + if (widget) + { + widget->setFlashState(false); + } + } +} + void LLFloaterIMContainer::selectConversation(const LLUUID& session_id) { selectConversationPair(session_id, true); @@ -1240,17 +1254,6 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool BOOL handled = TRUE; LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::findConversation(session_id); - // On selection, stop the flash state on all conversation widgets - conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); - for (;widget_it != mConversationsWidgets.end(); ++widget_it) - { - LLConversationViewSession* widget = dynamic_cast(widget_it->second); - if (widget) - { - widget->setFlashState(false); - } - } - /* widget processing */ if (select_widget) { diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 5db1565cea..09a24c0105 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -69,6 +69,7 @@ public: void showConversation(const LLUUID& session_id); void selectConversation(const LLUUID& session_id); BOOL selectConversationPair(const LLUUID& session_id, bool select_widget); + void clearAllFlashStates(); /*virtual*/ void tabClose(); void showStub(bool visible); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 39f54dfd4d..65048e352e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -155,9 +155,6 @@ void on_new_message(const LLSD& msg) } // execution of the action - llinfos << "Merov debug : on_new_message action = " << action << llendl; - - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index becdbda067..0de217fc0d 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -13,7 +13,7 @@ value="0.38 0.694 0.573 0.35" /> + value="0.749 0.298 0 1" /> -- cgit v1.2.3 From b15ba74485e24db9a996a2f6a9438ac48224ea7a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 19 Dec 2012 17:19:48 -0800 Subject: CHUI-607: Due to a problem in design we have two checkboxes that determine whether a conversation transcript should be saved. By defaut commiting a change that makes both checkboxes checked by default. This makes it so that a new user can see their transcript/chat history. --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 24fa0a0cd4..ebc915ec5a 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4676,7 +4676,7 @@ Type Boolean Value - 0 + 1 LandBrushSize -- cgit v1.2.3 From ba297b167f75d8a09c959952a300d492f2aec88b Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 19 Dec 2012 20:07:08 -0800 Subject: CHUI-600 : Fixed! Modified the button flash state so it sticks after the animation and is dismissed on toggle --- indra/llui/llbutton.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 99384439d2..7ca9b869a8 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -311,7 +311,7 @@ void LLButton::onCommit() { make_ui_sound("UISndClickRelease"); } - + if (mIsToggle) { toggleState(); @@ -613,10 +613,6 @@ void LLButton::draw() static LLCachedControl sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); - if (mFlashingTimer) - { - mFlashing = mFlashingTimer->isFlashingInProgress(); - } bool flash = mFlashing && sEnableButtonFlashing; bool pressed_by_keyboard = FALSE; @@ -701,7 +697,8 @@ void LLButton::draw() imagep = mImageDisabled; } - if (mFlashing) + // Selected has a higher priority than flashing. If both are set, flashing is ignored. + if (mFlashing && !selected) { // if button should flash and we have icon for flashing, use it as image for button if(flash && mImageFlash) @@ -711,13 +708,13 @@ void LLButton::draw() imagep = mImageFlash; } // else use usual flashing via flash_color - else + else if (mFlashingTimer) { LLColor4 flash_color = mFlashBgColor.get(); use_glow_effect = TRUE; glow_type = LLRender::BT_ALPHA; // blend the glow - if (mFlashingTimer->isCurrentlyHighlighted()) + if (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress()) { glow_color = flash_color; } @@ -773,8 +770,7 @@ void LLButton::draw() if (use_glow_effect) { mCurGlowStrength = lerp(mCurGlowStrength, - mFlashing ? (mFlashingTimer->isCurrentlyHighlighted() || mNeedsHighlight? 1.0 : 0.0) - : mHoverGlowStrength, + mFlashing ? (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress() || mNeedsHighlight? 1.0 : 0.0) : mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); } else @@ -961,23 +957,18 @@ void LLButton::setToggleState(BOOL b) { setControlValue(b); // will fire LLControlVariable callbacks (if any) setValue(b); // may or may not be redundant + setFlashing(false); // stop flash state whenever the selected/unselected state if reset // Unselected label assignments autoResize(); } } -void LLButton::setFlashing( bool b ) +void LLButton::setFlashing(bool b) { if (mFlashingTimer) { - if (b) - { - mFlashingTimer->startFlashing(); - } - else - { - mFlashingTimer->stopFlashing(); - } + mFlashing = b; + (b ? mFlashingTimer->startFlashing() : mFlashingTimer->stopFlashing()); } else if (b != mFlashing) { -- cgit v1.2.3 From ed716d996987722c32a105fac79daf1af4e5fb23 Mon Sep 17 00:00:00 2001 From: MaximB ProductEngine Date: Thu, 20 Dec 2012 09:42:34 +0200 Subject: CHUI-588 (Clicking nearby chat toast doesn't highlight proper conversation line item) --- indra/newview/llfloaterimsessiontab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 7984034ded..53d2f31b79 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -308,7 +308,7 @@ void LLFloaterIMSessionTab::onFocusReceived() LLFloaterIMContainer* container = LLFloaterReg::getTypedInstance("im_container"); if (container) { - container->selectConversationPair(mSessionID, ! getHost()); + container->selectConversationPair(mSessionID, true); container->showStub(! getHost()); } } -- cgit v1.2.3 From eb68845767309900b6b5915f6358ae5027fb7136 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 20 Dec 2012 15:01:50 +0200 Subject: CHUI-606 Default settings in CHUI viewer do not keep IM logs for users: Preferences > Chat > Keep a convers. log was turned on --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 24fa0a0cd4..ebc915ec5a 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4676,7 +4676,7 @@ Type Boolean Value - 0 + 1 LandBrushSize -- cgit v1.2.3 From c81a0b0a5701425aa52521d8600a280d05040517 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Thu, 20 Dec 2012 15:23:36 +0200 Subject: CHUI-602 FIXED Don't call getUUID() if there is no selected participants --- indra/newview/llfloaterimcontainer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 58ba186b57..92ea6dacde 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1101,7 +1101,14 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata) uuid_vec_t uuids; getParticipantUUIDs(uuids); - if("can_activate_group" == item) + + // If nothing is selected, everything needs to be disabled + if (uuids.size() <= 0) + { + return false; + } + + if("can_activate_group" == item) { LLUUID selected_group_id = getCurSelectedViewModelItem()->getUUID(); return gAgent.getGroupID() != selected_group_id; @@ -1116,12 +1123,6 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v { return gSavedSettings.getBOOL("KeepConversationLogTranscripts"); } - - // If nothing is selected, everything needs to be disabled - if (uuids.size() <= 0) - { - return false; - } // Extract the single select info bool is_single_select = (uuids.size() == 1); -- cgit v1.2.3 From 2aefdb47ca1d02bfe8b74928dee479072ef151a3 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 20 Dec 2012 15:24:14 +0200 Subject: CHUI-618 User sees no indication of offline messages received with conversation log preference turned off: flashing of CHUI button if offline messages was received --- indra/newview/llimview.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 65048e352e..cdc51ad2fc 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2488,16 +2488,23 @@ void LLIMMgr::addMessage( } // Open conversation log if offline messages are present and user allows a Call Log - if (is_offline_msg && gSavedSettings.getBOOL("KeepConversationLogTranscripts")) - { - LLFloaterConversationLog* floater_log = - LLFloaterReg::getTypedInstance("conversation"); - if (floater_log && !(floater_log->isFrontmost())) + if (is_offline_msg) + { + if (gSavedSettings.getBOOL("KeepConversationLogTranscripts")) { - floater_log->openFloater(); - floater_log->setFrontmost(TRUE); + LLFloaterConversationLog* floater_log = + LLFloaterReg::getTypedInstance("conversation"); + if (floater_log && !(floater_log->isFrontmost())) + { + floater_log->openFloater(); + floater_log->setFrontmost(TRUE); + } } - } + else + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } + } //*NOTE session_name is empty in case of incoming P2P sessions std::string fixed_session_name = from; -- cgit v1.2.3 From 95380b0aaa635c18c03801048559ba811640bc02 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Thu, 20 Dec 2012 22:37:04 +0200 Subject: CHUI-513 FIXED Revise initial conversation floater size --- indra/newview/app_settings/settings_per_account.xml | 2 +- indra/newview/skins/default/xui/en/floater_im_container.xml | 7 ++----- indra/newview/skins/default/xui/en/floater_im_session.xml | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index ca22041671..4ff494fbfb 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -53,7 +53,7 @@ Type S32 Value - 268 + 205 ConversationsMessagePaneCollapsed diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 3475c7da33..cbf1830093 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -3,9 +3,8 @@ can_close="true" can_minimize="true" can_resize="true" - height="230" + height="210" layout="topleft" - min_height="50" name="floater_im_box" help_topic="floater_im_box" save_rect="true" @@ -15,7 +14,7 @@ title="CONVERSATIONS" bottom="-50" right="-5" - width="500"> + width="450"> @@ -37,7 +36,6 @@ user_resize="true" name="conversations_layout_panel" min_dim="38" - width="225" expanded_min_dim="156"> + min_width="221"> Date: Thu, 20 Dec 2012 18:36:01 -0800 Subject: CHUI-429 : Fixed! Add a flag to filter multi/single selection situations in menu building. Implement in conversation contextual menu. --- indra/llui/llfolderview.cpp | 5 +- indra/llui/llfolderview.h | 1 + indra/newview/llconversationmodel.cpp | 67 ++++++++++++---------- indra/newview/llconversationmodel.h | 2 +- indra/newview/llfloaterimcontainer.cpp | 1 - .../skins/default/xui/en/menu_conversation.xml | 7 +++ 6 files changed, 50 insertions(+), 33 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index a33ffc4240..7ae79d94fe 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1913,14 +1913,15 @@ void LLFolderView::updateMenuOptions(LLMenuGL* menu) // Successively filter out invalid options - U32 flags = FIRST_SELECTED_ITEM; + U32 multi_select_flag = (mSelectedItems.size() > 1 ? ITEM_IN_MULTI_SELECTION : 0x0); + U32 flags = multi_select_flag | FIRST_SELECTED_ITEM; for (selected_items_t::iterator item_itor = mSelectedItems.begin(); item_itor != mSelectedItems.end(); ++item_itor) { LLFolderViewItem* selected_item = (*item_itor); selected_item->buildContextMenu(*menu, flags); - flags = 0x0; + flags = multi_select_flag; } addNoOptions(menu); diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index d4a1434c73..2ee7417240 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -400,5 +400,6 @@ public: // Flags for buildContextMenu() const U32 SUPPRESS_OPEN_ITEM = 0x1; const U32 FIRST_SELECTED_ITEM = 0x2; +const U32 ITEM_IN_MULTI_SELECTION = 0x4; #endif // LL_LLFOLDERVIEW_H diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index d03ad92fbc..005439301a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -102,35 +102,44 @@ void LLConversationItem::showProperties(void) { } -void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items) -{ - items.push_back(std::string("view_profile")); - items.push_back(std::string("im")); - items.push_back(std::string("offer_teleport")); - items.push_back(std::string("voice_call")); - items.push_back(std::string("chat_history")); - items.push_back(std::string("separator_chat_history")); - items.push_back(std::string("add_friend")); - items.push_back(std::string("remove_friend")); - items.push_back(std::string("invite_to_group")); - items.push_back(std::string("separator_invite_to_group")); - items.push_back(std::string("map")); - items.push_back(std::string("share")); - items.push_back(std::string("pay")); - items.push_back(std::string("block_unblock")); - items.push_back(std::string("MuteText")); - - if(this->getType() != CONV_SESSION_1_ON_1 && mDisplayModeratorOptions) +void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags) +{ + if (flags & ITEM_IN_MULTI_SELECTION) { - items.push_back(std::string("Moderator Options Separator")); - items.push_back(std::string("Moderator Options")); - items.push_back(std::string("AllowTextChat")); - items.push_back(std::string("moderate_voice_separator")); - items.push_back(std::string("ModerateVoiceToggleMuteSelected")); - items.push_back(std::string("ModerateVoiceMute")); - items.push_back(std::string("ModerateVoiceUnmute")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("remove_friends")); + } + else + { + items.push_back(std::string("view_profile")); + items.push_back(std::string("im")); + items.push_back(std::string("offer_teleport")); + items.push_back(std::string("voice_call")); + items.push_back(std::string("chat_history")); + items.push_back(std::string("separator_chat_history")); + items.push_back(std::string("add_friend")); + items.push_back(std::string("remove_friend")); + items.push_back(std::string("invite_to_group")); + items.push_back(std::string("separator_invite_to_group")); + items.push_back(std::string("map")); + items.push_back(std::string("share")); + items.push_back(std::string("pay")); + items.push_back(std::string("block_unblock")); + items.push_back(std::string("MuteText")); + + if ((getType() != CONV_SESSION_1_ON_1) && mDisplayModeratorOptions) + { + items.push_back(std::string("Moderator Options Separator")); + items.push_back(std::string("Moderator Options")); + items.push_back(std::string("AllowTextChat")); + items.push_back(std::string("moderate_voice_separator")); + items.push_back(std::string("ModerateVoiceToggleMuteSelected")); + items.push_back(std::string("ModerateVoiceMute")); + items.push_back(std::string("ModerateVoiceUnmute")); + } } - } // @@ -306,7 +315,7 @@ void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { items.push_back(std::string("close_conversation")); items.push_back(std::string("separator_disconnect_from_voice")); - buildParticipantMenuOptions(items); + buildParticipantMenuOptions(items, flags); } else if(this->getType() == CONV_SESSION_GROUP) { @@ -440,7 +449,7 @@ void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - buildParticipantMenuOptions(items); + buildParticipantMenuOptions(items, flags); hide_context_entries(menu, items, disabled_items); } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 743a6ba40b..02002d8f70 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -130,7 +130,7 @@ public: void postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant); - void buildParticipantMenuOptions(menuentry_vec_t& items); + void buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags); protected: std::string mName; // Name of the session or the participant diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 92ea6dacde..2019a35faa 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1232,7 +1232,6 @@ void LLFloaterIMContainer::showConversation(const LLUUID& session_id) void LLFloaterIMContainer::clearAllFlashStates() { - llinfos << "Merov debug : clear all flash states" << llendl; conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); for (;widget_it != mConversationsWidgets.end(); ++widget_it) { diff --git a/indra/newview/skins/default/xui/en/menu_conversation.xml b/indra/newview/skins/default/xui/en/menu_conversation.xml index e0edf384d6..46c6e19fa5 100644 --- a/indra/newview/skins/default/xui/en/menu_conversation.xml +++ b/indra/newview/skins/default/xui/en/menu_conversation.xml @@ -75,6 +75,13 @@ + + + + Date: Thu, 20 Dec 2012 19:57:51 +0200 Subject: CHUI-605 : Fixed : Keep conversation log requires restart to change preference: connected LLConversationLog::enableLogging() as listener to "LogInstantMessages" control changes --- indra/newview/llconversationlog.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 1171b3db41..eb3a3731ee 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -187,16 +187,23 @@ void LLConversationLogFriendObserver::changed(U32 mask) LLConversationLog::LLConversationLog() { - LLControlVariable* ctrl = gSavedPerAccountSettings.getControl("LogInstantMessages").get(); - if (ctrl) + LLControlVariable* log_instant_message = gSavedPerAccountSettings.getControl("LogInstantMessages").get(); + LLControlVariable* keep_convers_log = gSavedSettings.getControl("KeepConversationLogTranscripts").get(); + bool is_log_message = false; + bool is_keep_log = false; + + if (log_instant_message) { - ctrl->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2)); - if (ctrl->getValue().asBoolean() - && gSavedSettings.getBOOL("KeepConversationLogTranscripts")) - { - enableLogging(true); - } + log_instant_message->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2)); + is_log_message = log_instant_message->getValue().asBoolean(); } + if (keep_convers_log) + { + keep_convers_log->getSignal()->connect(boost::bind(&LLConversationLog::enableLogging, this, _2)); + is_keep_log = keep_convers_log->getValue().asBoolean(); + } + + enableLogging(is_log_message && is_keep_log); } void LLConversationLog::enableLogging(bool enable) -- cgit v1.2.3 From 2610af9798374ce9fff7623d7aa7e269b2a78174 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 21 Dec 2012 15:35:56 +0200 Subject: CHUI-619 FUI button and conversation line items blink at different rates: changed rate --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llimview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ebc915ec5a..507eb33f2d 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13173,7 +13173,7 @@ Type F32 Value - 0.25 + 0.5 WindLightUseAtmosShaders diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index cdc51ad2fc..708400cbe1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -964,7 +964,7 @@ const std::string LLIMModel::getName(const LLUUID& session_id) const { LLIMSession* session = findIMSession(session_id); - if (!session) + if (!session) { llwarns << "session " << session_id << "does not exist " << llendl; return LLTrans::getString("no_session_message"); -- cgit v1.2.3 From 7549a392cc32dc36f0bc673a6569f01731cc1bbd Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 21 Dec 2012 16:28:33 +0200 Subject: CHUI-566 Flashing and color on Conversations FUI button and conversation line item: change behavior for the case "If conversations (container) floater open but not on top" --- indra/newview/llimview.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 708400cbe1..d736b81bb7 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -160,6 +160,7 @@ void on_new_message(const LLSD& msg) //session floater not focused (visible or not) bool session_floater_not_focused = session_floater && !session_floater->hasFocus(); + //conv. floater is closed bool conversation_floater_is_closed = !( im_box @@ -210,20 +211,16 @@ void on_new_message(const LLSD& msg) else if ("flash" == action) { - if (session_floater_not_focused) + if (conversation_floater_not_focused) { - //User is not focused on conversation containing the message - - if(conversation_floater_not_focused) + if(session_floater_not_focused) { + //User is not focused on conversation containing the message gToolBarView->flashCommand(LLCommandId("chat"), true); } - //conversation floater is open but a different conversation is focused - //else - //{ - im_box->flashConversationItemWidget(session_id, true); - //} - } + + im_box->flashConversationItemWidget(session_id, true); + } } else if("openconversations" == action) -- cgit v1.2.3 From 765a5a73dd3e2e7a88141e26f4aa7b479229ad2e Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 21 Dec 2012 16:45:58 +0200 Subject: CHUI-621 FIXED Notification chiclet UI error --- indra/newview/llchiclet.cpp | 2 +- .../skins/default/textures/bottomtray/Notices_Unread.png | Bin 0 -> 3693 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 indra/newview/skins/default/textures/bottomtray/Notices_Unread.png diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 2fdcb17570..3dbb43c657 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -76,7 +76,7 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) LLSysWellChiclet::~LLSysWellChiclet() { - delete mFlashToLitTimer; + mFlashToLitTimer->unset(); } void LLSysWellChiclet::setCounter(S32 counter) diff --git a/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png b/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png new file mode 100644 index 0000000000..0ac5b72b8f Binary files /dev/null and b/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png differ -- cgit v1.2.3 From dd7509f56de5e8a47680b33176e90c11ed518066 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 21 Dec 2012 20:05:40 +0200 Subject: CHUI-411 Entries in chat history viewer do not show all dates of entries and some entries show on multiple pages Type of variable for the time saving was changed from S32 to long int ("capacity" of S32-timer is only ~18 hours!) --- indra/newview/llconversationlog.cpp | 45 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index eb3a3731ee..e44749fd79 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -236,17 +236,20 @@ void LLConversationLog::logConversation(const LLUUID& session_id, BOOL has_offli const LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); LLConversation* conversation = findConversation(session); - if (session && conversation) + if (session) { - if(has_offline_msg) + if (conversation) { - updateOfflineIMs(session, has_offline_msg); + if(has_offline_msg) + { + updateOfflineIMs(session, has_offline_msg); + } + updateConversationTimestamp(conversation); + } + else + { + createConversation(session); } - updateConversationTimestamp(conversation); - } - else if (session && !conversation) - { - createConversation(session); } } @@ -307,19 +310,17 @@ void LLConversationLog::updateConversationTimestamp(LLConversation* conversation LLConversation* LLConversationLog::findConversation(const LLIMModel::LLIMSession* session) { - if (!session) + if (session) { - return NULL; - } + const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID; - const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID; - - conversations_vec_t::iterator conv_it = mConversations.begin(); - for(; conv_it != mConversations.end(); ++conv_it) - { - if (conv_it->getSessionID() == session_id) + conversations_vec_t::iterator conv_it = mConversations.begin(); + for(; conv_it != mConversations.end(); ++conv_it) { - return &*conv_it; + if (conv_it->getSessionID() == session_id) + { + return &*conv_it; + } } } @@ -411,8 +412,8 @@ bool LLConversationLog::saveToFile(const std::string& filename) // [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe| // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| - fprintf(fp, "[%d] %d %d %d %s| %s %s %s|\n", - (S32)conv_it->getTime(), + fprintf(fp, "[%ld] %d %d %d %s| %s %s %s|\n", + conv_it->getTime(), (S32)conv_it->getConversationType(), (S32)0, (S32)conv_it->hasOfflineMessages(), @@ -446,7 +447,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename) char history_file_name[MAX_STRING]; int has_offline_ims; int stype; - S32 time; + time_t time; // before CHUI-348 it was a flag of conversation voice state int prereserved_unused; @@ -456,7 +457,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename) part_id_buffer[0] = '\0'; conv_id_buffer[0] = '\0'; - sscanf(buffer, "[%d] %d %d %d %[^|]| %s %s %[^|]|", + sscanf(buffer, "[%ld] %d %d %d %[^|]| %s %s %[^|]|", &time, &stype, &prereserved_unused, -- cgit v1.2.3 From 6df0377d1dd810cc1656c6c2664af2c7c87705fc Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 21 Dec 2012 20:11:01 +0200 Subject: CHUI-622 FIXED Default size of conversation log floater seems large --- .../default/xui/en/floater_conversation_log.xml | 163 ++++++++++----------- 1 file changed, 80 insertions(+), 83 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_conversation_log.xml b/indra/newview/skins/default/xui/en/floater_conversation_log.xml index c9c52e5ce5..960db137b3 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_log.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_log.xml @@ -1,91 +1,88 @@ - + can_resize="true" + positioning="cascading" + height="200" + min_height="100" + min_width="200" + layout="topleft" + name="floater_conversation_log" + save_rect="true" + single_instance="true" + reuse_instance="true" + title="CONVERSATION LOG" + width="300"> Conversations are not being logged. To log conversations in the future, select "Save IM logs on my computer" under Preferences > Privacy. - - - - - - - + + + + + + - + allow_select="true" + bottom="-8" + opaque="true" + follows="all" + left="8" + keep_selection_visible_on_reshape="true" + item_pad="2" + multi_select="false" + name="conversation_log_list" + right="-8" + top="0" /> + -- cgit v1.2.3 From 923262f154748eea5ce1eda37df1b9df1eaf0f43 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Mon, 24 Dec 2012 14:20:25 +0200 Subject: CHUI-583 FIXED Link will be opened in external browser if this preference is set. --- indra/newview/llviewermenu.cpp | 15 +++++++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 14 +++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fe9c00cc27..be9f7d645a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7586,6 +7586,20 @@ void handle_web_content_test(const LLSD& param) LLWeb::loadURLInternal(url); } +void handle_show_url(const LLSD& param) +{ + std::string url = param.asString(); + if(gSavedSettings.getBOOL("UseExternalBrowser")) + { + LLWeb::loadURLExternal(url); + } + else + { + LLWeb::loadURLInternal(url); + } + +} + void handle_buy_currency_test(void*) { std::string url = @@ -8415,6 +8429,7 @@ void initialize_menus() // Advanced > UI commit.add("Advanced.WebBrowserTest", boost::bind(&handle_web_browser_test, _2)); // sigh! this one opens the MEDIA browser commit.add("Advanced.WebContentTest", boost::bind(&handle_web_content_test, _2)); // this one opens the Web Content floater + commit.add("Advanced.ShowURL", boost::bind(&handle_show_url, _2)); view_listener_t::addMenu(new LLAdvancedBuyCurrencyTest(), "Advanced.BuyCurrencyTest"); view_listener_t::addMenu(new LLAdvancedDumpSelectMgr(), "Advanced.DumpSelectMgr"); view_listener_t::addMenu(new LLAdvancedDumpInventory(), "Advanced.DumpInventory"); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 00424e97f6..76de81559b 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1273,35 +1273,35 @@ label="User’s guide" name="User’s guide"> @@ -1309,14 +1309,14 @@ label="[SECOND_LIFE] News" name="Second Life News"> -- cgit v1.2.3 From 32944ef9e41a96950aa645a016c8f2c6bf71a351 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Mon, 24 Dec 2012 19:01:27 +0200 Subject: CHUI-627 FIXED Unnecessary attributes are deleted in xml --- indra/newview/skins/default/xui/en/floater_conversation_log.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_conversation_log.xml b/indra/newview/skins/default/xui/en/floater_conversation_log.xml index 960db137b3..cf61348a66 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_log.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_log.xml @@ -17,12 +17,10 @@ Conversations are not being logged. To log conversations in the future, select "Save IM logs on my computer" under Preferences > Privacy. Date: Tue, 25 Dec 2012 21:16:30 +0200 Subject: CHUI-623 FIXED No vertical scrollbar in conversation list --- indra/newview/skins/default/xui/en/floater_im_container.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index cbf1830093..e7638fe669 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -113,11 +113,12 @@ @@ -127,7 +128,7 @@ name="messages_layout_panel" expanded_min_dim="222"> Date: Wed, 26 Dec 2012 11:23:59 +0200 Subject: CHUI-632 FIXED Disable Gear button if nothing is selected --- indra/newview/llpanelblockedlist.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index ecab7d2167..df1ccdd9fc 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -137,6 +137,7 @@ void LLPanelBlockedList::updateButtons() { bool hasSelected = NULL != mBlockedList->getSelectedItem(); getChildView("unblock_btn")->setEnabled(hasSelected); + getChildView("blocked_gear_btn")->setEnabled(hasSelected); } void LLPanelBlockedList::unblockItem() -- cgit v1.2.3 From d05df4087c334fe30a9d0fe5224a828c677d0244 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Wed, 26 Dec 2012 11:46:29 +0200 Subject: CHUI-617 FIXED Update Gear button state after initing session. mConversationsRoot creation is moved to postBuild(). --- indra/newview/llfloaterimsession.cpp | 4 +-- indra/newview/llfloaterimsessiontab.cpp | 44 ++++++++++++++------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index ff07ddfcbf..d36b138c21 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -86,7 +86,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&LLFloaterIMSession::GearDoToSelected, this, _2)); mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&LLFloaterIMSession::checkGearMenuItem, this, _2)); - setDocked(true); + setDocked(true); } @@ -754,7 +754,7 @@ void LLFloaterIMSession::sessionInitReplyReceived(const LLUUID& im_session_id) } initIMFloater(); - + LLFloaterIMSessionTab::updateGearBtn(); //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) //need to send delayed messages collected while waiting for session initialization diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 53d2f31b79..f5b657fa60 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -240,7 +240,24 @@ BOOL LLFloaterIMSessionTab::postBuild() result = LLDockableFloater::postBuild(); } - // Now ready to build the conversation and participants list + // Create the root using an ad-hoc base item + LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel); + LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); + p.rect = LLRect(0, 0, getRect().getWidth(), 0); + p.parent_panel = mParticipantListPanel; + p.listener = base_item; + p.view_model = &mConversationViewModel; + p.root = NULL; + p.use_ellipses = true; + p.options_menu = "menu_conversation.xml"; + mConversationsRoot = LLUICtrlFactory::create(p); + mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); + // Attach that root to the scroller + mScroller->addChild(mConversationsRoot); + mConversationsRoot->setScrollContainer(mScroller); + mConversationsRoot->setFollowsAll(); + mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); + buildConversationViewParticipant(); refreshConversation(); @@ -388,31 +405,6 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() return; } - // Create or recreate the root folder: this is a dummy folder (not shown) but required by the LLFolderView architecture - // We need to redo this when rebuilding as the session id (mSessionID) *may* have changed - if (mConversationsRoot) - { - // Remove the old root if any - mScroller->removeChild(mConversationsRoot); - } - // Create the root using an ad-hoc base item - LLConversationItem* base_item = new LLConversationItem(mSessionID, mConversationViewModel); - LLFolderView::Params p(LLUICtrlFactory::getDefaultParams()); - p.rect = LLRect(0, 0, getRect().getWidth(), 0); - p.parent_panel = mParticipantListPanel; - p.listener = base_item; - p.view_model = &mConversationViewModel; - p.root = NULL; - p.use_ellipses = true; - p.options_menu = "menu_conversation.xml"; - mConversationsRoot = LLUICtrlFactory::create(p); - mConversationsRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); - // Attach that root to the scroller - mScroller->addChild(mConversationsRoot); - mConversationsRoot->setScrollContainer(mScroller); - mConversationsRoot->setFollowsAll(); - mConversationsRoot->addChild(mConversationsRoot->mStatusTextBox); - // Create the participants widgets now LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = item->getChildrenBegin(); LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = item->getChildrenEnd(); -- cgit v1.2.3 From 099c9bcc6ffd9760cf935b6bcff8d796d0dff09d Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 26 Dec 2012 20:25:56 +0200 Subject: CHUI-629 FIXED Windows crash on exit when closing viewer with conversation log open with unread offline messages --- indra/newview/llconversationlog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index e44749fd79..0479733706 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -412,7 +412,7 @@ bool LLConversationLog::saveToFile(const std::string& filename) // [1343221177] 0 1 0 John Doe| 7e4ec5be-783f-49f5-71dz-16c58c64c145 4ec62a74-c246-0d25-2af6-846beac2aa55 john.doe| // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| - fprintf(fp, "[%ld] %d %d %d %s| %s %s %s|\n", + fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n", conv_it->getTime(), (S32)conv_it->getConversationType(), (S32)0, -- cgit v1.2.3 From 1eae887434331357e057498905f7f5ff8f9f9c77 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Wed, 26 Dec 2012 23:55:23 +0200 Subject: CHUI-629 FIXED Resolve build problems; --- indra/newview/llconversationlog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 0479733706..8c86871134 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -413,7 +413,7 @@ bool LLConversationLog::saveToFile(const std::string& filename) // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n", - conv_it->getTime(), + (S64)conv_it->getTime(), (S32)conv_it->getConversationType(), (S32)0, (S32)conv_it->hasOfflineMessages(), -- cgit v1.2.3 From 7e8d336749b42ce134a67dfe1f1990644f1b263a Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Fri, 28 Dec 2012 15:28:19 +0200 Subject: CHUI-639 FIXED Min. width is increased to avoid overlapping --- indra/newview/skins/default/xui/en/floater_conversation_log.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_conversation_log.xml b/indra/newview/skins/default/xui/en/floater_conversation_log.xml index cf61348a66..256e03c4d7 100644 --- a/indra/newview/skins/default/xui/en/floater_conversation_log.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_log.xml @@ -5,7 +5,7 @@ positioning="cascading" height="200" min_height="100" - min_width="200" + min_width="230" layout="topleft" name="floater_conversation_log" save_rect="true" -- cgit v1.2.3 From d99fa985c8ff65913e85dfaa9fd91892a197c4cc Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Dec 2012 18:55:24 +0200 Subject: CHUI-566 ADD. FIX Flashing and color on Conversations FUI button and conversation line item Cancel sticking of color, if the button is pressed, or when a flashing of the previously selected button is ended --- indra/llui/llbutton.cpp | 18 +++++++++++++----- indra/newview/llimview.cpp | 16 ++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7ca9b869a8..a8149a9a1d 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -311,7 +311,7 @@ void LLButton::onCommit() { make_ui_sound("UISndClickRelease"); } - + if (mIsToggle) { toggleState(); @@ -613,8 +613,6 @@ void LLButton::draw() static LLCachedControl sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true); F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency(); - bool flash = mFlashing && sEnableButtonFlashing; - bool pressed_by_keyboard = FALSE; if (hasFocus()) { @@ -642,6 +640,17 @@ void LLButton::draw() LLColor4 glow_color; LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; LLUIImage* imagep = NULL; + + // Cancel sticking of color, if the button is pressed, + // or when a flashing of the previously selected button is ended + if (mFlashingTimer + && ((selected && !mFlashingTimer->isFlashingInProgress()) || pressed)) + { + mFlashing = false; + } + + bool flash = mFlashing && sEnableButtonFlashing; + if (pressed && mDisplayPressedState) { imagep = selected ? mImagePressedSelected : mImagePressed; @@ -697,8 +706,7 @@ void LLButton::draw() imagep = mImageDisabled; } - // Selected has a higher priority than flashing. If both are set, flashing is ignored. - if (mFlashing && !selected) + if (mFlashing) { // if button should flash and we have icon for flashing, use it as image for button if(flash && mImageFlash) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d736b81bb7..48cf7b3463 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -122,7 +122,7 @@ void on_new_message(const LLSD& msg) LLUUID session_id = msg["session_id"].asUUID(); LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id); - // determine action for this session + // determine action for this session if (session_id.isNull()) { @@ -148,13 +148,14 @@ void on_new_message(const LLSD& msg) action = gSavedSettings.getString("NotificationGroupChatOptions"); } - // do not show notification in "do not disturb" mode or it goes from agent + // do not show notification which goes from agent if (gAgent.getID() == participant_id) { return; } // execution of the action + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id); @@ -173,7 +174,7 @@ void on_new_message(const LLSD& msg) if ("toast" == action) { - // Skip toasting if we have open window of IM with this session id + // Skip toasting and flashing if we have open window of IM with this session id if (session_floater && session_floater->isInVisibleChain() && session_floater->hasFocus() @@ -184,12 +185,6 @@ void on_new_message(const LLSD& msg) return; } - // Skip toasting for system messages and for nearby chat - if (participant_id.isNull()) - { - return; - } - //User is not focused on conversation containing the message if(session_floater_not_focused) { @@ -201,7 +196,8 @@ void on_new_message(const LLSD& msg) gToolBarView->flashCommand(LLCommandId("chat"), true); //Show IM toasts (upper right toasts) - if(session_id.notNull()) + // Skip toasting for system messages and for nearby chat + if(session_id.notNull() && participant_id.notNull()) { LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); } -- cgit v1.2.3 From a25e6eb733bb8f6a0e9f8de1094155f685c6216d Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 28 Dec 2012 16:11:05 +0200 Subject: CHUI-453 FIXED Tooltip on chevron in torn-off conversation is incorrect: implemented suitable tool-tips; fixed a small separate bug ("tooltip_to_separate_window"/"tooltip_to_main_window" for Tear-Off Button: was shown reverse) --- indra/newview/llfloaterimsessiontab.cpp | 24 ++++++++++++++-------- .../skins/default/xui/en/floater_im_session.xml | 9 ++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 4e79bd0ac8..a79b4b3f1d 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -606,8 +606,8 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar() // prevent start conversation before its container LLFloaterIMContainer::getInstance(); - bool is_torn_off = checkIfTornOff(); - if (!is_torn_off) + bool is_not_torn_off = !checkIfTornOff(); + if (is_not_torn_off) { hideAllStandardButtons(); } @@ -616,7 +616,7 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar() // Participant list should be visible only in torn off floaters. bool is_participant_list_visible = - is_torn_off + !is_not_torn_off && gSavedSettings.getBOOL("IMShowControlPanel") && !mIsP2PChat; @@ -624,22 +624,28 @@ void LLFloaterIMSessionTab::updateHeaderAndToolbar() // Display collapse image (<<) if the floater is hosted // or if it is torn off but has an open control panel. - bool is_expanded = !is_torn_off || is_participant_list_visible; + bool is_expanded = is_not_torn_off || is_participant_list_visible; mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setToolTip( + is_not_torn_off? + getString("expcol_button_not_tearoff_tooltip") : + (is_expanded? + getString("expcol_button_tearoff_and_expanded_tooltip") : + getString("expcol_button_tearoff_and_collapsed_tooltip"))); // toggle floater's drag handle and title visibility if (mDragHandle) { - mDragHandle->setTitleVisible(is_torn_off); + mDragHandle->setTitleVisible(!is_not_torn_off); } // The button (>>) should be disabled for torn off P2P conversations. - mExpandCollapseBtn->setEnabled(!is_torn_off || !mIsP2PChat); + mExpandCollapseBtn->setEnabled(is_not_torn_off || !mIsP2PChat); - mTearOffBtn->setImageOverlay(getString(is_torn_off? "return_icon" : "tear_off_icon")); - mTearOffBtn->setToolTip(getString(!is_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window")); + mTearOffBtn->setImageOverlay(getString(is_not_torn_off? "tear_off_icon" : "return_icon")); + mTearOffBtn->setToolTip(getString(is_not_torn_off? "tooltip_to_separate_window" : "tooltip_to_main_window")); - mCloseBtn->setVisible(!is_torn_off && !mIsNearbyChat); + mCloseBtn->setVisible(is_not_torn_off && !mIsNearbyChat); enableDisableCallBtn(); diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 9e2132dc3b..8f0574177f 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -49,6 +49,15 @@ + + + Date: Wed, 2 Jan 2013 13:10:42 -0800 Subject: CHUI-499: Removing debug code --- .../newview/lldonotdisturbnotificationstorage.cpp | 25 ---------------------- 1 file changed, 25 deletions(-) diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index bf3dcae1f3..f4560d5668 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -29,11 +29,6 @@ #include "lldonotdisturbnotificationstorage.h" -#define XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT 0 - -#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT -#include "llchannelmanager.h" -#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT #include "llcommunicationchannel.h" #include "lldir.h" #include "llerror.h" @@ -41,9 +36,6 @@ #include "llnotifications.h" #include "llnotificationhandler.h" #include "llnotificationstorage.h" -#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT -#include "llscreenchannel.h" -#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT #include "llscriptfloater.h" #include "llsd.h" #include "llsingleton.h" @@ -109,12 +101,6 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() { return; } - -#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT - LLNotificationsUI::LLScreenChannel* notification_channel = - dynamic_cast(LLNotificationsUI::LLChannelManager::getInstance()-> - findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); -#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT LLNotifications& instance = LLNotifications::instance(); @@ -146,17 +132,6 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() instance.add(notification); } - -#if XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT - // hide script floaters so they don't confuse the user and don't overlap startup toast - LLScriptFloaterManager::getInstance()->setFloaterVisible(notification->getID(), false); - - if(notification_channel) - { - // hide saved toasts so they don't confuse the user - notification_channel->hideToast(notification->getID()); - } -#endif // XXX_STINSON_HIDE_NOTIFICATIONS_ON_DND_EXIT } // Clear the communication channel history and rewrite the save file to empty it as well -- cgit v1.2.3 From f40ee4792d948ca99d19bdd6f645faea07e15f47 Mon Sep 17 00:00:00 2001 From: maximbproductengine Date: Thu, 3 Jan 2013 06:35:40 +0200 Subject: CHUI-616 (Left Click on participant name in torn off conference moves focus to conversation floater) --- indra/newview/llconversationview.cpp | 21 --------------------- indra/newview/llconversationview.h | 2 -- 2 files changed, 23 deletions(-) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index e51efd48f5..903dd2a407 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -547,27 +547,6 @@ void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask) LLFolderViewItem::onMouseLeave(x, y, mask); } -BOOL LLConversationViewParticipant::handleMouseDown( S32 x, S32 y, MASK mask ) -{ - LLConversationItem* item = NULL; - LLConversationViewSession* session_widget = - dynamic_cast(this->getParentFolder()); - if (session_widget) - { - item = dynamic_cast(session_widget->getViewModelItem()); - } - LLUUID session_id = item? item->getUUID() : LLUUID(); - BOOL result = LLFolderViewItem::handleMouseDown(x, y, mask); - - if(result) - { - (LLFloaterReg::getTypedInstance("im_container"))-> - selectConversationPair(session_id, false); - } - - return result; -} - S32 LLConversationViewParticipant::getLabelXPos() { return getIndentation() + mAvatarIcon->getRect().getWidth() + mIconPad; diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h index 74443e1d88..5f6acfb9ab 100755 --- a/indra/newview/llconversationview.h +++ b/indra/newview/llconversationview.h @@ -132,8 +132,6 @@ public: void addToFolder(LLFolderViewFolder* folder); void addToSession(const LLUUID& session_id); - /*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - void onMouseEnter(S32 x, S32 y, MASK mask); void onMouseLeave(S32 x, S32 y, MASK mask); -- cgit v1.2.3 From 3d83fc3da5b0fa20bb631bfd2c94368946905675 Mon Sep 17 00:00:00 2001 From: maximbproductengine Date: Thu, 3 Jan 2013 06:43:25 +0200 Subject: CHUI-608 (Conversations floater can be resized too small once a conversation is torn off) --- indra/newview/llfloaterimcontainer.h | 3 ++- indra/newview/llfloaterimsessiontab.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 09a24c0105..8daed46c7d 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -106,6 +106,8 @@ public: bool enableContextMenuItem(const std::string& item, uuid_vec_t& selectedIDS); void doToParticipants(const std::string& item, uuid_vec_t& selectedIDS); + void assignResizeLimits(); + private: typedef std::map avatarID_panel_map_t; avatarID_panel_map_t mSessions; @@ -154,7 +156,6 @@ private: void toggleAllowTextChat(const LLUUID& participant_uuid); void toggleMute(const LLUUID& participant_id, U32 flags); void openNearbyChat(); - void assignResizeLimits(); LLButton* mExpandCollapseBtn; LLButton* mStubCollapseBtn; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index f5b657fa60..4e79bd0ac8 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -751,6 +751,11 @@ void LLFloaterIMSessionTab::onTearOffClicked() { forceReshape(); } + LLFloaterIMContainer* container = LLFloaterIMContainer::getInstance(); + if (container) + { + container->assignResizeLimits(); + } refreshConversation(); updateGearBtn(); } -- cgit v1.2.3 From c464adc8ae35d3656e8de6aa459eb4615bb34c6f Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Thu, 3 Jan 2013 14:03:33 +0200 Subject: CHUI-636 FIXED Enable group context menu options, if uuid is empty and selected model item is group chat. In addition enable Chat history item for ad-hoc and group conversations. --- indra/newview/llfloaterimcontainer.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2019a35faa..61a67a1f9f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1101,12 +1101,20 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata) uuid_vec_t uuids; getParticipantUUIDs(uuids); + //Enable Chat history item for ad-hoc and group conversations + if ("can_chat_history" == item) + { + if (getCurSelectedViewModelItem()->getType() != LLConversationItem::CONV_PARTICIPANT) + { + return isConversationLoggingAllowed(); + } + } - // If nothing is selected, everything needs to be disabled + // If nothing is selected(and selected item is not group chat), everything needs to be disabled if (uuids.size() <= 0) - { - return false; - } + { + return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP; + } if("can_activate_group" == item) { @@ -1123,7 +1131,7 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v { return gSavedSettings.getBOOL("KeepConversationLogTranscripts"); } - + // Extract the single select info bool is_single_select = (uuids.size() == 1); const LLUUID& single_id = uuids.front(); -- cgit v1.2.3 From f4902521f58956eda7701770eec51763a7663d3c Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 3 Jan 2013 15:12:11 +0200 Subject: CHUI-631 FIXED 'Nearby chat' is not selected in Conversations floater after closing separate conversation if list of participants was expand in Conversations floater: force select 'Nearby chat' when session floater is destroyed --- indra/newview/llfloaterimsessiontab.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index a79b4b3f1d..76643b0235 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -82,6 +82,13 @@ LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) LLFloaterIMSessionTab::~LLFloaterIMSessionTab() { delete mRefreshTimer; + + // Select Nearby Chat session + LLFloaterIMContainer* container = LLFloaterReg::getTypedInstance("im_container"); + if (container) + { + container->selectConversationPair(LLUUID(NULL), true); + } } //static -- cgit v1.2.3 From 799c1f241f66db6d8701ee8c4339a5cce41c3c47 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Thu, 3 Jan 2013 18:59:20 +0200 Subject: CHUI-628 FIXED Open conversation log menu option not active in conversation floater when nearby chat is selected: Determination of the availability menu item was moved to the right place --- indra/newview/llfloaterimcontainer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 61a67a1f9f..50acd4ae24 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1101,6 +1101,11 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata) uuid_vec_t uuids; getParticipantUUIDs(uuids); + if ("conversation_log" == item) + { + return gSavedSettings.getBOOL("KeepConversationLogTranscripts"); + } + //Enable Chat history item for ad-hoc and group conversations if ("can_chat_history" == item) { @@ -1127,11 +1132,6 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata) bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_vec_t& uuids) { - if ("conversation_log" == item) - { - return gSavedSettings.getBOOL("KeepConversationLogTranscripts"); - } - // Extract the single select info bool is_single_select = (uuids.size() == 1); const LLUUID& single_id = uuids.front(); -- cgit v1.2.3 From aa6fee292d1721eac6f0f1f270844e01e06979d4 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 3 Jan 2013 14:19:04 -0800 Subject: CHUI-499: Fixed a serialization problem where the a notification's objectInfo was not being serialized/deserialized. --- indra/llui/llnotifications.cpp | 5 +++++ indra/llui/llnotifications.h | 4 +++- indra/newview/lldonotdisturbnotificationstorage.cpp | 2 +- indra/newview/llnotificationstorage.cpp | 7 +------ indra/newview/llviewermessage.cpp | 3 +++ indra/newview/llviewermessage.h | 1 + 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index c9b4399bef..8aa0b6f110 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -517,6 +517,11 @@ LLSD LLNotification::asLLSD() p.expiry = mExpiresAt; p.priority = mPriority; + if(mResponder) + { + p.functor.responder_sd = mResponder->asLLSD(); + } + if(!mResponseFunctorName.empty()) { p.functor.name = mResponseFunctorName; diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 42dee4c3e9..2a6391f49e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -322,11 +322,13 @@ public: Alternative name; Alternative function; Alternative responder; + Alternative responder_sd; Functor() : name("responseFunctor"), function("functor"), - responder("responder") + responder("responder"), + responder_sd("responder_sd") {} }; Optional functor; diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index f4560d5668..6407a3fa0c 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -118,7 +118,7 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() } else { - LLNotificationResponderInterface* responder = createResponder(notification_params["name"], notification_params["responder"]); + LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); if (responder == NULL) { LL_WARNS("LLDoNotDisturbNotificationStorage") << "cannot create responder for notification of type '" diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index b797775369..4c5b7cc198 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -126,13 +126,8 @@ LLResponderRegistry::LLResponderRegistry() , mBuildMap() { add("ObjectGiveItem", &create); - add("OwnObjectGiveItem", &create); add("UserGiveItem", &create); - - add("TeleportOffered", &create); - add("TeleportOffered_MaturityExceeded", &create); - - add("OfferFriendship", &create); + add("offer_info", &create); } LLResponderRegistry::~LLResponderRegistry() diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 04dd7c911b..d264a18597 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1361,6 +1361,8 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id)); } +std::string LLOfferInfo::mResponderType = "offer_info"; + LLOfferInfo::LLOfferInfo() : LLNotificationResponderInterface() , mFromGroup(FALSE) @@ -1406,6 +1408,7 @@ LLOfferInfo::LLOfferInfo(const LLOfferInfo& info) LLSD LLOfferInfo::asLLSD() { LLSD sd; + sd["responder_type"] = mResponderType; sd["im_type"] = mIM; sd["from_id"] = mFromID; sd["from_group"] = mFromGroup; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 447fdeb9c7..3237f3fbdd 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -229,6 +229,7 @@ public: void forceResponse(InventoryOfferResponse response); + static std::string mResponderType; EInstantMessage mIM; LLUUID mFromID; BOOL mFromGroup; -- cgit v1.2.3 From 0e6ff3e7021b2e72f02b22550bbb96bc3674cba4 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Jan 2013 14:37:24 -0800 Subject: CHUI-654 : Fixed! Select the Nearby Chat directly when one conversation only left, don't finesse with a root UUID that might not be NULL --- indra/newview/llfloaterimcontainer.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 50acd4ae24..9fe67e99da 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1430,11 +1430,10 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c { is_widget_selected = widget->isSelected(); new_selection = mConversationsRoot->getNextFromChild(widget); - if(new_selection == NULL) + if (!new_selection) { new_selection = mConversationsRoot->getPreviousFromChild(widget); } - widget->destroyView(); } @@ -1446,14 +1445,20 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c if (change_focus) { setFocus(TRUE); - if(new_selection != NULL) + if (new_selection) { if (mConversationsWidgets.size() == 1) - new_selection = new_selection->getParentFolder(); - LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); - if(vmi != NULL) { - selectConversationPair(vmi->getUUID(), true); + // If only one widget is left, it has to be the Nearby Chat. Select it directly. + selectConversationPair(LLUUID(NULL), true); + } + else + { + LLConversationItem* vmi = dynamic_cast(new_selection->getViewModelItem()); + if (vmi) + { + selectConversationPair(vmi->getUUID(), true); + } } } } -- cgit v1.2.3 From 3d1feec7641051386733405186cfe81b68a929ca Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 3 Jan 2013 15:11:53 -0800 Subject: CHUI-656 : Fixed. getTypedInstance() will create an instance if not found. Do not use that in destructors (bad...) or in places where creation is not required. Use findTypedInstance() instead. --- indra/newview/llfloaterimsessiontab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 76643b0235..7b34a86f24 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -84,7 +84,7 @@ LLFloaterIMSessionTab::~LLFloaterIMSessionTab() delete mRefreshTimer; // Select Nearby Chat session - LLFloaterIMContainer* container = LLFloaterReg::getTypedInstance("im_container"); + LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance("im_container"); if (container) { container->selectConversationPair(LLUUID(NULL), true); @@ -329,7 +329,7 @@ void LLFloaterIMSessionTab::onFocusReceived() LLTransientDockableFloater::onFocusReceived(); - LLFloaterIMContainer* container = LLFloaterReg::getTypedInstance("im_container"); + LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance("im_container"); if (container) { container->selectConversationPair(mSessionID, true); -- cgit v1.2.3 From 9d687cc0042a6972a603778359055394c1cf0850 Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Fri, 4 Jan 2013 15:14:24 +0200 Subject: CHUI-637 FIXED Call requestArrange() to update widget state. --- indra/newview/llfloaterimcontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 9fe67e99da..22db4dd0eb 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -678,6 +678,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) { widget->setOpen(false); } + widget->requestArrange(); } } } -- cgit v1.2.3 From 4d971c43518f02fe202cf437f059250061cd9756 Mon Sep 17 00:00:00 2001 From: maximbproductengine Date: Fri, 4 Jan 2013 16:48:34 +0200 Subject: CHUI-608 (Conversations floater can be resized too small once a conversation is torn off) --- indra/newview/llfloaterimcontainer.cpp | 6 ++++++ indra/newview/llfloaterimcontainer.h | 1 + indra/newview/llfloaterimsessiontab.cpp | 5 ----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 2019a35faa..151d901708 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -605,6 +605,12 @@ void LLFloaterIMContainer::setVisible(BOOL visible) LLMultiFloater::setVisible(visible); } +void LLFloaterIMContainer::updateResizeLimits() +{ + LLMultiFloater::updateResizeLimits(); + assignResizeLimits(); +} + void LLFloaterIMContainer::collapseMessagesPane(bool collapse) { if (mMessagesPane->isCollapsed() == collapse) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 8daed46c7d..0cd1b6759b 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -60,6 +60,7 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void updateResizeLimits(); void onCloseFloater(LLUUID& id); /*virtual*/ void addFloater(LLFloater* floaterp, diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 4e79bd0ac8..f5b657fa60 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -751,11 +751,6 @@ void LLFloaterIMSessionTab::onTearOffClicked() { forceReshape(); } - LLFloaterIMContainer* container = LLFloaterIMContainer::getInstance(); - if (container) - { - container->assignResizeLimits(); - } refreshConversation(); updateGearBtn(); } -- cgit v1.2.3 From b1ba208e7fcb8dbaa2c47b70fe580094982e36dd Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Sat, 5 Jan 2013 00:09:36 +0200 Subject: CHUI-643 W.I.P. Collapsed conversations floater has huge right padding: corrected of a imcontainer's resize calculating --- indra/newview/llfloaterimcontainer.cpp | 59 ++++++++++++---------- .../skins/default/xui/en/floater_im_container.xml | 3 +- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index ae243d6495..69d6f1ca38 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -618,34 +618,34 @@ void LLFloaterIMContainer::collapseMessagesPane(bool collapse) return; } + // Save current width of panels before collapsing/expanding right pane. + S32 conv_pane_width = mConversationsPane->getRect().getWidth(); + S32 msg_pane_width = mMessagesPane->getRect().getWidth(); + if (collapse) { // Save the messages pane width before collapsing it. - gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", mMessagesPane->getRect().getWidth()); + gSavedPerAccountSettings.setS32("ConversationsMessagePaneWidth", msg_pane_width); // Save the order in which the panels are closed to reverse user's last action. gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", mConversationsPane->isCollapsed()); } - // Save left pane rectangle before collapsing/expanding right pane. - LLRect prevRect = mConversationsPane->getRect(); - // Show/hide the messages pane. mConversationsStack->collapsePanel(mMessagesPane, collapse); - if (!collapse) - { - // Make sure layout is updated before resizing conversation pane. - mConversationsStack->updateLayout(); - } + // Make sure layout is updated before resizing conversation pane. + mConversationsStack->updateLayout(); updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth")); + if (!collapse) { // Restore conversation's pane previous width after expanding messages pane. - mConversationsPane->setTargetDim(prevRect.getWidth()); + mConversationsPane->setTargetDim(conv_pane_width); } } + void LLFloaterIMContainer::collapseConversationsPane(bool collapse) { if (mConversationsPane->isCollapsed() == collapse) @@ -657,10 +657,13 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) button_panel->setVisible(!collapse); mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon")); + // Save current width of panels before collapsing/expanding right pane. + S32 conv_pane_width = mConversationsPane->getRect().getWidth(); + if (collapse) { // Save the conversations pane width before collapsing it. - gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", mConversationsPane->getRect().getWidth()); + gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", conv_pane_width); // Save the order in which the panels are closed to reverse user's last action. gSavedPerAccountSettings.setBOOL("ConversationsExpandMessagePaneFirst", !mMessagesPane->isCollapsed()); @@ -668,8 +671,9 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) mConversationsStack->collapsePanel(mConversationsPane, collapse); - S32 collapsed_width = mConversationsPane->getMinDim(); - updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - collapsed_width); + S32 delta_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - mConversationsPane->getMinDim(); + + updateState(collapse, delta_width); for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); widget_it != mConversationsWidgets.end(); ++widget_it) @@ -685,7 +689,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) widget->setOpen(false); } widget->requestArrange(); -} + } } } @@ -693,6 +697,8 @@ void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width) { LLRect floater_rect = getRect(); floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); +S32 debug_var = floater_rect.getWidth(); +debug_var = debug_var + 1; // Set by_user = true so that reshaped rect is saved in user_settings. setShape(floater_rect, true); @@ -705,29 +711,28 @@ void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width) setCanResize(is_left_pane_expanded || is_right_pane_expanded); setCanMinimize(is_left_pane_expanded || is_right_pane_expanded); + assignResizeLimits(); + // force set correct size for the title after show/hide minimize button LLRect cur_rect = getRect(); LLRect force_rect = cur_rect; force_rect.mRight = cur_rect.mRight + 1; setRect(force_rect); setRect(cur_rect); - - // restore floater's resize limits (prevent collapse when left panel is expanded) - if (is_left_pane_expanded && !is_right_pane_expanded) - { - S32 expanded_min_size = mConversationsPane->getExpandedMinDim(); - setResizeLimits(expanded_min_size, expanded_min_size); - } - - assignResizeLimits(); } void LLFloaterIMContainer::assignResizeLimits() { - const LLRect& conv_rect = mConversationsPane->isCollapsed() ? LLRect() : mConversationsPane->getRect(); - S32 msg_limits = mMessagesPane->isCollapsed() ? 0 : mMessagesPane->getExpandedMinDim(); - S32 x_limits = conv_rect.getWidth() + msg_limits; - setResizeLimits(x_limits + LLPANEL_BORDER_WIDTH * 3, getMinHeight()); + bool is_conv_pane_expanded = !mConversationsPane->isCollapsed(); + bool is_msg_pane_expanded = !mMessagesPane->isCollapsed(); + + S32 number_of_visible_borders = llmin((is_conv_pane_expanded? 2 : 0) + (is_msg_pane_expanded? 2 : 0), 3); + S32 summary_width_of_visible_borders = number_of_visible_borders * LLPANEL_BORDER_WIDTH; + S32 conv_pane_current_width = is_conv_pane_expanded? mConversationsPane->getRect().getWidth() : mConversationsPane->getMinDim(); + S32 msg_pane_min_width = is_msg_pane_expanded ? mMessagesPane->getExpandedMinDim() : 0; + S32 new_min_width = conv_pane_current_width + msg_pane_min_width + summary_width_of_visible_borders; + + setResizeLimits(new_min_width, getMinHeight()); } void LLFloaterIMContainer::onAddButtonClicked() diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index e7638fe669..951665552f 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -14,7 +14,8 @@ title="CONVERSATIONS" bottom="-50" right="-5" - width="450"> + width="450" + min_width="38"> -- cgit v1.2.3 From 118201943da157b6932d8c79ab3eb3d8c3c0a9a4 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 4 Jan 2013 23:54:38 +0200 Subject: CHUI-643 FIXED Collapsed conversations floater has huge right padding: prevent of a rewriting mOriginMinWidth and mOriginMinHeight to default values --- indra/llui/llmultifloater.cpp | 10 ++++------ indra/newview/llfloaterimcontainer.cpp | 15 ++++++++++++--- indra/newview/llfloaterimcontainer.h | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 179b251cdb..59faabd482 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -37,12 +37,10 @@ // LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params) - : LLFloater(key), - mTabContainer(NULL), - mTabPos(LLTabContainer::TOP), - mAutoResize(TRUE), - mOrigMinWidth(params.min_width), - mOrigMinHeight(params.min_height) + : LLFloater(key) + , mTabContainer(NULL) + , mTabPos(LLTabContainer::TOP) + , mAutoResize(TRUE) { } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 69d6f1ca38..5624788e45 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -56,8 +56,8 @@ // // LLFloaterIMContainer // -LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed) -: LLMultiFloater(seed), +LLFloaterIMContainer::LLFloaterIMContainer(const LLSD& seed, const Params& params /*= getDefaultParams()*/) +: LLMultiFloater(seed, params), mExpandCollapseBtn(NULL), mConversationsRoot(NULL), mConversationsEventStream("ConversationsEvents"), @@ -153,6 +153,9 @@ void LLFloaterIMContainer::onCurrentChannelChanged(const LLUUID& session_id) BOOL LLFloaterIMContainer::postBuild() { + mOrigMinWidth = getMinWidth(); + mOrigMinHeight = getMinHeight(); + mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLFloaterIMContainer::onNewMessageReceived, this, _1)); // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button // mTabContainer will be initialized in LLMultiFloater::addChild() @@ -657,7 +660,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse) button_panel->setVisible(!collapse); mExpandCollapseBtn->setImageOverlay(getString(collapse ? "expand_icon" : "collapse_icon")); - // Save current width of panels before collapsing/expanding right pane. + // Save current width of Conversation panel before collapsing/expanding right pane. S32 conv_pane_width = mConversationsPane->getRect().getWidth(); if (collapse) @@ -1408,6 +1411,12 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& current_participant_model++; } } + + if (uuid.notNull() && im_sessionp->isP2PSessionType()) + { + item->fetchAvatarName(LLIMModel::getInstance()->getOtherParticipantID(uuid)); + } + // Do that too for the conversation dialog LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid))); if (conversation_floater) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 0cd1b6759b..85d950c58b 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -53,7 +53,7 @@ class LLFloaterIMContainer , public LLIMSessionObserver { public: - LLFloaterIMContainer(const LLSD& seed); + LLFloaterIMContainer(const LLSD& seed, const Params& params = getDefaultParams()); virtual ~LLFloaterIMContainer(); /*virtual*/ BOOL postBuild(); -- cgit v1.2.3 From e59458590535d7fe571f9504fe97caa4e15701e6 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Sat, 5 Jan 2013 00:19:54 +0200 Subject: CHUI-643 FIXED Collapsed conversations floater has huge right padding: clean up; remove debug code --- indra/newview/llfloaterimcontainer.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 5624788e45..09d83e2a8f 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -700,8 +700,6 @@ void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width) { LLRect floater_rect = getRect(); floater_rect.mRight += ((collapse ? -1 : 1) * delta_width); -S32 debug_var = floater_rect.getWidth(); -debug_var = debug_var + 1; // Set by_user = true so that reshaped rect is saved in user_settings. setShape(floater_rect, true); @@ -729,6 +727,8 @@ void LLFloaterIMContainer::assignResizeLimits() bool is_conv_pane_expanded = !mConversationsPane->isCollapsed(); bool is_msg_pane_expanded = !mMessagesPane->isCollapsed(); + // With two panels visible number of borders is three, because the borders + // between the panels are merged into one S32 number_of_visible_borders = llmin((is_conv_pane_expanded? 2 : 0) + (is_msg_pane_expanded? 2 : 0), 3); S32 summary_width_of_visible_borders = number_of_visible_borders * LLPANEL_BORDER_WIDTH; S32 conv_pane_current_width = is_conv_pane_expanded? mConversationsPane->getRect().getWidth() : mConversationsPane->getMinDim(); @@ -1412,11 +1412,6 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& } } - if (uuid.notNull() && im_sessionp->isP2PSessionType()) - { - item->fetchAvatarName(LLIMModel::getInstance()->getOtherParticipantID(uuid)); - } - // Do that too for the conversation dialog LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid))); if (conversation_floater) -- cgit v1.2.3 From 02ca16c1334d1409d8b14136f76305686796c359 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 4 Jan 2013 17:58:30 -0800 Subject: CHUI-499: Now when existing DND mode, stored IM's will not show a toast but instead flash the conversation line item and Chat FUI button. --- indra/llui/llnotifications.cpp | 3 +- indra/llui/llnotifications.h | 18 ++++- .../newview/lldonotdisturbnotificationstorage.cpp | 10 ++- indra/newview/llimhandler.cpp | 86 ++++++++++++---------- indra/newview/llimview.cpp | 37 ++++++++++ 5 files changed, 110 insertions(+), 44 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 8aa0b6f110..9ba598995f 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -475,7 +475,8 @@ LLNotification::LLNotification(const LLSDParamAdapter& p) : mIgnored(false), mResponderObj(NULL), mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()), - mOfferFromAgent(p.offer_from_agent) + mOfferFromAgent(p.offer_from_agent), + mIsDND(p.is_dnd) { if (p.functor.name.isChosen()) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 2a6391f49e..092a9acd7c 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -316,6 +316,7 @@ public: Optional context; Optional responder; Optional offer_from_agent; + Optional is_dnd; struct Functor : public LLInitParam::ChoiceBlock { @@ -342,7 +343,8 @@ public: form_elements("form"), substitutions("substitutions"), expiry("expiry"), - offer_from_agent("offer_from_agent", false) + offer_from_agent("offer_from_agent", false), + is_dnd("is_dnd", false) { time_stamp = LLDate::now(); responder = NULL; @@ -356,7 +358,8 @@ public: form_elements("form"), substitutions("substitutions"), expiry("expiry"), - offer_from_agent("offer_from_agent", false) + offer_from_agent("offer_from_agent", false), + is_dnd("is_dnd", false) { functor.name = _name; name = _name; @@ -383,6 +386,7 @@ private: void* mResponderObj; // TODO - refactor/remove this field LLNotificationResponderPtr mResponder; bool mOfferFromAgent; + bool mIsDND; // a reference to the template LLNotificationTemplatePtr mTemplatep; @@ -523,6 +527,16 @@ public: return mOfferFromAgent; } + bool isDND() const + { + return mIsDND; + } + + void setDND(const bool flag) + { + mIsDND = flag; + } + std::string getType() const; std::string getMessage() const; std::string getFooter() const; diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 6407a3fa0c..9bb2f27a46 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -109,15 +109,19 @@ void LLDoNotDisturbNotificationStorage::loadNotifications() ++notification_it) { LLSD notification_params = *notification_it; - LLNotificationPtr notification(new LLNotification(notification_params)); + const LLUUID& notificationID = notification_params["id"]; + LLNotificationPtr notification = instance.find(notificationID); - const LLUUID& notificationID = notification->id(); - if (instance.find(notificationID)) + //Notification already exists in notification pipeline (same instance of app running) + if (notification) { + notification->setDND(true); instance.update(notification); } + //Notification doesn't exist (different instance since restarted app while in DND mode) else { + notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true)); LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]); if (responder == NULL) { diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp index 72967eb6c7..c2b29f36e8 100644 --- a/indra/newview/llimhandler.cpp +++ b/indra/newview/llimhandler.cpp @@ -36,6 +36,8 @@ using namespace LLNotificationsUI; +extern void process_dnd_im(const LLSD& notification); + //-------------------------------------------------------------------------- LLIMHandler::LLIMHandler() : LLCommunicationNotificationHandler("IM Notifications", "notifytoast") @@ -60,44 +62,52 @@ void LLIMHandler::initChannel() //-------------------------------------------------------------------------- bool LLIMHandler::processNotification(const LLNotificationPtr& notification) { - if(mChannel.isDead()) - { - return false; - } - - // arrange a channel on a screen - if(!mChannel.get()->getVisible()) - { - initChannel(); - } - - LLSD substitutions = notification->getSubstitutions(); - - // According to comments in LLIMMgr::addMessage(), if we get message - // from ourselves, the sender id is set to null. This fixes EXT-875. - LLUUID avatar_id = substitutions["FROM_ID"].asUUID(); - if (avatar_id.isNull()) - avatar_id = gAgentID; - - LLToastIMPanel::Params im_p; - im_p.notification = notification; - im_p.avatar_id = avatar_id; - im_p.from = substitutions["FROM"].asString(); - im_p.time = substitutions["TIME"].asString(); - im_p.message = substitutions["MESSAGE"].asString(); - im_p.session_id = substitutions["SESSION_ID"].asUUID(); - - LLToastIMPanel* im_box = new LLToastIMPanel(im_p); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.session_id = im_p.session_id; - p.notification = notification; - p.panel = im_box; - p.can_be_stored = false; - LLScreenChannel* channel = dynamic_cast(mChannel.get()); - if(channel) - channel->addToast(p); + if(notification->isDND()) + { + LLSD data = notification->asLLSD(); //don't need this if retrieve needed data from notification getters + process_dnd_im(data); + } + else + { + if(mChannel.isDead()) + { + return false; + } + + // arrange a channel on a screen + if(!mChannel.get()->getVisible()) + { + initChannel(); + } + + LLSD substitutions = notification->getSubstitutions(); + + // According to comments in LLIMMgr::addMessage(), if we get message + // from ourselves, the sender id is set to null. This fixes EXT-875. + LLUUID avatar_id = substitutions["FROM_ID"].asUUID(); + if (avatar_id.isNull()) + avatar_id = gAgentID; + + LLToastIMPanel::Params im_p; + im_p.notification = notification; + im_p.avatar_id = avatar_id; + im_p.from = substitutions["FROM"].asString(); + im_p.time = substitutions["TIME"].asString(); + im_p.message = substitutions["MESSAGE"].asString(); + im_p.session_id = substitutions["SESSION_ID"].asUUID(); + + LLToastIMPanel* im_box = new LLToastIMPanel(im_p); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.session_id = im_p.session_id; + p.notification = notification; + p.panel = im_box; + p.can_be_stored = false; + LLScreenChannel* channel = dynamic_cast(mChannel.get()); + if(channel) + channel->addToast(p); + } return false; } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d736b81bb7..716e6fe7ba 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -101,6 +101,43 @@ BOOL LLSessionTimeoutTimer::tick() return TRUE; } + + +void process_dnd_im(const LLSD& notification) +{ + LLSD data = notification["substitutions"]; + LLUUID sessionID = data["SESSION_ID"].asUUID(); + + //re-create the IM session if needed + //(when coming out of DND mode upon app restart) + if(!gIMMgr->hasSession(sessionID)) + { + //reconstruct session using data from the notification + std::string name = data["FROM"]; + LLAvatarName av_name; + if (LLAvatarNameCache::get(data["FROM_ID"], &av_name)) + { + name = av_name.getDisplayName(); + } + + + LLIMModel::getInstance()->newSession(sessionID, + name, + IM_NOTHING_SPECIAL, + data["FROM_ID"], + false, + false); //will need slight refactor to retrieve whether offline message or not (assume online for now) + } + + //For now always flash conversation line item + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); + im_box->flashConversationItemWidget(sessionID, true); + + //And flash toolbar button + gToolBarView->flashCommand(LLCommandId("chat"), true); +} + + static void on_avatar_name_cache_toast(const LLUUID& agent_id, const LLAvatarName& av_name, LLSD msg) -- cgit v1.2.3 From 12554bffb34895533ed11013a780bfa088756a67 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 4 Jan 2013 20:23:14 -0800 Subject: CHUI-580 : Fixed : Avoid fetching names while reacting to display name checkbox change (overkill), make display name pref disabled when usePeopleAPI is off --- indra/newview/llconversationmodel.cpp | 33 +++++++++++++++++++++++++-------- indra/newview/llconversationmodel.h | 6 ++++-- indra/newview/llfloaterimcontainer.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 13 ++++++++++++- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index b1f45d6d64..bc5b72e029 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -434,24 +434,31 @@ void LLConversationItemParticipant::fetchAvatarName() } } -void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +void LLConversationItemParticipant::updateAvatarName() { - menuentry_vec_t items; - menuentry_vec_t disabled_items; - - buildParticipantMenuOptions(items); - - hide_context_entries(menu, items, disabled_items); + llassert(getUUID().notNull()); + if (getUUID().notNull()) + { + LLAvatarName av_name; + if (LLAvatarNameCache::get(getUUID(),&av_name)) + { + updateAvatarName(av_name); + } + } } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { mAvatarNameCacheConnection.disconnect(); + updateAvatarName(av_name); +} +void LLConversationItemParticipant::updateAvatarName(const LLAvatarName& av_name) +{ mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); mNeedsRefresh = true; - if(mParent != NULL) + if (mParent != NULL) { LLConversationItemSession* parent_session = dynamic_cast(mParent); if (parent_session != NULL) @@ -463,6 +470,16 @@ void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_nam } } +void LLConversationItemParticipant::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + menuentry_vec_t items; + menuentry_vec_t disabled_items; + + buildParticipantMenuOptions(items); + + hide_context_entries(menu, items, disabled_items); +} + LLConversationItemSession* LLConversationItemParticipant::getParentSession() { LLConversationItemSession* parent_session = NULL; diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 743a6ba40b..6ae891203d 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -195,14 +195,16 @@ public: virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); } - void fetchAvatarName(); + void fetchAvatarName(); // fetch and update the avatar name + void updateAvatarName(); // get from the cache (do *not* fetch) and update the avatar name LLConversationItemSession* getParentSession(); void dumpDebugData(); void setModeratorOptionsVisible(bool visible) { mDisplayModeratorOptions = visible; } private: - void onAvatarNameCache(const LLAvatarName& av_name); + void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName + void updateAvatarName(const LLAvatarName& av_name); bool mIsMuted; // default is false bool mIsModerator; // default is false diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 3c85f21188..e1288a763c 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -393,7 +393,7 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - participant_model->fetchAvatarName(); + participant_model->updateAvatarName(); // Next participant current_participant_model++; } diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 13d8a79f8d..3d4a1c44d8 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1682,6 +1682,17 @@ LLPanelPreference::LLPanelPreference() //virtual BOOL LLPanelPreference::postBuild() { + ////////////////////// PanelGeneral /////////////////// + if (hasChild("display_names_check")) + { + BOOL use_people_api = gSavedSettings.getBOOL("UsePeopleAPI"); + LLCheckBoxCtrl* ctrl_display_name = getChild("display_names_check"); + ctrl_display_name->setEnabled(use_people_api); + if (!use_people_api) + { + ctrl_display_name->setValue(FALSE); + } + } ////////////////////// PanelVoice /////////////////// if (hasChild("voice_unavailable")) @@ -1732,7 +1743,7 @@ BOOL LLPanelPreference::postBuild() getChild("favorites_on_login_check")->setCommitCallback(boost::bind(&showFavoritesOnLoginWarning, _1, _2)); } - // Panel Advanced + //////////////////////PanelAdvanced /////////////////// if (hasChild("modifier_combo")) { //localizing if push2talk button is set to middle mouse -- cgit v1.2.3 From 3d0ec3da5baea6bb2b9b72707a884ac7b516c4fd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 15:32:47 -0800 Subject: CHUI-659 : WIP : Verified (tested) and cleaned up some CHUI-101 refactoring code. --- indra/llui/llfolderviewmodel.h | 4 ++-- indra/newview/llinventoryfilter.cpp | 9 +++------ indra/newview/llpanelobjectinventory.cpp | 10 +++++----- indra/newview/lltexturectrl.cpp | 15 --------------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 7019857c0f..5837052565 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -401,8 +401,8 @@ public: virtual const FilterType& getFilter() const { return mFilter; } virtual void setFilter(const FilterType& filter) { mFilter = filter; } - // TODO RN: remove this and put all filtering logic in view model - // add getStatusText and isFiltering() + // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, + // this method needs to be overloaded and return the relevant fetch status. virtual bool contentsReady() { return true; } diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index c913269aad..92f2d33073 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -42,8 +42,6 @@ #include "llclipboard.h" #include "lltrans.h" -//TODO RN: fix use of static cast as much as possible - LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard"); LLInventoryFilter::FilterOps::FilterOps(const Params& p) @@ -83,7 +81,7 @@ LLInventoryFilter::LLInventoryFilter(const Params& p) bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { - const LLFolderViewModelItemInventory* listener = static_cast(item); + const LLFolderViewModelItemInventory* listener = dynamic_cast(item); // Clipboard cut items are *always* filtered so we need this value upfront const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE); @@ -122,7 +120,7 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const { - const LLFolderViewModelItemInventory* listener = static_cast(item); + const LLFolderViewModelItemInventory* listener = dynamic_cast(item); if (!listener) { llerrs << "Folder view event listener not found." << llendl; @@ -384,8 +382,7 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const { - const LLFolderViewModelItemInventory* listener = static_cast(item); - return mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; + return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; } bool LLInventoryFilter::isDefault() const diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index a2aabb50b5..527aefe821 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1555,6 +1555,10 @@ void LLPanelObjectInventory::reset() mCommitCallbackRegistrar.pushScope(); // push local callbacks + // Reset the inventory model to show all folders by default + mInventoryViewModel.getFilter().setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); + + // Create a new folder view root LLRect dummy_rect(0, 1, 1, 0); LLFolderView::Params p; p.name = "task inventory"; @@ -1566,11 +1570,7 @@ void LLPanelObjectInventory::reset() p.view_model = &mInventoryViewModel; p.root = NULL; mFolders = LLUICtrlFactory::create(p); - // this ensures that we never say "searching..." or "no items found" - //TODO RN: make this happen by manipulating filter object directly - LLInventoryFilter& inventoryFilter = dynamic_cast(mFolders->getFolderViewModel()->getFilter()); - inventoryFilter.setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); - + mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); if (hasFocus()) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 65f0290060..007eb8e33f 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -652,26 +652,11 @@ void LLFloaterTexturePicker::draw() { folder_view->setPinningSelectedItem(mSelectedItemPinned); folder_view->getViewModelItem()->dirtyFilter(); - //TODO RN: test..still works without this? - //folder_view->arrangeFromRoot(); - mSelectedItemPinned = TRUE; } } } -// static -/* -void LLFloaterTexturePicker::onSaveAnotherCopyDialog( S32 option, void* userdata ) -{ - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - if( 0 == option ) - { - self->copyToInventoryFinal(); - } -} -*/ - const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only) { LLViewerInventoryCategory::cat_array_t cats; -- cgit v1.2.3 From d68f4ff646378070c1a92b3dc53f791454395356 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 17:42:11 -0800 Subject: CHUI-659 : WIP : Reimplemented favorite landmark sorting to follow favorites bar index sorting. --- indra/newview/llfolderviewmodelinventory.cpp | 53 ++++++++++++---------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 8a4b4bae84..429315e33f 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -29,6 +29,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "lltooldraganddrop.h" +#include "llfavoritesbar.h" // // class LLFolderViewModelInventory @@ -236,39 +237,31 @@ const LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() const bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, const LLFolderViewModelItemInventory* const& b) const { - // ignore sort order for landmarks in the Favorites folder. - // they should be always sorted as in Favorites bar. See EXT-719 - //TODO RN: fix sorting in favorites folder - //if (a->getSortGroup() == SG_ITEM - // && b->getSortGroup() == SG_ITEM - // && a->getInventoryType() == LLInventoryType::IT_LANDMARK - // && b->getInventoryType() == LLInventoryType::IT_LANDMARK) - //{ - - // static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); - - // LLUUID a_uuid = a->getParentFolder()->getUUID(); - // LLUUID b_uuid = b->getParentFolder()->getUUID(); - - // if ((a_uuid == favorites_folder_id && b_uuid == favorites_folder_id)) - // { - // // *TODO: mantipov: probably it is better to add an appropriate method to LLFolderViewItem - // // or to LLInvFVBridge - // LLViewerInventoryItem* aitem = (static_cast(a))->getItem(); - // LLViewerInventoryItem* bitem = (static_cast(b))->getItem(); - // if (!aitem || !bitem) - // return false; - // S32 a_sort = aitem->getSortField(); - // S32 b_sort = bitem->getSortField(); - // return a_sort < b_sort; - // } - //} + // Ignore sort order for landmarks in the Favorites folder. + // In that folder, landmarks should be always sorted as in the Favorites bar. See EXT-719 + if (a->getSortGroup() == SG_ITEM + && b->getSortGroup() == SG_ITEM + && a->getInventoryType() == LLInventoryType::IT_LANDMARK + && b->getInventoryType() == LLInventoryType::IT_LANDMARK) + { + static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); + // If both landmarks are in the favorite folder... + if (gInventory.isObjectDescendentOf(a->getUUID(), favorites_folder_id) && gInventory.isObjectDescendentOf(b->getUUID(), favorites_folder_id)) + { + // Get their index in that folder + S32 a_sort = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID()); + S32 b_sort = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID()); + // Note: since there are both in the favorite, we shouldn't get negative index value... + if (!((a_sort < 0) && (b_sort < 0))) + { + return a_sort < b_sort; + } + } + } // We sort by name if we aren't sorting by date // OR if these are folders and we are sorting folders by name. - bool by_name = (!mByDate - || (mFoldersByName - && (a->getSortGroup() != SG_ITEM))); + bool by_name = (!mByDate || (mFoldersByName && (a->getSortGroup() != SG_ITEM))); if (a->getSortGroup() != b->getSortGroup()) { -- cgit v1.2.3 From 51d6589eedc408aa7f8a81009b1be356ddc99252 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 18:02:28 -0800 Subject: CHUI-659 : WIP : Clean up typos in my own comments --- indra/newview/llfolderviewmodelinventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 429315e33f..d47c28678d 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -245,13 +245,13 @@ bool LLInventorySort::operator()(const LLFolderViewModelItemInventory* const& a, && b->getInventoryType() == LLInventoryType::IT_LANDMARK) { static const LLUUID& favorites_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); - // If both landmarks are in the favorite folder... + // If both landmarks are in the Favorites folder... if (gInventory.isObjectDescendentOf(a->getUUID(), favorites_folder_id) && gInventory.isObjectDescendentOf(b->getUUID(), favorites_folder_id)) { // Get their index in that folder S32 a_sort = LLFavoritesOrderStorage::instance().getSortIndex(a->getUUID()); S32 b_sort = LLFavoritesOrderStorage::instance().getSortIndex(b->getUUID()); - // Note: since there are both in the favorite, we shouldn't get negative index value... + // Note: this test is a bit overkill: since they are both in the Favorites folder, we shouldn't get negative index values... if (!((a_sort < 0) && (b_sort < 0))) { return a_sort < b_sort; -- cgit v1.2.3 From d71c0ab32c744a6672e4364e3d090d317ec0647c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 18:30:59 -0800 Subject: CHUI-659 : WIP : Clamp down on the number of rearrange we really need. --- indra/llui/llfolderviewitem.cpp | 14 +++++++------- indra/newview/llfolderviewmodelinventory.cpp | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 1281d6bd66..6f8bdb1919 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1664,16 +1664,16 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) void LLFolderViewFolder::requestArrange() { - //if ( mLastArrangeGeneration != -1) + if ( mLastArrangeGeneration != -1) { - mLastArrangeGeneration = -1; - // flag all items up to root - if (mParentFolder) - { - mParentFolder->requestArrange(); - } + mLastArrangeGeneration = -1; + // flag all items up to root + if (mParentFolder) + { + mParentFolder->requestArrange(); } } +} void LLFolderViewFolder::toggleOpen() { diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index d47c28678d..586965e5a0 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -135,7 +135,6 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_gen if (passed_filter_before != mPrevPassedAllFilters) { - //TODO RN: ensure this still happens, but without dependency on folderview LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); if (parent_folder) { -- cgit v1.2.3 From 0e7e877379b4ab0d8d8b7ae3ce8c9dfb91cc9de7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 7 Jan 2013 19:12:32 -0800 Subject: CHUI-659 : WIP : Cleanup llfolderviewitem of filter code as it all moved into llfolderviewmodel. --- indra/llui/llfolderviewitem.cpp | 53 +++-------------------------------------- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 6f8bdb1919..b7165f68b7 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -267,28 +267,11 @@ void LLFolderViewItem::refresh() mIconOpen = vmi.getIconOpen(); mIconOverlay = vmi.getIconOverlay(); - if (mRoot->useLabelSuffix()) - { + if (mRoot->useLabelSuffix()) + { mLabelStyle = vmi.getLabelStyle(); mLabelSuffix = vmi.getLabelSuffix(); -} - - //TODO RN: make sure this logic still fires - //std::string searchable_label(mLabel); - //searchable_label.append(mLabelSuffix); - //LLStringUtil::toUpper(searchable_label); - - //if (mSearchableLabel.compare(searchable_label)) - //{ - // mSearchableLabel.assign(searchable_label); - // vmi.dirtyFilter(); - // // some part of label has changed, so overall width has potentially changed, and sort order too - // if (mParentFolder) - // { - // mParentFolder->requestSort(); - // mParentFolder->requestArrange(); - // } - //} + } mLabelWidthDirty = true; vmi.dirtyFilter(); @@ -1125,22 +1108,6 @@ BOOL LLFolderViewFolder::needsArrange() return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } -//TODO RN: get height resetting working -//void LLFolderViewFolder::setPassedFilter(BOOL passed, BOOL passed_folder, S32 filter_generation) -//{ -// // if this folder is now filtered, but wasn't before -// // (it just passed) -// if (passed && !passedFilter(filter_generation)) -// { -// // reset current height, because last time we drew it -// // it might have had more visible items than now -// mCurHeight = 0.f; -// } -// -// LLFolderViewItem::setPassedFilter(passed, passed_folder, filter_generation); -//} - - // Passes selection information on to children and record selection // information if necessary. BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, @@ -1620,20 +1587,6 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) { getViewModelItem()->addChild(item->getViewModelItem()); } - - //TODO RN - make sort bubble up as long as parent Folder doesn't have anything matching sort criteria - //// Traverse parent folders and update creation date and resort, if necessary - //LLFolderViewFolder* parentp = this; - //while (parentp) - //{ - // if (parentp->mSortFunction.isByDate()) - // { - // // parent folder doesn't have a time stamp yet, so get it from us - // parentp->requestSort(); - // } - - // parentp = parentp->getParentFolder(); - //} } // this is an internal method used for adding items to folders. -- cgit v1.2.3 From dbe1d2f0933db59493d11e9b3ab2d84ca884e28a Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Tue, 8 Jan 2013 14:38:30 +0200 Subject: CHUI-602 FIXED Return false if Selected view model item is null. --- indra/newview/llfloaterimcontainer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 09d83e2a8f..82563b8736 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -1124,16 +1124,23 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata) //Enable Chat history item for ad-hoc and group conversations if ("can_chat_history" == item) { - if (getCurSelectedViewModelItem()->getType() != LLConversationItem::CONV_PARTICIPANT) + if(getCurSelectedViewModelItem()) { - return isConversationLoggingAllowed(); + if (getCurSelectedViewModelItem()->getType() != LLConversationItem::CONV_PARTICIPANT) + { + return isConversationLoggingAllowed(); + } } } // If nothing is selected(and selected item is not group chat), everything needs to be disabled if (uuids.size() <= 0) { - return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP; + if(getCurSelectedViewModelItem()) + { + return getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP; + } + return false; } if("can_activate_group" == item) -- cgit v1.2.3 From df5378cf38b0e8325ae41be8af772e30cb815dd4 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Tue, 8 Jan 2013 19:59:27 +0200 Subject: CHUI-611 Fixed! Text in torn off message panel not wrapping correctly with size of conversation panel --- indra/newview/llfloaterimcontainer.cpp | 2 +- .../skins/default/xui/en/floater_im_container.xml | 30 ++++++---------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 82563b8736..38528f18f0 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -162,7 +162,7 @@ BOOL LLFloaterIMContainer::postBuild() setTabContainer(getChild("im_box_tab_container")); mStubPanel = getChild("stub_panel"); - mStubTextBox = getChild("stub_textbox_2"); + mStubTextBox = getChild("stub_textbox"); mStubTextBox->setURLClickedCallback(boost::bind(&LLFloaterIMContainer::returnFloaterToHost, this)); mConversationsStack = getChild("conversations_stack"); diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml index 951665552f..12c1676127 100644 --- a/indra/newview/skins/default/xui/en/floater_im_container.xml +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -161,32 +161,18 @@ - This conversation is in a separate window. - - - [secondlife:/// Bring it back.] - + This conversation is in a separate window. [secondlife:/// Bring it back.] + -- cgit v1.2.3 From 974720373d608a8cbcd3cd26c125b6487b5926a2 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 8 Jan 2013 12:21:47 -0800 Subject: CHUI-660: Problem: Upon auto-existing DND mode upon startup, the notification form elements (buttonts) were added to the form. But then deserialized form elements were also being added to the form causing duplicate buttons. As a solution, only add on the deserialized form elements that exceed the amount in the template. --- indra/llui/llnotifications.cpp | 18 ++- indra/llui/llnotifications.h | 1 + indra/newview/lltoastnotifypanel.cpp | 300 +++++++++++++++++------------------ 3 files changed, 168 insertions(+), 151 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 386345177d..ebdb4d5024 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -320,6 +320,11 @@ void LLNotificationForm::addElement(const std::string& type, const std::string& mFormData.append(element); } +void LLNotificationForm::addElement(const LLSD& element) +{ + mFormData.append(element); +} + void LLNotificationForm::append(const LLSD& sub_form) { if (sub_form.isArray()) @@ -818,7 +823,18 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); - mForm->append(form_elements); + + //Prevents appending elements(buttons) that the template already had + if(form_elements.isArray() + && mForm->getNumElements() < form_elements.size()) + { + LLSD::array_const_iterator it = form_elements.beginArray() + mForm->getNumElements();; + + for(; it != form_elements.endArray(); ++it) + { + mForm->addElement(*it); + } + } // apply substitution to form labels mForm->formatElements(mSubstitutions); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 092a9acd7c..96e0a86b7f 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -246,6 +246,7 @@ public: bool getElementEnabled(const std::string& element_name) const; void setElementEnabled(const std::string& element_name, bool enabled); void addElement(const std::string& type, const std::string& name, const LLSD& value = LLSD(), bool enabled = true); + void addElement(const LLSD &element); void formatElements(const LLSD& substitutions); // appends form elements from another form serialized as LLSD void append(const LLSD& sub_form); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 844d7314d9..d494d12903 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -343,156 +343,156 @@ void LLToastNotifyPanel::onClickButton(void* data) void LLToastNotifyPanel::init( LLRect rect, bool show_images ) { - deleteAllChildren(); - - mTextBox = NULL; - mInfoPanel = NULL; - mControlPanel = NULL; - mNumOptions = 0; - mNumButtons = 0; - mAddedDefaultBtn = false; - - buildFromFile( "panel_notification.xml"); - if(rect != LLRect::null) - { - this->setShape(rect); - } - mInfoPanel = getChild("info_panel"); - mInfoPanel->setFollowsAll(); - - mControlPanel = getChild("control_panel"); - BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); - // customize panel's attributes - // is it intended for displaying a tip? - mIsTip = mNotification->getType() == "notifytip"; - // is it a script dialog? - mIsScriptDialog = (mNotification->getName() == "ScriptDialog" || mNotification->getName() == "ScriptDialogGroup"); - // is it a caution? - // - // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the - // notify xml template specifies that it is a caution - // tip-style notification handle 'caution' differently -they display the tip in a different color - mIsCaution = mNotification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; - - // setup parameters - // get a notification message - mMessage = mNotification->getMessage(); - // init font variables - if (!sFont) -{ - sFont = LLFontGL::getFontSansSerif(); - sFontSmall = LLFontGL::getFontSansSerifSmall(); -} - // initialize - setFocusRoot(!mIsTip); - // get a form for the notification - LLNotificationFormPtr form(mNotification->getForm()); - // get number of elements - mNumOptions = form->getNumElements(); - - // customize panel's outfit - // preliminary adjust panel's layout - //move to the end - //mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form); - - // adjust text options according to the notification type - // add a caution textbox at the top of a caution notification - if (mIsCaution && !mIsTip) - { - mTextBox = getChild("caution_text_box"); - } - else - { - mTextBox = getChild("text_editor_box"); - } - - mTextBox->setMaxTextLength(MAX_LENGTH); - mTextBox->setVisible(TRUE); - mTextBox->setPlainText(!show_images); - mTextBox->setValue(mNotification->getMessage()); - - // add buttons for a script notification - if (mIsTip) - { - adjustPanelForTipNotice(); - } - else -{ - std::vector buttons; - buttons.reserve(mNumOptions); - S32 buttons_width = 0; - // create all buttons and accumulate they total width to reshape mControlPanel - for (S32 i = 0; i < mNumOptions; i++) - { - LLSD form_element = form->getElement(i); - if (form_element["type"].asString() != "button") - { - // not a button. - continue; - } - if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) - { - // a textbox pretending to be a button. - continue; - } - LLButton* new_button = createButton(form_element, TRUE); - buttons_width += new_button->getRect().getWidth(); - S32 index = form_element["index"].asInteger(); - buttons.push_back(index_button_pair_t(index,new_button)); -} - if (buttons.empty()) -{ - addDefaultButton(); - } - else - { - const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel - S32 button_panel_height = mControlPanel->getRect().getHeight(); - //try get an average h_pad to spread out buttons - S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size())); - if(h_pad < 2*HPAD) - { - /* - * Probably it is a scriptdialog toast - * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. - * In last case set default h_pad to avoid heaping of buttons - */ - S32 button_per_row = button_panel_width / BUTTON_WIDTH; - h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row - if(h_pad < 2*HPAD) // still not enough space between buttons ? - { - h_pad = 2*HPAD; - } -} - if (mIsScriptDialog) -{ - // we are using default width for script buttons so we can determinate button_rows - //to get a number of rows we divide the required width of the buttons to button_panel_width - S32 button_rows = llceil(F32(buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width); - //S32 button_rows = (buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width; - //reserve one row for the ignore_btn - button_rows++; - //calculate required panel height for scripdialog notification. - button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD; - } - else - { - // in common case buttons can have different widths so we need to calculate button_rows according to buttons_width - //S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width); - S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width); - //calculate required panel height - button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD; -} - - // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed - adjustPanelForScriptNotice(button_panel_width, button_panel_height); - updateButtonsLayout(buttons, h_pad); - // save buttons for later use in disableButtons() - //mButtons.assign(buttons.begin(), buttons.end()); - } - } - // adjust panel's height to the text size - snapToMessageHeight(mTextBox, MAX_LENGTH); + deleteAllChildren(); + + mTextBox = NULL; + mInfoPanel = NULL; + mControlPanel = NULL; + mNumOptions = 0; + mNumButtons = 0; + mAddedDefaultBtn = false; + + buildFromFile( "panel_notification.xml"); + if(rect != LLRect::null) + { + this->setShape(rect); + } + mInfoPanel = getChild("info_panel"); + mInfoPanel->setFollowsAll(); + + mControlPanel = getChild("control_panel"); + BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); + // customize panel's attributes + // is it intended for displaying a tip? + mIsTip = mNotification->getType() == "notifytip"; + // is it a script dialog? + mIsScriptDialog = (mNotification->getName() == "ScriptDialog" || mNotification->getName() == "ScriptDialogGroup"); + // is it a caution? + // + // caution flag can be set explicitly by specifying it in the notification payload, or it can be set implicitly if the + // notify xml template specifies that it is a caution + // tip-style notification handle 'caution' differently -they display the tip in a different color + mIsCaution = mNotification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; + + // setup parameters + // get a notification message + mMessage = mNotification->getMessage(); + // init font variables + if (!sFont) + { + sFont = LLFontGL::getFontSansSerif(); + sFontSmall = LLFontGL::getFontSansSerifSmall(); + } + // initialize + setFocusRoot(!mIsTip); + // get a form for the notification + LLNotificationFormPtr form(mNotification->getForm()); + // get number of elements + mNumOptions = form->getNumElements(); + + // customize panel's outfit + // preliminary adjust panel's layout + //move to the end + //mIsTip ? adjustPanelForTipNotice() : adjustPanelForScriptNotice(form); + + // adjust text options according to the notification type + // add a caution textbox at the top of a caution notification + if (mIsCaution && !mIsTip) + { + mTextBox = getChild("caution_text_box"); + } + else + { + mTextBox = getChild("text_editor_box"); + } + + mTextBox->setMaxTextLength(MAX_LENGTH); + mTextBox->setVisible(TRUE); + mTextBox->setPlainText(!show_images); + mTextBox->setValue(mNotification->getMessage()); + + // add buttons for a script notification + if (mIsTip) + { + adjustPanelForTipNotice(); + } + else + { + std::vector buttons; + buttons.reserve(mNumOptions); + S32 buttons_width = 0; + // create all buttons and accumulate they total width to reshape mControlPanel + for (S32 i = 0; i < mNumOptions; i++) + { + LLSD form_element = form->getElement(i); + if (form_element["type"].asString() != "button") + { + // not a button. + continue; + } + if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN) + { + // a textbox pretending to be a button. + continue; + } + LLButton* new_button = createButton(form_element, TRUE); + buttons_width += new_button->getRect().getWidth(); + S32 index = form_element["index"].asInteger(); + buttons.push_back(index_button_pair_t(index,new_button)); + } + if (buttons.empty()) + { + addDefaultButton(); + } + else + { + const S32 button_panel_width = mControlPanel->getRect().getWidth();// do not change width of the panel + S32 button_panel_height = mControlPanel->getRect().getHeight(); + //try get an average h_pad to spread out buttons + S32 h_pad = (button_panel_width - buttons_width) / (S32(buttons.size())); + if(h_pad < 2*HPAD) + { + /* + * Probably it is a scriptdialog toast + * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. + * In last case set default h_pad to avoid heaping of buttons + */ + S32 button_per_row = button_panel_width / BUTTON_WIDTH; + h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row + if(h_pad < 2*HPAD) // still not enough space between buttons ? + { + h_pad = 2*HPAD; + } + } + if (mIsScriptDialog) + { + // we are using default width for script buttons so we can determinate button_rows + //to get a number of rows we divide the required width of the buttons to button_panel_width + S32 button_rows = llceil(F32(buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width); + //S32 button_rows = (buttons.size() - 1) * (BUTTON_WIDTH + h_pad) / button_panel_width; + //reserve one row for the ignore_btn + button_rows++; + //calculate required panel height for scripdialog notification. + button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD; + } + else + { + // in common case buttons can have different widths so we need to calculate button_rows according to buttons_width + //S32 button_rows = llceil(F32(buttons.size()) * (buttons_width + h_pad) / button_panel_width); + S32 button_rows = llceil(F32((buttons.size() - 1) * h_pad + buttons_width) / button_panel_width); + //calculate required panel height + button_panel_height = button_rows * (BTN_HEIGHT + VPAD) + BOTTOM_PAD; + } + + // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed + adjustPanelForScriptNotice(button_panel_width, button_panel_height); + updateButtonsLayout(buttons, h_pad); + // save buttons for later use in disableButtons() + //mButtons.assign(buttons.begin(), buttons.end()); + } + } + // adjust panel's height to the text size + snapToMessageHeight(mTextBox, MAX_LENGTH); } -- cgit v1.2.3 From 856969285e027def5acba6c252dc65a242349d4f Mon Sep 17 00:00:00 2001 From: "maxim@mnikolenko" Date: Thu, 10 Jan 2013 14:56:33 +0200 Subject: CHUI-658 FIXED Don't highlight whole content of the folder after right clicking if it is flashing. --- indra/llui/llfolderviewitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 42e5a6debf..ad18adddd5 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -736,7 +736,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo getRect().getWidth() - 2, 0, focusOutlineColor, FALSE); - if (showContent) + if (showContent && !isFlashing()) { gl_rect_2d(FOCUS_LEFT, focus_bottom + 1, -- cgit v1.2.3 From def252341a8c1675405404a6588749d06fa40791 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 8 Jan 2013 23:37:29 +0200 Subject: CHUI-612 FIXED Blank conversation names showing in conversation list --- indra/newview/llconversationmodel.cpp | 129 +++++++++++++++++++++------------ indra/newview/llconversationmodel.h | 20 +++-- indra/newview/llfloaterimcontainer.cpp | 9 ++- 3 files changed, 102 insertions(+), 56 deletions(-) diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0243fb1c97..a8da4908ce 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -47,7 +47,8 @@ LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& u mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -58,7 +59,8 @@ LLConversationItem::LLConversationItem(const LLUUID& uuid, LLFolderViewModelInte mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } @@ -69,10 +71,21 @@ LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_mod mNeedsRefresh(true), mConvType(CONV_UNKNOWN), mLastActiveTime(0.0), - mDisplayModeratorOptions(false) + mDisplayModeratorOptions(false), + mAvatarNameCacheConnection() { } +LLConversationItem::~LLConversationItem() +{ + // Disconnect any previous avatar name cache connection to ensure + // that the callback method is not called after destruction + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } +} + void LLConversationItem::postEvent(const std::string& event_type, LLConversationItemSession* session, LLConversationItemParticipant* participant) { LLUUID session_id = (session ? session->getUUID() : LLUUID()); @@ -142,6 +155,37 @@ void LLConversationItem::buildParticipantMenuOptions(menuentry_vec_t& items, U32 } } +// method does subscription to changes in avatar name cache for current session/participant conversation item. +void LLConversationItem::fetchAvatarName(bool isParticipant /*= true*/) +{ + LLUUID item_id = getUUID(); + + // item should not be null for participants + if (isParticipant) + { + llassert(item_id.notNull()); + } + + // disconnect any previous avatar name cache connection + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + // exclude nearby chat item + if (item_id.notNull()) + { + // for P2P session item, override it as item of called agent + if (CONV_SESSION_1_ON_1 == getType()) + { + item_id = LLIMModel::getInstance()->getOtherParticipantID(item_id); + } + + // subscribe on avatar name cache changes for participant and session items + mAvatarNameCacheConnection = LLAvatarNameCache::get(item_id, boost::bind(&LLConversationItem::onAvatarNameCache, this, _2)); + } +} + // // LLConversationItemSession // @@ -169,11 +213,11 @@ void LLConversationItemSession::addParticipant(LLConversationItemParticipant* pa addChild(participant); mIsLoaded = true; mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("add_participant", this, participant); } -void LLConversationItemSession::updateParticipantName(LLConversationItemParticipant* participant) +void LLConversationItemSession::updateName(LLConversationItemParticipant* participant) { EConversationType conversation_type = getType(); // We modify the session name only in the case of an ad-hoc session or P2P session, exit otherwise (nothing to do) @@ -181,11 +225,13 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip { return; } + // Avoid changing the default name if no participant present yet if (mChildren.size() == 0) { return; } + uuid_vec_t temp_uuids; // uuids vector for building the added participants' names string if (conversation_type == CONV_SESSION_AD_HOC) { @@ -210,12 +256,14 @@ void LLConversationItemSession::updateParticipantName(LLConversationItemParticip } else if (conversation_type == CONV_SESSION_1_ON_1) { - // In the case of a P2P conversersation, we need to grab the name of the other participant in the session instance itself + // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself // as we do not create participants for such a session. - LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(mUUID); - LLUUID participantID = conversationFloater->getOtherParticipantUUID(); - temp_uuids.push_back(participantID); + if (gAgentID != participant->getUUID()) + { + temp_uuids.push_back(participant->getUUID()); + } } + if (temp_uuids.size() != 0) { std::string new_session_name; @@ -229,7 +277,7 @@ void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* { removeChild(participant); mNeedsRefresh = true; - updateParticipantName(participant); + updateName(participant); postEvent("remove_participant", this, participant); } @@ -393,6 +441,18 @@ void LLConversationItemSession::dumpDebugData(bool dump_children) } } +// should be invoked only for P2P sessions +void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name) +{ + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + renameItem(av_name.getDisplayName()); + postEvent("update_session", this, NULL); +} + // // LLConversationItemParticipant // @@ -401,8 +461,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display LLConversationItem(display_name,uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mDisplayName = display_name; mConvType = CONV_PARTICIPANT; @@ -412,38 +471,12 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLConversationItem(uuid,root_view_model), mIsMuted(false), mIsModerator(false), - mDistToAgent(-1.0), - mAvatarNameCacheConnection() + mDistToAgent(-1.0) { mConvType = CONV_PARTICIPANT; } -LLConversationItemParticipant::~LLConversationItemParticipant() -{ - // Disconnect any previous avatar name cache connection to ensure - // that the callback method is not called after destruction - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } -} - -void LLConversationItemParticipant::fetchAvatarName() -{ - // Request the avatar name from the cache - llassert(getUUID().notNull()); - if (getUUID().notNull()) - { - // Disconnect any previous avatar name cache connection - if (mAvatarNameCacheConnection.connected()) - { - mAvatarNameCacheConnection.disconnect(); - } - mAvatarNameCacheConnection = LLAvatarNameCache::get(getUUID(), boost::bind(&LLConversationItemParticipant::onAvatarNameCache, this, _2)); - } -} - -void LLConversationItemParticipant::updateAvatarName() +void LLConversationItemParticipant::updateName() { llassert(getUUID().notNull()); if (getUUID().notNull()) @@ -451,29 +484,33 @@ void LLConversationItemParticipant::updateAvatarName() LLAvatarName av_name; if (LLAvatarNameCache::get(getUUID(),&av_name)) { - updateAvatarName(av_name); + updateName(av_name); } } } void LLConversationItemParticipant::onAvatarNameCache(const LLAvatarName& av_name) { - mAvatarNameCacheConnection.disconnect(); - updateAvatarName(av_name); + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + + updateName(av_name); } -void LLConversationItemParticipant::updateAvatarName(const LLAvatarName& av_name) +void LLConversationItemParticipant::updateName(const LLAvatarName& av_name) { mName = av_name.getUserName(); mDisplayName = av_name.getDisplayName(); - mNeedsRefresh = true; + renameItem(mDisplayName); if (mParent != NULL) { LLConversationItemSession* parent_session = dynamic_cast(mParent); if (parent_session != NULL) { parent_session->requestSort(); - parent_session->updateParticipantName(this); + parent_session->updateName(this); postEvent("update_participant", parent_session, this); } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 01b3850f5e..6aaea041e4 100755 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -64,7 +64,7 @@ public: LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItem(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItem(LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItem() {} + virtual ~LLConversationItem(); // Stub those things we won't really be using in this conversation context virtual const std::string& getName() const { return mName; } @@ -132,27 +132,31 @@ public: void buildParticipantMenuOptions(menuentry_vec_t& items, U32 flags); + void fetchAvatarName(bool isParticipant = true); // fetch and update the avatar name + protected: + virtual void onAvatarNameCache(const LLAvatarName& av_name) {} + std::string mName; // Name of the session or the participant LLUUID mUUID; // UUID of the session or the participant EConversationType mConvType; // Type of conversation item bool mNeedsRefresh; // Flag signaling to the view that something changed for this item F64 mLastActiveTime; bool mDisplayModeratorOptions; -}; + boost::signals2::connection mAvatarNameCacheConnection; +}; class LLConversationItemSession : public LLConversationItem { public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemSession() {} /*virtual*/ bool hasChildren() const; LLPointer getIcon() const { return NULL; } void setSessionID(const LLUUID& session_id) { mUUID = session_id; mNeedsRefresh = true; } void addParticipant(LLConversationItemParticipant* participant); - void updateParticipantName(LLConversationItemParticipant* participant); + void updateName(LLConversationItemParticipant* participant); void removeParticipant(LLConversationItemParticipant* participant); void removeParticipant(const LLUUID& participant_id); void clearParticipants(); @@ -172,6 +176,8 @@ public: void dumpDebugData(bool dump_children = false); private: + /*virtual*/ void onAvatarNameCache(const LLAvatarName& av_name); + bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; @@ -180,7 +186,6 @@ class LLConversationItemParticipant : public LLConversationItem public: LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); - virtual ~LLConversationItemParticipant(); virtual const std::string& getDisplayName() const { return mDisplayName; } @@ -195,8 +200,7 @@ public: virtual const bool getDistanceToAgent(F64& dist) const { dist = mDistToAgent; return (dist >= 0.0); } - void fetchAvatarName(); // fetch and update the avatar name - void updateAvatarName(); // get from the cache (do *not* fetch) and update the avatar name + void updateName(); // get from the cache (do *not* fetch) and update the avatar name LLConversationItemSession* getParentSession(); void dumpDebugData(); @@ -204,7 +208,7 @@ public: private: void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName - void updateAvatarName(const LLAvatarName& av_name); + void updateName(const LLAvatarName& av_name); bool mIsMuted; // default is false bool mIsModerator; // default is false diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 38528f18f0..a599fb51e1 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -380,7 +380,7 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() { LLConversationItemParticipant* participant_model = dynamic_cast(*current_participant_model); // Get the avatar name for this participant id from the cache and update the model - participant_model->updateAvatarName(); + participant_model->updateName(); // Next participant current_participant_model++; } @@ -1390,7 +1390,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& return NULL; } item->renameItem(display_name); - item->updateParticipantName(NULL); + item->updateName(NULL); mConversationsItems[uuid] = item; @@ -1419,6 +1419,11 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& } } + if (uuid.notNull() && im_sessionp->isP2PSessionType()) + { + item->fetchAvatarName(false); + } + // Do that too for the conversation dialog LLFloaterIMSessionTab *conversation_floater = (uuid.isNull() ? (LLFloaterIMSessionTab*)(LLFloaterReg::findTypedInstance("nearby_chat")) : (LLFloaterIMSessionTab*)(LLFloaterIMSession::findInstance(uuid))); if (conversation_floater) -- cgit v1.2.3 From b5172de28fd6bb8a833cf93180d2d43dd9d4a073 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 8 Jan 2013 17:06:49 -0800 Subject: CHUI-660: Post code review changes --- indra/llui/llnotifications.cpp | 51 +++++++++++++--------- indra/llui/llnotifications.h | 4 +- .../newview/lldonotdisturbnotificationstorage.cpp | 2 +- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ebdb4d5024..a5492b46f7 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -279,6 +279,18 @@ bool LLNotificationForm::hasElement(const std::string& element_name) const return false; } +void LLNotificationForm::getElements(LLSD& elements, S32 offset) +{ + //Finds elements that the template did not add + LLSD::array_const_iterator it = mFormData.beginArray() + offset; + + //Keeps track of only the dynamic elements + for(; it != mFormData.endArray(); ++it) + { + elements.append(*it); + } +} + bool LLNotificationForm::getElementEnabled(const std::string& element_name) const { for (LLSD::array_const_iterator it = mFormData.beginArray(); @@ -320,11 +332,6 @@ void LLNotificationForm::addElement(const std::string& type, const std::string& mFormData.append(element); } -void LLNotificationForm::addElement(const LLSD& element) -{ - mFormData.append(element); -} - void LLNotificationForm::append(const LLSD& sub_form) { if (sub_form.isArray()) @@ -508,21 +515,36 @@ LLNotification::LLNotification(const LLSDParamAdapter& p) : } -LLSD LLNotification::asLLSD() +LLSD LLNotification::asLLSD(bool excludeTemplateElements) { LLParamSDParser parser; Params p; p.id = mId; p.name = mTemplatep->mName; - p.form_elements = getForm()->asLLSD(); - p.substitutions = mSubstitutions; p.payload = mPayload; p.time_stamp = mTimestamp; p.expiry = mExpiresAt; p.priority = mPriority; + LLNotificationFormPtr templateForm = mTemplatep->mForm; + LLSD formElements = mForm->asLLSD(); + + //All form elements (dynamic or not) + if(!excludeTemplateElements) + { + p.form_elements = formElements; + } + //Only dynamic form elements (exclude template elements) + else if(templateForm->getNumElements() < formElements.size()) + { + LLSD dynamicElements; + //Offset to dynamic elements and store them + mForm->getElements(dynamicElements, templateForm->getNumElements()); + p.form_elements = dynamicElements; + } + if(mResponder) { p.functor.responder_sd = mResponder->asLLSD(); @@ -823,18 +845,7 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele //mSubstitutions["_ARGS"] = get_all_arguments_as_text(mSubstitutions); mForm = LLNotificationFormPtr(new LLNotificationForm(*mTemplatep->mForm)); - - //Prevents appending elements(buttons) that the template already had - if(form_elements.isArray() - && mForm->getNumElements() < form_elements.size()) - { - LLSD::array_const_iterator it = form_elements.beginArray() + mForm->getNumElements();; - - for(; it != form_elements.endArray(); ++it) - { - mForm->addElement(*it); - } - } + mForm->append(form_elements); // apply substitution to form labels mForm->formatElements(mSubstitutions); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 96e0a86b7f..236c2a42d1 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -242,11 +242,11 @@ public: S32 getNumElements() { return mFormData.size(); } LLSD getElement(S32 index) { return mFormData.get(index); } LLSD getElement(const std::string& element_name); + void getElements(LLSD& elements, S32 offset = 0); bool hasElement(const std::string& element_name) const; bool getElementEnabled(const std::string& element_name) const; void setElementEnabled(const std::string& element_name, bool enabled); void addElement(const std::string& type, const std::string& name, const LLSD& value = LLSD(), bool enabled = true); - void addElement(const LLSD &element); void formatElements(const LLSD& substitutions); // appends form elements from another form serialized as LLSD void append(const LLSD& sub_form); @@ -457,7 +457,7 @@ public: // ["time"] = time at which notification was generated; // ["expiry"] = time at which notification expires; // ["responseFunctor"] = name of registered functor that handles responses to notification; - LLSD asLLSD(); + LLSD asLLSD(bool excludeTemplateElements = false); const LLNotificationFormPtr getForm(); void updateForm(const LLNotificationFormPtr& form); diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 9bb2f27a46..ac41a3804f 100644 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -77,7 +77,7 @@ void LLDoNotDisturbNotificationStorage::saveNotifications() if (!notificationPtr->isRespondedTo() && !notificationPtr->isCancelled() && !notificationPtr->isExpired()) { - data.append(notificationPtr->asLLSD()); + data.append(notificationPtr->asLLSD(true)); } } -- cgit v1.2.3 From 4ef1181cdcb03a08fbce8d774cd85ef914bef8f3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 8 Jan 2013 21:46:00 -0800 Subject: CHUI-659 : Fixed : Reimplemented open selection on hitting return the right way --- indra/llui/llfolderview.cpp | 86 -------------------------------------- indra/llui/llfolderview.h | 4 -- indra/llui/llfolderviewmodel.h | 2 +- indra/newview/llinventorypanel.cpp | 20 ++++++++- indra/newview/llinventorypanel.h | 1 + 5 files changed, 20 insertions(+), 93 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 7ae79d94fe..324142f6c3 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -275,17 +275,6 @@ BOOL LLFolderView::canFocusChildren() const void LLFolderView::addFolder( LLFolderViewFolder* folder) { LLFolderViewFolder::addFolder(folder); - - // TODO RN: enforce sort order of My Inventory followed by Library - //mFolders.remove(folder); - //if (((LLFolderViewModelItemInventory*)folder->getViewModelItem())->getUUID() == gInventory.getLibraryRootFolderID()) - //{ - // mFolders.push_back(folder); - //} - //else - //{ - // mFolders.insert(mFolders.begin(), folder); - //} } void LLFolderView::closeAllFolders() @@ -793,76 +782,6 @@ void LLFolderView::removeSelectedItems() } } -// TODO RN: abstract -// open the selected item. -void LLFolderView::openSelectedItems( void ) -{ - //TODO RN: get working again - //if(getVisible() && getEnabled()) - //{ - // if (mSelectedItems.size() == 1) - // { - // mSelectedItems.front()->openItem(); - // } - // else - // { - // LLMultiPreview* multi_previewp = new LLMultiPreview(); - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // // IT_{OBJECT,ATTACHMENT} creates LLProperties - // // floaters; others create LLPreviews. Put - // // each one in the right type of container. - // LLFolderViewModelItemInventory* listener = static_cast((*item_it)->getViewModelItem()); - // bool is_prop = listener && (listener->getInventoryType() == LLInventoryType::IT_OBJECT || listener->getInventoryType() == LLInventoryType::IT_ATTACHMENT); - // if (is_prop) - // LLFloater::setFloaterHost(multi_propertiesp); - // else - // LLFloater::setFloaterHost(multi_previewp); - // listener->openItem(); - // } - - // LLFloater::setFloaterHost(NULL); - // // *NOTE: LLMulti* will safely auto-delete when open'd - // // without any children. - // multi_previewp->openFloater(LLSD()); - // multi_propertiesp->openFloater(LLSD()); - // } - //} - } - -void LLFolderView::propertiesSelectedItems( void ) -{ - //TODO RN: get working again - //if(getVisible() && getEnabled()) - //{ - // if (mSelectedItems.size() == 1) - // { - // LLFolderViewItem* folder_item = mSelectedItems.front(); - // if(!folder_item) return; - // folder_item->getViewModelItem()->showProperties(); - // } - // else - // { - // LLMultiProperties* multi_propertiesp = new LLMultiProperties(); - - // LLFloater::setFloaterHost(multi_propertiesp); - - // selected_items_t::iterator item_it; - // for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) - // { - // (*item_it)->getViewModelItem()->showProperties(); - // } - - // LLFloater::setFloaterHost(NULL); - // multi_propertiesp->openFloater(LLSD()); - // } - //} - } - - void LLFolderView::autoOpenItem( LLFolderViewFolder* item ) { if ((mAutoOpenItems.check() == item) || @@ -1151,11 +1070,6 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) mSearchString.clear(); handled = TRUE; } - else - { - LLFolderView::openSelectedItems(); - handled = TRUE; - } } break; diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 2ee7417240..a6e0a3b4c0 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -163,10 +163,6 @@ public: // Deletion functionality void removeSelectedItems(); - // Open the selected item - void openSelectedItems( void ); - void propertiesSelectedItems( void ); - void autoOpenItem(LLFolderViewFolder* item); void closeAutoOpenedFolders(); BOOL autoOpenTest(LLFolderViewFolder* item); diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 5837052565..1b61212c0e 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -127,7 +127,7 @@ public: virtual bool startDrag(std::vector& items) = 0; }; -// This is am abstract base class that users of the folderview classes +// This is an abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data class LLFolderViewModelItem : public LLRefCount { diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 81e7f166e1..25dc365467 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -684,8 +684,9 @@ void LLInventoryPanel::initializeViews() } else { - buildNewViews(gInventory.getRootFolderID()); - buildNewViews(gInventory.getLibraryRootFolderID()); + // Default case: always add "My Inventory" first, "Library" second + buildNewViews(gInventory.getRootFolderID()); // My Inventory + buildNewViews(gInventory.getLibraryRootFolderID()); // Library } gIdleCallbacks.addFunction(idle, this); @@ -1354,6 +1355,21 @@ void LLInventoryPanel::doToSelected(const LLSD& userdata) return; } +BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + switch (key) + { + case KEY_RETURN: + // Open selected items if enter key hit on the inventory panel + if (mask == MASK_NONE) + { + LLInventoryAction::doToSelected(mInventory, mFolderRoot, "open"); + handled = TRUE; + } + } + return handled; +} /************************************************************************/ /* Recent Inventory Panel related class */ diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 9639086c11..6eb85fbad2 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -143,6 +143,7 @@ public: // LLView methods void draw(); + /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, -- cgit v1.2.3 From 3cf2d8e9eac215024bc216958b0920e61aa25de1 Mon Sep 17 00:00:00 2001 From: maximbproductengine Date: Wed, 9 Jan 2013 10:41:09 +0200 Subject: CHUI-665 (Change "Open conversation log" to "Conversation log..." in communication floater view/sort menu) --- indra/newview/skins/default/xui/en/menu_participant_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/menu_participant_view.xml b/indra/newview/skins/default/xui/en/menu_participant_view.xml index 33d7bd7c01..2f2bafb95d 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_view.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_view.xml @@ -76,7 +76,7 @@ parameter="privacy_preferences" /> Date: Wed, 9 Jan 2013 15:08:58 +0200 Subject: CHUI-638 FIXED Don't force button and widget to flash if the object is muted. --- indra/newview/llimview.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0011f54175..0326235d37 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -225,12 +225,17 @@ void on_new_message(const LLSD& msg) //User is not focused on conversation containing the message if(session_floater_not_focused) { - im_box->flashConversationItemWidget(session_id, true); - + if(!LLMuteList::getInstance()->isMuted(participant_id)) + { + im_box->flashConversationItemWidget(session_id, true); + } //The conversation floater isn't focused/open if(conversation_floater_not_focused) { - gToolBarView->flashCommand(LLCommandId("chat"), true); + if(!LLMuteList::getInstance()->isMuted(participant_id)) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } //Show IM toasts (upper right toasts) // Skip toasting for system messages and for nearby chat -- cgit v1.2.3 From 9d70bc259a02a0f6dcc6cff1c95a34353e0f1e59 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Jan 2013 12:45:34 -0800 Subject: CHUI-652 : Fixed : Skip the bogus fetching test when adding objects to object content. --- indra/newview/llviewerobject.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 2fe6cd578b..52f73d6c43 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2869,23 +2869,6 @@ void LLViewerObject::updateInventory( U8 key, bool is_new) { - LLMemType mt(LLMemType::MTYPE_OBJECT); - - std::list::iterator begin = mPendingInventoryItemsIDs.begin(); - std::list::iterator end = mPendingInventoryItemsIDs.end(); - - bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end; - bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL; - - if (is_fetched || is_fetching) - { - return; - } - else - { - mPendingInventoryItemsIDs.push_back(item->getAssetUUID()); - } - // This slices the object into what we're concerned about on the // viewer. The simulator will take the permissions and transfer // ownership. -- cgit v1.2.3 From 6a30c4c3c54f3d70d1a10fb76e7c81cd5e36a524 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 9 Jan 2013 13:30:14 -0800 Subject: CHUI-669: Upon DND mode exit, no longer flash IM messages that were stored during DND mode. --- indra/newview/llimview.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 0326235d37..a3c338831c 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -129,11 +129,7 @@ void process_dnd_im(const LLSD& notification) false); //will need slight refactor to retrieve whether offline message or not (assume online for now) } - //For now always flash conversation line item - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); - im_box->flashConversationItemWidget(sessionID, true); - - //And flash toolbar button + //Flash toolbar button for now, eventually the user's preference will be taken into account gToolBarView->flashCommand(LLCommandId("chat"), true); } -- cgit v1.2.3 From 41d5f820ea1859493b7f14d9d81b145a6a3b38b6 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 9 Jan 2013 14:30:10 -0800 Subject: CHUI-670: Prevent flashing of 'Chat' FUI button while in DND mode and receive IM. --- indra/newview/llimview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a3c338831c..067f0d1993 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -228,7 +228,8 @@ void on_new_message(const LLSD& msg) //The conversation floater isn't focused/open if(conversation_floater_not_focused) { - if(!LLMuteList::getInstance()->isMuted(participant_id)) + if(!LLMuteList::getInstance()->isMuted(participant_id) + && !gAgent.isDoNotDisturb()) { gToolBarView->flashCommand(LLCommandId("chat"), true); } -- cgit v1.2.3 From 60eaa8875df45f023c3bf0fb82863b05cb5a090f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Jan 2013 19:10:41 -0800 Subject: CHUI-652 : Fixed : Maintain multi selection consistent when click and drag an already selected item (drag multi select was broken) --- indra/llui/llfolderviewitem.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index b7165f68b7..42e5a6debf 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -506,13 +506,10 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) } make_ui_sound("UISndClick"); } - //Just re-select the item since it is clicked without ctrl or shift - else if(!(mask & (MASK_CONTROL | MASK_SHIFT))) - { - getRoot()->setSelection(this, FALSE); - } else { + // If selected, we reserve the decision of deselecting/reselecting to the mouse up moment. + // This is necessary so we maintain selection consistent when starting a drag. mSelectPending = TRUE; } -- cgit v1.2.3 From be3cfd872be89f30012d66a4b64071e4fe2568cf Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 9 Jan 2013 20:20:32 -0800 Subject: CHUI-649 : WIP : Cleanup code to make it readable --- indra/llui/llfolderviewitem.cpp | 8 ++++---- indra/newview/llinventorybridge.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 42e5a6debf..6d3b883b09 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -409,7 +409,7 @@ void LLFolderViewItem::selectItem(void) BOOL LLFolderViewItem::isMovable() { return getViewModelItem()->isItemMovable(); - } +} BOOL LLFolderViewItem::isRemovable() { @@ -438,19 +438,19 @@ BOOL LLFolderViewItem::remove() return FALSE; } return getViewModelItem()->removeItem(); - } +} // Build an appropriate context menu for the item. void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags) { getViewModelItem()->buildContextMenu(menu, flags); - } +} void LLFolderViewItem::openItem( void ) { if (mAllowOpen) { - getViewModelItem()->openItem(); + getViewModelItem()->openItem(); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cb6290368c..837870ae27 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -511,8 +511,10 @@ BOOL LLInvFVBridge::isClipboardPasteable() const // Each item must be copyable to be pastable LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id); if (!item_br.isItemCopyable()) - return FALSE; - } + { + return FALSE; + } + } return TRUE; } -- cgit v1.2.3 From bad4eda43677d26b88c86f4381c6a0f7436f0daf Mon Sep 17 00:00:00 2001 From: maximbproductengine Date: Thu, 10 Jan 2013 13:41:47 +0200 Subject: CHUI-663 (Right click menus on participants inactive in conversation floater for torn off conversation) --- indra/newview/llfloaterimcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 82563b8736..a21cbf2bb2 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -906,7 +906,7 @@ const LLConversationItem * LLFloaterIMContainer::getCurSelectedViewModelItem() mConversationsRoot->getCurSelectedItem()->getViewModelItem()) { LLFloaterIMSessionTab *selected_session_floater = LLFloaterIMSessionTab::getConversation(mSelectedSession); - if (selected_session_floater && !selected_session_floater->getHost()) + if (selected_session_floater && !selected_session_floater->getHost() && selected_session_floater->getCurSelectedViewModelItem()) { conversation_item = selected_session_floater->getCurSelectedViewModelItem(); } -- cgit v1.2.3 From b5b44ddf175e46379aa20b79b0abedab6bc05e2e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 10 Jan 2013 11:10:41 -0800 Subject: CHUI-649 : Fixed : Added the contextual menu to in build content tab --- indra/newview/llinventorypanel.cpp | 4 ++-- indra/newview/llpanelobjectinventory.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 25dc365467..c4918f0a31 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -181,7 +181,7 @@ LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id ) LLAssetType::AT_CATEGORY, LLInventoryType::IT_CATEGORY, this, - &mInventoryViewModel, + &mInventoryViewModel, NULL, root_id); p.view_model = &mInventoryViewModel; @@ -218,7 +218,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) mFolderRoot = createFolderRoot(root_id); addItemID(root_id, mFolderRoot); -} + } mCommitCallbackRegistrar.popScope(); mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 527aefe821..7555ac7b2c 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1569,6 +1569,8 @@ void LLPanelObjectInventory::reset() p.folder_indentation = -14; // subtract space normally reserved for folder expanders p.view_model = &mInventoryViewModel; p.root = NULL; + p.options_menu = "menu_inventory.xml"; + mFolders = LLUICtrlFactory::create(p); mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); -- cgit v1.2.3