summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llconversationmodel.cpp46
-rw-r--r--indra/newview/llconversationmodel.h19
-rw-r--r--indra/newview/llconversationview.cpp78
-rw-r--r--indra/newview/llconversationview.h58
-rw-r--r--indra/newview/llimfloatercontainer.cpp16
6 files changed, 156 insertions, 63 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9553476aaf..c49c625dbd 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -138,6 +138,7 @@ set(viewer_SOURCE_FILES
llconversationloglist.cpp
llconversationloglistitem.cpp
llconversationmodel.cpp
+ llconversationview.cpp
llcurrencyuimanager.cpp
llcylinder.cpp
lldateutil.cpp
@@ -721,6 +722,7 @@ set(viewer_HEADER_FILES
llconversationloglist.h
llconversationloglistitem.h
llconversationmodel.h
+ llconversationview.h
llcurrencyuimanager.h
llcylinder.h
lldateutil.h
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 0c23e2654e..832dc3c3e4 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -28,57 +28,23 @@
#include "llviewerprecompiledheaders.h"
#include "llconversationmodel.h"
-#include "llimconversation.h"
-#include "llimfloatercontainer.h"
// Conversation items
-LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp) :
- LLFolderViewModelItemCommon(containerp->getRootViewModel()),
+LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
+ LLFolderViewModelItemCommon(root_view_model),
mName(display_name),
- mUUID(uuid),
- mContainer(containerp)
+ mUUID(uuid)
{
}
-LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) :
- LLFolderViewModelItemCommon(containerp->getRootViewModel()),
+LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) :
+ LLFolderViewModelItemCommon(root_view_model),
mName(""),
- mUUID(),
- mContainer(NULL)
+ mUUID()
{
}
-
// Virtual action callbacks
-void LLConversationItem::selectItem(void)
-{
- LLFloater* session_floater = LLIMConversation::getConversation(mUUID);
- LLMultiFloater* host_floater = session_floater->getHost();
-
-// LLIMFloater::show(mUUID);
- if (host_floater == mContainer)
- {
- // Always expand the message pane if the panel is hosted by the container
- mContainer->collapseMessagesPane(false);
- // Switch to the conversation floater that is being selected
- mContainer->selectFloater(session_floater);
- }
- // Set the focus on the selected floater
- session_floater->setFocus(TRUE);
-}
-
-void LLConversationItem::setVisibleIfDetached(BOOL visible)
-{
- // 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
- LLFloater* session_floater = LLIMConversation::getConversation(mUUID);
-
- if (session_floater && !session_floater->getHost() && !session_floater->isMinimized())
- {
- session_floater->setVisible(visible);
- }
-}
-
void LLConversationItem::performAction(LLInventoryModel* model, std::string action)
{
}
diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h
index 56a5b73c15..cb03128cac 100644
--- a/indra/newview/llconversationmodel.h
+++ b/indra/newview/llconversationmodel.h
@@ -27,19 +27,9 @@
#ifndef LL_LLCONVERSATIONMODEL_H
#define LL_LLCONVERSATIONMODEL_H
-//#include <map>
-//#include <vector>
-
#include "llfolderviewitem.h"
#include "llfolderviewmodel.h"
-class LLButton;
-class LLFloater;
-class LLLayoutPanel;
-class LLLayoutStack;
-class LLTabContainer;
-class LLIMFloaterContainer;
-
// Implementation of conversations list
class LLConversationItem;
@@ -52,8 +42,8 @@ typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map;
class LLConversationItem : public LLFolderViewModelItemCommon
{
public:
- LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp);
- LLConversationItem(LLIMFloaterContainer* containerp);
+ LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model);
+ LLConversationItem(LLFolderViewModelInterface& root_view_model);
virtual ~LLConversationItem() {}
// Stub those things we won't really be using in this conversation context
@@ -95,11 +85,9 @@ public:
virtual void openItem( void );
virtual void closeItem( void );
virtual void previewItem( void );
- virtual void selectItem(void);
+ virtual void selectItem(void) { }
virtual void showProperties(void);
- void setVisibleIfDetached(BOOL visible);
-
// This method will be called to determine if a drop can be
// performed, and will set drop to TRUE if a drop is
// requested.
@@ -114,7 +102,6 @@ public:
private:
std::string mName;
const LLUUID mUUID;
- LLIMFloaterContainer* mContainer;
};
// 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/llconversationview.cpp b/indra/newview/llconversationview.cpp
new file mode 100644
index 0000000000..6cc911ecef
--- /dev/null
+++ b/indra/newview/llconversationview.cpp
@@ -0,0 +1,78 @@
+/**
+ * @file llconversationview.cpp
+ * @brief Implementation of conversations list widgets and views
+ *
+ * $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 "llviewerprecompiledheaders.h"
+
+#include "llconversationview.h"
+#include "llconversationmodel.h"
+#include "llimconversation.h"
+#include "llimfloatercontainer.h"
+
+LLConversationViewSession::Params::Params() :
+ container()
+{}
+
+LLConversationViewSession::LLConversationViewSession( const LLConversationViewSession::Params& p ):
+ LLFolderViewFolder(p),
+ mContainer(p.container)
+{
+}
+
+void LLConversationViewSession::selectItem()
+{
+ LLFolderViewItem::selectItem();
+
+ LLConversationItem* item = dynamic_cast<LLConversationItem*>(mViewModelItem);
+ LLFloater* session_floater = LLIMConversation::getConversation(item->getUUID());
+ LLMultiFloater* host_floater = session_floater->getHost();
+
+ if (host_floater == mContainer)
+ {
+ // Always expand the message pane if the panel is hosted by the container
+ mContainer->collapseMessagesPane(false);
+ // Switch to the conversation floater that is being selected
+ mContainer->selectFloater(session_floater);
+ }
+
+ // Set the focus on the selected floater
+ session_floater->setFocus(TRUE);
+}
+
+void LLConversationViewSession::setVisibleIfDetached(BOOL visible)
+{
+ // 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
+ LLConversationItem* item = dynamic_cast<LLConversationItem*>(mViewModelItem);
+ LLFloater* session_floater = LLIMConversation::getConversation(item->getUUID());
+
+ if (session_floater && !session_floater->getHost() && !session_floater->isMinimized())
+ {
+ session_floater->setVisible(visible);
+ }
+}
+
+// EOF
diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h
new file mode 100644
index 0000000000..6a51e719c8
--- /dev/null
+++ b/indra/newview/llconversationview.h
@@ -0,0 +1,58 @@
+/**
+ * @file llconversationview.h
+ * @brief Implementation of conversations list widgets and views
+ *
+ * $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_LLCONVERSATIONVIEW_H
+#define LL_LLCONVERSATIONVIEW_H
+
+#include "llfolderviewitem.h"
+
+class LLIMFloaterContainer;
+
+// Implementation of conversations list widgets
+
+class LLConversationViewSession : public LLFolderViewFolder
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params>
+ {
+ Optional<LLIMFloaterContainer*> container;
+
+ Params();
+ };
+
+protected:
+ friend class LLUICtrlFactory;
+ LLConversationViewSession( const Params& p );
+
+ LLIMFloaterContainer* mContainer;
+
+public:
+ virtual ~LLConversationViewSession( void ) { }
+ virtual void selectItem();
+ void setVisibleIfDetached(BOOL visible);
+};
+
+#endif // LL_LLCONVERSATIONVIEW_H
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 6127a9a19b..35b9f404c3 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -43,6 +43,7 @@
#include "llimview.h"
#include "lltransientfloatermgr.h"
#include "llviewercontrol.h"
+#include "llconversationview.h"
//
// LLIMFloaterContainer
@@ -111,7 +112,7 @@ BOOL LLIMFloaterContainer::postBuild()
mConversationsListPanel = getChild<LLPanel>("conversations_list_panel");
// CHUI-98 : View Model for conversations
- LLConversationItem* base_item = new LLConversationItem(this);
+ LLConversationItem* base_item = new LLConversationItem(getRootViewModel());
LLFolderView::Params p;
p.view_model = &mConversationViewModel;
p.parent_panel = mConversationsListPanel;
@@ -327,10 +328,10 @@ 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)
+ conversations_widgets_map::iterator item_it = mConversationsWidgets.begin();
+ for (;item_it != mConversationsWidgets.end(); ++item_it)
{
- LLConversationItem* item = item_it->second;
+ LLConversationViewSession* item = dynamic_cast<LLConversationViewSession*>(item_it->second);
item->setVisibleIfDetached(visible);
}
@@ -470,7 +471,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid)
removeConversationListItem(uuid,false);
// Create a conversation item
- LLConversationItem* item = new LLConversationItem(display_name, uuid, this);
+ LLConversationItem* item = new LLConversationItem(display_name, uuid, getRootViewModel());
mConversationsItems[uuid] = item;
// Create a widget from it
@@ -523,7 +524,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c
LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item)
{
- LLFolderViewItem::Params params;
+ LLConversationViewSession::Params params;
params.name = item->getDisplayName();
//params.icon = bridge->getIcon();
@@ -533,8 +534,9 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat
params.listener = item;
params.rect = LLRect (0, 0, 0, 0);
params.tool_tip = params.name;
+ params.container = this;
- return LLUICtrlFactory::create<LLFolderViewItem>(params);
+ return LLUICtrlFactory::create<LLConversationViewSession>(params);
}
// EOF