groups tree tooltips and info panels - add last post date info

This commit is contained in:
unknown 2017-01-10 00:31:32 +03:00
parent c2214c8cfa
commit 2bb7c8d010
4 changed files with 47 additions and 40 deletions

View File

@ -36,6 +36,7 @@
#include "gui/common/ElidedLabel.h" #include "gui/common/ElidedLabel.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h" #include "util/QtVersion.h"
#include "util/DateTime.h"
#include <stdint.h> #include <stdint.h>
@ -477,10 +478,11 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
tooltip += "\n" + tr("You have been granted as publisher (you can post here!)"); tooltip += "\n" + tr("You have been granted as publisher (you can post here!)");
if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags)) if(!IS_GROUP_SUBSCRIBED(itemInfo.subscribeFlags))
{
tooltip += "\n" + QString::number(itemInfo.max_visible_posts) + " messages available" ; 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") ; tooltip += "\n" + tr("Subscribe to download and read messages") ;
}
item->setToolTip(COLUMN_NAME, tooltip); item->setToolTip(COLUMN_NAME, tooltip);
item->setToolTip(COLUMN_UNREAD, tooltip); item->setToolTip(COLUMN_UNREAD, tooltip);

View File

@ -33,6 +33,7 @@
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/SubFileItem.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include <algorithm> #include <algorithm>
#include "util/DateTime.h"
#define CHAN_DEFAULT_IMAGE ":/images/channels.png" #define CHAN_DEFAULT_IMAGE ":/images/channels.png"
@ -266,6 +267,10 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
ui->infoDescription->clear(); ui->infoDescription->clear();
} else { } else {
ui->infoPosts->setText(QString::number(group.mMeta.mVisibleMsgCount)); 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->infoDescription->setText(QString::fromUtf8(group.mDescription.c_str()));
ui->infoAdministrator->setId(group.mMeta.mAuthorId) ; ui->infoAdministrator->setId(group.mMeta.mAuthorId) ;

View File

@ -14,16 +14,7 @@
<property name="spacing"> <property name="spacing">
<number>4</number> <number>4</number>
</property> </property>
<property name="leftMargin"> <property name="margin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -35,16 +26,7 @@
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin"> <property name="margin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item> <item>
@ -307,16 +289,7 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin"> <property name="margin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
@ -397,7 +370,7 @@
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="font"> <property name="font">
<font> <font>
@ -429,14 +402,33 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="1" column="0">
<widget class="QLabel" name="infoLastPostLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Last Post:</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QTextBrowser" name="infoDescription"> <widget class="QTextBrowser" name="infoDescription">
<property name="html"> <property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">&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; &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; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; 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:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &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-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
@ -446,7 +438,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="infoDescriptionLabel"> <widget class="QLabel" name="infoDescriptionLabel">
<property name="font"> <property name="font">
<font> <font>
@ -459,7 +451,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="GxsIdLabel" name="infoAdministrator"> <widget class="GxsIdLabel" name="infoAdministrator">
<property name="text"> <property name="text">
<string>unknown</string> <string>unknown</string>
@ -473,7 +465,14 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="1">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="font"> <property name="font">
<font> <font>
@ -486,7 +485,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QLabel" name="infoDistribution"> <widget class="QLabel" name="infoDistribution">
<property name="text"> <property name="text">
<string>unknown</string> <string>unknown</string>

View File

@ -879,6 +879,7 @@ static QString getDurationString(uint32_t days)
tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str())); tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop); tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount); tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Last post")).arg(DateTime::formatLongDateTime(group.mMeta.mLastPost));
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ; tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Synchronization")).arg(getDurationString( rsGxsForums->getSyncPeriod(group.mMeta.mGroupId)/86400 )) ;
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400)); tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Storage")).arg(getDurationString( rsGxsForums->getStoragePeriod(group.mMeta.mGroupId)/86400));