FriendList:

- Removed avatar column
- Removed state column
- Added combined avatar and status icon
- Added status icons in 64px
- Renamed "Hide state" to "Show state"
- Added sort by name and state

RSTreeWidget:
- Added version for load/save state
- Added method setColumnCustomizable
This commit is contained in:
thunder2 2015-08-08 20:27:19 +02:00
parent ec67ee0e00
commit 87f2e6da37
24 changed files with 619 additions and 596 deletions

View File

@ -142,9 +142,7 @@ QList<int> sizes;
// load settings
RsAutoUpdatePage::lockAllEvents();
ui.friendList->setColumnVisible(FriendList::COLUMN_STATE, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_LAST_CONTACT, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_AVATAR, true);
ui.friendList->setColumnVisible(FriendList::COLUMN_IP, false);
ui.friendList->setShowGroups(true);
processSettings(true);

View File

@ -142,13 +142,10 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
// load settings
RsAutoUpdatePage::lockAllEvents();
ui.friendList->setColumnVisible(FriendList::COLUMN_STATE, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_LAST_CONTACT, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_AVATAR, true);
ui.friendList->setColumnVisible(FriendList::COLUMN_IP, false);
ui.friendList->setShowGroups(false);
processSettings(true);
ui.friendList->setBigName(true);
RsAutoUpdatePage::unlockAllEvents();
// add self nick

File diff suppressed because it is too large Load Diff

View File

@ -52,10 +52,14 @@ public:
enum Column
{
COLUMN_NAME = 0,
COLUMN_AVATAR = 1,
COLUMN_STATE = 2,
COLUMN_LAST_CONTACT = 3,
COLUMN_IP = 4
COLUMN_LAST_CONTACT = 1,
COLUMN_IP = 2
};
enum SortMode
{
SORT_MODE_NAME = 1,
SORT_MODE_STATE = 2
};
public:
@ -74,7 +78,9 @@ public:
virtual void updateDisplay();
void setColumnVisible(Column column, bool visible);
void sortByColumn(Column column, Qt::SortOrder sortOrder);
void setSortMode(SortMode sortMode);
SortMode sortMode();
QColor textColorGroup() const { return mTextColorGroup; }
QColor textColorStatusOffline() const { return mTextColorStatus[RS_STATUS_OFFLINE]; }
@ -92,11 +98,12 @@ public:
public slots:
void filterItems(const QString &text);
void setSortByName();
void setSortByState();
void setBigName(bool bigName); // show customStateString in second line of the name cell
void setShowGroups(bool show);
void setHideUnconnected(bool hidden);
void setHideState(bool hidden);
void setShowState(bool show);
private slots:
void peerTreeColumnVisibleChanged(int column, bool visible);
@ -107,12 +114,11 @@ protected:
private:
Ui::FriendList *ui;
RSTreeWidgetItemCompareRole *m_compareRole;
RSTreeWidgetItemCompareRole *mCompareRole;
// Settings for peer list display
bool mBigName;
bool mShowGroups;
bool mHideState;
bool mShowState;
bool mHideUnconnected;
QString mFilterText;
@ -126,14 +132,12 @@ private:
QColor mTextColorStatus[RS_STATUS_COUNT];
QTreeWidgetItem *getCurrentPeer() const;
void initializeHeader(bool afterLoadSettings);
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds);
private slots:
void groupsChanged();
void insertPeers();
void peerTreeWidgetCustomPopupMenu();
void updateAvatar(const QString &);
void updateMenu();
void pastePerson();

View File

@ -81,15 +81,6 @@
<height>38</height>
</size>
</property>
<property name="autoExpandDelay">
<number>1</number>
</property>
<property name="indentation">
<number>20</number>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
@ -97,7 +88,7 @@
<bool>false</bool>
</property>
<property name="columnCount">
<number>5</number>
<number>3</number>
</property>
<attribute name="headerStretchLastSection">
<bool>false</bool>
@ -106,15 +97,8 @@
<property name="text">
<string>Friend nodes</string>
</property>
</column>
<column>
<property name="text">
<string>Avatar</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
@ -138,15 +122,37 @@
<string>Hide Offline Friends</string>
</property>
</action>
<action name="actionHideState">
<action name="actionSortByName">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled">
<bool>false</bool>
<property name="text">
<string>Name</string>
</property>
<property name="toolTip">
<string>Sort by Name</string>
</property>
</action>
<action name="actionSortByState">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Hide State</string>
<string>State</string>
</property>
<property name="toolTip">
<string>Sort by State</string>
</property>
</action>
<action name="actionShowState">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Stow State</string>
</property>
<property name="toolTip">
<string>Show State</string>
</property>
</action>
<action name="actionShowGroups">

View File

