Improved layout better look & feel for Circles View

Added activity column
This commit is contained in:
defnax 2015-09-10 17:37:42 +02:00
parent 0769dabb2e
commit b1527b608f
2 changed files with 559 additions and 482 deletions

View file

@ -68,7 +68,8 @@
#define RSID_COL_NICKNAME 0 #define RSID_COL_NICKNAME 0
#define RSID_COL_KEYID 1 #define RSID_COL_KEYID 1
#define RSID_COL_IDTYPE 2 #define RSID_COL_LASTUSED 2
#define RSID_COL_IDTYPE 3
#define RSIDREP_COL_NAME 0 #define RSIDREP_COL_NAME 0
#define RSIDREP_COL_OPINION 1 #define RSIDREP_COL_OPINION 1
@ -164,9 +165,9 @@ IdDialog::IdDialog(QWidget *parent) :
connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg())); connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg()));
#ifdef UNFINISHED_CODE
ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png")); ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png"));
#endif
ui->headerTextLabel->setText(tr("People")); ui->headerTextLabel->setText(tr("People"));
/* Initialize splitter */ /* Initialize splitter */
@ -193,12 +194,20 @@ IdDialog::IdDialog(QWidget *parent) :
headerText = headerItem->text(RSID_COL_KEYID); headerText = headerItem->text(RSID_COL_KEYID);
ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText)); ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText));
/* Set initial section sizes */
QHeaderView * circlesheader = ui->treeWidget_membership->header () ;
circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 280);
/* Setup tree */ /* Setup tree */
ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder); ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder);
ui->idTreeWidget->enableColumnCustomize(true); ui->idTreeWidget->enableColumnCustomize(true);
ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false); ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false);
ui->idTreeWidget->setColumnHidden(RSID_COL_IDTYPE, true);
ui->idTreeWidget->setColumnHidden(RSID_COL_LASTUSED, true);
/* Set initial column width */ /* Set initial column width */
int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W"); int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W");
ui->idTreeWidget->setColumnWidth(RSID_COL_NICKNAME, 18 * fontWidth); ui->idTreeWidget->setColumnWidth(RSID_COL_NICKNAME, 18 * fontWidth);
@ -213,9 +222,6 @@ IdDialog::IdDialog(QWidget *parent) :
// Hiding RepList until that part is finished. // Hiding RepList until that part is finished.
//ui->treeWidget_RepList->setVisible(false); //ui->treeWidget_RepList->setVisible(false);
ui->toolButton_Reputation->setVisible(false); ui->toolButton_Reputation->setVisible(false);
#ifdef UNFINISHED_CODE
ui->todoPushButton->hide() ;
#endif
QString hlp_str = tr( QString hlp_str = tr(
" <h1><img width=\"32\" src=\":/icons/help_64.png\">&nbsp;&nbsp;Identities</h1> \ " <h1><img width=\"32\" src=\":/icons/help_64.png\">&nbsp;&nbsp;Identities</h1> \
@ -494,6 +500,24 @@ void IdDialog::todo()
"</ul>"); "</ul>");
} }
static QString getHumanReadableDuration(uint32_t seconds)
{
if(seconds < 60)
return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
else if(seconds < 120)
return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
else if(seconds < 3600)
return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
else if(seconds < 7200)
return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
else if(seconds < 24*3600)
return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
else if(seconds < 2*24*3600)
return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
else
return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
}
void IdDialog::processSettings(bool load) void IdDialog::processSettings(bool load)
{ {
Settings->beginGroup("IdDialog"); Settings->beginGroup("IdDialog");
@ -618,8 +642,13 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE)); item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString())); item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
time_t now = time(NULL) ;
item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ;
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ; item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
item->setData(RSID_COL_LASTUSED, Qt::UserRole, QString::number(now - data.mLastUsageTS));
if(isOwnId) if(isOwnId)
{ {
QFont font = item->font(RSID_COL_NICKNAME) ; QFont font = item->font(RSID_COL_NICKNAME) ;
@ -770,24 +799,6 @@ void IdDialog::requestIdDetails()
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS); mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS);
} }
static QString getHumanReadableDuration(uint32_t seconds)
{
if(seconds < 60)
return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
else if(seconds < 120)
return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
else if(seconds < 3600)
return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
else if(seconds < 7200)
return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
else if(seconds < 24*3600)
return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
else if(seconds < 2*24*3600)
return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
else
return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
}
void IdDialog::insertIdDetails(uint32_t token) void IdDialog::insertIdDetails(uint32_t token)
{ {
mStateHelper->setLoading(IDDIALOG_IDDETAILS, false); mStateHelper->setLoading(IDDIALOG_IDDETAILS, false);
@ -843,9 +854,9 @@ void IdDialog::insertIdDetails(uint32_t token)
#ifdef ID_DEBUG #ifdef ID_DEBUG
std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl; std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl;
#endif #endif
#ifdef UNFINISHED_CODE
ui->avlabel->setPixmap(pixmap); ui->avlabel->setPixmap(pixmap);
#endif
ui->avatarLabel->setPixmap(pixmap); ui->avatarLabel->setPixmap(pixmap);
if (data.mPgpKnown) if (data.mPgpKnown)

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1226</width> <width>826</width>
<height>1085</height> <height>579</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -19,8 +19,8 @@
<property name="windowTitle"> <property name="windowTitle">
<string/> <string/>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QGridLayout" name="gridLayout_6">
<item> <item row="0" column="0">
<widget class="QFrame" name="titleBarFrame"> <widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -103,7 +103,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -169,7 +169,7 @@
<item> <item>
<widget class="RSTreeWidget" name="idTreeWidget"> <widget class="RSTreeWidget" name="idTreeWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -193,6 +193,11 @@
<string>Identity ID</string> <string>Identity ID</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Last Activity</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Owned by</string> <string>Owned by</string>
@ -200,21 +205,166 @@
</column> </column>
</widget> </widget>
</item> </item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget1">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Circles</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item> <item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
<item>
<property name="text">
<string>Public Circles</string>
</property>
</item>
<item>
<property name="text">
<string>Personal Circles</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Person</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QFrame" name="headerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="avlabel">
<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="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="StyledElidedLabel" name="headerTextLabel"> <widget class="StyledElidedLabel" name="headerTextLabel">
<property name="text"> <property name="text">
<string>People</string> <string>People</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="3" rowspan="2">
<widget class="QGroupBox" name="detailsGroupBox"> <widget class="QToolButton" name="messageButton">
<property name="sizePolicy"> <property name="minimumSize">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <size>
<horstretch>0</horstretch> <width>48</width>
<verstretch>0</verstretch> <height>48</height>
</sizepolicy> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolTip">
<string>Send message</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail-message-new.png</normaloff>:/images/mail-message-new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="detailsGroupBox">
<property name="title"> <property name="title">
<string>Identity info</string> <string>Identity info</string>
</property> </property>
@ -224,16 +374,6 @@
<property name="margin"> <property name="margin">
<number>6</number> <number>6</number>
</property> </property>
<item row="2" 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="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -241,6 +381,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
@ -265,6 +418,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" 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="4" column="1"> <item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId"> <widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled"> <property name="enabled">
@ -353,41 +516,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QToolButton" name="messageButton">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolTip">
<string>Send message</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail-message-new.png</normaloff>:/images/mail-message-new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -406,7 +534,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QGroupBox" name="reputationGroupBox"> <widget class="QGroupBox" name="reputationGroupBox">
@ -589,64 +717,9 @@
</layout> </layout>
</item> </item>
</layout> </layout>
<zorder>detailsGroupBox</zorder>
<zorder>headerFrame</zorder>
</widget> </widget>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Circles</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
<item>
<property name="text">
<string>Public Circles</string>
</property>
</item>
<item>
<property name="text">
<string>Personal Circles</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create External Circle</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</item> </item>
@ -686,16 +759,16 @@
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>StyledElidedLabel</class> <class>StyledElidedLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>gui/common/StyledElidedLabel.h</header> <header>gui/common/StyledElidedLabel.h</header>
</customwidget> </customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>RSTreeWidget</class> <class>RSTreeWidget</class>
<extends>QTreeWidget</extends> <extends>QTreeWidget</extends>
@ -709,13 +782,6 @@
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>idTreeWidget</tabstop> <tabstop>idTreeWidget</tabstop>
<tabstop>lineEdit_Nickname</tabstop>
<tabstop>lineEdit_KeyId</tabstop>
<tabstop>lineEdit_GpgId</tabstop>
<tabstop>lineEdit_GpgName</tabstop>
<tabstop>line_RatingOverall</tabstop>
<tabstop>line_RatingImplicit</tabstop>
<tabstop>line_RatingOwn</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>