Merge pull request #1677 from defnax/changes-for-satistics-window

Changes for satistics window
This commit is contained in:
csoler 2019-10-12 23:04:04 +02:00 committed by GitHub
commit 001d67cf23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 335 additions and 270 deletions

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * * along with this program. If not, see <https://www.gnu.org/licenses/>. *
* * * *
*******************************************************************************/ *******************************************************************************/
#include <QDateTime>
#include "IdDetailsDialog.h" #include "IdDetailsDialog.h"
#include "ui_IdDetailsDialog.h" #include "ui_IdDetailsDialog.h"
@ -53,6 +54,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Created);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->ownOpinion_CB); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->ownOpinion_CB);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->overallOpinion_TF); mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->overallOpinion_TF);
@ -63,6 +65,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId); mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId); mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Created);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed); mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName); mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
@ -70,6 +73,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId); mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId); mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type); mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Created);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed); mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName); mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
@ -80,7 +84,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
Settings->loadWidgetInformation(this); Settings->loadWidgetInformation(this);
ui->headerFrame->setHeaderImage(QPixmap(":/images/identity/identity_64.png")); ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/person.png"));
ui->headerFrame->setHeaderText(tr("Person Details")); ui->headerFrame->setHeaderText(tr("Person Details"));
//connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(changeGroup())); //connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(changeGroup()));
@ -178,6 +182,8 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ; ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
ui->banoption_label->setVisible(!data.mPgpId.isNull()) ; ui->banoption_label->setVisible(!data.mPgpId.isNull()) ;
ui->lineEdit_Created->setText(QDateTime::fromMSecsSinceEpoch(qint64(1000)*data.mMeta.mPublishTs).toString(Qt::SystemLocaleShortDate));
time_t now = time(NULL) ; time_t now = time(NULL) ;
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ; ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;

View File

@ -17,7 +17,7 @@
<iconset resource="../images.qrc"> <iconset resource="../images.qrc">
<normaloff>:/images/logo/logo_32.png</normaloff>:/images/logo/logo_32.png</iconset> <normaloff>:/images/logo/logo_32.png</normaloff>:/images/logo/logo_32.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -30,6 +30,9 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"> <widget class="HeaderFrame" name="headerFrame">
<property name="frameShape"> <property name="frameShape">
@ -41,7 +44,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>9</number> <number>9</number>
</property> </property>
@ -52,28 +55,51 @@
<number>9</number> <number>9</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>9</number>
</property> </property>
<item> <item>
<widget class="QGroupBox" name="detailsGroupBox"> <widget class="QGroupBox" name="detailsGroupBox">
<property name="title"> <property name="title">
<string>Identity Info</string> <string>Identity Info</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" rowspan="2">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <item row="11" column="0" colspan="2">
<number>6</number> <spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
<property name="topMargin"> <property name="sizeHint" stdset="0">
<number>6</number> <size>
<width>20</width>
<height>40</height>
</size>
</property> </property>
<property name="rightMargin"> </spacer>
<number>6</number> </item>
<item row="10" column="0">
<widget class="QLabel" name="banoption_label">
<property name="text">
<string>Ban-option:</string>
</property> </property>
<property name="bottomMargin"> </widget>
<number>6</number> </item>
<item row="9" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="text">
<string>Auto-Ban all identities signed by the same node</string>
</property>
</widget>
</item>
<item row="9" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="font"> <property name="font">
@ -87,165 +113,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Friends votes:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<widget class="QComboBox" name="ownOpinion_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the average of your friend's opinions. If not, your own opinion gives the score.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -0.6, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a higher reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 30 days). &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Neutral</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
</property>
</item>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="PgpId_LB">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Type:</string> <string>Type:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="PgpName_LB">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Identity ID :</string> <string>Identity ID :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="2" column="1">
<widget class="QLabel" name="label_7"> <widget class="QLineEdit" name="lineEdit_Type"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="PgpId_LB">
<property name="text"> <property name="text">
<string>Last used:</string> <string>Owner node ID :</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0"> <item row="3" column="1">
<widget class="QLabel" name="banoption_label">
<property name="text">
<string>Ban-option:</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="2">
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="text">
<string>Auto-Ban all identities signed by the same node</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_LastUsed">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_GpgId"> <widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -255,32 +147,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="2"> <item row="0" column="2" rowspan="12">
<widget class="QLineEdit" name="lineEdit_Type"/>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum> <enum>QLayout::SetDefaultConstraint</enum>
@ -426,8 +293,158 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0">
<spacer name="verticalSpacer_2"> <widget class="QLabel" name="PgpName_LB">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Friends votes:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="ownOpinion_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the average of your friend's opinions. If not, your own opinion gives the score.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:9pt;&quot;&gt;The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -0.6, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a higher reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 30 days). &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Neutral</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_Created">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Created :</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -440,11 +457,8 @@ p, li { white-space: pre-wrap; }
</spacer> </spacer>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> <item row="2" column="0">
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin"> <property name="leftMargin">
<number>9</number> <number>9</number>
@ -483,19 +497,6 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

