mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
Chat lobby:
- added new notifier to p3ChatService GUI: - list all public and private chat lobbies - added subscribe/unsubscribe - added new basic widget ChatTabWidget and use it in PopupChatWindow and ChatLobbyDialog - added a tabbed dialog for every subscribed chat lobby git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4782 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fc949ce5d0
commit
6c626e180f
@ -224,7 +224,7 @@ const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
||||
const int NOTIFY_LIST_GROUPLIST = 16;
|
||||
const int NOTIFY_LIST_CHANNELLIST_LOCKED = 17; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_INVITATION = 18;
|
||||
const int NOTIFY_LIST_PUBLIC_CHAT_LOBBY_LIST = 19;
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_LIST = 19;
|
||||
|
||||
const int NOTIFY_TYPE_SAME = 0x01;
|
||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||
|
@ -666,7 +666,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PUBLIC_CHAT_LOBBY_LIST,0) ;
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
}
|
||||
|
||||
void p3ChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
|
||||
@ -1922,6 +1922,7 @@ bool p3ChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id)
|
||||
#endif
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD);
|
||||
|
||||
// send AKN item
|
||||
sendLobbyStatusNewPeer(lobby_id) ;
|
||||
@ -2009,6 +2010,8 @@ bool p3ChatService::joinPublicChatLobby(const ChatLobbyId& lobby_id)
|
||||
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
invitePeerToLobby(lobby_id,*it) ;
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@ -2047,33 +2050,39 @@ ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const s
|
||||
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
invitePeerToLobby(lobby_id,*it) ;
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
|
||||
return lobby_id ;
|
||||
}
|
||||
|
||||
void p3ChatService::handleFriendUnsubscribeLobby(RsChatLobbyUnsubscribeItem *item)
|
||||
{
|
||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(item->lobby_id) ;
|
||||
{
|
||||
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
|
||||
std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.find(item->lobby_id) ;
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Received unsubscribed to lobby " << std::hex << item->lobby_id << std::dec << ", from friend " << item->PeerId() << std::endl;
|
||||
std::cerr << "Received unsubscribed to lobby " << std::hex << item->lobby_id << std::dec << ", from friend " << item->PeerId() << std::endl;
|
||||
#endif
|
||||
|
||||
if(it == _chat_lobbys.end())
|
||||
{
|
||||
std::cerr << "Chat lobby " << std::hex << item->lobby_id << std::dec << " does not exist ! Can't unsubscribe friend!" << std::endl;
|
||||
return ;
|
||||
if(it == _chat_lobbys.end())
|
||||
{
|
||||
std::cerr << "Chat lobby " << std::hex << item->lobby_id << std::dec << " does not exist ! Can't unsubscribe friend!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
for(std::set<std::string>::iterator it2(it->second.participating_friends.begin());it2!=it->second.participating_friends.end();++it2)
|
||||
if(*it2 == item->PeerId())
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << " removing peer id " << item->PeerId() << " from participant list of lobby " << std::hex << item->lobby_id << std::dec << std::endl;
|
||||
#endif
|
||||
it->second.participating_friends.erase(it2) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
for(std::set<std::string>::iterator it2(it->second.participating_friends.begin());it2!=it->second.participating_friends.end();++it2)
|
||||
if(*it2 == item->PeerId())
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << " removing peer id " << item->PeerId() << " from participant list of lobby " << std::hex << item->lobby_id << std::dec << std::endl;
|
||||
#endif
|
||||
it->second.participating_friends.erase(it2) ;
|
||||
break ;
|
||||
}
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_MOD) ;
|
||||
}
|
||||
|
||||
void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
||||
@ -2117,6 +2126,9 @@ void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
|
||||
|
||||
// done!
|
||||
}
|
||||
bool p3ChatService::setDefaultNickNameForChatLobby(const std::string& nick)
|
||||
@ -2197,5 +2209,3 @@ void p3ChatService::cleanLobbyCaches()
|
||||
// also clean inactive lobbies.
|
||||
// [...]
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,6 +270,7 @@ HEADERS += rshare.h \
|
||||
gui/profile/StatusMessage.h \
|
||||
gui/chat/PopupChatWindow.h \
|
||||
gui/chat/PopupChatDialog.h \
|
||||
gui/chat/ChatTabWidget.h \
|
||||
gui/ChatLobbyWidget.h \
|
||||
gui/chat/ChatLobbyDialog.h \
|
||||
gui/chat/CreateLobbyDialog.h \
|
||||
@ -411,6 +412,7 @@ FORMS += gui/StartDialog.ui \
|
||||
gui/channels/ShareKey.ui \
|
||||
gui/chat/PopupChatWindow.ui \
|
||||
gui/chat/PopupChatDialog.ui \
|
||||
gui/chat/ChatTabWidget.ui \
|
||||
gui/chat/CreateLobbyDialog.ui \
|
||||
gui/ChatLobbyWidget.ui \
|
||||
gui/connect/ConfCertDialog.ui \
|
||||
@ -537,6 +539,7 @@ SOURCES += main.cpp \
|
||||
gui/channels/ShareKey.cpp \
|
||||
gui/chat/PopupChatWindow.cpp \
|
||||
gui/chat/PopupChatDialog.cpp \
|
||||
gui/chat/ChatTabWidget.cpp \
|
||||
gui/ChatLobbyWidget.cpp \
|
||||
gui/chat/ChatLobbyDialog.cpp \
|
||||
gui/chat/CreateLobbyDialog.cpp \
|
||||
|
@ -1,97 +1,377 @@
|
||||
#include <QTableWidget>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <QTreeWidget>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include "ChatLobbyWidget.h"
|
||||
#include "chat/CreateLobbyDialog.h"
|
||||
#include "common/RSTreeWidgetItem.h"
|
||||
#include "notifyqt.h"
|
||||
#include "chat/ChatLobbyDialog.h"
|
||||
|
||||
#define COL_LOBBY_NAME 0
|
||||
#define COL_LOBBY_ID 1
|
||||
#define COL_LOBBY_TYPE 2
|
||||
#define COL_LOBBY_STATE 3
|
||||
#define COL_LOBBY_COUNT 4
|
||||
#include "retroshare/rsmsgs.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsnotify.h"
|
||||
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_USER_COUNT 1
|
||||
#define COLUMN_COUNT 2
|
||||
|
||||
#define COLUMN_DATA 0
|
||||
#define ROLE_SORT Qt::UserRole
|
||||
#define ROLE_ID Qt::UserRole + 1
|
||||
#define ROLE_SUBSCRIBED Qt::UserRole + 2
|
||||
|
||||
#define TYPE_FOLDER 0
|
||||
#define TYPE_LOBBY 1
|
||||
|
||||
#define IMAGE_CREATE ""
|
||||
#define IMAGE_PUBLIC ""
|
||||
#define IMAGE_PRIVATE ""
|
||||
#define IMAGE_SUBSCRIBE ""
|
||||
#define IMAGE_UNSUBSCRIBE ""
|
||||
|
||||
static ChatLobbyWidget *instance = NULL;
|
||||
|
||||
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
||||
: RsAutoUpdatePage(5000,parent)
|
||||
{
|
||||
setupUi(this) ;
|
||||
|
||||
QObject::connect(this,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(doubleClickCell(int,int))) ;
|
||||
setupUi(this);
|
||||
|
||||
_lobby_table_TW->setColumnHidden(1,true) ;
|
||||
updateDisplay() ;
|
||||
if (instance == NULL) {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
QObject::connect(NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
|
||||
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
|
||||
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
|
||||
|
||||
QObject::connect(lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCostumPopupMenu()));
|
||||
QObject::connect(lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
|
||||
QObject::connect(lobbyTabWidget, SIGNAL(infoChanged()), this, SLOT(tabInfoChanged()));
|
||||
|
||||
compareRole = new RSTreeWidgetItemCompareRole;
|
||||
compareRole->setRole(COLUMN_NAME, ROLE_SORT);
|
||||
|
||||
lobbyTreeWidget->setColumnCount(COLUMN_COUNT);
|
||||
lobbyTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder);
|
||||
|
||||
QTreeWidgetItem *headerItem = lobbyTreeWidget->headerItem();
|
||||
headerItem->setText(COLUMN_NAME, tr("Name"));
|
||||
headerItem->setText(COLUMN_USER_COUNT, tr("Count"));
|
||||
headerItem->setTextAlignment(COLUMN_NAME, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_USER_COUNT, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
QHeaderView *header = lobbyTreeWidget->header();
|
||||
header->setResizeMode(COLUMN_NAME, QHeaderView::Interactive);
|
||||
header->setResizeMode(COLUMN_USER_COUNT, QHeaderView::Stretch);
|
||||
|
||||
lobbyTreeWidget->setColumnWidth(COLUMN_NAME, 200);
|
||||
lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50);
|
||||
|
||||
privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
||||
privateLobbyItem->setText(COLUMN_NAME, tr("Private Lobbies"));
|
||||
privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1");
|
||||
lobbyTreeWidget->insertTopLevelItem(0, privateLobbyItem);
|
||||
|
||||
publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER);
|
||||
publicLobbyItem->setText(COLUMN_NAME, tr("Public Lobbies"));
|
||||
publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2");
|
||||
lobbyTreeWidget->insertTopLevelItem(1, publicLobbyItem);
|
||||
|
||||
lobbyTreeWidget->expandAll();
|
||||
|
||||
lobbyChanged();
|
||||
}
|
||||
|
||||
ChatLobbyWidget::~ChatLobbyWidget()
|
||||
{
|
||||
if (this == instance) {
|
||||
instance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ ChatTabWidget *ChatLobbyWidget::getTabWidget()
|
||||
{
|
||||
return instance ? instance->lobbyTabWidget : NULL;
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::lobbyTreeWidgetCostumPopupMenu()
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_CREATE), tr("Create chat lobby"), this, SLOT(createChatLobby()));
|
||||
|
||||
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
|
||||
if (item && item->type() == TYPE_LOBBY) {
|
||||
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool()) {
|
||||
contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeItem()));
|
||||
} else {
|
||||
contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe"), this, SLOT(subscribeItem()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::lobbyChanged()
|
||||
{
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
static void updateItem(QTreeWidgetItem *item, ChatLobbyId id, const std::string &name, int count, bool subscribed)
|
||||
{
|
||||
item->setText(COLUMN_NAME, QString::fromUtf8(name.c_str()));
|
||||
item->setData(COLUMN_NAME, ROLE_SORT, QString::fromUtf8(name.c_str()));
|
||||
|
||||
item->setText(COLUMN_USER_COUNT, QString::number(count));
|
||||
|
||||
item->setData(COLUMN_DATA, ROLE_ID, id);
|
||||
item->setData(COLUMN_DATA, ROLE_SUBSCRIBED, subscribed);
|
||||
|
||||
for (int column = 0; column < COLUMN_COUNT; ++column) {
|
||||
item->setTextColor(column, subscribed ? QColor() : QColor(Qt::gray));
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::updateDisplay()
|
||||
{
|
||||
std::cerr << "updating chat lobby display!" << std::endl;
|
||||
std::vector<PublicChatLobbyRecord> public_lobbies ;
|
||||
rsMsgs->getListOfNearbyChatLobbies(public_lobbies) ;
|
||||
std::vector<PublicChatLobbyRecord> publicLobbies;
|
||||
rsMsgs->getListOfNearbyChatLobbies(publicLobbies);
|
||||
|
||||
std::list<ChatLobbyInfo> linfos ;
|
||||
rsMsgs->getChatLobbyList(linfos) ;
|
||||
std::list<ChatLobbyInfo> lobbies;
|
||||
rsMsgs->getChatLobbyList(lobbies);
|
||||
|
||||
std::cerr << "got " << public_lobbies.size() << " public lobbies, and " << linfos.size() << " private lobbies." << std::endl;
|
||||
std::cerr << "got " << publicLobbies.size() << " public lobbies, and " << lobbies.size() << " private lobbies." << std::endl;
|
||||
|
||||
// now, do a nice display of public lobbies.
|
||||
// now, do a nice display of lobbies
|
||||
|
||||
_lobby_table_TW->clear() ;
|
||||
int n=0 ;
|
||||
std::string vpid;
|
||||
uint32_t i;
|
||||
uint32_t size = publicLobbies.size();
|
||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||
|
||||
QList<QTreeWidgetItem*> list ;
|
||||
std::string vpid ;
|
||||
for(uint32_t i=0;i<public_lobbies.size();++i,++n)
|
||||
if(!rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid)) // only display unsubscribed lobbies
|
||||
{
|
||||
std::cerr << "adding " << public_lobbies[i].lobby_name << " #" << std::hex << public_lobbies[i].lobby_id << std::dec << " public " << public_lobbies[i].total_number_of_peers << " peers." << std::endl;
|
||||
// remove not existing public lobbies
|
||||
int childCount = publicLobbyItem->childCount();
|
||||
int childIndex = 0;
|
||||
while (childIndex < childCount) {
|
||||
QTreeWidgetItem *itemLoop = publicLobbyItem->child(childIndex);
|
||||
if (itemLoop->type() == TYPE_LOBBY) {
|
||||
// check for public lobby
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == publicLobbies[i].lobby_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QStringList strl ;
|
||||
if (i >= size) {
|
||||
// check for private lobby with public level
|
||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||
if (lobbyIt->lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC &&
|
||||
itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobbyIt->lobby_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strl.push_back(QString::fromUtf8(public_lobbies[i].lobby_name.c_str())) ;
|
||||
strl.push_back(QString::number(public_lobbies[i].lobby_id,16)) ;
|
||||
strl.push_back(tr("Public")) ;
|
||||
strl.push_back(QString::number(public_lobbies[i].total_number_of_peers)) ;
|
||||
strl.push_back("") ;
|
||||
if (lobbyIt == lobbies.end()) {
|
||||
delete(publicLobbyItem->takeChild(publicLobbyItem->indexOfChild(itemLoop)));
|
||||
childCount = publicLobbyItem->childCount();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
childIndex++;
|
||||
}
|
||||
|
||||
list.push_back(new QTreeWidgetItem(strl)) ;
|
||||
for (i = 0; i < size; ++i) {
|
||||
const PublicChatLobbyRecord &lobby = publicLobbies[i];
|
||||
|
||||
std::cerr << "adding " << lobby.lobby_name << " #" << std::hex << lobby.lobby_id << std::dec << " public " << lobby.total_number_of_peers << " peers." << std::endl;
|
||||
|
||||
QTreeWidgetItem *item = NULL;
|
||||
|
||||
// search existing item
|
||||
childCount = publicLobbyItem->childCount();
|
||||
for (childIndex = 0; childIndex < childCount; childIndex++) {
|
||||
QTreeWidgetItem *itemLoop = publicLobbyItem->child(childIndex);
|
||||
if (itemLoop->type() == TYPE_LOBBY && itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobby.lobby_id) {
|
||||
item = itemLoop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());it!=linfos.end();++it,++n)
|
||||
{
|
||||
std::cerr << "adding " << (*it).lobby_name << " #" << std::hex << (*it).lobby_id << std::dec << " private " << (*it).nick_names.size() << " peers." << std::endl;
|
||||
if (item == NULL) {
|
||||
item = new RSTreeWidgetItem(compareRole, TYPE_LOBBY);
|
||||
publicLobbyItem->addChild(item);
|
||||
}
|
||||
|
||||
QStringList strl ;
|
||||
strl.push_back(QString::fromUtf8((*it).lobby_name.c_str())) ;
|
||||
strl.push_back(QString::number((*it).lobby_id,16)) ;
|
||||
item->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
|
||||
|
||||
if( (*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)
|
||||
strl.push_back(tr("Public")) ;
|
||||
else
|
||||
strl.push_back(tr("Private")) ;
|
||||
bool subscribed = false;
|
||||
if (rsMsgs->getVirtualPeerId(lobby.lobby_id, vpid)) {
|
||||
subscribed = true;
|
||||
}
|
||||
|
||||
strl.push_back(QString::number((*it).nick_names.size())) ;
|
||||
strl.push_back(tr("subscribed")) ;
|
||||
|
||||
list.push_back(new QTreeWidgetItem(strl)) ;
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name, lobby.total_number_of_peers, subscribed);
|
||||
}
|
||||
|
||||
// remove not existing private lobbies
|
||||
childCount = privateLobbyItem->childCount();
|
||||
childIndex = 0;
|
||||
while (childIndex < childCount) {
|
||||
QTreeWidgetItem *itemLoop = privateLobbyItem->child(childIndex);
|
||||
if (itemLoop->type() == TYPE_LOBBY) {
|
||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||
if (lobbyIt->lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE &&
|
||||
itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobbyIt->lobby_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lobbyIt == lobbies.end()) {
|
||||
delete(privateLobbyItem->takeChild(privateLobbyItem->indexOfChild(itemLoop)));
|
||||
childCount = privateLobbyItem->childCount();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
childIndex++;
|
||||
}
|
||||
|
||||
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
|
||||
const ChatLobbyInfo &lobby = *lobbyIt;
|
||||
|
||||
std::cerr << "adding " << lobby.lobby_name << " #" << std::hex << lobby.lobby_id << std::dec << " private " << lobby.nick_names.size() << " peers." << std::endl;
|
||||
|
||||
QTreeWidgetItem *itemParent;
|
||||
if (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) {
|
||||
itemParent = publicLobbyItem;
|
||||
} else {
|
||||
itemParent = privateLobbyItem;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = NULL;
|
||||
|
||||
// search existing item
|
||||
childCount = itemParent->childCount();
|
||||
for (childIndex = 0; childIndex < childCount; childIndex++) {
|
||||
QTreeWidgetItem *itemLoop = itemParent->child(childIndex);
|
||||
if (itemLoop->type() == TYPE_LOBBY && itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == lobby.lobby_id) {
|
||||
item = itemLoop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == NULL) {
|
||||
item = new RSTreeWidgetItem(compareRole, TYPE_LOBBY);
|
||||
itemParent->addChild(item);
|
||||
}
|
||||
|
||||
if (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) {
|
||||
item->setIcon(COLUMN_NAME, QIcon(IMAGE_PUBLIC));
|
||||
} else {
|
||||
item->setIcon(COLUMN_NAME, QIcon(IMAGE_PRIVATE));
|
||||
}
|
||||
|
||||
updateItem(item, lobby.lobby_id, lobby.lobby_name, lobby.nick_names.size(), true);
|
||||
}
|
||||
|
||||
_lobby_table_TW->addTopLevelItems(list) ;
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::doubleClickCell(int row,int col)
|
||||
void ChatLobbyWidget::createChatLobby()
|
||||
{
|
||||
// Each lobby can be joined directly, by calling
|
||||
std::list<std::string> friends;
|
||||
CreateLobbyDialog(friends).exec();
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::subscribeItem()
|
||||
{
|
||||
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
|
||||
if (item == NULL && item->type() != TYPE_LOBBY) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
||||
if (rsMsgs->joinPublicChatLobby(id)) {
|
||||
std::string vpeer_id;
|
||||
if (rsMsgs->getVirtualPeerId(id, vpeer_id)) {
|
||||
PopupChatDialog::chatFriend(vpeer_id) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::unsubscribeItem()
|
||||
{
|
||||
QTreeWidgetItem *item = lobbyTreeWidget->currentItem();
|
||||
if (item == NULL && item->type() != TYPE_LOBBY) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ChatLobbyId id = item->data(COLUMN_DATA, ROLE_ID).toULongLong();
|
||||
|
||||
std::string vpeer_id;
|
||||
if (rsMsgs->getVirtualPeerId(id, vpeer_id)) {
|
||||
PopupChatDialog::closeChat(vpeer_id);
|
||||
}
|
||||
|
||||
rsMsgs->unsubscribeChatLobby(id);
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
// Each lobby can be joined directly, by calling
|
||||
// rsMsgs->joinPublicLobby(chatLobbyId) ;
|
||||
|
||||
// e.g. fill a list of public lobbies
|
||||
|
||||
|
||||
// also maintain a list of active chat lobbies. Each active (subscribed) lobby has a lobby tab in the gui.
|
||||
// Each tab knows its lobby id and its virtual peer id (the one to send private chat messages to)
|
||||
//
|
||||
// One possibility is to convert ChatLobbyDialog to be used at a chat lobby tab.
|
||||
|
||||
|
||||
// then the lobby can be accessed using the virtual peer id through
|
||||
// rsMsgs->getVirtualPeerId(ChatLobbyId,std::string& virtual_peer_id)
|
||||
// rsMsgs->getVirtualPeerId(ChatLobbyId,std::string& virtual_peer_id)
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str)
|
||||
{
|
||||
std::cerr << "Received displayChatLobbyEvent()!" << std::endl;
|
||||
|
||||
std::string vpid;
|
||||
if (rsMsgs->getVirtualPeerId(lobby_id, vpid)) {
|
||||
if (ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(PopupChatDialog::getExistingInstance(vpid))) {
|
||||
cld->displayLobbyEvent(event_type, nickname, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::readChatLobbyInvites()
|
||||
{
|
||||
std::list<ChatLobbyInvite> invites;
|
||||
rsMsgs->getPendingChatLobbyInvites(invites);
|
||||
|
||||
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it) {
|
||||
if (QMessageBox::Ok == QMessageBox::question(NULL, tr("Invitation to chat lobby"), QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str()) + QString(" invites you to chat lobby named ") + QString::fromUtf8((*it).lobby_name.c_str()), QMessageBox::Ok, QMessageBox::Ignore)) {
|
||||
std::cerr << "Accepting invite to lobby " << (*it).lobby_name << std::endl;
|
||||
|
||||
rsMsgs->acceptLobbyInvite((*it).lobby_id);
|
||||
|
||||
std::string vpid;
|
||||
if(rsMsgs->getVirtualPeerId((*it).lobby_id,vpid )) {
|
||||
PopupChatDialog::chatFriend(vpid);
|
||||
} else {
|
||||
std::cerr << "No lobby known with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;
|
||||
}
|
||||
} else {
|
||||
rsMsgs->denyLobbyInvite((*it).lobby_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::tabInfoChanged()
|
||||
{
|
||||
emit infoChanged();
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon)
|
||||
{
|
||||
lobbyTabWidget->getInfo(isTyping, hasNewMessage, icon);
|
||||
}
|
||||
|
@ -3,20 +3,41 @@
|
||||
#include "ui_ChatLobbyWidget.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
|
||||
class ChatLobbyWidget : public RsAutoUpdatePage, public Ui::ChatLobbyWidget
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
class ChatTabWidget;
|
||||
|
||||
class ChatLobbyWidget : public RsAutoUpdatePage, Ui::ChatLobbyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
ChatLobbyWidget(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
public:
|
||||
/** Default constructor */
|
||||
ChatLobbyWidget(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
|
||||
/** Default destructor */
|
||||
~ChatLobbyWidget();
|
||||
/** Default destructor */
|
||||
~ChatLobbyWidget();
|
||||
|
||||
virtual void updateDisplay() ;
|
||||
virtual void updateDisplay();
|
||||
void getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon);
|
||||
|
||||
protected slots:
|
||||
void doubleClickCell(int,int);
|
||||
static ChatTabWidget *getTabWidget();
|
||||
|
||||
signals:
|
||||
void infoChanged();
|
||||
|
||||
protected slots:
|
||||
void lobbyChanged();
|
||||
void lobbyTreeWidgetCostumPopupMenu();
|
||||
void createChatLobby();
|
||||
void subscribeItem();
|
||||
void unsubscribeItem();
|
||||
void itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str);
|
||||
void readChatLobbyInvites();
|
||||
void tabInfoChanged();
|
||||
|
||||
private:
|
||||
RSTreeWidgetItemCompareRole *compareRole;
|
||||
QTreeWidgetItem *privateLobbyItem;
|
||||
QTreeWidgetItem *publicLobbyItem;
|
||||
};
|
||||
|
||||
|
@ -10,47 +10,37 @@
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="_lobby_table_TW">
|
||||
<widget class="QTreeWidget" name="lobbyTreeWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>ID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Count</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>S</string>
|
||||
</property>
|
||||
</column>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="_lobby_tab_TW">
|
||||
<widget class="ChatTabWidget" name="lobbyTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
@ -58,6 +48,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ChatTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header location="global">gui/chat/ChatTabWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#include "channels/CreateChannel.h"
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include "chat/ChatLobbyDialog.h"
|
||||
#include "common/Emoticons.h"
|
||||
#include "common/vmessagebox.h"
|
||||
#include "connect/ConfCertDialog.h"
|
||||
@ -86,7 +85,9 @@ FriendsDialog::FriendsDialog(QWidget *parent)
|
||||
ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME);
|
||||
ui.avatar->setOwnId();
|
||||
|
||||
ui.peertabWidget->addTab(new ChatLobbyWidget(), tr("Chat lobbies"));
|
||||
chatLobbyWidget = new ChatLobbyWidget();
|
||||
QObject::connect(chatLobbyWidget, SIGNAL(infoChanged()), this, SLOT(lobbyInfoChanged()));
|
||||
chatlobbyTabIndex = ui.peertabWidget->addTab(chatLobbyWidget, tr("Chat lobbies"));
|
||||
ui.peertabWidget->setTabPosition(QTabWidget::North);
|
||||
ui.peertabWidget->addTab(new ProfileWidget(), tr("Profile"));
|
||||
NewsFeed *newsFeed = new NewsFeed();
|
||||
@ -300,21 +301,6 @@ void FriendsDialog::updateStatusTyping()
|
||||
}
|
||||
}
|
||||
|
||||
void FriendsDialog::updatePublicLobbyList()
|
||||
{
|
||||
std::cerr << "Updating public lobby list !!" << std::endl;
|
||||
}
|
||||
|
||||
void FriendsDialog::displayChatLobbyEvent(qulonglong lobby_id,int event_type,const QString& nickname,const QString& str)
|
||||
{
|
||||
std::cerr << "Received displayChatLobbyEvent()!" << std::endl;
|
||||
|
||||
std::string vpid ;
|
||||
if(rsMsgs->getVirtualPeerId(lobby_id,vpid))
|
||||
if( ChatLobbyDialog *cld = dynamic_cast<ChatLobbyDialog*>(PopupChatDialog::getExistingInstance(vpid)))
|
||||
cld->displayLobbyEvent(event_type,nickname,str) ;
|
||||
}
|
||||
|
||||
// Called by libretroshare through notifyQt to display the peer's status
|
||||
//
|
||||
void FriendsDialog::updateStatusString(const QString& peer_id, const QString& status_string)
|
||||
@ -329,28 +315,6 @@ void FriendsDialog::updateStatusString(const QString& peer_id, const QString& st
|
||||
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
|
||||
}
|
||||
|
||||
void FriendsDialog::readChatLobbyInvites()
|
||||
{
|
||||
std::list<ChatLobbyInvite> invites ;
|
||||
rsMsgs->getPendingChatLobbyInvites(invites) ;
|
||||
|
||||
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it)
|
||||
if(QMessageBox::Ok == QMessageBox::question(NULL,tr("Invitation to chat lobby"),QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())+QString(" invites you to chat lobby named ")+QString::fromUtf8((*it).lobby_name.c_str()),QMessageBox::Ok,QMessageBox::Ignore))
|
||||
{
|
||||
std::cerr << "Accepting invite to lobby " << (*it).lobby_name << std::endl;
|
||||
|
||||
rsMsgs->acceptLobbyInvite( (*it).lobby_id ) ;
|
||||
|
||||
std::string vpid ;
|
||||
if(rsMsgs->getVirtualPeerId( (*it).lobby_id,vpid ) )
|
||||
PopupChatDialog::chatFriend(vpid) ;
|
||||
else
|
||||
std::cerr << "No lobby known with id 0x" << std::hex << (*it).lobby_id << std::dec << std::endl;
|
||||
}
|
||||
else
|
||||
rsMsgs->denyLobbyInvite( (*it).lobby_id ) ;
|
||||
}
|
||||
|
||||
void FriendsDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat)
|
||||
{
|
||||
if(is_private_chat)
|
||||
@ -860,3 +824,13 @@ void FriendsDialog::newsFeedChanged(int count)
|
||||
ui.peertabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
|
||||
}
|
||||
}
|
||||
|
||||
void FriendsDialog::lobbyInfoChanged()
|
||||
{
|
||||
bool isTyping;
|
||||
bool hasNewMessage;
|
||||
QIcon icon;
|
||||
chatLobbyWidget->getInfo(isTyping, hasNewMessage, &icon);
|
||||
|
||||
ui.peertabWidget->setTabIcon(chatlobbyTabIndex, icon);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ class QAction;
|
||||
class QTextEdit;
|
||||
class QTextCharFormat;
|
||||
class ChatDialog;
|
||||
class ChatLobbyWidget;
|
||||
|
||||
class FriendsDialog : public RsAutoUpdatePage
|
||||
{
|
||||
@ -56,10 +57,7 @@ public slots:
|
||||
|
||||
void insertChat();
|
||||
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
void displayChatLobbyEvent(qulonglong,int,const QString&,const QString&) ;
|
||||
void updatePublicLobbyList() ;
|
||||
void resetStatusBar() ;
|
||||
void readChatLobbyInvites() ;
|
||||
|
||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||
|
||||
@ -114,6 +112,8 @@ private slots:
|
||||
|
||||
void newsFeedChanged(int count);
|
||||
|
||||
void lobbyInfoChanged();
|
||||
|
||||
signals:
|
||||
void notifyGroupChat(const QString&,const QString&) ;
|
||||
|
||||
@ -140,6 +140,9 @@ private:
|
||||
QColor newsFeedTabColor;
|
||||
QString newsFeedText;
|
||||
|
||||
ChatLobbyWidget *chatLobbyWidget;
|
||||
int chatlobbyTabIndex;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::FriendsDialog ui;
|
||||
};
|
||||
|
@ -45,41 +45,56 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "ChatLobbyDialog.h"
|
||||
#include "gui/ChatLobbyWidget.h"
|
||||
|
||||
/** Default constructor */
|
||||
ChatLobbyDialog::ChatLobbyDialog(const std::string& dialog_id,const ChatLobbyId& lid, const QString &name, QWidget *parent, Qt::WFlags flags)
|
||||
: PopupChatDialog(dialog_id,name,parent,flags),lobby_id(lid)
|
||||
ChatLobbyDialog::ChatLobbyDialog(const std::string& dialog_id, const ChatLobbyId& lid, const QString &name, QWidget *parent, Qt::WFlags flags)
|
||||
: PopupChatDialog(dialog_id, name, parent, flags), lobby_id(lid)
|
||||
{
|
||||
// remove the avatar widget. Replace it with a friends list.
|
||||
|
||||
ui.avatarWidget->hide() ;
|
||||
PopupChatDialog::updateStatus(QString::fromStdString(getPeerId()),RS_STATUS_ONLINE) ;
|
||||
ui.avatarWidget->hide();
|
||||
ui.ownAvatarWidget->hide();
|
||||
PopupChatDialog::updateStatus(QString::fromStdString(getPeerId()),RS_STATUS_ONLINE);
|
||||
|
||||
QObject::connect(this,SIGNAL(close()),this,SLOT(closeAndAsk())) ;
|
||||
// hide history buttons
|
||||
ui.actionClearOfflineMessages->setVisible(false);
|
||||
ui.actionDelete_Chat_History->setVisible(false);
|
||||
ui.actionMessageHistory->setVisible(false);
|
||||
|
||||
ui.avatarframe->layout()->addWidget(new QLabel(tr("Participants:"))) ;
|
||||
friendsListWidget = new QListWidget ;
|
||||
ui.avatarframe->layout()->addWidget(friendsListWidget) ;
|
||||
ui.avatarframe->layout()->addItem(new QSpacerItem(12, 335, QSizePolicy::Minimum, QSizePolicy::Expanding)) ;
|
||||
ui.avatarFrameButton->setToolTip(tr("Hide participants"));
|
||||
|
||||
ui.avatarframe->layout()->addWidget(new QLabel(tr("Participants:")));
|
||||
friendsListWidget = new QListWidget;
|
||||
ui.avatarframe->layout()->addWidget(friendsListWidget);
|
||||
ui.avatarframe->layout()->addItem(new QSpacerItem(12, 335, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||
}
|
||||
|
||||
/** Destructor. */
|
||||
ChatLobbyDialog::~ChatLobbyDialog()
|
||||
{
|
||||
// announce leaving of lobby
|
||||
|
||||
// check that the lobby still exists.
|
||||
ChatLobbyId lid ;
|
||||
if(!rsMsgs->isLobbyId(getPeerId(),lid))
|
||||
return ;
|
||||
|
||||
if(QMessageBox::Yes == QMessageBox::question(NULL,tr("Unsubscribe to lobby?"),tr("Do you want to unsubscribe to this chat lobby?"),QMessageBox::Yes | QMessageBox::No))
|
||||
rsMsgs->unsubscribeChatLobby(lobby_id) ;
|
||||
// check that the lobby still exists.
|
||||
ChatLobbyId lid;
|
||||
if (rsMsgs->isLobbyId(getPeerId(),lid)) {
|
||||
rsMsgs->unsubscribeChatLobby(lobby_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatLobbyDialog::addToParent()
|
||||
{
|
||||
ChatTabWidget *tabWidget = ChatLobbyWidget::getTabWidget();
|
||||
if (tabWidget) {
|
||||
tabWidget->addDialog(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::setNickName(const QString& nick)
|
||||
{
|
||||
rsMsgs->setNickNameForChatLobby(lobby_id,nick.toUtf8().constData()) ;
|
||||
rsMsgs->setNickNameForChatLobby(lobby_id, nick.toUtf8().constData());
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
@ -87,7 +102,7 @@ void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
QDateTime sendTime = QDateTime::fromTime_t(info.sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(info.recvTime);
|
||||
QString message = QString::fromStdWString(info.msg);
|
||||
QString name = QString::fromUtf8(info.peer_nickname.c_str()) ;
|
||||
QString name = QString::fromUtf8(info.peer_nickname.c_str());
|
||||
|
||||
addChatMsg(true, name, sendTime, recvTime, message, TYPE_NORMAL);
|
||||
|
||||
@ -96,42 +111,44 @@ void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
static time_t last = 0 ;
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(now > last)
|
||||
{
|
||||
last = now ;
|
||||
updateFriendsList() ;
|
||||
if (now > last) {
|
||||
last = now;
|
||||
updateFriendsList();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::updateFriendsList()
|
||||
{
|
||||
friendsListWidget->clear() ;
|
||||
friendsListWidget->clear();
|
||||
|
||||
std::list<ChatLobbyInfo> linfos ;
|
||||
std::list<ChatLobbyInfo> linfos;
|
||||
rsMsgs->getChatLobbyList(linfos);
|
||||
|
||||
std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());
|
||||
for(;it!=linfos.end() && (*it).lobby_id != lobby_id;++it) ;
|
||||
for (; it!=linfos.end() && (*it).lobby_id != lobby_id; ++it);
|
||||
|
||||
if(it!=linfos.end())
|
||||
for(std::set<std::string>::const_iterator it2( (*it).nick_names.begin());it2!=(*it).nick_names.end();++it2)
|
||||
friendsListWidget->addItem(QString::fromUtf8((*it2).c_str())) ;
|
||||
if (it != linfos.end()) {
|
||||
for (std::set<std::string>::const_iterator it2((*it).nick_names.begin()); it2 != (*it).nick_names.end(); ++it2) {
|
||||
friendsListWidget->addItem(QString::fromUtf8((*it2).c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::displayLobbyEvent(int event_type,const QString& nickname,const QString& str)
|
||||
void ChatLobbyDialog::displayLobbyEvent(int event_type, const QString& nickname, const QString& str)
|
||||
{
|
||||
switch(event_type)
|
||||
{
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_LEFT: addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), str + tr(" has left the lobby."), TYPE_NORMAL);
|
||||
break ;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), str + tr(" joined the lobby."), TYPE_NORMAL);
|
||||
break ;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
updateStatusString(nickname,str) ;
|
||||
break ;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_LEFT:
|
||||
addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 has left the lobby.").arg(str), TYPE_NORMAL);
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), tr("%1 joined the lobby.").arg(str), TYPE_NORMAL);
|
||||
break;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
updateStatusString(nickname,str);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "ChatLobbyDialog::displayLobbyEvent() Unhandled lobby event type " << event_type << std::endl;
|
||||
std::cerr << "ChatLobbyDialog::displayLobbyEvent() Unhandled lobby event type " << event_type << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,3 +157,17 @@ QString ChatLobbyDialog::makeStatusString(const QString& peer_id, const QString&
|
||||
return QString::fromUtf8(peer_id.toStdString().c_str()) + " " + tr(status_string.toAscii());
|
||||
}
|
||||
|
||||
bool ChatLobbyDialog::canClose()
|
||||
{
|
||||
// check that the lobby still exists.
|
||||
ChatLobbyId lid;
|
||||
if (!rsMsgs->isLobbyId(getPeerId(),lid)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (QMessageBox::Yes == QMessageBox::question(NULL, tr("Unsubscribe to lobby?"), tr("Do you want to unsubscribe to this chat lobby?"), QMessageBox::Yes | QMessageBox::No)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -41,34 +41,41 @@ class ChatLobbyDialog: public PopupChatDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void displayLobbyEvent(int event_type,const QString& nickname,const QString& str) ;
|
||||
public:
|
||||
void displayLobbyEvent(int event_type,const QString& nickname,const QString& str) ;
|
||||
|
||||
protected:
|
||||
/** Default constructor */
|
||||
ChatLobbyDialog(const std::string& id,const ChatLobbyId& lid, const QString &name, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
// The following methods are differentfrom those of the parent:
|
||||
//
|
||||
virtual bool hasPeerStatus() { return false; }
|
||||
virtual bool canClose();
|
||||
|
||||
/** Default destructor */
|
||||
virtual ~ChatLobbyDialog();
|
||||
protected:
|
||||
/** Default constructor */
|
||||
ChatLobbyDialog(const std::string& id,const ChatLobbyId& lid, const QString &name, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
|
||||
// virtual void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType);
|
||||
// virtual void sendChat();
|
||||
/** Default destructor */
|
||||
virtual ~ChatLobbyDialog();
|
||||
|
||||
friend class PopupChatDialog ;
|
||||
// virtual void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType);
|
||||
// virtual void sendChat();
|
||||
|
||||
// The following methods are differentfrom those of the parent:
|
||||
//
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info) ; //
|
||||
virtual QString makeStatusString(const QString& peer_id,const QString& status_string) const ;
|
||||
friend class PopupChatDialog ;
|
||||
|
||||
protected slots:
|
||||
void setNickName(const QString&) ;
|
||||
// The following methods are differentfrom those of the parent:
|
||||
//
|
||||
virtual bool addToParent();
|
||||
virtual bool isChatLobby() { return true; }
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info) ; //
|
||||
virtual QString makeStatusString(const QString& peer_id,const QString& status_string) const ;
|
||||
|
||||
private:
|
||||
void updateFriendsList() ;
|
||||
protected slots:
|
||||
void setNickName(const QString&) ;
|
||||
|
||||
ChatLobbyId lobby_id ;
|
||||
QListWidget *friendsListWidget ;
|
||||
private:
|
||||
void updateFriendsList() ;
|
||||
|
||||
ChatLobbyId lobby_id ;
|
||||
QListWidget *friendsListWidget ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
116
retroshare-gui/src/gui/chat/ChatTabWidget.cpp
Normal file
116
retroshare-gui/src/gui/chat/ChatTabWidget.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
#include "ChatTabWidget.h"
|
||||
#include "ui_ChatTabWidget.h"
|
||||
#include "PopupChatDialog.h"
|
||||
#include "gui/common/StatusDefs.h"
|
||||
|
||||
#define IMAGE_WINDOW ":/images/rstray3.png"
|
||||
#define IMAGE_TYPING ":/images/typing.png"
|
||||
#define IMAGE_CHAT ":/images/chat.png"
|
||||
|
||||
ChatTabWidget::ChatTabWidget(QWidget *parent) :
|
||||
QTabWidget(parent),
|
||||
ui(new Ui::ChatTabWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClose(int)));
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
}
|
||||
|
||||
ChatTabWidget::~ChatTabWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ChatTabWidget::addDialog(PopupChatDialog *dialog)
|
||||
{
|
||||
addTab(dialog, dialog->getTitle());
|
||||
|
||||
QObject::connect(dialog, SIGNAL(infoChanged(PopupChatDialog*)), this, SLOT(tabInfoChanged(PopupChatDialog*)));
|
||||
|
||||
tabInfoChanged(dialog);
|
||||
}
|
||||
|
||||
void ChatTabWidget::removeDialog(PopupChatDialog *dialog)
|
||||
{
|
||||
QObject::disconnect(dialog, SIGNAL(infoChanged(PopupChatDialog*)), this, SLOT(tabInfoChanged(PopupChatDialog*)));
|
||||
|
||||
int tab = indexOf(dialog);
|
||||
if (tab >= 0) {
|
||||
removeTab(tab);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatTabWidget::tabClose(int tab)
|
||||
{
|
||||
PopupChatDialog *dialog = dynamic_cast<PopupChatDialog*>(widget(tab));
|
||||
|
||||
if (dialog) {
|
||||
if (dialog->canClose()) {
|
||||
dialog->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatTabWidget::tabChanged(int tab)
|
||||
{
|
||||
PopupChatDialog *dialog = dynamic_cast<PopupChatDialog*>(widget(tab));
|
||||
|
||||
if (dialog) {
|
||||
dialog->activate();
|
||||
emit tabChanged(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatTabWidget::tabInfoChanged(PopupChatDialog *dialog)
|
||||
{
|
||||
int tab = indexOf(dialog);
|
||||
if (tab >= 0) {
|
||||
if (dialog->isTyping()) {
|
||||
setTabIcon(tab, QIcon(IMAGE_TYPING));
|
||||
} else if (dialog->hasNewMessages()) {
|
||||
setTabIcon(tab, QIcon(IMAGE_CHAT));
|
||||
} else if (dialog->hasPeerStatus()) {
|
||||
setTabIcon(tab, QIcon(StatusDefs::imageIM(dialog->getPeerStatus())));
|
||||
} else {
|
||||
setTabIcon(tab, QIcon());
|
||||
}
|
||||
}
|
||||
|
||||
emit infoChanged();
|
||||
}
|
||||
|
||||
void ChatTabWidget::getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon)
|
||||
{
|
||||
isTyping = false;
|
||||
hasNewMessage = false;
|
||||
|
||||
PopupChatDialog *pcd;
|
||||
int tabCount = count();
|
||||
for (int i = 0; i < tabCount; i++) {
|
||||
pcd = dynamic_cast<PopupChatDialog*>(widget(i));
|
||||
if (pcd) {
|
||||
if (pcd->isTyping()) {
|
||||
isTyping = true;
|
||||
}
|
||||
if (pcd->hasNewMessages()) {
|
||||
hasNewMessage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
if (isTyping) {
|
||||
*icon = QIcon(IMAGE_TYPING);
|
||||
} else if (hasNewMessage) {
|
||||
*icon = QIcon(IMAGE_CHAT);
|
||||
} else {
|
||||
pcd = dynamic_cast<PopupChatDialog*>(currentWidget());
|
||||
if (pcd && pcd->hasPeerStatus()) {
|
||||
*icon = QIcon(StatusDefs::imageIM(pcd->getPeerStatus()));
|
||||
} else {
|
||||
*icon = QIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
retroshare-gui/src/gui/chat/ChatTabWidget.h
Normal file
38
retroshare-gui/src/gui/chat/ChatTabWidget.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef CHATTABWIDGET_H
|
||||
#define CHATTABWIDGET_H
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ChatTabWidget;
|
||||
}
|
||||
|
||||
class PopupChatDialog;
|
||||
|
||||
class ChatTabWidget : public QTabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ChatTabWidget(QWidget *parent = 0);
|
||||
~ChatTabWidget();
|
||||
|
||||
void addDialog(PopupChatDialog *dialog);
|
||||
void removeDialog(PopupChatDialog *dialog);
|
||||
|
||||
void getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon);
|
||||
|
||||
signals:
|
||||
void tabChanged(PopupChatDialog *dialog);
|
||||
void infoChanged();
|
||||
|
||||
private slots:
|
||||
void tabClose(int tab);
|
||||
void tabChanged(int tab);
|
||||
void tabInfoChanged(PopupChatDialog *dialog);
|
||||
|
||||
private:
|
||||
Ui::ChatTabWidget *ui;
|
||||
};
|
||||
|
||||
#endif // CHATTABWIDGET_H
|
22
retroshare-gui/src/gui/chat/ChatTabWidget.ui
Normal file
22
retroshare-gui/src/gui/chat/ChatTabWidget.ui
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChatTabWidget</class>
|
||||
<widget class="QTabWidget" name="ChatTabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -91,7 +91,6 @@ void playsound()
|
||||
PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWidget *parent, Qt::WFlags flags)
|
||||
: QWidget(parent, flags), dialogId(id), dialogName(name),
|
||||
lastChatTime(0), lastChatName("")
|
||||
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -155,7 +154,7 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi
|
||||
ui.hashBox->setDropWidget(this);
|
||||
ui.hashBox->setAutoHide(true);
|
||||
|
||||
QMenu * toolmenu = new QMenu();
|
||||
QMenu *toolmenu = new QMenu();
|
||||
toolmenu->addAction(ui.actionClear_Chat_History);
|
||||
toolmenu->addAction(ui.actionDelete_Chat_History);
|
||||
toolmenu->addAction(ui.actionSave_Chat_History);
|
||||
@ -164,63 +163,63 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi
|
||||
//toolmenu->addAction(ui.action_Disable_Emoticons);
|
||||
ui.pushtoolsButton->setMenu(toolmenu);
|
||||
|
||||
mCurrentColor.setNamedColor(PeerSettings->getPrivateChatColor(dialogId));
|
||||
mCurrentFont.fromString(PeerSettings->getPrivateChatFont(dialogId));
|
||||
|
||||
colorChanged(mCurrentColor);
|
||||
fontChanged(mCurrentFont);
|
||||
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
// load style
|
||||
PeerSettings->getStyle(dialogId, "PopupChatDialog", style);
|
||||
|
||||
// initialize first status
|
||||
StatusInfo peerStatusInfo;
|
||||
// No check of return value. Non existing status info is handled as offline.
|
||||
rsStatus->getStatus(dialogId, peerStatusInfo);
|
||||
updateStatus(QString::fromStdString(dialogId), peerStatusInfo.status);
|
||||
|
||||
// initialize first custom state string
|
||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(dialogId).c_str());
|
||||
updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString);
|
||||
|
||||
if (rsHistory->getEnable(false)) {
|
||||
// get chat messages from history
|
||||
std::list<HistoryMsg> historyMsgs;
|
||||
int messageCount = Settings->getPrivateChatHistoryCount();
|
||||
if (messageCount > 0) {
|
||||
rsHistory->getMessages(dialogId, historyMsgs, messageCount);
|
||||
|
||||
std::list<HistoryMsg>::iterator historyIt;
|
||||
for (historyIt = historyMsgs.begin(); historyIt != historyMsgs.end(); historyIt++) {
|
||||
addChatMsg(historyIt->incoming, QString::fromUtf8(historyIt->peerName.c_str()), QDateTime::fromTime_t(historyIt->sendTime), QDateTime::fromTime_t(historyIt->recvTime), QString::fromUtf8(historyIt->message.c_str()), TYPE_HISTORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ui.chattextEdit->installEventFilter(this);
|
||||
|
||||
// add offline chat messages
|
||||
onPrivateChatChanged(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
|
||||
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
ui.attachPictureButton->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PopupChatDialog::init()
|
||||
{
|
||||
if (!isChatLobby()) {
|
||||
mCurrentColor.setNamedColor(PeerSettings->getPrivateChatColor(dialogId));
|
||||
mCurrentFont.fromString(PeerSettings->getPrivateChatFont(dialogId));
|
||||
|
||||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
// load style
|
||||
PeerSettings->getStyle(dialogId, "PopupChatDialog", style);
|
||||
|
||||
// initialize first status
|
||||
StatusInfo peerStatusInfo;
|
||||
// No check of return value. Non existing status info is handled as offline.
|
||||
rsStatus->getStatus(dialogId, peerStatusInfo);
|
||||
updateStatus(QString::fromStdString(dialogId), peerStatusInfo.status);
|
||||
|
||||
// initialize first custom state string
|
||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(dialogId).c_str());
|
||||
updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString);
|
||||
|
||||
if (rsHistory->getEnable(false)) {
|
||||
// get chat messages from history
|
||||
std::list<HistoryMsg> historyMsgs;
|
||||
int messageCount = Settings->getPrivateChatHistoryCount();
|
||||
if (messageCount > 0) {
|
||||
rsHistory->getMessages(dialogId, historyMsgs, messageCount);
|
||||
|
||||
std::list<HistoryMsg>::iterator historyIt;
|
||||
for (historyIt = historyMsgs.begin(); historyIt != historyMsgs.end(); historyIt++) {
|
||||
addChatMsg(historyIt->incoming, QString::fromUtf8(historyIt->peerName.c_str()), QDateTime::fromTime_t(historyIt->sendTime), QDateTime::fromTime_t(historyIt->recvTime), QString::fromUtf8(historyIt->message.c_str()), TYPE_HISTORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
// add offline chat messages
|
||||
onPrivateChatChanged(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
colorChanged(mCurrentColor);
|
||||
fontChanged(mCurrentFont);
|
||||
}
|
||||
|
||||
/** Destructor. */
|
||||
PopupChatDialog::~PopupChatDialog()
|
||||
{
|
||||
// save settings
|
||||
processSettings(false);
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
window->removeDialog(this);
|
||||
window->calculateTitle(NULL);
|
||||
}
|
||||
emit dialogClose(this);
|
||||
|
||||
std::map<std::string, PopupChatDialog *>::iterator it;
|
||||
if (chatDialogs.end() != (it = chatDialogs.find(dialogId))) {
|
||||
@ -260,37 +259,38 @@ void PopupChatDialog::processSettings(bool bLoad)
|
||||
|
||||
/*static*/ PopupChatDialog *PopupChatDialog::getPrivateChat(const std::string &id, uint chatflags)
|
||||
{
|
||||
/* see if it exists already */
|
||||
/* see if it already exists */
|
||||
PopupChatDialog *popupchatdialog = getExistingInstance(id);
|
||||
|
||||
if (popupchatdialog == NULL) {
|
||||
ChatLobbyId lobby_id;
|
||||
if (rsMsgs->isLobbyId(id, lobby_id)) {
|
||||
chatflags = RS_CHAT_OPEN; // use own flags
|
||||
}
|
||||
|
||||
if (chatflags & RS_CHAT_OPEN) {
|
||||
RsPeerDetails sslDetails;
|
||||
ChatLobbyId lobby_id ;
|
||||
|
||||
if (rsPeers->getPeerDetails(id, sslDetails))
|
||||
{
|
||||
if (rsPeers->getPeerDetails(id, sslDetails)) {
|
||||
popupchatdialog = new PopupChatDialog(id, PeerDefs::nameWithLocation(sslDetails));
|
||||
popupchatdialog->init();
|
||||
chatDialogs[id] = popupchatdialog;
|
||||
|
||||
PopupChatWindow *window = PopupChatWindow::getWindow(false);
|
||||
window->addDialog(popupchatdialog);
|
||||
popupchatdialog->addToParent();
|
||||
} else if (lobby_id) {
|
||||
std::list<ChatLobbyInfo> linfos;
|
||||
rsMsgs->getChatLobbyList(linfos);
|
||||
|
||||
for (std::list<ChatLobbyInfo>::const_iterator it(linfos.begin()); it != linfos.end(); ++it) {
|
||||
if ((*it).lobby_id == lobby_id) {
|
||||
popupchatdialog = new ChatLobbyDialog(id, lobby_id, QString::fromUtf8((*it).lobby_name.c_str()));
|
||||
popupchatdialog->init();
|
||||
chatDialogs[id] = popupchatdialog;
|
||||
|
||||
popupchatdialog->addToParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rsMsgs->isLobbyId(id, lobby_id))
|
||||
{
|
||||
std::list<ChatLobbyInfo> linfos;
|
||||
rsMsgs->getChatLobbyList(linfos) ;
|
||||
|
||||
for(std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());it!=linfos.end();++it)
|
||||
if( (*it).lobby_id == lobby_id)
|
||||
{
|
||||
popupchatdialog = new ChatLobbyDialog(id,lobby_id,QString::fromUtf8((*it).lobby_name.c_str()));
|
||||
chatDialogs[id] = popupchatdialog;
|
||||
|
||||
PopupChatWindow *window = PopupChatWindow::getWindow(false);
|
||||
window->addDialog(popupchatdialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,27 +357,38 @@ void PopupChatDialog::processSettings(bool bLoad)
|
||||
}
|
||||
}
|
||||
|
||||
void PopupChatDialog::closeChat(const std::string& id)
|
||||
bool PopupChatDialog::addToParent()
|
||||
{
|
||||
PopupChatDialog *popupchatdialog = getExistingInstance(id);
|
||||
PopupChatWindow *window = PopupChatWindow::getWindow(false);
|
||||
if (window) {
|
||||
window->addDialog(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(popupchatdialog != NULL)
|
||||
popupchatdialog->hide() ;
|
||||
return false;
|
||||
}
|
||||
|
||||
void PopupChatDialog::chatFriend(const std::string &id)
|
||||
/*static*/ void PopupChatDialog::closeChat(const std::string& id)
|
||||
{
|
||||
PopupChatDialog *popupchatdialog = getExistingInstance(id);
|
||||
|
||||
if (popupchatdialog) {
|
||||
delete(popupchatdialog);
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void PopupChatDialog::chatFriend(const std::string &id)
|
||||
{
|
||||
if (id.empty()){
|
||||
return;
|
||||
}
|
||||
std::cerr<<" popup dialog chat friend 1"<<std::endl;
|
||||
|
||||
ChatLobbyId lid ;
|
||||
if(rsMsgs->isLobbyId(id,lid))
|
||||
{
|
||||
getPrivateChat(id, RS_CHAT_OPEN | RS_CHAT_FOCUS);
|
||||
return ;
|
||||
}
|
||||
ChatLobbyId lid ;
|
||||
if(rsMsgs->isLobbyId(id, lid)) {
|
||||
getPrivateChat(id, RS_CHAT_OPEN | RS_CHAT_FOCUS);
|
||||
return;
|
||||
}
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(id, detail))
|
||||
@ -447,17 +458,14 @@ void PopupChatDialog::contextMenu( QPoint /*point*/ )
|
||||
delete(contextMnu);
|
||||
}
|
||||
|
||||
void PopupChatDialog::resetStatusBar()
|
||||
void PopupChatDialog::resetStatusBar()
|
||||
{
|
||||
ui.statusLabel->clear();
|
||||
ui.typingpixmapLabel->clear();
|
||||
|
||||
typing = false;
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
window->calculateTitle(this);
|
||||
}
|
||||
emit infoChanged(this);
|
||||
}
|
||||
|
||||
void PopupChatDialog::updateStatusTyping()
|
||||
@ -477,21 +485,19 @@ QString PopupChatDialog::makeStatusString(const QString& peer_id,const QString&
|
||||
{
|
||||
return QString::fromUtf8(rsPeers->getPeerName(peer_id.toStdString()).c_str()) + " " + tr(status_string.toAscii());
|
||||
}
|
||||
|
||||
// Called by libretroshare through notifyQt to display the peer's status
|
||||
//
|
||||
void PopupChatDialog::updateStatusString(const QString& peer_id, const QString& status_string)
|
||||
{
|
||||
QString status = makeStatusString(peer_id,status_string) ;
|
||||
QString status = makeStatusString(peer_id, status_string) ;
|
||||
ui.statusLabel->setText(status); // displays info for 5 secs.
|
||||
ui.typingpixmapLabel->setPixmap(QPixmap(":images/typing.png") );
|
||||
|
||||
if (status_string == "is typing...") {
|
||||
typing = true;
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
window->calculateTitle(this);
|
||||
}
|
||||
emit infoChanged(this);
|
||||
}
|
||||
|
||||
QTimer::singleShot(5000,this,SLOT(resetStatusBar())) ;
|
||||
@ -504,17 +510,26 @@ void PopupChatDialog::resizeEvent(QResizeEvent */*event*/)
|
||||
scrollbar->setValue(scrollbar->maximum());
|
||||
}
|
||||
|
||||
void PopupChatDialog::showEvent(QShowEvent */*event*/)
|
||||
{
|
||||
newMessages = false;
|
||||
emit infoChanged(this);
|
||||
focusDialog();
|
||||
}
|
||||
|
||||
void PopupChatDialog::activate()
|
||||
{
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
if (window->isActiveWindow()) {
|
||||
newMessages = false;
|
||||
window->calculateTitle(this);
|
||||
emit infoChanged(this);
|
||||
focusDialog();
|
||||
}
|
||||
} else {
|
||||
newMessages = false;
|
||||
emit infoChanged(this);
|
||||
focusDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,56 +539,60 @@ void PopupChatDialog::onPrivateChatChanged(int list, int type)
|
||||
switch (type) {
|
||||
case NOTIFY_TYPE_ADD:
|
||||
{
|
||||
std::list<ChatInfo> savedOfflineChatNew;
|
||||
if (!isChatLobby()) {
|
||||
std::list<ChatInfo> savedOfflineChatNew;
|
||||
|
||||
QString name = QString::fromUtf8(rsPeers->getPeerName(rsPeers->getOwnId()).c_str());
|
||||
QString name = QString::fromUtf8(rsPeers->getPeerName(rsPeers->getOwnId()).c_str());
|
||||
|
||||
std::list<ChatInfo> offlineChat;
|
||||
if (rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat)) {
|
||||
ui.actionClearOfflineMessages->setEnabled(true);
|
||||
std::list<ChatInfo> offlineChat;
|
||||
if (rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat)) {
|
||||
ui.actionClearOfflineMessages->setEnabled(true);
|
||||
|
||||
std::list<ChatInfo>::iterator it;
|
||||
for(it = offlineChat.begin(); it != offlineChat.end(); it++) {
|
||||
/* are they public? */
|
||||
if ((it->chatflags & RS_CHAT_PRIVATE) == 0) {
|
||||
/* this should not happen */
|
||||
continue;
|
||||
std::list<ChatInfo>::iterator it;
|
||||
for(it = offlineChat.begin(); it != offlineChat.end(); it++) {
|
||||
/* are they public? */
|
||||
if ((it->chatflags & RS_CHAT_PRIVATE) == 0) {
|
||||
/* this should not happen */
|
||||
continue;
|
||||
}
|
||||
|
||||
savedOfflineChatNew.push_back(*it);
|
||||
|
||||
if (std::find(savedOfflineChat.begin(), savedOfflineChat.end(), *it) != savedOfflineChat.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QDateTime sendTime = QDateTime::fromTime_t(it->sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(it->recvTime);
|
||||
QString message = QString::fromStdWString(it->msg);
|
||||
|
||||
addChatMsg(false, name, sendTime, recvTime, message, TYPE_OFFLINE);
|
||||
}
|
||||
|
||||
savedOfflineChatNew.push_back(*it);
|
||||
|
||||
if (std::find(savedOfflineChat.begin(), savedOfflineChat.end(), *it) != savedOfflineChat.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QDateTime sendTime = QDateTime::fromTime_t(it->sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(it->recvTime);
|
||||
QString message = QString::fromStdWString(it->msg);
|
||||
|
||||
addChatMsg(false, name, sendTime, recvTime, message, TYPE_OFFLINE);
|
||||
}
|
||||
}
|
||||
|
||||
savedOfflineChat = savedOfflineChatNew;
|
||||
savedOfflineChat = savedOfflineChatNew;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NOTIFY_TYPE_DEL:
|
||||
{
|
||||
if (manualDelete == false) {
|
||||
QString name = QString::fromUtf8(rsPeers->getPeerName(rsPeers->getOwnId()).c_str());
|
||||
if (!isChatLobby()) {
|
||||
if (manualDelete == false) {
|
||||
QString name = QString::fromUtf8(rsPeers->getPeerName(rsPeers->getOwnId()).c_str());
|
||||
|
||||
// now show saved offline chat messages as sent
|
||||
std::list<ChatInfo>::iterator it;
|
||||
for(it = savedOfflineChat.begin(); it != savedOfflineChat.end(); ++it) {
|
||||
QDateTime sendTime = QDateTime::fromTime_t(it->sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(it->recvTime);
|
||||
QString message = QString::fromStdWString(it->msg);
|
||||
// now show saved offline chat messages as sent
|
||||
std::list<ChatInfo>::iterator it;
|
||||
for(it = savedOfflineChat.begin(); it != savedOfflineChat.end(); ++it) {
|
||||
QDateTime sendTime = QDateTime::fromTime_t(it->sendTime);
|
||||
QDateTime recvTime = QDateTime::fromTime_t(it->recvTime);
|
||||
QString message = QString::fromStdWString(it->msg);
|
||||
|
||||
addChatMsg(false, name, sendTime, recvTime, message, TYPE_NORMAL);
|
||||
addChatMsg(false, name, sendTime, recvTime, message, TYPE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
savedOfflineChat.clear();
|
||||
savedOfflineChat.clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -619,18 +638,14 @@ void PopupChatDialog::insertChatMsgs()
|
||||
|
||||
playsound();
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
window->alertDialog(this);
|
||||
}
|
||||
emit newMessage(this);
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (isVisible() == false || (window && window->isActiveWindow() == false)) {
|
||||
newMessages = true;
|
||||
|
||||
if (window) {
|
||||
window->calculateTitle(this);
|
||||
}
|
||||
}
|
||||
|
||||
emit infoChanged(this);
|
||||
}
|
||||
|
||||
void PopupChatDialog::addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType)
|
||||
@ -962,7 +977,7 @@ void PopupChatDialog::clearOfflineMessages()
|
||||
|
||||
void PopupChatDialog::updateStatus_slot(const QString &peer_id, int status)
|
||||
{
|
||||
updateStatus(peer_id,status) ;
|
||||
updateStatus(peer_id, status);
|
||||
}
|
||||
|
||||
void PopupChatDialog::updateStatus(const QString &peer_id, int status)
|
||||
@ -1004,10 +1019,7 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
|
||||
|
||||
peerStatus = status;
|
||||
|
||||
PopupChatWindow *window = WINDOW(this);
|
||||
if (window) {
|
||||
window->calculateTitle(this);
|
||||
}
|
||||
emit infoChanged(this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
static void closeChat(const std::string &id);
|
||||
static void privateChatChanged(int list, int type);
|
||||
|
||||
void init();
|
||||
|
||||
void updateStatusString(const QString& peer_id, const QString& statusString);
|
||||
std::string getPeerId() { return dialogId; }
|
||||
QString getTitle() { return dialogName; }
|
||||
@ -61,6 +63,16 @@ public:
|
||||
const RSStyle &getStyle();
|
||||
virtual void updateStatus(const QString &peer_id, int status);
|
||||
|
||||
// derived in ChatLobbyDialog.
|
||||
//
|
||||
virtual bool hasPeerStatus() { return true; }
|
||||
virtual bool canClose() { return true; }
|
||||
|
||||
signals:
|
||||
void dialogClose(PopupChatDialog *dialog);
|
||||
void infoChanged(PopupChatDialog *dialog);
|
||||
void newMessage(PopupChatDialog *dialog);
|
||||
|
||||
public slots:
|
||||
void updateStatus_slot(const QString &peer_id, int status);
|
||||
|
||||
@ -71,16 +83,19 @@ protected:
|
||||
~PopupChatDialog();
|
||||
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
||||
void insertChatMsgs();
|
||||
void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType);
|
||||
|
||||
// derived in ChatLobbyDialog.
|
||||
//
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info) ;
|
||||
virtual QString makeStatusString(const QString& peer_id,const QString& status_string) const ;
|
||||
// derived in ChatLobbyDialog.
|
||||
//
|
||||
virtual bool addToParent();
|
||||
virtual bool isChatLobby() { return false; } // TODO: spilt into a good base class
|
||||
virtual void addIncomingChatMsg(const ChatInfo& info);
|
||||
virtual QString makeStatusString(const QString& peer_id, const QString& status_string) const;
|
||||
|
||||
private slots:
|
||||
void pasteLink() ;
|
||||
@ -150,7 +165,7 @@ private:
|
||||
RSStyle style;
|
||||
|
||||
protected:
|
||||
virtual bool sendPrivateChat(const std::wstring& msg) ; // can be derived to send chat to e.g. a chat lobby
|
||||
virtual bool sendPrivateChat(const std::wstring& msg) ; // can be derived to send chat to e.g. a chat lobby
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::PopupChatDialog ui;
|
||||
|
@ -88,8 +88,7 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WFlags flags)
|
||||
connect(ui.actionUndockTab, SIGNAL(triggered()), this, SLOT(undockTab()));
|
||||
connect(ui.actionSetOnTop, SIGNAL(toggled(bool)), this, SLOT(setOnTop()));
|
||||
|
||||
connect(ui.tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
|
||||
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabCurrentChanged(int)));
|
||||
connect(ui.tabWidget, SIGNAL(tabChanged(PopupChatDialog*)), this, SLOT(tabChanged(PopupChatDialog*)));
|
||||
|
||||
if (tabbedWindow) {
|
||||
/* signal toggled is called */
|
||||
@ -159,7 +158,7 @@ void PopupChatWindow::changeEvent(QEvent *event)
|
||||
void PopupChatWindow::addDialog(PopupChatDialog *dialog)
|
||||
{
|
||||
if (tabbedWindow) {
|
||||
ui.tabWidget->addTab(dialog, dialog->getTitle());
|
||||
ui.tabWidget->addDialog(dialog);
|
||||
} else {
|
||||
ui.horizontalLayout->addWidget(dialog);
|
||||
ui.horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
@ -170,15 +169,20 @@ void PopupChatWindow::addDialog(PopupChatDialog *dialog)
|
||||
/* signal toggled is called */
|
||||
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
|
||||
}
|
||||
|
||||
QObject::connect(dialog, SIGNAL(infoChanged(PopupChatDialog*)), this, SLOT(tabInfoChanged(PopupChatDialog*)));
|
||||
QObject::connect(dialog, SIGNAL(newMessage(PopupChatDialog*)), this, SLOT(tabNewMessage(PopupChatDialog*)));
|
||||
QObject::connect(dialog, SIGNAL(dialogClose(PopupChatDialog*)), this, SLOT(dialogClose(PopupChatDialog*)));
|
||||
}
|
||||
|
||||
void PopupChatWindow::removeDialog(PopupChatDialog *dialog)
|
||||
{
|
||||
QObject::disconnect(dialog, SIGNAL(infoChanged(PopupChatDialog*)), this, SLOT(tabInfoChanged(PopupChatDialog*)));
|
||||
QObject::disconnect(dialog, SIGNAL(newMessage(PopupChatDialog*)), this, SLOT(tabNewMessage(PopupChatDialog*)));
|
||||
QObject::disconnect(dialog, SIGNAL(dialogClose(PopupChatDialog*)), this, SLOT(dialogClose(PopupChatDialog*)));
|
||||
|
||||
if (tabbedWindow) {
|
||||
int tab = ui.tabWidget->indexOf(dialog);
|
||||
if (tab >= 0) {
|
||||
ui.tabWidget->removeTab(tab);
|
||||
}
|
||||
ui.tabWidget->removeDialog(dialog);
|
||||
|
||||
if (ui.tabWidget->count() == 0) {
|
||||
deleteLater();
|
||||
@ -220,39 +224,13 @@ void PopupChatWindow::alertDialog(PopupChatDialog */*dialog*/)
|
||||
|
||||
void PopupChatWindow::calculateTitle(PopupChatDialog *dialog)
|
||||
{
|
||||
if (dialog) {
|
||||
if (ui.tabWidget->isVisible()) {
|
||||
int tab = ui.tabWidget->indexOf(dialog);
|
||||
if (tab >= 0) {
|
||||
if (dialog->isTyping()) {
|
||||
ui.tabWidget->setTabIcon(tab, QIcon(IMAGE_TYPING));
|
||||
} else if (dialog->hasNewMessages()) {
|
||||
ui.tabWidget->setTabIcon(tab, QIcon(IMAGE_CHAT));
|
||||
} else {
|
||||
ui.tabWidget->setTabIcon(tab, QIcon(StatusDefs::imageIM(dialog->getPeerStatus())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool hasNewMessages = false;
|
||||
PopupChatDialog *pcd;
|
||||
|
||||
/* is typing */
|
||||
bool isTyping = false;
|
||||
if (ui.tabWidget->isVisible()) {
|
||||
int tabCount = ui.tabWidget->count();
|
||||
for (int i = 0; i < tabCount; i++) {
|
||||
pcd = dynamic_cast<PopupChatDialog*>(ui.tabWidget->widget(i));
|
||||
if (pcd) {
|
||||
if (pcd->isTyping()) {
|
||||
isTyping = true;
|
||||
}
|
||||
if (pcd->hasNewMessages()) {
|
||||
hasNewMessages = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui.tabWidget->getInfo(isTyping, hasNewMessages, NULL);
|
||||
} else {
|
||||
if (dialog) {
|
||||
isTyping = dialog->isTyping();
|
||||
@ -272,7 +250,7 @@ void PopupChatWindow::calculateTitle(PopupChatDialog *dialog)
|
||||
} else if (hasNewMessages) {
|
||||
icon = QIcon(IMAGE_CHAT);
|
||||
} else {
|
||||
if (pcd) {
|
||||
if (pcd && pcd->hasPeerStatus()) {
|
||||
icon = QIcon(StatusDefs::imageIM(pcd->getPeerStatus()));
|
||||
} else {
|
||||
icon = QIcon(IMAGE_WINDOW);
|
||||
@ -291,31 +269,32 @@ void PopupChatWindow::calculateTitle(PopupChatDialog *dialog)
|
||||
void PopupChatWindow::getAvatar()
|
||||
{
|
||||
QByteArray ba;
|
||||
if (misc::getOpenAvatarPicture(this, ba))
|
||||
{
|
||||
if (misc::getOpenAvatarPicture(this, ba)) {
|
||||
std::cerr << "Avatar image size = " << ba.size() << std::endl ;
|
||||
|
||||
rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()), ba.size()); // last char 0 included.
|
||||
}
|
||||
}
|
||||
|
||||
void PopupChatWindow::tabCloseRequested(int tab)
|
||||
void PopupChatWindow::dialogClose(PopupChatDialog *dialog)
|
||||
{
|
||||
QWidget *widget = ui.tabWidget->widget(tab);
|
||||
|
||||
if (widget) {
|
||||
widget->deleteLater();
|
||||
}
|
||||
removeDialog(dialog);
|
||||
}
|
||||
|
||||
void PopupChatWindow::tabCurrentChanged(int tab)
|
||||
void PopupChatWindow::tabChanged(PopupChatDialog *dialog)
|
||||
{
|
||||
PopupChatDialog *pcd = dynamic_cast<PopupChatDialog*>(ui.tabWidget->widget(tab));
|
||||
calculateStyle(dialog);
|
||||
calculateTitle(dialog);
|
||||
}
|
||||
|
||||
if (pcd) {
|
||||
pcd->activate();
|
||||
calculateStyle(pcd);
|
||||
}
|
||||
void PopupChatWindow::tabInfoChanged(PopupChatDialog *dialog)
|
||||
{
|
||||
calculateTitle(dialog);
|
||||
}
|
||||
|
||||
void PopupChatWindow::tabNewMessage(PopupChatDialog *dialog)
|
||||
{
|
||||
alertDialog(dialog);
|
||||
}
|
||||
|
||||
void PopupChatWindow::dockTab()
|
||||
|
@ -54,8 +54,10 @@ protected:
|
||||
|
||||
private slots:
|
||||
void getAvatar();
|
||||
void tabCloseRequested(int tab);
|
||||
void tabCurrentChanged(int tab);
|
||||
void tabChanged(PopupChatDialog *dialog);
|
||||
void tabInfoChanged(PopupChatDialog *dialog);
|
||||
void tabNewMessage(PopupChatDialog *dialog);
|
||||
void dialogClose(PopupChatDialog *dialog);
|
||||
void dockTab();
|
||||
void undockTab();
|
||||
void setStyle();
|
||||
|
@ -37,7 +37,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="ChatTabWidget" name="tabWidget">
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -147,6 +147,14 @@
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ChatTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header location="global">gui/chat/ChatTabWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
|
@ -380,9 +380,9 @@ void NotifyQt::notifyListChange(int list, int type)
|
||||
#endif
|
||||
emit privateChatChanged(list, type);
|
||||
break;
|
||||
case NOTIFY_LIST_PUBLIC_CHAT_LOBBY_LIST:
|
||||
std::cerr << "received notify public chat lobby list" << std::endl;
|
||||
emit publicLobbyListChanged();
|
||||
case NOTIFY_LIST_CHAT_LOBBY_LIST:
|
||||
std::cerr << "received notify chat lobby list" << std::endl;
|
||||
emit lobbyListChanged();
|
||||
|
||||
case NOTIFY_LIST_GROUPLIST:
|
||||
#ifdef NOTIFY_DEBUG
|
||||
|
@ -68,7 +68,7 @@ class NotifyQt: public QObject, public NotifyBase
|
||||
void filesPostModChanged(bool) const ;
|
||||
void transfersChanged() const ;
|
||||
void friendsChanged() const ;
|
||||
void publicLobbyListChanged() const ;
|
||||
void lobbyListChanged() const ;
|
||||
void chatLobbyEvent(qulonglong,int,const QString&,const QString&) ;
|
||||
void neighboursChanged() const ;
|
||||
void messagesChanged() const ;
|
||||
|
@ -127,8 +127,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
/* Login Dialog */
|
||||
/* check for existing Certificate */
|
||||
std::string userName;
|
||||
|
||||
StartDialog *sd = NULL;
|
||||
bool genCert = false;
|
||||
std::list<std::string> accountIds;
|
||||
@ -281,9 +279,6 @@ int main(int argc, char *argv[])
|
||||
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
|
||||
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
|
||||
QObject::connect(notify,SIGNAL(messagesChanged()) ,w ,SLOT(updateMessages() )) ;
|
||||
QObject::connect(notify,SIGNAL(chatLobbyInviteReceived()) ,w->friendsDialog ,SLOT(readChatLobbyInvites() )) ;
|
||||
QObject::connect(notify,SIGNAL(publicLobbyListChanged()) ,w->friendsDialog ,SLOT(updatePublicLobbyList() )) ;
|
||||
QObject::connect(notify,SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)),w->friendsDialog,SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&))) ;
|
||||
QObject::connect(notify,SIGNAL(forumsChanged()) ,w ,SLOT(updateForums() ), Qt::QueuedConnection);
|
||||
QObject::connect(notify,SIGNAL(channelsChanged(int)) ,w ,SLOT(updateChannels(int) ), Qt::QueuedConnection);
|
||||
QObject::connect(notify,SIGNAL(downloadCompleteCountChanged(int)) ,w ,SLOT(updateTransfers(int) ));
|
||||
|
Loading…
Reference in New Issue
Block a user