mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
gui: chat: add power to vote distant participant
If identity got deleted, then banned one should start this distant conversation, if i am not mistaken.
This commit is contained in:
parent
c6c6e11bec
commit
ed0ea3aa01
@ -27,8 +27,8 @@
|
||||
#include "ChatDialog.h"
|
||||
#include "PopupChatWindow.h"
|
||||
|
||||
Q_DECLARE_METATYPE(RsGxsId)
|
||||
Q_DECLARE_METATYPE(QList<RsGxsId>)
|
||||
// Q_DECLARE_METATYPE(RsGxsId)
|
||||
// Q_DECLARE_METATYPE(QList<RsGxsId>)
|
||||
|
||||
class GxsIdChooser ;
|
||||
class QToolButton;
|
||||
@ -101,7 +101,7 @@ private:
|
||||
void muteParticipant(const RsGxsId& id);
|
||||
void unMuteParticipant(const RsGxsId& id);
|
||||
bool isNicknameInLobby(const RsGxsId& id);
|
||||
|
||||
|
||||
ChatLobbyId lobbyId;
|
||||
QString _lobby_name ;
|
||||
time_t lastUpdateListTime;
|
||||
@ -117,7 +117,7 @@ private:
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::ChatLobbyDialog ui;
|
||||
|
||||
|
||||
/** Ignored Users in Chatlobby by nickname until we had implemented Peer Ids in ver 0.6 */
|
||||
std::set<RsGxsId> mutedParticipants;
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "util/misc.h"
|
||||
#include "rshare.h"
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
|
||||
@ -100,6 +101,17 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WindowFlags f
|
||||
|
||||
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
|
||||
|
||||
voteNegative = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/png/thumbs-down.png"),
|
||||
tr("Ban this person (Sets negative opinion)"), this);
|
||||
voteNeutral = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/png/thumbs-neutral.png"),
|
||||
tr("Give neutral opinion"), this);
|
||||
votePositive = new QAction(FilesDefs::getIconFromQtResourcePath(":/icons/png/thumbs-up.png"),
|
||||
tr("Give positive opinion"), this);
|
||||
|
||||
connect(votePositive, SIGNAL(triggered()), this, SLOT(voteParticipant()));
|
||||
connect(voteNeutral, SIGNAL(triggered()), this, SLOT(voteParticipant()));
|
||||
connect(voteNegative, SIGNAL(triggered()), this, SLOT(voteParticipant()));
|
||||
|
||||
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
|
||||
connect(ui.tabWidget, SIGNAL(tabClosed(ChatDialog*)), this, SLOT(tabClosed(ChatDialog*)));
|
||||
|
||||
@ -116,6 +128,37 @@ void PopupChatWindow::showContextMenu(QPoint)
|
||||
QMenu contextMnu(this);
|
||||
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/highlight.png"),tr("Choose window color..."),this,SLOT(setStyle()));
|
||||
|
||||
ChatId ch_id = getCurrentDialog()->getChatId();
|
||||
if (ch_id.isDistantChatId()) {
|
||||
DistantChatPeerId dc_id = ch_id.toDistantChatId();
|
||||
DistantChatPeerInfo dc_info;
|
||||
if(rsMsgs->getDistantChatStatus(dc_id, dc_info)) {
|
||||
RsGxsId gxs_id = dc_info.to_id;
|
||||
if(!gxs_id.isNull() && !rsIdentity->isOwnId(gxs_id)) {
|
||||
contextMnu.addAction(votePositive);
|
||||
contextMnu.addAction(voteNeutral);
|
||||
contextMnu.addAction(voteNegative);
|
||||
|
||||
votePositive->setEnabled(false);
|
||||
voteNeutral ->setEnabled(false);
|
||||
voteNegative->setEnabled(false);
|
||||
|
||||
RsOpinion rs_rep;
|
||||
rsReputations->getOwnOpinion(gxs_id, rs_rep);
|
||||
if (rsReputations->getOwnOpinion(gxs_id, rs_rep)) {
|
||||
votePositive->setEnabled(rs_rep != RsOpinion::POSITIVE);
|
||||
voteNeutral->setEnabled( ( rs_rep == RsOpinion::POSITIVE )
|
||||
|| ( rs_rep == RsOpinion::NEGATIVE ) );
|
||||
voteNegative->setEnabled(rs_rep != RsOpinion::NEGATIVE);
|
||||
|
||||
votePositive->setData(QVariant::fromValue(gxs_id));
|
||||
voteNeutral ->setData(QVariant::fromValue(gxs_id));
|
||||
voteNegative->setData(QVariant::fromValue(gxs_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW)
|
||||
{
|
||||
if(tabbedWindow)
|
||||
@ -457,3 +500,17 @@ void PopupChatWindow::blink(bool on)
|
||||
setWindowIcon(on ? mBlinkIcon : *mEmptyIcon);
|
||||
}
|
||||
}
|
||||
|
||||
void PopupChatWindow::voteParticipant()
|
||||
{
|
||||
QAction *act = dynamic_cast<QAction*>(sender()) ;
|
||||
if (!act) {
|
||||
return ;
|
||||
}
|
||||
|
||||
RsOpinion opinion = RsOpinion::NEUTRAL;
|
||||
if (act == voteNeutral) opinion = RsOpinion::NEUTRAL;
|
||||
if (act == votePositive) opinion = RsOpinion::POSITIVE;
|
||||
if (act == voteNegative) opinion = RsOpinion::NEGATIVE;
|
||||
rsReputations->setOwnOpinion(act->data().value<RsGxsId>(), opinion);
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "ui_PopupChatWindow.h"
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
Q_DECLARE_METATYPE(RsGxsId)
|
||||
Q_DECLARE_METATYPE(QList<RsGxsId>)
|
||||
|
||||
class ChatDialog;
|
||||
|
||||
@ -67,6 +69,7 @@ private slots:
|
||||
void setOnTop();
|
||||
void blink(bool on);
|
||||
void showContextMenu(QPoint p);
|
||||
void voteParticipant();
|
||||
|
||||
private:
|
||||
bool tabbedWindow;
|
||||
@ -75,6 +78,9 @@ private:
|
||||
ChatDialog *chatDialog;
|
||||
QIcon mBlinkIcon;
|
||||
QIcon *mEmptyIcon;
|
||||
QAction* votePositive;
|
||||
QAction* voteNegative;
|
||||
QAction* voteNeutral;
|
||||
|
||||
ChatDialog *getCurrentDialog();
|
||||
void saveSettings();
|
||||
|
Loading…
Reference in New Issue
Block a user