View File

@ -18,6 +18,7 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <QDateTime>
#include <iostream> #include <iostream>
#include <QTimer> #include <QTimer>
#include <QObject> #include <QObject>
@ -39,6 +40,9 @@
#include "gui/Identity/IdDetailsDialog.h" #include "gui/Identity/IdDetailsDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "util/DateTime.h"
#include "util/QtVersion.h" #include "util/QtVersion.h"
#include "util/misc.h" #include "util/misc.h"
@ -52,6 +56,8 @@
#define COL_RECEIVED 7 #define COL_RECEIVED 7
#define COL_SEND 8 #define COL_SEND 8
#define COL_DUPLICATION_FACTOR 9 #define COL_DUPLICATION_FACTOR 9
#define COL_RECEIVEDTIME 10
#define COL_SENDTIME 11
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 ;
@ -65,7 +71,7 @@ static QColor colorScale(float f)
} }
GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent) GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent)
: RsAutoUpdatePage(2000,parent) : RsAutoUpdatePage(4000,parent)
{ {
setupUi(this) ; setupUi(this) ;
@ -168,7 +174,8 @@ void GlobalRouterStatistics::updateContent()
for(uint32_t i=0;i<cache_infos.size();++i) for(uint32_t i=0;i<cache_infos.size();++i)
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(); //QTreeWidgetItem *item = new QTreeWidgetItem();
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR) ;
treeWidget->addTopLevelItem(item); treeWidget->addTopLevelItem(item);
RsIdentityDetails details ; RsIdentityDetails details ;
@ -178,6 +185,12 @@ void GlobalRouterStatistics::updateContent()
if(nicknames.isEmpty()) if(nicknames.isEmpty())
nicknames = tr("Unknown"); nicknames = tr("Unknown");
QDateTime routingtime;
routingtime.setTime_t(cache_infos[i].routing_time);
QDateTime senttime;
senttime.setTime_t(cache_infos[i].last_sent_time);
item -> setId(cache_infos[i].destination,COL_NICKNAME, false) ;
item -> setData(COL_ID, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0')); item -> setData(COL_ID, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0'));
item -> setData(COL_NICKNAME, Qt::DisplayRole, nicknames ) ; item -> setData(COL_NICKNAME, Qt::DisplayRole, nicknames ) ;
item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(cache_infos[i].destination.toStdString())); item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(cache_infos[i].destination.toStdString()));
@ -185,9 +198,11 @@ void GlobalRouterStatistics::updateContent()
item -> setData(COL_TUNNELSTATUS, Qt::DisplayRole, tunnel_status_string[cache_infos[i].tunnel_status % 3]); item -> setData(COL_TUNNELSTATUS, Qt::DisplayRole, tunnel_status_string[cache_infos[i].tunnel_status % 3]);
item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(cache_infos[i].data_size)); item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(cache_infos[i].data_size));
item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString())); item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
item -> setData(COL_RECEIVED, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time)); item -> setData(COL_RECEIVED, Qt::DisplayRole, DateTime::formatDateTime(routingtime));
item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time)); item -> setData(COL_SEND, Qt::DisplayRole, DateTime::formatDateTime(senttime));
item -> setData(COL_DUPLICATION_FACTOR, Qt::DisplayRole, QString::number(cache_infos[i].duplication_factor)); item -> setData(COL_DUPLICATION_FACTOR, Qt::DisplayRole, QString::number(cache_infos[i].duplication_factor));
item -> setData(COL_RECEIVEDTIME, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
item -> setData(COL_SENDTIME, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
} }
} }

