2012-01-07 14:52:58 -05:00
|
|
|
#pragma once
|
|
|
|
|
2013-02-22 16:42:27 -05:00
|
|
|
#include <QTreeWidget>
|
2013-02-24 17:44:14 -05:00
|
|
|
#include <retroshare/rsmsgs.h>
|
2012-01-07 16:01:43 -05:00
|
|
|
#include "ui_ChatLobbyWidget.h"
|
2012-01-07 14:52:58 -05:00
|
|
|
#include "RsAutoUpdatePage.h"
|
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
#define IMAGE_CHATLOBBY ":/images/chat_32.png"
|
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
class RSTreeWidgetItemCompareRole;
|
2013-02-22 16:42:27 -05:00
|
|
|
class ChatTabWidget ;
|
2013-02-24 17:44:14 -05:00
|
|
|
class ChatLobbyDialog ;
|
|
|
|
class QTextBrowser ;
|
2012-01-11 19:13:25 -05:00
|
|
|
|
2013-02-27 17:17:49 -05:00
|
|
|
struct ChatLobbyInfoStruct
|
|
|
|
{
|
|
|
|
QIcon default_icon ;
|
|
|
|
ChatLobbyDialog *dialog ;
|
|
|
|
time_t last_typing_event ;
|
|
|
|
};
|
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
class ChatLobbyWidget : public RsAutoUpdatePage
|
2012-01-07 14:52:58 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
public:
|
|
|
|
/** Default constructor */
|
2013-10-18 17:10:33 -04:00
|
|
|
ChatLobbyWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
2012-01-07 14:52:58 -05:00
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
/** Default destructor */
|
|
|
|
~ChatLobbyWidget();
|
2012-01-07 14:52:58 -05:00
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_CHATLOBBY) ; } //MainPage
|
|
|
|
virtual QString pageName() const { return tr("Chat Lobbies") ; } //MainPage
|
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
virtual void updateDisplay();
|
2012-01-07 14:52:58 -05:00
|
|
|
|
2013-02-24 17:44:14 -05:00
|
|
|
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
|
|
|
|
void addChatPage(ChatLobbyDialog *) ;
|
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
protected slots:
|
|
|
|
void lobbyChanged();
|
2013-02-24 17:44:14 -05:00
|
|
|
void lobbyTreeWidgetCustomPopupMenu(QPoint);
|
2012-01-11 19:13:25 -05:00
|
|
|
void createChatLobby();
|
|
|
|
void subscribeItem();
|
|
|
|
void unsubscribeItem();
|
|
|
|
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
2013-02-24 17:44:14 -05:00
|
|
|
void updateCurrentLobby() ;
|
2012-01-11 19:13:25 -05:00
|
|
|
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str);
|
|
|
|
void readChatLobbyInvites();
|
2013-02-24 17:44:14 -05:00
|
|
|
void showLobby(QTreeWidgetItem *lobby_item) ;
|
|
|
|
void showBlankPage(ChatLobbyId id) ;
|
|
|
|
void unsubscribeChatLobby(ChatLobbyId id) ;
|
|
|
|
void updateTypingStatus(ChatLobbyId id) ;
|
|
|
|
void resetLobbyTreeIcons() ;
|
2013-02-27 17:17:49 -05:00
|
|
|
void updateMessageChanged(ChatLobbyId);
|
|
|
|
void updatePeerEntering(ChatLobbyId);
|
|
|
|
void updatePeerLeaving(ChatLobbyId);
|
2013-09-01 20:08:38 -04:00
|
|
|
void autoSubscribeItem();
|
2012-01-11 19:13:25 -05:00
|
|
|
|
2013-09-01 20:08:38 -04:00
|
|
|
private slots:
|
|
|
|
void filterColumnChanged(int);
|
|
|
|
void filterItems(const QString &text);
|
|
|
|
|
2013-09-19 15:22:17 -04:00
|
|
|
|
|
|
|
void setShowUserCountColumn(bool show);
|
|
|
|
void setShowTopicColumn(bool show);
|
|
|
|
void setShowSubscribeColumn(bool show);
|
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
private:
|
2013-09-01 20:08:38 -04:00
|
|
|
void autoSubscribeLobby(QTreeWidgetItem *item);
|
|
|
|
|
|
|
|
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
2013-06-29 12:15:33 -04:00
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
RSTreeWidgetItemCompareRole *compareRole;
|
|
|
|
QTreeWidgetItem *privateLobbyItem;
|
|
|
|
QTreeWidgetItem *publicLobbyItem;
|
2013-10-11 16:46:25 -04:00
|
|
|
QTreeWidgetItem *privateSubLobbyItem;
|
|
|
|
QTreeWidgetItem *publicSubLobbyItem;
|
2013-02-24 17:44:14 -05:00
|
|
|
QTreeWidgetItem *getTreeWidgetItem(ChatLobbyId);
|
2013-02-22 16:42:27 -05:00
|
|
|
|
|
|
|
ChatTabWidget *tabWidget ;
|
2013-02-24 17:44:14 -05:00
|
|
|
|
2013-02-27 17:17:49 -05:00
|
|
|
std::map<ChatLobbyId,ChatLobbyInfoStruct> _lobby_infos ;
|
2013-02-24 17:44:14 -05:00
|
|
|
|
|
|
|
std::map<QTreeWidgetItem*,time_t> _icon_changed_map ;
|
2013-09-19 15:22:17 -04:00
|
|
|
|
|
|
|
bool m_bProcessSettings;
|
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
|
|
|
/** Defines the actions for the header context menu */
|
|
|
|
QAction* showUserCountAct;
|
2014-05-09 22:38:47 -04:00
|
|
|
QAction* showTopicAct;
|
|
|
|
QAction* showSubscribeAct;
|
|
|
|
int getNumColVisible();
|
|
|
|
|
|
|
|
/* UI - from Designer */
|
|
|
|
Ui::ChatLobbyWidget ui;
|
2012-01-11 19:13:25 -05:00
|
|
|
};
|
2013-02-24 17:44:14 -05:00
|
|
|
|