small gui tweaks

This commit is contained in:
unknown 2017-01-07 23:29:24 +03:00
parent e895b6b357
commit bc43cb8cf0
4 changed files with 44 additions and 5 deletions

View File

@ -87,7 +87,8 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
ui.participantsList->setColumnHidden(COLUMN_ID,true);
muteAct = new QAction(QIcon(), tr("Mute participant"), this);
banAct = new QAction(QIcon(":/icons/yellow_biohazard64.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);
voteAct = 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);
@ -107,6 +108,7 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant()));
connect(sendMessageAct, SIGNAL(triggered()), this, SLOT(sendMessage()));
connect(banAct, SIGNAL(triggered()), this, SLOT(banParticipant()));
connect(voteAct, SIGNAL(triggered()), this, SLOT(voteParticipant()));
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
@ -221,11 +223,13 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
contextMnu.addAction(actionSortByName);
contextMnu.addSeparator();
contextMnu.addAction(muteAct);
contextMnu.addAction(voteAct);
contextMnu.addAction(banAct);
muteAct->setCheckable(true);
muteAct->setEnabled(false);
muteAct->setChecked(false);
voteAct->setEnabled(false);
banAct->setEnabled(false);
if (selectedItems.size())
@ -237,6 +241,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
{
muteAct->setEnabled(true);
banAct->setEnabled(true);
voteAct->setEnabled(true);
QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
@ -288,6 +293,35 @@ void ChatLobbyDialog::banParticipant()
}
}
void ChatLobbyDialog::voteParticipant()
{
QList<QTreeWidgetItem*> selectedItems = ui.participantsList->selectedItems();
if (selectedItems.isEmpty()) {
return;
}
QList<QTreeWidgetItem*>::iterator item;
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
RsGxsId nickname;
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->getId(nickname) ;
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
// This test avoids to mute/ban your own identity
if (gxs_id!=nickname)
{
std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl;
rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE);
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
}
}
}
void ChatLobbyDialog::init()
{

View File

@ -81,6 +81,7 @@ protected slots:
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
void sendMessage();
void banParticipant();
void voteParticipant();
private:
void updateParticipantsList();
@ -109,6 +110,7 @@ private:
QAction *muteAct;
QAction *banAct;
QAction *voteAct;
QAction *distantChatAct;
QAction *actionSortByName;
QAction *actionSortByActivity;

View File

@ -991,6 +991,9 @@ QString nickname ;
else
comment += QString("<br/>%1:&nbsp;%2").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "anonymous"));
if(details.mReputation.mFriendsPositiveVotes > 0) comment += "<br/><b>+" + QString::number(details.mReputation.mFriendsPositiveVotes) + "</b>";
if(details.mReputation.mFriendsNegativeVotes > 0) comment += "<br/><b>-" + QString::number(details.mReputation.mFriendsNegativeVotes) + "</b>";
return comment;
}

View File

@ -124,9 +124,6 @@ void StatisticsWindow::initStackedPage()
QActionGroup *grp = new QActionGroup(this);
QAction *action;
ui->stackPages->add(dhtw = new DhtWindow(ui->stackPages),
action = createPageAction(QIcon(IMAGE_DHT), tr("DHT"), grp));
ui->stackPages->add(bwdlg = new BwCtrlWindow(ui->stackPages),
action = createPageAction(QIcon(IMAGE_BANDWIDTH), tr("Bandwidth"), grp));
@ -139,6 +136,9 @@ void StatisticsWindow::initStackedPage()
ui->stackPages->add(rttdlg = new RttStatistics(ui->stackPages),
action = createPageAction(QIcon(IMAGE_RTT), tr("RTT Statistics"), grp));
ui->stackPages->add(dhtw = new DhtWindow(ui->stackPages),
action = createPageAction(QIcon(IMAGE_DHT), tr("DHT"), grp));
/*std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
{