diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index ac0578cbf..1a02f0583 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -48,6 +48,7 @@ #include "gui/gxs/GxsIdDetails.h" #include "util/HandleRichText.h" #include "gui/SoundManager.h" +#include "gui/Identity/IdDialog.h" #include @@ -87,10 +88,13 @@ 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); actionSortByName->setCheckable(true); @@ -106,8 +110,11 @@ 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())); @@ -215,79 +222,128 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) QMenu contextMnu(this); contextMnu.addAction(distantChatAct); - contextMnu.addAction(sendMessageAct); + contextMnu.addAction(sendMessageAct); contextMnu.addSeparator(); contextMnu.addAction(actionSortByActivity); 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); - banAct->setEnabled(false); - - if (selectedItems.size()) + muteAct->setEnabled(false); + muteAct->setChecked(false); + votePositiveAct->setEnabled(false); + voteNeutralAct->setEnabled(false); + banAct->setEnabled(false); + 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)) - { - muteAct->setEnabled(true); - banAct->setEnabled(true); - - QList::iterator item; - for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { - - RsGxsId gxsid ; - if ( dynamic_cast(*item)->getId(gxsid) && isParticipantMuted(gxsid)) - { - muteAct->setChecked(true); - break; - } - } - } - distantChatAct->setEnabled(selectedItems.count()==1 && RsGxsId(selectedItems.front()->text(COLUMN_ID).toStdString())!=nickName) ; + if(RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName) + { + distantChatAct->setEnabled(true); + RsGxsId gxsid ; + dynamic_cast(*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); + } } - contextMnu.exec(QCursor::pos()); } +void ChatLobbyDialog::voteParticipantPositive() +{ + QList selectedItems = ui.participantsList->selectedItems(); + if (selectedItems.isEmpty()) + return; + QList::iterator item; + for (item = selectedItems.begin(); item != selectedItems.end(); ++item) + { + RsGxsId nickname; + dynamic_cast(*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(*item)->forceUpdate(); + } + } +} + +void ChatLobbyDialog::voteParticipantNeutral() +{ + QList selectedItems = ui.participantsList->selectedItems(); + if (selectedItems.isEmpty()) + return; + QList::iterator item; + for (item = selectedItems.begin(); item != selectedItems.end(); ++item) + { + RsGxsId nickname; + dynamic_cast(*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(*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 selectedItems = ui.participantsList->selectedItems(); - - if (selectedItems.isEmpty()) { + if (selectedItems.isEmpty()) return; - } - QList::iterator item; - for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { - - RsGxsId nickname; + for (item = selectedItems.begin(); item != selectedItems.end(); ++item) + { + RsGxsId nickname; dynamic_cast(*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_NEGATIVE); std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl; - rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE); - - dynamic_cast(*item)->forceUpdate(); - + dynamic_cast(*item)->forceUpdate(); } } } +void ChatLobbyDialog::showInPeopleTab() +{ + QList selectedItems = ui.participantsList->selectedItems(); + if (selectedItems.count()!=1) + return; + RsGxsId nickname; + dynamic_cast(*selectedItems.begin())->getId(nickname); + IdDialog *idDialog = dynamic_cast(MainWindow::getPage(MainWindow::People)); + if (!idDialog) + return ; + MainWindow::showWindow(MainWindow::People); + idDialog->navigate(nickname); +} void ChatLobbyDialog::init() { diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index 0dc9a7497..9ca5f87ab 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -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,13 +111,16 @@ private: std::set mutedParticipants; QAction *muteAct; + QAction *votePositiveAct; + QAction *voteNeutralAct; QAction *banAct; QAction *distantChatAct; QAction *actionSortByName; QAction *actionSortByActivity; QWidgetAction *checkableAction; QAction *sendMessageAct; - + QAction *showinpeopleAct; + GxsIdChooser *ownIdChooser ; }; diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 2009d55a5..d37520c2f 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -36,6 +36,7 @@ #include "gui/common/ElidedLabel.h" #include "gui/settings/rsharesettings.h" #include "util/QtVersion.h" +#include "util/DateTime.h" #include @@ -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); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index 803c0f6df..b18ab3688 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -416,7 +416,10 @@ 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)); - ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost)); + 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())); ui.descriptiontextEdit->setPlainText(description); diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 13b0e1047..1427ce3e5 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -990,7 +990,13 @@ QString nickname ; } else comment += QString("
%1: %2").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "anonymous")); - + + if(details.mReputation.mFriendsPositiveVotes || details.mReputation.mFriendsNegativeVotes) + { + comment += "
Votes:"; + if(details.mReputation.mFriendsPositiveVotes > 0) comment += " +" + QString::number(details.mReputation.mFriendsPositiveVotes) + ""; + if(details.mReputation.mFriendsNegativeVotes > 0) comment += " -" + QString::number(details.mReputation.mFriendsNegativeVotes) + ""; + } return comment; } diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index dd5c39b50..76c777607 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -33,6 +33,7 @@ #include "gui/feeds/SubFileItem.h" #include "gui/notifyqt.h" #include +#include "util/DateTime.h" #define CHAN_DEFAULT_IMAGE ":/images/channels.png" @@ -265,8 +266,12 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) ui->infoPosts->clear(); ui->infoDescription->clear(); } else { - ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); - ui->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str())); + 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) ; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui index bdb6ca5d2..e93296003 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui @@ -397,7 +397,7 @@ - + @@ -429,7 +429,26 @@ - + + + + + 0 + 0 + + + + + 75 + true + + + + Last Post: + + + + <!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; } - + @@ -459,7 +478,7 @@ p, li { white-space: pre-wrap; } - + unknown @@ -473,7 +492,14 @@ p, li { white-space: pre-wrap; } - + + + + unknown + + + + @@ -486,7 +512,7 @@ p, li { white-space: pre-wrap; } - + unknown diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 2ba84ac18..9f0c5040d 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -909,6 +909,10 @@ static QString getDurationString(uint32_t days) tw->mForumDescription = QString("%1: \t%2
").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str())); tw->mForumDescription += QString("%1: \t%2
").arg(tr("Subscribers")).arg(group.mMeta.mPop); tw->mForumDescription += QString("%1: \t%2
").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount); + if(group.mMeta.mLastPost==0) + tw->mForumDescription += QString("%1: \t%2
").arg(tr("Last post")).arg(tr("Never")); + else + tw->mForumDescription += QString("%1: \t%2
").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost)); tw->mForumDescription += QString("%1: \t%2
").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ; tw->mForumDescription += QString("%1: \t%2
").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400)); diff --git a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp index 50381ec30..d4618f5a4 100644 --- a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp +++ b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp @@ -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;inbPlugins();++i) {