mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #630 from RetroPooh/master
small gui fixes in lobbies id menu and stats window
This commit is contained in:
commit
7e750d3161
@ -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>
|
||||
|
||||
@ -87,9 +88,12 @@ 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);
|
||||
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);
|
||||
@ -106,7 +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(banAct, SIGNAL(triggered()), this, SLOT(banParticipant()));
|
||||
connect(votePositiveAct, SIGNAL(triggered()), this, SLOT(voteParticipantPositive()));
|
||||
connect(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipantNeutral()));
|
||||
connect(banAct, SIGNAL(triggered()), this, SLOT(voteParticipantNegative()));
|
||||
connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab()));
|
||||
|
||||
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
@ -221,73 +228,122 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
|
||||
contextMnu.addAction(actionSortByName);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction(muteAct);
|
||||
contextMnu.addAction(votePositiveAct);
|
||||
contextMnu.addAction(voteNeutralAct);
|
||||
contextMnu.addAction(banAct);
|
||||
contextMnu.addAction(showinpeopleAct);
|
||||
|
||||
distantChatAct->setEnabled(false);
|
||||
sendMessageAct->setEnabled(selectedItems.count()==1);
|
||||
muteAct->setCheckable(true);
|
||||
muteAct->setEnabled(false);
|
||||
muteAct->setChecked(false);
|
||||
votePositiveAct->setEnabled(false);
|
||||
voteNeutralAct->setEnabled(false);
|
||||
banAct->setEnabled(false);
|
||||
|
||||
if (selectedItems.size())
|
||||
showinpeopleAct->setEnabled(selectedItems.count()==1);
|
||||
if(selectedItems.count()==1)
|
||||
{
|
||||
RsGxsId nickName;
|
||||
rsMsgs->getIdentityForChatLobby(lobbyId, nickName);
|
||||
|
||||
if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName))
|
||||
if(RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName)
|
||||
{
|
||||
muteAct->setEnabled(true);
|
||||
banAct->setEnabled(true);
|
||||
|
||||
QList<QTreeWidgetItem*>::iterator item;
|
||||
for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
|
||||
|
||||
distantChatAct->setEnabled(true);
|
||||
RsGxsId gxsid ;
|
||||
if ( dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->getId(gxsid) && isParticipantMuted(gxsid))
|
||||
{
|
||||
dynamic_cast<GxsIdRSTreeWidgetItem*>(*selectedItems.begin())->getId(gxsid);
|
||||
votePositiveAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_POSITIVE);
|
||||
voteNeutralAct->setEnabled((rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_POSITIVE) || (rsReputations->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_NEGATIVE) );
|
||||
banAct->setEnabled(rsReputations->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_NEGATIVE);
|
||||
muteAct->setEnabled(true);
|
||||
if(isParticipantMuted(gxsid))
|
||||
muteAct->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
distantChatAct->setEnabled(selectedItems.count()==1 && RsGxsId(selectedItems.front()->text(COLUMN_ID).toStdString())!=nickName) ;
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
void ChatLobbyDialog::voteParticipantPositive()
|
||||
{
|
||||
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)
|
||||
{
|
||||
rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE);
|
||||
std::cerr << "Giving positive opinion to GXS id " << nickname << std::endl;
|
||||
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::voteParticipantNeutral()
|
||||
{
|
||||
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)
|
||||
{
|
||||
rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEUTRAL);
|
||||
std::cerr << "Giving neutral opinion to GXS id " << nickname << std::endl;
|
||||
dynamic_cast<GxsIdRSTreeWidgetItem*>(*item)->forceUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called when the "ban" menu is selected. Sets a negative reputation on the selected user.
|
||||
*/
|
||||
void ChatLobbyDialog::banParticipant()
|
||||
void ChatLobbyDialog::voteParticipantNegative()
|
||||
{
|
||||
QList<QTreeWidgetItem*> selectedItems = ui.participantsList->selectedItems();
|
||||
|
||||
if (selectedItems.isEmpty()) {
|
||||
if (selectedItems.isEmpty())
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*>::iterator item;
|
||||
for (item = selectedItems.begin(); item != selectedItems.end(); ++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_NEGATIVE);
|
||||
|
||||
std::cerr << "Giving negative 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;
|
||||
RsGxsId nickname;
|
||||
dynamic_cast<GxsIdRSTreeWidgetItem*>(*selectedItems.begin())->getId(nickname);
|
||||
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
|
||||
if (!idDialog)
|
||||
return ;
|
||||
MainWindow::showWindow(MainWindow::People);
|
||||
idDialog->navigate(nickname);
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::init()
|
||||
{
|
||||
|
@ -54,6 +54,7 @@ private slots:
|
||||
void inviteFriends() ;
|
||||
void leaveLobby() ;
|
||||
void filterChanged(const QString &text);
|
||||
void showInPeopleTab();
|
||||
|
||||
signals:
|
||||
void lobbyLeave(ChatLobbyId) ;
|
||||
@ -80,7 +81,9 @@ protected slots:
|
||||
void distantChatParticipant();
|
||||
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
void sendMessage();
|
||||
void banParticipant();
|
||||
void voteParticipantPositive();
|
||||
void voteParticipantNeutral();
|
||||
void voteParticipantNegative();
|
||||
|
||||
private:
|
||||
void updateParticipantsList();
|
||||
@ -108,12 +111,15 @@ private:
|
||||
std::set<RsGxsId> mutedParticipants;
|
||||
|
||||
QAction *muteAct;
|
||||
QAction *votePositiveAct;
|
||||
QAction *voteNeutralAct;
|
||||
QAction *banAct;
|
||||
QAction *distantChatAct;
|
||||
QAction *actionSortByName;
|
||||
QAction *actionSortByActivity;
|
||||
QWidgetAction *checkableAction;
|
||||
QAction *sendMessageAct;
|
||||
QAction *showinpeopleAct;
|
||||
|
||||
GxsIdChooser *ownIdChooser ;
|
||||
};
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gui/common/ElidedLabel.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -477,10 +478,14 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
|
||||
tooltip += "\n" + tr("You have been granted as publisher (you can post here!)");
|
||||
|
||||
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
|
||||
{
|
||||
tooltip += "\n" + QString::number(itemInfo.max_visible_posts) + " messages available" ;
|
||||
// if(itemInfo.max_visible_posts) // wtf? this=0 when there are some posts definitely exist - lastpost is recent
|
||||
if(itemInfo.lastpost == QDateTime::fromTime_t(0))
|
||||
tooltip += "\n" + tr("Last Post") + ": " + tr("Never") ;
|
||||
else
|
||||
tooltip += "\n" + tr("Last Post") + ": " + DateTime::formatLongDateTime(itemInfo.lastpost) ;
|
||||
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
|
||||
tooltip += "\n" + tr("Subscribe to download and read messages") ;
|
||||
}
|
||||
|
||||
item->setToolTip(COLUMN_NAME, tooltip);
|
||||
item->setToolTip(COLUMN_UNREAD, tooltip);
|
||||
|
@ -416,6 +416,9 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
|
||||
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
|
||||
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
|
||||
if(mGrpMeta.mLastPost==0)
|
||||
ui.lastpostline->setText(tr("Never"));
|
||||
else
|
||||
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
|
||||
ui.authorLabel->setId(mGrpMeta.mAuthorId);
|
||||
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
|
||||
|
@ -991,6 +991,12 @@ QString nickname ;
|
||||
else
|
||||
comment += QString("<br/>%1: %2").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "anonymous"));
|
||||
|
||||
if(details.mReputation.mFriendsPositiveVotes || details.mReputation.mFriendsNegativeVotes)
|
||||
{
|
||||
comment += "<br/>Votes:";
|
||||
if(details.mReputation.mFriendsPositiveVotes > 0) comment += " <b>+" + QString::number(details.mReputation.mFriendsPositiveVotes) + "</b>";
|
||||
if(details.mReputation.mFriendsNegativeVotes > 0) comment += " <b>-" + QString::number(details.mReputation.mFriendsNegativeVotes) + "</b>";
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "gui/feeds/SubFileItem.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include <algorithm>
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||
|
||||
@ -266,6 +267,10 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
|
||||
ui->infoDescription->clear();
|
||||
} else {
|
||||
ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount));
|
||||
if(group.mMeta.mLastPost==0)
|
||||
ui->infoLastPost->setText(tr("Never"));
|
||||
else
|
||||
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
|
||||
ui->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str()));
|
||||
|
||||
ui->infoAdministrator->setId(group.mMeta.mAuthorId) ;
|
||||
|
@ -397,7 +397,7 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -429,7 +429,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="infoLastPostLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last Post:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QTextBrowser" name="infoDescription">
|
||||
<property name="html">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
@ -446,7 +465,7 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="infoDescriptionLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -459,7 +478,7 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="GxsIdLabel" name="infoAdministrator">
|
||||
<property name="text">
|
||||
<string>unknown</string>
|
||||
@ -473,7 +492,14 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="infoLastPost">
|
||||
<property name="text">
|
||||
<string notr="true">unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
@ -486,7 +512,7 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="infoDistribution">
|
||||
<property name="text">
|
||||
<string>unknown</string>
|
||||
|
@ -909,6 +909,10 @@ static QString getDurationString(uint32_t days)
|
||||
tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
|
||||
if(group.mMeta.mLastPost==0)
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(tr("Never"));
|
||||
else
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost));
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
|
||||
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user