chatlobby id menu - add open people tab for id

This commit is contained in:
unknown 2017-01-09 18:22:47 +03:00
parent cc3b8bde52
commit c2214c8cfa
2 changed files with 53 additions and 27 deletions

View File

@ -48,6 +48,7 @@
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "gui/Identity/IdDialog.h"
#include <retroshare/rsnotify.h> #include <retroshare/rsnotify.h>
@ -92,6 +93,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive opinion"), this); votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive opinion"), this);
distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this); distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this);
sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this); sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this);
showinpeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this);
QActionGroup *sortgrp = new QActionGroup(this); QActionGroup *sortgrp = new QActionGroup(this);
actionSortByName = new QAction(QIcon(), tr("Sort by Name"), this); actionSortByName = new QAction(QIcon(), tr("Sort by Name"), this);
@ -111,6 +113,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(votePositiveAct, SIGNAL(triggered()), this, SLOT(voteParticipant(1))); connect(votePositiveAct, SIGNAL(triggered()), this, SLOT(voteParticipant(1)));
connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant(0))); connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant(0)));
connect(banAct, SIGNAL(triggered()), this, SLOT(voteParticipant(-1))); connect(banAct, SIGNAL(triggered()), this, SLOT(voteParticipant(-1)));
connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants())); connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants())); connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
@ -228,6 +231,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(votePositiveAct); contextMnu.addAction(votePositiveAct);
contextMnu.addAction(voteNeutralAct); contextMnu.addAction(voteNeutralAct);
contextMnu.addAction(banAct); contextMnu.addAction(banAct);
contextMnu.addAction(showinpeopleAct);
muteAct->setCheckable(true); muteAct->setCheckable(true);
muteAct->setEnabled(false); muteAct->setEnabled(false);
@ -235,6 +239,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
votePositiveAct->setEnabled(false); votePositiveAct->setEnabled(false);
voteNeutralAct->setEnabled(false); voteNeutralAct->setEnabled(false);
banAct->setEnabled(false); banAct->setEnabled(false);
showinpeopleAct->setEnabled(false);
if (selectedItems.size()) if (selectedItems.size())
{ {
@ -247,6 +252,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
votePositiveAct->setEnabled(true); votePositiveAct->setEnabled(true);
voteNeutralAct->setEnabled(true); voteNeutralAct->setEnabled(true);
banAct->setEnabled(true); banAct->setEnabled(true);
showinpeopleAct->setEnabled(true);
QList<QTreeWidgetItem*>::iterator item; QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
@ -301,6 +307,24 @@ void ChatLobbyDialog::voteParticipant(int vote)
} }
} }
void ChatLobbyDialog::showInPeopleTab()
{
QList<QTreeWidgetItem*> selectedItems = ui.participantsList->selectedItems();
if (selectedItems.count()!=1)
return;
QList<QTreeWidgetItem*>::iterator item;
RsGxsId nickname;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item)
{
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->getId(nickname) ;
}
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
if (!idDialog)
return ;
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(nickname);
}
void ChatLobbyDialog::init() void ChatLobbyDialog::init()
{ {
ChatLobbyInfo linfo ; ChatLobbyInfo linfo ;

View File

@ -54,6 +54,7 @@ private slots:
void inviteFriends() ; void inviteFriends() ;
void leaveLobby() ; void leaveLobby() ;
void filterChanged(const QString &text); void filterChanged(const QString &text);
void showInPeopleTab();
signals: signals:
void lobbyLeave(ChatLobbyId) ; void lobbyLeave(ChatLobbyId) ;
@ -116,6 +117,7 @@ private:
QAction *actionSortByActivity; QAction *actionSortByActivity;
QWidgetAction *checkableAction; QWidgetAction *checkableAction;
QAction *sendMessageAct; QAction *sendMessageAct;
QAction *showinpeopleAct;
GxsIdChooser *ownIdChooser ; GxsIdChooser *ownIdChooser ;
}; };