From bc43cb8cf0abeefe44b519779ba13512f57705b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Jan 2017 23:29:24 +0300 Subject: [PATCH 01/11] small gui tweaks --- .../src/gui/chat/ChatLobbyDialog.cpp | 36 ++++++++++++++++++- retroshare-gui/src/gui/chat/ChatLobbyDialog.h | 2 ++ retroshare-gui/src/gui/gxs/GxsIdDetails.cpp | 5 ++- .../src/gui/statistics/StatisticsWindow.cpp | 6 ++-- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index ac0578cbf..db2263964 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -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::iterator item; for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { @@ -288,6 +293,35 @@ void ChatLobbyDialog::banParticipant() } } +void ChatLobbyDialog::voteParticipant() +{ + 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) + { + std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl; + rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE); + + dynamic_cast(*item)->forceUpdate(); + + } + } +} void ChatLobbyDialog::init() { diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index 0dc9a7497..cab44d989 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -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; diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 13b0e1047..d5ceb1398 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -990,7 +990,10 @@ QString nickname ; } else comment += QString("
%1: %2").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "anonymous")); - + + 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/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) { From cc3b8bde52f87e42d2aaaad97f9ea82242c937f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Jan 2017 16:05:23 +0300 Subject: [PATCH 02/11] lobby id dialog - add vote neutral option --- .../src/gui/chat/ChatLobbyDialog.cpp | 66 +++++++------------ retroshare-gui/src/gui/chat/ChatLobbyDialog.h | 6 +- 2 files changed, 25 insertions(+), 47 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index db2263964..79fb6820a 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -88,7 +88,8 @@ 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); - voteAct = 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); @@ -107,9 +108,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(voteAct, SIGNAL(triggered()), this, SLOT(voteParticipant())); - + 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(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants())); connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants())); @@ -223,13 +225,15 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) contextMnu.addAction(actionSortByName); contextMnu.addSeparator(); contextMnu.addAction(muteAct); - contextMnu.addAction(voteAct); + contextMnu.addAction(votePositiveAct); + contextMnu.addAction(voteNeutralAct); contextMnu.addAction(banAct); muteAct->setCheckable(true); muteAct->setEnabled(false); muteAct->setChecked(false); - voteAct->setEnabled(false); + votePositiveAct->setEnabled(false); + voteNeutralAct->setEnabled(false); banAct->setEnabled(false); if (selectedItems.size()) @@ -240,8 +244,9 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) if(selectedItems.count()>1 || (RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName)) { muteAct->setEnabled(true); - banAct->setEnabled(true); - voteAct->setEnabled(true); + votePositiveAct->setEnabled(true); + voteNeutralAct->setEnabled(true); + banAct->setEnabled(true); QList::iterator item; for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { @@ -263,7 +268,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) /** * @brief Called when the "ban" menu is selected. Sets a negative reputation on the selected user. */ -void ChatLobbyDialog::banParticipant() +void ChatLobbyDialog::voteParticipant(int vote) { QList selectedItems = ui.participantsList->selectedItems(); @@ -284,41 +289,14 @@ void ChatLobbyDialog::banParticipant() if (gxs_id!=nickname) { - std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl; - rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE); - - dynamic_cast(*item)->forceUpdate(); - - } - } -} - -void ChatLobbyDialog::voteParticipant() -{ - 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) - { - std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl; - rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_POSITIVE); - - dynamic_cast(*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(*item)->forceUpdate(); } } } diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index cab44d989..de5a5055f 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -80,8 +80,7 @@ protected slots: void distantChatParticipant(); void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column); void sendMessage(); - void banParticipant(); - void voteParticipant(); + void voteParticipant(int vote); private: void updateParticipantsList(); @@ -109,8 +108,9 @@ private: std::set mutedParticipants; QAction *muteAct; + QAction *votePositiveAct; + QAction *voteNeutralAct; QAction *banAct; - QAction *voteAct; QAction *distantChatAct; QAction *actionSortByName; QAction *actionSortByActivity; From c2214c8cfacccea0ea944f2aa2515509e9f73edf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Jan 2017 18:22:47 +0300 Subject: [PATCH 03/11] chatlobby id menu - add open people tab for id --- .../src/gui/chat/ChatLobbyDialog.cpp | 70 +++++++++++++------ retroshare-gui/src/gui/chat/ChatLobbyDialog.h | 10 +-- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 79fb6820a..cc1cfa821 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 @@ -88,11 +89,12 @@ 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); actionSortByName->setCheckable(true); @@ -108,10 +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(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::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(*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(*item)->forceUpdate(); } } } +void ChatLobbyDialog::showInPeopleTab() +{ + QList selectedItems = ui.participantsList->selectedItems(); + if (selectedItems.count()!=1) + return; + QList::iterator item; + RsGxsId nickname; + for (item = selectedItems.begin(); item != selectedItems.end(); ++item) + { + dynamic_cast(*item)->getId(nickname) ; + } + IdDialog *idDialog = dynamic_cast(MainWindow::getPage(MainWindow::People)); + if (!idDialog) + return ; + MainWindow::showWindow(MainWindow::People); + idDialog->navigate(nickname); +} + void ChatLobbyDialog::init() { ChatLobbyInfo linfo ; diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index de5a5055f..94359802a 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,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,15 +109,16 @@ private: std::set 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 ; }; From 2bb7c8d0104fe6371a3f55e997ef7ad9c52a3d9c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Jan 2017 00:31:32 +0300 Subject: [PATCH 04/11] groups tree tooltips and info panels - add last post date info --- .../src/gui/common/GroupTreeWidget.cpp | 6 +- .../gui/gxschannels/GxsChannelPostsWidget.cpp | 5 ++ .../gui/gxschannels/GxsChannelPostsWidget.ui | 75 +++++++++---------- .../gui/gxsforums/GxsForumThreadWidget.cpp | 1 + 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 2009d55a5..c3d0ad479 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,11 @@ 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 + 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/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index dd5c39b50..109ab942a 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" @@ -266,6 +267,10 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) ui->infoDescription->clear(); } else { ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); + + 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..2317157fb 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui @@ -14,16 +14,7 @@ 4 - - 0 - - - 0 - - - 0 - - + 0 @@ -35,16 +26,7 @@ QFrame::Sunken - - 4 - - - 4 - - - 4 - - + 4 @@ -307,16 +289,7 @@ - - 3 - - - 3 - - - 3 - - + 3 @@ -397,7 +370,7 @@ - + @@ -429,14 +402,33 @@ - + + + + + 0 + 0 + + + + + 75 + true + + + + Last Post: + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Description</span></p></body></html> +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Description</span></p></body></html> Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse @@ -446,7 +438,7 @@ p, li { white-space: pre-wrap; } - + @@ -459,7 +451,7 @@ p, li { white-space: pre-wrap; } - + unknown @@ -473,7 +465,14 @@ p, li { white-space: pre-wrap; } - + + + + unknown + + + + @@ -486,7 +485,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 cc0890077..113cc8ecb 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -879,6 +879,7 @@ 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); + 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)); From 8365ac26470737205424d7cc3eb1ff8ec2fe0fb8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Jan 2017 00:46:29 +0300 Subject: [PATCH 05/11] Revert "groups tree tooltips and info panels - add last post date info" This reverts commit 2bb7c8d0104fe6371a3f55e997ef7ad9c52a3d9c. --- .../src/gui/common/GroupTreeWidget.cpp | 6 +- .../gui/gxschannels/GxsChannelPostsWidget.cpp | 5 -- .../gui/gxschannels/GxsChannelPostsWidget.ui | 75 ++++++++++--------- .../gui/gxsforums/GxsForumThreadWidget.cpp | 1 - 4 files changed, 40 insertions(+), 47 deletions(-) diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index c3d0ad479..2009d55a5 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -36,7 +36,6 @@ #include "gui/common/ElidedLabel.h" #include "gui/settings/rsharesettings.h" #include "util/QtVersion.h" -#include "util/DateTime.h" #include @@ -478,11 +477,10 @@ 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 - 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/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index 109ab942a..dd5c39b50 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -33,7 +33,6 @@ #include "gui/feeds/SubFileItem.h" #include "gui/notifyqt.h" #include -#include "util/DateTime.h" #define CHAN_DEFAULT_IMAGE ":/images/channels.png" @@ -267,10 +266,6 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) ui->infoDescription->clear(); } else { ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); - - 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 2317157fb..bdb6ca5d2 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.ui @@ -14,7 +14,16 @@ 4 - + + 0 + + + 0 + + + 0 + + 0 @@ -26,7 +35,16 @@ QFrame::Sunken - + + 4 + + + 4 + + + 4 + + 4 @@ -289,7 +307,16 @@ - + + 3 + + + 3 + + + 3 + + 3 @@ -370,7 +397,7 @@ - + @@ -402,33 +429,14 @@ - - - - - 0 - 0 - - - - - 75 - true - - - - Last Post: - - - - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Description</span></p></body></html> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Description</span></p></body></html> Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse @@ -438,7 +446,7 @@ p, li { white-space: pre-wrap; } - + @@ -451,7 +459,7 @@ p, li { white-space: pre-wrap; } - + unknown @@ -465,14 +473,7 @@ p, li { white-space: pre-wrap; } - - - - unknown - - - - + @@ -485,7 +486,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 113cc8ecb..cc0890077 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -879,7 +879,6 @@ 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); - 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)); From a954b19d8e05f6a3d982af86a41773ea33528d11 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Jan 2017 01:18:35 +0300 Subject: [PATCH 06/11] groups tree tooltips and info panels - add last post date info --- .../src/gui/common/GroupTreeWidget.cpp | 6 ++- .../gui/gxschannels/GxsChannelPostsWidget.cpp | 5 +++ .../gui/gxschannels/GxsChannelPostsWidget.ui | 38 ++++++++++++++++--- .../gui/gxsforums/GxsForumThreadWidget.cpp | 1 + 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 2009d55a5..50165aadd 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,11 @@ 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 + 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/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index dd5c39b50..109ab942a 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" @@ -266,6 +267,10 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) ui->infoDescription->clear(); } else { ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); + + 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 cc0890077..113cc8ecb 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -879,6 +879,7 @@ 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); + 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)); From 36dbdee4095cc72ebab5821cb1dc1806c8673ada Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Wed, 11 Jan 2017 22:44:27 +0300 Subject: [PATCH 07/11] show in people - enabled for yourself; Votes in tooltip; lastpost 1970 to Never --- retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp | 9 ++------- retroshare-gui/src/gui/common/GroupTreeWidget.cpp | 5 ++++- retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp | 5 ++++- retroshare-gui/src/gui/gxs/GxsIdDetails.cpp | 9 ++++++--- .../src/gui/gxschannels/GxsChannelPostsWidget.cpp | 12 ++++++------ .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 5 ++++- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index cc1cfa821..955174887 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -239,7 +239,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) votePositiveAct->setEnabled(false); voteNeutralAct->setEnabled(false); banAct->setEnabled(false); - showinpeopleAct->setEnabled(false); + showinpeopleAct->setEnabled(true); if (selectedItems.size()) { @@ -252,7 +252,6 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) votePositiveAct->setEnabled(true); voteNeutralAct->setEnabled(true); banAct->setEnabled(true); - showinpeopleAct->setEnabled(true); QList::iterator item; for (item = selectedItems.begin(); item != selectedItems.end(); ++item) { @@ -312,12 +311,8 @@ void ChatLobbyDialog::showInPeopleTab() QList selectedItems = ui.participantsList->selectedItems(); if (selectedItems.count()!=1) return; - QList::iterator item; RsGxsId nickname; - for (item = selectedItems.begin(); item != selectedItems.end(); ++item) - { - dynamic_cast(*item)->getId(nickname) ; - } + dynamic_cast(*selectedItems.begin())->getId(nickname); IdDialog *idDialog = dynamic_cast(MainWindow::getPage(MainWindow::People)); if (!idDialog) return ; diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp index 50165aadd..d37520c2f 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.cpp +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.cpp @@ -480,7 +480,10 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList< 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 - tooltip += "\n" + tr("Last Post") + ": " + DateTime::formatLongDateTime(itemInfo.lastpost) ; + 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") ; 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 d5ceb1398..1427ce3e5 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -991,9 +991,12 @@ QString nickname ; else comment += QString("
%1: %2").arg(QApplication::translate("GxsIdDetails", "Authentication"), QApplication::translate("GxsIdDetails", "anonymous")); - if(details.mReputation.mFriendsPositiveVotes > 0) comment += "
+" + QString::number(details.mReputation.mFriendsPositiveVotes) + ""; - if(details.mReputation.mFriendsNegativeVotes > 0) comment += "
-" + QString::number(details.mReputation.mFriendsNegativeVotes) + ""; - + 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 109ab942a..76c777607 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -266,12 +266,12 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) ui->infoPosts->clear(); ui->infoDescription->clear(); } else { - ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); - - ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost)); - - - 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/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 113cc8ecb..5130416d7 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -879,7 +879,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); - tw->mForumDescription += QString("%1: \t%2
").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost)); + 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)); From 10ba3a636430032ce030ba69b2068746c42ae7f5 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Thu, 12 Jan 2017 16:26:06 +0300 Subject: [PATCH 08/11] chatlobby id context menu - fix display conditions --- .../src/gui/chat/ChatLobbyDialog.cpp | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 955174887..932baab84 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -222,7 +222,7 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) QMenu contextMnu(this); contextMnu.addAction(distantChatAct); - contextMnu.addAction(sendMessageAct); + contextMnu.addAction(sendMessageAct); contextMnu.addSeparator(); contextMnu.addAction(actionSortByActivity); contextMnu.addAction(actionSortByName); @@ -233,40 +233,33 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) contextMnu.addAction(banAct); contextMnu.addAction(showinpeopleAct); + distantChatAct->setEnabled(false); + sendMessageAct->setEnabled(false); muteAct->setCheckable(true); muteAct->setEnabled(false); muteAct->setChecked(false); votePositiveAct->setEnabled(false); voteNeutralAct->setEnabled(false); banAct->setEnabled(false); - showinpeopleAct->setEnabled(true); - - if (selectedItems.size()) + if(selectedItems.count()==1) { + sendMessageAct->setEnabled(true); + showinpeopleAct->setEnabled(true); RsGxsId nickName; rsMsgs->getIdentityForChatLobby(lobbyId, nickName); - - 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); - - 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(rsIdentity->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_POSITIVE); + voteNeutralAct->setEnabled((rsIdentity->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_POSITIVE) || (rsIdentity->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_NEGATIVE) ); + banAct->setEnabled(rsIdentity->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_NEGATIVE); + muteAct->setEnabled(true); + if(isParticipantMuted(gxsid)) + muteAct->setChecked(true); + } } - contextMnu.exec(QCursor::pos()); } From 8ae9eff928cb2ef6e34edbe17c2a91ede4fe6513 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Thu, 12 Jan 2017 16:26:35 +0300 Subject: [PATCH 09/11] chatlobby id context menu - fix reputation change actions --- .../src/gui/chat/ChatLobbyDialog.cpp | 75 +++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 932baab84..850c7930d 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -110,9 +110,9 @@ 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(voteNeutralAct, SIGNAL(triggered()), this, SLOT(voteParticipant(0))); - connect(banAct, SIGNAL(triggered()), this, SLOT(voteParticipant(-1))); + 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())); @@ -263,37 +263,70 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) 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::voteParticipant(int vote) +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) { - 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; + rsReputations->setOwnOpinion(nickname, RsReputations::OPINION_NEGATIVE); + std::cerr << "Giving negative opinion to GXS id " << nickname << std::endl; dynamic_cast(*item)->forceUpdate(); } } From cef62e30fc0f36796155d833ecfe2716b354d0b1 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Fri, 13 Jan 2017 18:20:19 +0300 Subject: [PATCH 10/11] fix --- retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp | 5 ++--- retroshare-gui/src/gui/chat/ChatLobbyDialog.h | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 850c7930d..9eb72ab3f 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -234,17 +234,16 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) contextMnu.addAction(showinpeopleAct); distantChatAct->setEnabled(false); - sendMessageAct->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); + showinpeopleAct->setEnabled(selectedItems.count()==1); if(selectedItems.count()==1) { - sendMessageAct->setEnabled(true); - showinpeopleAct->setEnabled(true); RsGxsId nickName; rsMsgs->getIdentityForChatLobby(lobbyId, nickName); if(RsGxsId(selectedItems.at(0)->text(COLUMN_ID).toStdString())!=nickName) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h index 94359802a..9ca5f87ab 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h @@ -81,7 +81,9 @@ protected slots: void distantChatParticipant(); void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column); void sendMessage(); - void voteParticipant(int vote); + void voteParticipantPositive(); + void voteParticipantNeutral(); + void voteParticipantNegative(); private: void updateParticipantsList(); From 75d717c2df0a6207045e76b0951d22e1deb11a32 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Sun, 15 Jan 2017 20:29:59 +0300 Subject: [PATCH 11/11] fix --- retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp index 9eb72ab3f..1a02f0583 100644 --- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp @@ -251,9 +251,9 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint) distantChatAct->setEnabled(true); RsGxsId gxsid ; dynamic_cast(*selectedItems.begin())->getId(gxsid); - votePositiveAct->setEnabled(rsIdentity->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_POSITIVE); - voteNeutralAct->setEnabled((rsIdentity->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_POSITIVE) || (rsIdentity->overallReputationLevel(gxsid) == RsReputations::REPUTATION_LOCALLY_NEGATIVE) ); - banAct->setEnabled(rsIdentity->overallReputationLevel(gxsid) != RsReputations::REPUTATION_LOCALLY_NEGATIVE); + 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);