@ -29,7 +29,8 @@
RSTreeWidget::RSTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
mColumnCustomizable = false;
mEnableColumnCustomize = false;
mSettingsVersion = 0; // disabled
}
void RSTreeWidget::setPlaceholderText(const QString &text)
@ -117,32 +118,45 @@ bool RSTreeWidget::filterItem(QTreeWidgetItem *item, int filterColumn, const QSt
return (itemVisible || visibleChildCount);
}
void RSTreeWidget::setSettingsVersion(qint32 version)
{
mSettingsVersion = version;
}
void RSTreeWidget::processSettings(bool load)
{
if (load) {
// load settings
// Load settings
// state of tree widget
header()->restoreState(Settings->value(objectName()).toByteArray());
// State of tree widget
if (mSettingsVersion == 0 || Settings->value(QString("%1Version").arg(objectName())) == mSettingsVersion) {
// Compare version, because Qt can crash in restoreState after column changes
header()->restoreState(Settings->value(objectName()).toByteArray());
}
} else {
// save settings
// Save settings
// state of tree widget
Settings->setValue(objectName(), header()->saveState());
// Save version
if (mSettingsVersion) {
Settings->setValue(QString("%1Version").arg(objectName()), mSettingsVersion);
}
}
}
void RSTreeWidget::setColumnCustomizable(bool customizable)
void RSTreeWidget::enableColumnCustomize(bool customizable)
{
if (customizable == mColumnCustomizable) {
if (customizable == mEnableColumnCustomize) {
return;
}
mColumnCustomizable = customizable;
mEnableColumnCustomize = customizable;
QHeaderView *h = header();
if (mColumnCustomizable) {
if (mEnableColumnCustomize) {
h->setContextMenuPolicy(Qt::CustomContextMenu);
connect(h, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(headerContextMenuRequested(QPoint)));
} else {
@ -151,9 +165,14 @@ void RSTreeWidget::setColumnCustomizable(bool customizable)
}
}
void RSTreeWidget::setColumnCustomizable(int column, bool customizable)
{
mColumnCustomizable[column] = customizable;
}
void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
{
if (!mColumnCustomizable) {
if (!mEnableColumnCustomize) {
return;
}
@ -162,6 +181,10 @@ void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
QTreeWidgetItem *item = headerItem();
int columnCount = item->columnCount();
for (int column = 0; column < columnCount; ++column) {
QMap<int, bool>::const_iterator it = mColumnCustomizable.find(column);
if (it != mColumnCustomizable.end() && *it == false) {
continue;
}
QAction *action = contextMenu.addAction(QIcon(), item->text(column), this, SLOT(columnVisible()));
action->setCheckable(true);
action->setData(column);

View File

@ -37,9 +37,11 @@ public:
void filterItems(int filterColumn, const QString &text);
void setSettingsVersion(qint32 version);
void processSettings(bool load);
void setColumnCustomizable(bool customizable);
void enableColumnCustomize(bool customizable);
void setColumnCustomizable(int column, bool customizable);
signals:
void signalMouseMiddleButtonClicked(QTreeWidgetItem *item);
@ -58,7 +60,9 @@ protected:
private:
QString mPlaceholderText;
bool mColumnCustomizable;
bool mEnableColumnCustomize;
quint32 mSettingsVersion;
QMap<int, bool> mColumnCustomizable;
};
#endif

View File

@ -86,15 +86,15 @@ const char *StatusDefs::imageStatus(unsigned int status)
{
switch (status) {
case RS_STATUS_OFFLINE:
return ":/images/status/user-offline.png";
return ":/icons/user-offline_64.png";
case RS_STATUS_AWAY:
return ":/images/status/user-away.png";
return ":/icons/user-away_64.png";
case RS_STATUS_BUSY:
return ":/images/status/user-busy.png";
return ":/icons/user-busy_64.png";
case RS_STATUS_ONLINE:
return ":/images/status/user-online.png";
return ":/icons/user-online_64.png";
case RS_STATUS_INACTIVE:
return ":/images/status/user-away-extended.png";
return ":/icons/user-away-extended_64.png";
}
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;

View File

@ -55,5 +55,10 @@
<file>icons/tile_downloaded_48.png</file>
<file>icons/tile_downloading_48.png</file>
<file>icons/tile_inactive_48.png</file>
<file>icons/user-away_64.png</file>
<file>icons/user-away-extended_64.png</file>
<file>icons/user-busy_64.png</file>
<file>icons/user-offline_64.png</file>
<file>icons/user-online_64.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -60,10 +60,7 @@
<file>images/btn_green.png</file>
<file>images/btn_green_hover.png</file>
<file>images/btn_green_pressed.png</file>
<file>images/connect_established.png</file>
<file>images/connect_established_low.png</file>
<file>images/connect_creating.png</file>
<file>images/connect_no.png</file>
<file>images/dht16.png</file>
<file>images/dht32.png</file>
<file>images/edit-clear-history.png</file>
@ -424,7 +421,6 @@
<file>images/replymail-pressed.png</file>
<file>images/replymail24.png</file>
<file>images/replymailall24-hover.png</file>
<file>images/reload24.png</file>
<file>images/reset.png</file>
<file>images/resume.png</file>
<file>images/security-high-16.png</file>
@ -694,11 +690,6 @@
<file>images/tags/dev-translator.png</file>
<file>images/tags/dev-patcher.png</file>
<file>images/tags/developer.png</file>
<file>images/status/user-online.png</file>
<file>images/status/user-offline.png</file>
<file>images/status/user-busy.png</file>
<file>images/status/user-away-extended.png</file>
<file>images/status/user-away.png</file>
<file>images/circles/circles_32.png</file>
<file>images/circles/circles_64.png</file>
<file>images/newsfeed/news-feed-32.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB