CHUI-282 : WIP : Isolated llconversationview classes and suppressed the dependency of model to widgets
parent
b93e2f7c84
commit
2cf5307c92
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -32,41 +32,22 @@
|
|||
#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
|
||||
|
|
|
|||
|
|
@ -52,8 +52,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,7 +95,7 @@ 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);
|
||||
|
|
@ -114,7 +114,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.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* @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 "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);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* @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"
|
||||
#include "llfolderviewmodel.h"
|
||||
|
||||
class LLButton;
|
||||
class LLFloater;
|
||||
class LLLayoutPanel;
|
||||
class LLLayoutStack;
|
||||
class LLTabContainer;
|
||||
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();
|
||||
};
|
||||
|
||||
#endif // LL_LLCONVERSATIONVIEW_H
|
||||
|
|
@ -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;
|
||||
|
|
@ -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
|
||||
|
|
@ -524,7 +525,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();
|
||||
|
|
@ -534,8 +535,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue