Enabled back counting People

Enabled "Sort by Posts" for Channels/Forums/Posted
Fixed Width/Height of Message Composer
Moved Chat Settings Page order.
This commit is contained in:
defnax 2015-12-24 17:46:02 +01:00
parent 12c919491c
commit 7afcc2a91e
5 changed files with 62 additions and 13 deletions

View File

@ -518,6 +518,10 @@ void IdDialog::insertIdList(uint32_t token)
allItem->addChild(item); allItem->addChild(item);
} }
/* count items */
int itemCount = contactsItem->childCount() + allItem->childCount();
ui->label_count->setText( "(" + QString::number( itemCount ) + ")" );
filterIds(); filterIds();
updateSelection(); updateSelection();
} }

View File

@ -46,10 +46,11 @@
#define ROLE_DESCRIPTION Qt::UserRole + 2 #define ROLE_DESCRIPTION Qt::UserRole + 2
#define ROLE_POPULARITY Qt::UserRole + 3 #define ROLE_POPULARITY Qt::UserRole + 3
#define ROLE_LASTPOST Qt::UserRole + 4 #define ROLE_LASTPOST Qt::UserRole + 4
#define ROLE_SEARCH_SCORE Qt::UserRole + 5 #define ROLE_POSTS Qt::UserRole + 5
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 6 #define ROLE_SEARCH_SCORE Qt::UserRole + 6
#define ROLE_COLOR Qt::UserRole + 7 #define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 7
#define ROLE_SAVED_ICON Qt::UserRole + 8 #define ROLE_COLOR Qt::UserRole + 8
#define ROLE_SAVED_ICON Qt::UserRole + 9
#define FILTER_NAME_INDEX 0 #define FILTER_NAME_INDEX 0
#define FILTER_DESC_INDEX 1 #define FILTER_DESC_INDEX 1
@ -65,6 +66,7 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
actionSortByName = NULL; actionSortByName = NULL;
actionSortByPopularity = NULL; actionSortByPopularity = NULL;
actionSortByLastPost = NULL; actionSortByLastPost = NULL;
actionSortByPosts = NULL;
compareRole = new RSTreeWidgetItemCompareRole; compareRole = new RSTreeWidgetItemCompareRole;
compareRole->setRole(COLUMN_DATA, ROLE_NAME); compareRole->setRole(COLUMN_DATA, ROLE_NAME);
@ -153,6 +155,7 @@ void GroupTreeWidget::processSettings(RshareSettings *settings, bool load)
const int SORTBY_NAME = 1; const int SORTBY_NAME = 1;
const int SORTBY_POPULRITY = 2; const int SORTBY_POPULRITY = 2;
const int SORTBY_LASTPOST = 3; const int SORTBY_LASTPOST = 3;
const int SORTBY_POSTS = 4;
if (load) { if (load) {
// load settings // load settings
@ -175,6 +178,11 @@ void GroupTreeWidget::processSettings(RshareSettings *settings, bool load)
actionSortByLastPost->setChecked(true); actionSortByLastPost->setChecked(true);
} }
break; break;
case SORTBY_POSTS:
if (actionSortByPosts) {
actionSortByPosts->setChecked(true);
}
break;
} }
} else { } else {
// save settings // save settings
@ -222,6 +230,10 @@ void GroupTreeWidget::initDisplayMenu(QToolButton *toolButton)
actionSortByLastPost->setCheckable(true); actionSortByLastPost->setCheckable(true);
actionSortByLastPost->setActionGroup(actionGroup); actionSortByLastPost->setActionGroup(actionGroup);
actionSortByPosts = displayMenu->addAction(QIcon(), tr("Sort by Posts"), this, SLOT(sort()));
actionSortByPosts->setCheckable(true);
actionSortByPosts->setActionGroup(actionGroup);
toolButton->setMenu(displayMenu); toolButton->setMenu(displayMenu);
} }
@ -360,6 +372,9 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
qlonglong lastPost = itemInfo.lastpost.toTime_t(); qlonglong lastPost = itemInfo.lastpost.toTime_t();
item->setData(COLUMN_DATA, ROLE_LASTPOST, -lastPost); // negative for correct sorting item->setData(COLUMN_DATA, ROLE_LASTPOST, -lastPost); // negative for correct sorting
/* Set visible posts */
item->setData(COLUMN_DATA, ROLE_POSTS, -itemInfo.max_visible_posts);// negative for correct sorting
/* Set icon */ /* Set icon */
if (ui->treeWidget->itemWidget(item, COLUMN_NAME)) { if (ui->treeWidget->itemWidget(item, COLUMN_NAME)) {
/* Item is waiting, save icon in role */ /* Item is waiting, save icon in role */
@ -623,6 +638,8 @@ void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem)
compareRole->setRole(COLUMN_DATA, ROLE_POPULARITY); compareRole->setRole(COLUMN_DATA, ROLE_POPULARITY);
} else if (actionSortByLastPost && actionSortByLastPost->isChecked()) { } else if (actionSortByLastPost && actionSortByLastPost->isChecked()) {
compareRole->setRole(COLUMN_DATA, ROLE_LASTPOST); compareRole->setRole(COLUMN_DATA, ROLE_LASTPOST);
} else if (actionSortByPosts && actionSortByPosts->isChecked()) {
compareRole->setRole(COLUMN_DATA, ROLE_POSTS);
} }
if (categoryItem) { if (categoryItem) {

View File

@ -137,6 +137,7 @@ private:
QAction *actionSortByName; QAction *actionSortByName;
QAction *actionSortByPopularity; QAction *actionSortByPopularity;
QAction *actionSortByLastPost; QAction *actionSortByLastPost;
QAction *actionSortByPosts;
RSTreeWidgetItemCompareRole *compareRole; RSTreeWidgetItemCompareRole *compareRole;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1679</width> <width>935</width>
<height>951</height> <height>706</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -191,7 +191,16 @@
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<property name="margin"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
@ -772,7 +781,16 @@
<enum>QFrame::Box</enum> <enum>QFrame::Box</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="margin"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
@ -1009,7 +1027,16 @@ border-image: url(:/images/closepressed.png)
</widget> </widget>
<widget class="QWidget" name="layoutWidget_1"> <widget class="QWidget" name="layoutWidget_1">
<layout class="QGridLayout" name="layoutrecommended"> <layout class="QGridLayout" name="layoutrecommended">
<property name="margin"> <property name="leftMargin">
<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>
<property name="spacing"> <property name="spacing">
@ -1084,8 +1111,8 @@ border-image: url(:/images/closepressed.png)
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1679</width> <width>935</width>
<height>37</height> <height>21</height>
</rect> </rect>
</property> </property>
</widget> </widget>

View File

@ -142,11 +142,11 @@ RSettingsWin::initStackedWidget()
addPage(new PluginsPage() ); addPage(new PluginsPage() );
addPage(new NotifyPage()); addPage(new NotifyPage());
addPage(new CryptoPage()); addPage(new CryptoPage());
addPage(new ChatPage());
addPage(new MessagePage()); addPage(new MessagePage());
addPage(new ChannelPage()); addPage(new ChannelPage());
addPage(new ForumPage()); addPage(new ForumPage());
addPage(new PostedPage()); addPage(new PostedPage());
addPage(new ChatPage());
addPage(new AppearancePage()); addPage(new AppearancePage());
addPage(new SoundPage() ); addPage(new SoundPage() );
addPage(new ServicePermissionsPage() ); addPage(new ServicePermissionsPage() );