2012-01-07 14:52:58 -05:00
|
|
|
#pragma once
|
|
|
|
|
2012-01-07 16:01:43 -05:00
|
|
|
#include "ui_ChatLobbyWidget.h"
|
2018-01-05 08:45:29 -05:00
|
|
|
|
2012-01-07 14:52:58 -05:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2015-05-17 06:13:32 -04:00
|
|
|
#include "chat/ChatLobbyUserNotify.h"
|
2018-01-05 08:45:29 -05:00
|
|
|
#include "gui/gxs/GxsIdChooser.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <retroshare/rsmsgs.h>
|
|
|
|
|
|
|
|
#include <QAbstractButton>
|
|
|
|
#include <QTreeWidget>
|
2012-01-07 14:52:58 -05:00
|
|
|
|
2016-08-16 16:02:30 -04:00
|
|
|
#define IMAGE_CHATLOBBY ":/icons/png/chat-lobbies.png"
|
2014-05-09 22:38:47 -04:00
|
|
|
|
2015-03-06 16:13:23 -05:00
|
|
|
#define CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC 1
|
|
|
|
#define CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE 2
|
|
|
|
|
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
|
2017-01-17 11:00:41 -05:00
|
|
|
virtual QString pageName() const { return tr("Chats") ; } //MainPage
|
2014-05-09 22:38:47 -04:00
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
|
|
|
|
2015-05-17 06:13:32 -04:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent); //MainPage
|
2014-12-12 18:50:35 -05:00
|
|
|
|
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 *) ;
|
2015-05-17 06:13:32 -04:00
|
|
|
void showLobbyAnchor(ChatLobbyId id, QString anchor) ;
|
2013-02-24 17:44:14 -05:00
|
|
|
|
2014-12-12 18:50:35 -05:00
|
|
|
uint unreadCount();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void unreadCountChanged(uint unreadCount);
|
|
|
|
|
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() ;
|
2016-02-14 05:53:27 -05:00
|
|
|
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId& gxs_id, const QString& str);
|
2012-01-11 19:13:25 -05:00
|
|
|
void readChatLobbyInvites();
|
2013-02-24 17:44:14 -05:00
|
|
|
void showLobby(QTreeWidgetItem *lobby_item) ;
|
|
|
|
void showBlankPage(ChatLobbyId id) ;
|
2015-03-06 16:13:23 -05:00
|
|
|
void unsubscribeChatLobby(ChatLobbyId id) ;
|
2015-05-17 06:13:32 -04:00
|
|
|
void createIdentityAndSubscribe();
|
2015-03-06 16:13:23 -05:00
|
|
|
void subscribeChatLobbyAs() ;
|
|
|
|
void updateTypingStatus(ChatLobbyId id) ;
|
2013-02-24 17:44:14 -05:00
|
|
|
void resetLobbyTreeIcons() ;
|
2015-05-17 06:13:32 -04:00
|
|
|
void updateMessageChanged(bool incoming, ChatLobbyId, QDateTime time, QString senderName, QString msg);
|
2013-02-27 17:17:49 -05:00
|
|
|
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);
|
|
|
|
|
2015-05-17 06:13:32 -04:00
|
|
|
void updateNotify(ChatLobbyId id, unsigned int count) ;
|
2018-01-05 08:45:29 -05:00
|
|
|
void idChooserCurrentIndexChanged(int index);
|
2015-05-17 06:13:32 -04:00
|
|
|
|
2012-01-11 19:13:25 -05:00
|
|
|
private:
|
2013-09-01 20:08:38 -04:00
|
|
|
void autoSubscribeLobby(QTreeWidgetItem *item);
|
2015-03-06 16:13:23 -05:00
|
|
|
void subscribeChatLobby(ChatLobbyId id) ;
|
|
|
|
void subscribeChatLobbyAtItem(QTreeWidgetItem *item) ;
|
2013-09-01 20:08:38 -04:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2015-05-17 06:13:32 -04:00
|
|
|
ChatLobbyUserNotify* myChatLobbyUserNotify;
|
|
|
|
|
2018-01-05 08:45:29 -05:00
|
|
|
QAbstractButton* myInviteYesButton;
|
|
|
|
GxsIdChooser* myInviteIdChooser;
|
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
/* UI - from Designer */
|
|
|
|
Ui::ChatLobbyWidget ui;
|
2012-01-11 19:13:25 -05:00
|
|
|
};
|
2013-02-24 17:44:14 -05:00
|
|
|
|