Enabled sorting for gxs transport statistics, view details & small changes

* Enabled sorting for gxs transport statistics
* Context menu to view author details on gxs transport groups
* ui layout  fixes for view boards details
* Display counting for people tree
This commit is contained in:
defnax 2020-06-04 19:38:46 +02:00
parent b29abaf67b
commit 58cfbbd823
5 changed files with 270 additions and 206 deletions

View File

@ -1576,6 +1576,14 @@ void IdDialog::loadIdentities(const std::map<RsGxsGroupId,RsGxsIdGroup>& ids_set
int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount(); int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount();
ui->label_count->setText( "(" + QString::number( itemCount ) + ")" ); ui->label_count->setText( "(" + QString::number( itemCount ) + ")" );
int contactsCount = contactsItem->childCount() ;
int allCount = allItem->childCount() ;
int ownCount = ownItem->childCount();
contactsItem->setText(0, tr("My contacts") + " (" + QString::number( contactsCount ) + ")" );
allItem->setText(0, tr("All") + " (" + QString::number( allCount ) + ")" );
ownItem->setText(0, tr("My own identities") + " (" + QString::number( ownCount ) + ")" );
navigate(RsGxsId(oldCurrentId)); navigate(RsGxsId(oldCurrentId));
filterIds(); filterIds();
updateSelection(); updateSelection();

View File

@ -298,199 +298,10 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/png/postedlinks.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="topMargin"> <property name="topMargin">
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="poplabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="infoPostsLabel">
<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>Posts</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Administrator:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="3" 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="3" column="1">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -503,7 +314,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QTextBrowser" name="infoDescription"> <widget class="QTextBrowser" name="infoDescription">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
@ -526,6 +337,194 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="topMargin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="poplabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="infoPostsLabel">
<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>Posts</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Administrator:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="4" 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="4" column="1">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/png/postedlinks.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -49,6 +49,8 @@
#include "gui/gxs/GxsIdLabel.h" #include "gui/gxs/GxsIdLabel.h"
#include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h" #include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "gui/Identity/IdDialog.h"
#include "gui/MainWindow.h"
#define COL_PENDING_ID 0 #define COL_PENDING_ID 0
#define COL_PENDING_DESTINATION 1 #define COL_PENDING_DESTINATION 1
@ -61,11 +63,13 @@
#define COL_PENDING_DESTINATION_ID 8 #define COL_PENDING_DESTINATION_ID 8
#define COL_GROUP_GRP_ID 0 #define COL_GROUP_GRP_ID 0
#define COL_GROUP_NUM_MSGS 1 #define COL_GROUP_PUBLISHTS 1
#define COL_GROUP_SIZE_MSGS 2 #define COL_GROUP_NUM_MSGS 2
#define COL_GROUP_SUBSCRIBED 3 #define COL_GROUP_SIZE_MSGS 3
#define COL_GROUP_POPULARITY 4 #define COL_GROUP_SUBSCRIBED 4
#define COL_GROUP_UNIQUE_ID 5 #define COL_GROUP_POPULARITY 5
#define COL_GROUP_UNIQUE_ID 6
#define COL_GROUP_AUTHOR_ID 7
//static const int PARTIAL_VIEW_SIZE = 9 ; //static const int PARTIAL_VIEW_SIZE = 9 ;
//static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; //static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
@ -94,8 +98,10 @@ GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
QHeaderView_setSectionResizeMode(groupTreeWidget->header(), QHeaderView::ResizeToContents); QHeaderView_setSectionResizeMode(groupTreeWidget->header(), QHeaderView::ResizeToContents);
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint))); connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint)));
connect(groupTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenuGroups(QPoint)));
treeWidget->setColumnHidden(COL_PENDING_DESTINATION_ID,true); treeWidget->setColumnHidden(COL_PENDING_DESTINATION_ID,true);
groupTreeWidget->setColumnHidden(COL_GROUP_AUTHOR_ID,true);
// load settings // load settings
processSettings(true); processSettings(true);
@ -146,6 +152,19 @@ void GxsTransportStatistics::CustomPopupMenu( QPoint )
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
void GxsTransportStatistics::CustomPopupMenuGroups( QPoint )
{
QMenu contextMnu( this );
QTreeWidgetItem *item = groupTreeWidget->currentItem();
if (item) {
contextMnu.addAction(QIcon(":/images/info16.png"), tr("View details"), this, SLOT(showAuthorInPeople()));
}
contextMnu.exec(QCursor::pos());
}
void GxsTransportStatistics::updateDisplay(bool) void GxsTransportStatistics::updateDisplay(bool)
{ {
time_t now = time(NULL) ; time_t now = time(NULL) ;
@ -277,7 +296,8 @@ void GxsTransportStatistics::updateContent()
QString msg_time_string = (stat.last_publish_TS>0)?QString("(Last msg: %1)").arg(QDateTime::fromTime_t((uint)stat.last_publish_TS).toString()):"" ; QString msg_time_string = (stat.last_publish_TS>0)?QString("(Last msg: %1)").arg(QDateTime::fromTime_t((uint)stat.last_publish_TS).toString()):"" ;
item->setData(COL_GROUP_NUM_MSGS, Qt::DisplayRole, QString::number(stat.mNumMsgs) + msg_time_string) ; item->setData(COL_GROUP_PUBLISHTS, Qt::DisplayRole, msg_time_string) ;
item->setData(COL_GROUP_NUM_MSGS, Qt::DisplayRole, QString::number(stat.mNumMsgs) ) ;
item->setData(COL_GROUP_GRP_ID, Qt::DisplayRole, QString::fromStdString(it->first.toStdString())) ; item->setData(COL_GROUP_GRP_ID, Qt::DisplayRole, QString::fromStdString(it->first.toStdString())) ;
item->setData(COL_GROUP_SIZE_MSGS, Qt::DisplayRole, QString::number(stat.mTotalSizeOfMsgs)) ; item->setData(COL_GROUP_SIZE_MSGS, Qt::DisplayRole, QString::number(stat.mTotalSizeOfMsgs)) ;
item->setData(COL_GROUP_SUBSCRIBED,Qt::DisplayRole, stat.subscribed?tr("Yes"):tr("No")) ; item->setData(COL_GROUP_SUBSCRIBED,Qt::DisplayRole, stat.subscribed?tr("Yes"):tr("No")) ;
@ -308,6 +328,8 @@ void GxsTransportStatistics::updateContent()
rsIdentity->getIdDetails(meta.mAuthorId,idDetails); rsIdentity->getIdDetails(meta.mAuthorId,idDetails);
QPixmap pixmap ; QPixmap pixmap ;
QDateTime qdatetime;
qdatetime.setTime_t(meta.mPublishTs);
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL)) if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
pixmap = GxsIdDetails::makeDefaultIcon(meta.mAuthorId,GxsIdDetails::SMALL); pixmap = GxsIdDetails::makeDefaultIcon(meta.mAuthorId,GxsIdDetails::SMALL);
@ -315,7 +337,9 @@ void GxsTransportStatistics::updateContent()
sitem->setIcon(COL_GROUP_GRP_ID, QIcon(pixmap)); sitem->setIcon(COL_GROUP_GRP_ID, QIcon(pixmap));
sitem->setData(COL_GROUP_UNIQUE_ID, Qt::DisplayRole,QString::fromStdString(meta.mMsgId.toStdString())); sitem->setData(COL_GROUP_UNIQUE_ID, Qt::DisplayRole,QString::fromStdString(meta.mMsgId.toStdString()));
sitem->setData(COL_GROUP_NUM_MSGS,Qt::DisplayRole, QDateTime::fromTime_t(meta.mPublishTs).toString()); sitem->setData(COL_GROUP_AUTHOR_ID, Qt::DisplayRole, QString::fromStdString(meta.mAuthorId.toStdString())) ;
sitem->setText(COL_GROUP_PUBLISHTS, QDateTime::fromTime_t(meta.mPublishTs).toString());
sitem->setData(COL_GROUP_PUBLISHTS, Qt::UserRole, qdatetime);
} }
} }
} }
@ -333,6 +357,25 @@ void GxsTransportStatistics::personDetails()
dialog->show(); dialog->show();
} }
void GxsTransportStatistics::showAuthorInPeople()
{
QTreeWidgetItem *item = groupTreeWidget->currentItem();
std::string id = item->text(COL_GROUP_AUTHOR_ID).toStdString();
if (id.empty()) {
return;
}
/* window will destroy itself! */
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
if (!idDialog)
return ;
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(RsGxsId(id));
}
#ifdef TO_REMOVE #ifdef TO_REMOVE
void GxsTransportStatistics::loadGroupMeta(const std::vector<RsGroupMetaData>& groupInfo) void GxsTransportStatistics::loadGroupMeta(const std::vector<RsGroupMetaData>& groupInfo)
{ {

View File

@ -51,7 +51,10 @@ public:
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */
void CustomPopupMenu( QPoint point ); void CustomPopupMenu( QPoint point );
void CustomPopupMenuGroups( QPoint point ) ;
void personDetails(); void personDetails();
void showAuthorInPeople();
private: private:
void updateDisplay(bool complete) ; void updateDisplay(bool complete) ;

View File

@ -41,7 +41,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<attribute name="headerShowSortIndicator" stdset="0"> <attribute name="headerShowSortIndicator" stdset="0">
<bool>false</bool> <bool>true</bool>
</attribute> </attribute>
<column> <column>
<property name="text"> <property name="text">
@ -108,6 +108,12 @@
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<column> <column>
<property name="text"> <property name="text">
<string>Group ID / Author</string> <string>Group ID / Author</string>
@ -115,7 +121,12 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Number of messages / Publish TS</string> <string>Publish TS</string>
</property>
</column>
<column>
<property name="text">
<string>Number of messages </string>
</property> </property>
</column> </column>
<column> <column>