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>
@ -88,10 +89,11 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
muteAct = new QAction(QIcon(), tr("Mute participant"), this); muteAct = new QAction(QIcon(), tr("Mute participant"), this);
banAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this); banAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this);
voteNeutralAct = new QAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Give neutral opinion"), this); voteNeutralAct = new QAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Give neutral opinion"), this);
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);
@ -108,9 +110,10 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState())); connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState()));
connect(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant())); connect(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant()));
connect(sendMessageAct, SIGNAL(triggered()), this, SLOT(sendMessage())); connect(sendMessageAct, SIGNAL(triggered()), this, SLOT(sendMessage()));
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()));
@ -225,16 +228,18 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(actionSortByName); contextMnu.addAction(actionSortByName);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction(muteAct); contextMnu.addAction(muteAct);
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);
muteAct->setChecked(false); muteAct->setChecked(false);
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())
{ {
@ -244,9 +249,10 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName)) if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName))
{ {
muteAct->setEnabled(true); muteAct->setEnabled(true);
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) {
@ -289,18 +295,36 @@ void ChatLobbyDialog::voteParticipant(int vote)
if (gxs_id!=nickname) if (gxs_id!=nickname)
{ {
switch(vote) switch(vote)
{ {
case 1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE); case 1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE);
case -1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE); case -1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE);
default: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEUTRAL); default: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEUTRAL);
} }
std::cerr << "Giving " << vote << " opinion to GXS id " << nickname << std::endl; std::cerr << "Giving " << vote << " opinion to GXS id " << nickname << std::endl;
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate(); dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
} }
} }
} }
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) ;
@ -80,7 +81,7 @@ protected slots:
void distantChatParticipant(); void distantChatParticipant();
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column); void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
void sendMessage(); void sendMessage();
void voteParticipant(int vote); void voteParticipant(int vote);
private: private:
void updateParticipantsList(); void updateParticipantsList();
@ -108,14 +109,15 @@ private:
std::set<RsGxsId> mutedParticipants; std::set<RsGxsId> mutedParticipants;
QAction *muteAct; QAction *muteAct;
QAction *votePositiveAct; QAction *votePositiveAct;
QAction *voteNeutralAct; QAction *voteNeutralAct;
QAction *banAct; QAction *banAct;
QAction *distantChatAct; QAction *distantChatAct;
QAction *actionSortByName; QAction *actionSortByName;
QAction *actionSortByActivity; QAction *actionSortByActivity;
QWidgetAction *checkableAction; QWidgetAction *checkableAction;
QAction *sendMessageAct; QAction *sendMessageAct;
QAction *showinpeopleAct;
GxsIdChooser *ownIdChooser ; GxsIdChooser *ownIdChooser ;
}; };