mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
chatlobby id menu - add open people tab for id
This commit is contained in:
parent
cc3b8bde52
commit
c2214c8cfa
@ -48,6 +48,7 @@
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "gui/SoundManager.h"
|
||||
#include "gui/Identity/IdDialog.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);
|
||||
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);
|
||||
votePositiveAct = new QAction(QIcon(":/icons/png/thumbs-up.png"), tr("Give positive 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);
|
||||
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);
|
||||
showinpeopleAct = new QAction(QIcon(), tr("Show author in people tab"), this);
|
||||
|
||||
QActionGroup *sortgrp = new QActionGroup(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(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant()));
|
||||
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(banAct, SIGNAL(triggered()), this, SLOT(voteParticipant(-1)));
|
||||
connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
|
||||
|
||||
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
@ -225,16 +228,18 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
|
||||
contextMnu.addAction(actionSortByName);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(muteAct);
|
||||
contextMnu.addAction(votePositiveAct);
|
||||
contextMnu.addAction(voteNeutralAct);
|
||||
contextMnu.addAction(votePositiveAct);
|
||||
contextMnu.addAction(voteNeutralAct);
|
||||
contextMnu.addAction(banAct);
|
||||
contextMnu.addAction(showinpeopleAct);
|
||||
|
||||
muteAct->setCheckable(true);
|
||||
muteAct->setEnabled(false);
|
||||
muteAct->setChecked(false);
|
||||
votePositiveAct->setEnabled(false);
|
||||
voteNeutralAct->setEnabled(false);
|
||||
banAct->setEnabled(false);
|
||||
muteAct->setEnabled(false);
|
||||
muteAct->setChecked(false);
|
||||
votePositiveAct->setEnabled(false);
|
||||
voteNeutralAct->setEnabled(false);
|
||||
banAct->setEnabled(false);
|
||||
showinpeopleAct->setEnabled(false);
|
||||
|
||||
if (selectedItems.size())
|
||||
{
|
||||
@ -244,9 +249,10 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
|
||||
if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName))
|
||||
{
|
||||
muteAct->setEnabled(true);
|
||||
votePositiveAct->setEnabled(true);
|
||||
voteNeutralAct->setEnabled(true);
|
||||
banAct->setEnabled(true);
|
||||
votePositiveAct->setEnabled(true);
|
||||
voteNeutralAct->setEnabled(true);
|
||||
banAct->setEnabled(true);
|
||||
showinpeopleAct->setEnabled(true);
|
||||
|
||||
QList<QTreeWidgetItem*>::iterator item;
|
||||
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
|
||||
@ -289,18 +295,36 @@ void ChatLobbyDialog::voteParticipant(int vote)
|
||||
|
||||
if (gxs_id!=nickname)
|
||||
{
|
||||
switch(vote)
|
||||
{
|
||||
case 1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE);
|
||||
case -1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE);
|
||||
default: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEUTRAL);
|
||||
}
|
||||
std::cerr << "Giving " << vote << " opinion to GXS id " << nickname << std::endl;
|
||||
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
|
||||
switch(vote)
|
||||
{
|
||||
case 1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE);
|
||||
case -1: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE);
|
||||
default: rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEUTRAL);
|
||||
}
|
||||
std::cerr << "Giving " << vote << " opinion to GXS id " << nickname << std::endl;
|
||||
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()
|
||||
{
|
||||
ChatLobbyInfo linfo ;
|
||||
|
@ -54,6 +54,7 @@ private slots:
|
||||
void inviteFriends() ;
|
||||
void leaveLobby() ;
|
||||
void filterChanged(const QString &text);
|
||||
void showInPeopleTab();
|
||||
|
||||
signals:
|
||||
void lobbyLeave(ChatLobbyId) ;
|
||||
@ -80,7 +81,7 @@ protected slots:
|
||||
void distantChatParticipant();
|
||||
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void sendMessage();
|
||||
void voteParticipant(int vote);
|
||||
void voteParticipant(int vote);
|
||||
|
||||
private:
|
||||
void updateParticipantsList();
|
||||
@ -108,14 +109,15 @@ private:
|
||||
std::set<RsGxsId> mutedParticipants;
|
||||
|
||||
QAction *muteAct;
|
||||
QAction *votePositiveAct;
|
||||
QAction *voteNeutralAct;
|
||||
QAction *votePositiveAct;
|
||||
QAction *voteNeutralAct;
|
||||
QAction *banAct;
|
||||
QAction *distantChatAct;
|
||||
QAction *actionSortByName;
|
||||
QAction *actionSortByActivity;
|
||||
QWidgetAction *checkableAction;
|
||||
QAction *sendMessageAct;
|
||||
QAction *showinpeopleAct;
|
||||
|
||||
GxsIdChooser *ownIdChooser ;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user