View File

@ -91,6 +91,21 @@
<string>Data hash</string> <string>Data hash</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Receive time</string>
</property>
</column>
<column>
<property name="text">
<string>Sending time</string>
</property>
</column>
<column>
<property name="text">
<string>Branching factor</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Receive time (secs ago)</string> <string>Receive time (secs ago)</string>
@ -101,11 +116,6 @@
<string>Sending time (secs ago)</string> <string>Sending time (secs ago)</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Branching factor</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -33,7 +33,6 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QWheelEvent> #include <QWheelEvent>
#include <retroshare/rsgxstrans.h> #include <retroshare/rsgxstrans.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentity.h>
@ -47,6 +46,8 @@
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include "util/misc.h" #include "util/misc.h"
#include "gui/gxs/GxsIdLabel.h" #include "gui/gxs/GxsIdLabel.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#define COL_PENDING_ID 0 #define COL_PENDING_ID 0
#define COL_PENDING_DESTINATION 1 #define COL_PENDING_DESTINATION 1
@ -55,6 +56,8 @@
#define COL_PENDING_DATAHASH 4 #define COL_PENDING_DATAHASH 4
#define COL_PENDING_SEND 5 #define COL_PENDING_SEND 5
#define COL_PENDING_GROUP_ID 6 #define COL_PENDING_GROUP_ID 6
#define COL_PENDING_SENDTIME 7
#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_NUM_MSGS 1
@ -89,9 +92,11 @@ GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
/* Set header resize modes and initial section sizes Uploads TreeView*/ /* Set header resize modes and initial section sizes Uploads TreeView*/
QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents); QHeaderView_setSectionResizeMode(treeWidget->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)));
treeWidget->setColumnHidden(COL_PENDING_DESTINATION_ID,true);
// load settings // load settings
processSettings(true); processSettings(true);
@ -205,13 +210,16 @@ void GxsTransportStatistics::updateContent()
// 1 - fill the table for pending packets // 1 - fill the table for pending packets
time_t now = time(NULL) ;
groupBox->setTitle(tr("Pending data items")+": " + QString::number(transinfo.outgoing_records.size()) ); groupBox->setTitle(tr("Pending data items")+": " + QString::number(transinfo.outgoing_records.size()) );
for(uint32_t i=0;i<transinfo.outgoing_records.size();++i) for(uint32_t i=0;i<transinfo.outgoing_records.size();++i)
{ {
const RsGxsTransOutgoingRecord& rec(transinfo.outgoing_records[i]) ; const RsGxsTransOutgoingRecord& rec(transinfo.outgoing_records[i]) ;
QTreeWidgetItem *item = new QTreeWidgetItem(); //QTreeWidgetItem *item = new QTreeWidgetItem();
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR) ;
treeWidget->addTopLevelItem(item); treeWidget->addTopLevelItem(item);
RsIdentityDetails details ; RsIdentityDetails details ;
@ -221,17 +229,19 @@ void GxsTransportStatistics::updateContent()
if(nickname.isEmpty()) if(nickname.isEmpty())
nickname = tr("Unknown"); nickname = tr("Unknown");
item -> setId(rec.recipient,COL_PENDING_DESTINATION, false) ;
item -> setData(COL_PENDING_ID, Qt::DisplayRole, QString::number(rec.trans_id,16).rightJustified(8,'0')); item -> setData(COL_PENDING_ID, Qt::DisplayRole, QString::number(rec.trans_id,16).rightJustified(8,'0'));
item -> setData(COL_PENDING_DATASTATUS, Qt::DisplayRole, getStatusString(rec.status)); item -> setData(COL_PENDING_DATASTATUS, Qt::DisplayRole, getStatusString(rec.status));
item -> setData(COL_PENDING_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(rec.data_size)); item -> setData(COL_PENDING_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(rec.data_size));
item -> setData(COL_PENDING_DATAHASH, Qt::DisplayRole, QString::fromStdString(rec.data_hash.toStdString())); item -> setData(COL_PENDING_DATAHASH, Qt::DisplayRole, QString::fromStdString(rec.data_hash.toStdString()));
item -> setData(COL_PENDING_SEND, Qt::DisplayRole, QDateTime::fromTime_t(rec.send_TS).toString()); item -> setData(COL_PENDING_SEND, Qt::DisplayRole, QDateTime::fromTime_t(rec.send_TS).toString());
item -> setData(COL_PENDING_GROUP_ID, Qt::DisplayRole, QString::fromStdString(rec.group_id.toStdString())); item -> setData(COL_PENDING_GROUP_ID, Qt::DisplayRole, QString::fromStdString(rec.group_id.toStdString()));
item -> setData(COL_PENDING_DESTINATION_ID, Qt::DisplayRole, QString::fromStdString(rec.recipient.toStdString()));
item -> setData(COL_PENDING_SENDTIME, Qt::DisplayRole, QString::number(now - rec.send_TS));
GxsIdLabel *label = new GxsIdLabel() ; item->setTextAlignment(COL_PENDING_DATASIZE, Qt::AlignRight );
label->setId(rec.recipient) ; item->setTextAlignment(COL_PENDING_SEND, Qt::AlignRight );
treeWidget -> setItemWidget(item,COL_PENDING_DESTINATION, label) ;
} }
// 2 - fill the table for pending group data // 2 - fill the table for pending group data
@ -294,6 +304,16 @@ void GxsTransportStatistics::updateContent()
label->setId(meta.mAuthorId) ; label->setId(meta.mAuthorId) ;
groupTreeWidget->setItemWidget(sitem,COL_GROUP_GRP_ID,label) ; groupTreeWidget->setItemWidget(sitem,COL_GROUP_GRP_ID,label) ;
RsIdentityDetails idDetails ;
rsIdentity->getIdDetails(meta.mAuthorId,idDetails);
QPixmap pixmap ;
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
pixmap = GxsIdDetails::makeDefaultIcon(meta.mAuthorId,GxsIdDetails::SMALL);
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_NUM_MSGS,Qt::DisplayRole, QDateTime::fromTime_t(meta.mPublishTs).toString());
} }
@ -303,7 +323,7 @@ void GxsTransportStatistics::updateContent()
void GxsTransportStatistics::personDetails() void GxsTransportStatistics::personDetails()
{ {
QTreeWidgetItem *item = treeWidget->currentItem(); QTreeWidgetItem *item = treeWidget->currentItem();
std::string id = item->text(COL_PENDING_DESTINATION).toStdString(); std::string id = item->text(COL_PENDING_DESTINATION_ID).toStdString();
if (id.empty()) { if (id.empty()) {
return; return;

View File

@ -70,7 +70,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Sending time (secs ago)</string> <string>Sending time</string>
</property> </property>
</column> </column>
<column> <column>
@ -78,6 +78,16 @@
<string>Group ID</string> <string>Group ID</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Sending time (secs ago)</string>
</property>
</column>
<column>
<property name="text">
<string>Destination ID</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -95,6 +105,9 @@
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QTreeWidget" name="groupTreeWidget"> <widget class="QTreeWidget" name="groupTreeWidget">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<column> <column>
<property name="text"> <property name="text">
<string>Group ID / Author</string> <string>Group ID / Author</string>