mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
FriendList:
- Added customize of columns with RSTreeWidget. - Reduced display menu. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8583 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e8e02b9c79
commit
c0ad7d3e46
2
TODO.txt
2
TODO.txt
@ -20,7 +20,7 @@ GUI
|
||||
|
||||
[X] http://www.cjoint.com/c/EFlhWgeLg4F. Strings too long in Add Friends Wizard on the conclusion page.
|
||||
[X] RS crashes when right clicking on the People tabs when there's nobody yet
|
||||
[ ] Network tab cannot shrink the avatar column
|
||||
[X] Network tab cannot shrink the avatar column
|
||||
[X] newsfeed default:
|
||||
Options -- Notify -- Feed
|
||||
Security <-- Make as Default Enabled
|
||||
|
@ -142,11 +142,10 @@ QList<int> sizes;
|
||||
|
||||
// load settings
|
||||
RsAutoUpdatePage::lockAllEvents();
|
||||
ui.friendList->setShowStatusColumn(false);
|
||||
ui.friendList->setShowLastContactColumn(false);
|
||||
ui.friendList->setShowAvatarColumn(true);
|
||||
ui.friendList->setShowIPColumn(false);
|
||||
ui.friendList->setRootIsDecorated(true);
|
||||
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);
|
||||
RsAutoUpdatePage::unlockAllEvents();
|
||||
|
@ -142,11 +142,10 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
|
||||
// load settings
|
||||
RsAutoUpdatePage::lockAllEvents();
|
||||
ui.friendList->setShowStatusColumn(false);
|
||||
ui.friendList->setShowLastContactColumn(false);
|
||||
ui.friendList->setShowAvatarColumn(true);
|
||||
ui.friendList->setShowIPColumn(false);
|
||||
ui.friendList->setRootIsDecorated(true);
|
||||
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);
|
||||
|
@ -77,13 +77,6 @@
|
||||
#define IMAGE_PASTELINK ":/images/pasterslink.png"
|
||||
#define IMAGE_GROUP24 ":/images/user/group24.png"
|
||||
|
||||
#define COLUMN_COUNT 5
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_AVATAR 1
|
||||
#define COLUMN_STATE 2
|
||||
#define COLUMN_LAST_CONTACT 3
|
||||
#define COLUMN_IP 4
|
||||
|
||||
#define COLUMN_DATA 0 // column for storing the userdata id
|
||||
|
||||
#define COLUMN_AVATAR_WIDTH 42
|
||||
@ -143,21 +136,9 @@ FriendList::FriendList(QWidget *parent) :
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||
|
||||
connect(ui->actionHideOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setHideUnconnected(bool)));
|
||||
connect(ui->actionShowStatusColumn, SIGNAL(triggered(bool)), this, SLOT(setShowStatusColumn(bool)));
|
||||
connect(ui->actionShowAvatarColumn, SIGNAL(triggered(bool)), this, SLOT(setShowAvatarColumn(bool)));
|
||||
connect(ui->actionShowLastContactColumn, SIGNAL(triggered(bool)), this, SLOT(setShowLastContactColumn(bool)));
|
||||
connect(ui->actionShowIPColumn, SIGNAL(triggered(bool)), this, SLOT(setShowIPColumn(bool)));
|
||||
connect(ui->actionHideState, SIGNAL(triggered(bool)), this, SLOT(setHideState(bool)));
|
||||
connect(ui->actionRootIsDecorated, SIGNAL(triggered(bool)), this, SLOT(setRootIsDecorated(bool)));
|
||||
connect(ui->actionShowGroups, SIGNAL(triggered(bool)), this, SLOT(setShowGroups(bool)));
|
||||
|
||||
connect(ui->actionSortByName, SIGNAL(triggered()), this, SLOT(setSortByName()));
|
||||
connect(ui->actionSortByState, SIGNAL(triggered()), this, SLOT(setSortByState()));
|
||||
connect(ui->actionSortByLastContact, SIGNAL(triggered()), this, SLOT(setSortByLastContact()));
|
||||
connect(ui->actionSortByIP, SIGNAL(triggered()), this, SLOT(setSortByIP()));
|
||||
connect(ui->actionSortPeersAscendingOrder, SIGNAL(triggered()), this, SLOT(sortPeersAscendingOrder()));
|
||||
connect(ui->actionSortPeersDescendingOrder, SIGNAL(triggered()), this, SLOT(sortPeersDescendingOrder()));
|
||||
|
||||
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
|
||||
|
||||
ui->filterLineEdit->setPlaceholderText(tr("Search")) ;
|
||||
@ -178,6 +159,10 @@ FriendList::FriendList(QWidget *parent) :
|
||||
QShortcut *Shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->peerTreeWidget, 0, 0, Qt::WidgetShortcut);
|
||||
connect(Shortcut, SIGNAL(activated()), this, SLOT(removefriend()));
|
||||
|
||||
/* Initialize tree */
|
||||
ui->peerTreeWidget->setColumnCustomizable(true);
|
||||
connect(ui->peerTreeWidget, SIGNAL(columnVisibleChanged(int,bool)), this, SLOT(peerTreeColumnVisibleChanged(int,bool)));
|
||||
|
||||
/* Initialize display menu */
|
||||
createDisplayMenu();
|
||||
}
|
||||
@ -202,31 +187,20 @@ void FriendList::addToolButton(QToolButton *toolButton)
|
||||
ui->titleBarFrame->layout()->addWidget(toolButton);
|
||||
}
|
||||
|
||||
void FriendList::processSettings(bool bLoad)
|
||||
void FriendList::processSettings(bool load)
|
||||
{
|
||||
int peerTreeVersion = 2; // version number for the settings to solve problems when modifying the column count
|
||||
// state of peer tree
|
||||
ui->peerTreeWidget->processSettings(load);
|
||||
|
||||
if (bLoad) {
|
||||
if (load) {
|
||||
// load settings
|
||||
|
||||
// state of peer tree
|
||||
if (Settings->value("peerTreeVersion").toInt() == peerTreeVersion) {
|
||||
ui->peerTreeWidget->header()->restoreState(Settings->value("peerTree").toByteArray());
|
||||
}
|
||||
// ui->peerTreeWidget->header()->doItemsLayout(); // is needed because I added a third column
|
||||
// restoreState would corrupt the internal sectionCount
|
||||
|
||||
// state of the columns
|
||||
setShowStatusColumn(Settings->value("showStatusColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_STATE)).toBool());
|
||||
setShowLastContactColumn(Settings->value("showLastContactColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_LAST_CONTACT)).toBool());
|
||||
setShowIPColumn(Settings->value("showIPColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_IP)).toBool());
|
||||
setShowAvatarColumn(Settings->value("showAvatarColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_AVATAR)).toBool());
|
||||
|
||||
// states
|
||||
setHideUnconnected(Settings->value("hideUnconnected", mHideUnconnected).toBool());
|
||||
setHideState(Settings->value("hideState", mHideState).toBool());
|
||||
//setRootIsDecorated(Settings->value("rootIsDecorated", ui->peerTreeWidget->rootIsDecorated()).toBool());
|
||||
setRootIsDecorated(true) ;
|
||||
setShowGroups(Settings->value("showGroups", mShowGroups).toBool());
|
||||
|
||||
// open groups
|
||||
@ -238,20 +212,10 @@ void FriendList::processSettings(bool bLoad)
|
||||
Settings->endArray();
|
||||
|
||||
initializeHeader(true);
|
||||
updateHeader();
|
||||
peerTreeColumnVisibleChanged(COLUMN_STATE, !ui->peerTreeWidget->isColumnHidden(COLUMN_STATE));
|
||||
} else {
|
||||
// save settings
|
||||
|
||||
// state of peer tree
|
||||
Settings->setValue("peerTree", ui->peerTreeWidget->header()->saveState());
|
||||
Settings->setValue("peerTreeVersion", peerTreeVersion);
|
||||
|
||||
// state of the columns
|
||||
Settings->setValue("showStatusColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_STATE));
|
||||
Settings->setValue("showLastContactColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_LAST_CONTACT));
|
||||
Settings->setValue("showIPColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_IP));
|
||||
Settings->setValue("showAvatarColumn", !ui->peerTreeWidget->isColumnHidden(COLUMN_AVATAR));
|
||||
|
||||
// states
|
||||
Settings->setValue("hideUnconnected", mHideUnconnected);
|
||||
Settings->setValue("hideState", mHideState);
|
||||
@ -295,12 +259,8 @@ void FriendList::initializeHeader(bool /*afterLoadSettings*/)
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_LAST_CONTACT, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_IP, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_AVATAR, QHeaderView::Fixed);
|
||||
header->setStretchLastSection(false);
|
||||
|
||||
/* if (!afterLoadSettings) {
|
||||
header->resizeSection(COLUMN_NAME, 150);
|
||||
header->resizeSection(COLUMN_LAST_CONTACT, 120);
|
||||
}*/
|
||||
header->resizeSection(COLUMN_NAME, 200);
|
||||
header->resizeSection(COLUMN_AVATAR, COLUMN_AVATAR_WIDTH);
|
||||
}
|
||||
|
||||
@ -560,6 +520,7 @@ void FriendList::insertPeers()
|
||||
|
||||
bool isStatusColumnHidden = ui->peerTreeWidget->isColumnHidden(COLUMN_STATE);
|
||||
bool isAvatarColumnHidden = ui->peerTreeWidget->isColumnHidden(COLUMN_AVATAR);
|
||||
int columnCount = ui->peerTreeWidget->columnCount();
|
||||
|
||||
std::list<StatusInfo> statusInfo;
|
||||
rsStatus->getStatusList(statusInfo);
|
||||
@ -1035,7 +996,7 @@ void FriendList::insertPeers()
|
||||
}
|
||||
sslItem -> setIcon(COLUMN_NAME, sslIcon);
|
||||
|
||||
for (int i = 0; i < COLUMN_COUNT; ++i) {
|
||||
for (int i = 0; i < columnCount; ++i) {
|
||||
sslItem -> setTextColor(i, sslColor);
|
||||
sslItem -> setFont(i, sslFont);
|
||||
}
|
||||
@ -1055,7 +1016,7 @@ void FriendList::insertPeers()
|
||||
|
||||
QColor textColor = mTextColorStatus[bestRSState];
|
||||
QFont font = StatusDefs::font(bestRSState);
|
||||
for(int i = 0; i < COLUMN_COUNT; ++i) {
|
||||
for(int i = 0; i < columnCount; ++i) {
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
gpgItem->setFont(i, font);
|
||||
}
|
||||
@ -1090,7 +1051,7 @@ void FriendList::insertPeers()
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
QColor textColor = mTextColorStatus[RS_STATUS_ONLINE];
|
||||
for(int i = 0; i < COLUMN_COUNT; ++i) {
|
||||
for(int i = 0; i < columnCount; ++i) {
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
gpgItem->setFont(i,font);
|
||||
}
|
||||
@ -1107,7 +1068,7 @@ void FriendList::insertPeers()
|
||||
|
||||
QColor textColor = mTextColorStatus[RS_STATUS_OFFLINE];
|
||||
QFont font = StatusDefs::font(RS_STATUS_OFFLINE);
|
||||
for(int i = 0; i < COLUMN_COUNT; ++i) {
|
||||
for(int i = 0; i < columnCount; ++i) {
|
||||
gpgItem->setTextColor(i, textColor);
|
||||
gpgItem->setFont(i, font);
|
||||
}
|
||||
@ -1161,14 +1122,8 @@ void FriendList::insertPeers()
|
||||
}
|
||||
}
|
||||
|
||||
if (filterText.isEmpty() == false) {
|
||||
filterItems(filterText);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
if (c && c->isHidden()) {
|
||||
// active item is hidden, deselect it
|
||||
ui->peerTreeWidget->setCurrentItem(NULL);
|
||||
if (mFilterText.isEmpty() == false) {
|
||||
filterItems(mFilterText);
|
||||
}
|
||||
|
||||
groupsHasChanged = false;
|
||||
@ -1721,56 +1676,35 @@ void FriendList::setHideUnconnected(bool hidden)
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::setShowStatusColumn(bool show)
|
||||
void FriendList::setColumnVisible(Column column, bool visible)
|
||||
{
|
||||
ui->actionHideState->setEnabled(!show);
|
||||
bool isColumnVisible = !ui->peerTreeWidget->isColumnHidden(COLUMN_STATE);
|
||||
ui->peerTreeWidget->setColumnHidden(column, !visible);
|
||||
peerTreeColumnVisibleChanged(column, visible);
|
||||
}
|
||||
|
||||
if (isColumnVisible != show) {
|
||||
ui->peerTreeWidget->setColumnHidden(COLUMN_STATE, !show);
|
||||
void FriendList::sortByColumn(Column column, Qt::SortOrder sortOrder)
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(column, sortOrder);
|
||||
}
|
||||
|
||||
updateHeader();
|
||||
void FriendList::peerTreeColumnVisibleChanged(int column, bool visible)
|
||||
{
|
||||
switch (column) {
|
||||
case COLUMN_NAME:
|
||||
case COLUMN_AVATAR:
|
||||
case COLUMN_LAST_CONTACT:
|
||||
case COLUMN_IP:
|
||||
break;
|
||||
case COLUMN_STATE:
|
||||
ui->actionHideState->setEnabled(!visible);
|
||||
break;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
insertPeers();
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::setShowLastContactColumn(bool show)
|
||||
{
|
||||
bool isColumnVisible = !ui->peerTreeWidget->isColumnHidden(COLUMN_LAST_CONTACT);
|
||||
|
||||
if (isColumnVisible != show) {
|
||||
ui->peerTreeWidget->setColumnHidden(COLUMN_LAST_CONTACT, !show);
|
||||
|
||||
updateHeader();
|
||||
insertPeers();
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::setShowIPColumn(bool show)
|
||||
{
|
||||
bool isColumnVisible = !ui->peerTreeWidget->isColumnHidden(COLUMN_IP);
|
||||
|
||||
if (isColumnVisible != show) {
|
||||
ui->peerTreeWidget->setColumnHidden(COLUMN_IP, !show);
|
||||
|
||||
updateHeader();
|
||||
insertPeers();
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::setShowAvatarColumn(bool show)
|
||||
{
|
||||
bool isColumnVisible = !ui->peerTreeWidget->isColumnHidden(COLUMN_AVATAR);
|
||||
if (isColumnVisible == show)
|
||||
return;
|
||||
|
||||
ui->peerTreeWidget->setColumnHidden(COLUMN_AVATAR, !show);
|
||||
|
||||
updateHeader();
|
||||
initializeHeader(true);
|
||||
insertPeers();
|
||||
}
|
||||
|
||||
void FriendList::setHideState(bool hidden)
|
||||
{
|
||||
if (mHideState != hidden) {
|
||||
@ -1779,60 +1713,6 @@ void FriendList::setHideState(bool hidden)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the header visible.
|
||||
*/
|
||||
void FriendList::updateHeader()
|
||||
{
|
||||
if (ui->peerTreeWidget->isColumnHidden(COLUMN_STATE) \
|
||||
&& ui->peerTreeWidget->isColumnHidden(COLUMN_LAST_CONTACT) \
|
||||
&& ui->peerTreeWidget->isColumnHidden(COLUMN_IP)) {
|
||||
ui->peerTreeWidget->setHeaderHidden(true);
|
||||
initializeHeader(true);
|
||||
} else {
|
||||
ui->peerTreeWidget->setHeaderHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
void FriendList::setSortByName()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(COLUMN_NAME);
|
||||
sortPeersAscendingOrder();
|
||||
}
|
||||
|
||||
void FriendList::setSortByState()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(COLUMN_STATE);
|
||||
sortPeersAscendingOrder();
|
||||
}
|
||||
|
||||
void FriendList::setSortByLastContact()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(COLUMN_LAST_CONTACT);
|
||||
sortPeersDescendingOrder();
|
||||
}
|
||||
|
||||
void FriendList::setSortByIP()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(COLUMN_IP);
|
||||
sortPeersDescendingOrder();
|
||||
}
|
||||
|
||||
void FriendList::sortPeersAscendingOrder()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(ui->peerTreeWidget->sortColumn(), Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void FriendList::sortPeersDescendingOrder()
|
||||
{
|
||||
ui->peerTreeWidget->sortByColumn(ui->peerTreeWidget->sortColumn(), Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
void FriendList::setRootIsDecorated(bool show)
|
||||
{
|
||||
ui->peerTreeWidget->setRootIsDecorated(show);
|
||||
}
|
||||
|
||||
void FriendList::setShowGroups(bool show)
|
||||
{
|
||||
if (mShowGroups != show) {
|
||||
@ -1885,48 +1765,12 @@ void FriendList::setBigName(bool bigName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides all items that don't contain sPattern in the name column.
|
||||
* Hides all items that don't contain text in the name column.
|
||||
*/
|
||||
void FriendList::filterItems(const QString &text)
|
||||
{
|
||||
filterText = text;
|
||||
int count = ui->peerTreeWidget->topLevelItemCount();
|
||||
for (int index = 0; index < count; ++index) {
|
||||
FriendList::filterItem(ui->peerTreeWidget->topLevelItem(index), filterText);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *c = getCurrentPeer();
|
||||
if (c && c->isHidden()) {
|
||||
// active item is hidden, deselect it
|
||||
ui->peerTreeWidget->setCurrentItem(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
bool FriendList::filterItem(QTreeWidgetItem *item, const QString &text)
|
||||
{
|
||||
bool visible = true;
|
||||
|
||||
if (text.isEmpty() == false) {
|
||||
if (item->text(0).contains(text, Qt::CaseInsensitive) == false) {
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
int visibleChildCount = 0;
|
||||
int count = item->childCount();
|
||||
for (int index = 0; index < count; ++index) {
|
||||
if (FriendList::filterItem(item->child(index), text)) {
|
||||
++visibleChildCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (visible || visibleChildCount) {
|
||||
item->setHidden(false);
|
||||
} else {
|
||||
item->setHidden(true);
|
||||
}
|
||||
|
||||
return (visible || visibleChildCount);
|
||||
mFilterText = text;
|
||||
ui->peerTreeWidget->filterItems(COLUMN_NAME, mFilterText);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1958,56 +1802,16 @@ void FriendList::createDisplayMenu()
|
||||
QMenu *displayMenu = new QMenu(this);
|
||||
connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||
|
||||
// displayMenu->addAction(ui->actionSortPeersDescendingOrder);
|
||||
// displayMenu->addAction(ui->actionSortPeersAscendingOrder);
|
||||
QMenu *menu = displayMenu->addMenu(tr("Columns"));
|
||||
menu->addAction(ui->actionShowAvatarColumn);
|
||||
menu->addAction(ui->actionShowLastContactColumn);
|
||||
menu->addAction(ui->actionShowIPColumn);
|
||||
menu->addAction(ui->actionShowStatusColumn);
|
||||
menu = displayMenu->addMenu(tr("Sort by"));
|
||||
// menu->addAction(ui->actionSortByName);
|
||||
menu->addAction(ui->actionSortByState);
|
||||
// menu->addAction(ui->actionSortByLastContact);
|
||||
// menu->addAction(ui->actionSortByIP);
|
||||
displayMenu->addAction(ui->actionHideOfflineFriends);
|
||||
displayMenu->addAction(ui->actionHideState);
|
||||
// displayMenu->addAction(ui->actionRootIsDecorated);
|
||||
displayMenu->addAction(ui->actionShowGroups);
|
||||
|
||||
QActionGroup *group = new QActionGroup(this);
|
||||
// group->addAction(ui->actionSortByName);
|
||||
group->addAction(ui->actionSortByState);
|
||||
// group->addAction(ui->actionSortByLastContact);
|
||||
// group->addAction(ui->actionSortByIP);
|
||||
|
||||
ui->displayButton->setMenu(displayMenu);
|
||||
}
|
||||
|
||||
void FriendList::updateMenu()
|
||||
{
|
||||
switch (ui->peerTreeWidget->sortColumn()) {
|
||||
case COLUMN_NAME:
|
||||
ui->actionSortByName->setChecked(true);
|
||||
break;
|
||||
case COLUMN_STATE:
|
||||
ui->actionSortByState->setChecked(true);
|
||||
break;
|
||||
case COLUMN_LAST_CONTACT:
|
||||
ui->actionSortByLastContact->setChecked(true);
|
||||
break;
|
||||
case COLUMN_IP:
|
||||
ui->actionSortByIP->setChecked(true);
|
||||
break;
|
||||
case COLUMN_AVATAR:
|
||||
break;
|
||||
}
|
||||
ui->actionShowStatusColumn->setChecked(!ui->peerTreeWidget->isColumnHidden(COLUMN_STATE));
|
||||
ui->actionShowLastContactColumn->setChecked(!ui->peerTreeWidget->isColumnHidden(COLUMN_LAST_CONTACT));
|
||||
ui->actionShowIPColumn->setChecked(!ui->peerTreeWidget->isColumnHidden(COLUMN_IP));
|
||||
ui->actionShowAvatarColumn->setChecked(!ui->peerTreeWidget->isColumnHidden(COLUMN_AVATAR));
|
||||
ui->actionHideOfflineFriends->setChecked(mHideUnconnected);
|
||||
ui->actionHideState->setChecked(mHideState);
|
||||
ui->actionRootIsDecorated->setChecked(ui->peerTreeWidget->rootIsDecorated());
|
||||
ui->actionShowGroups->setChecked(mShowGroups);
|
||||
}
|
||||
|
@ -48,13 +48,23 @@ class FriendList : public RsAutoUpdatePage
|
||||
Q_PROPERTY(QColor textColorStatusOnline READ textColorStatusOnline WRITE setTextColorStatusOnline)
|
||||
Q_PROPERTY(QColor textColorStatusInactive READ textColorStatusInactive WRITE setTextColorStatusInactive)
|
||||
|
||||
public:
|
||||
enum Column
|
||||
{
|
||||
COLUMN_NAME = 0,
|
||||
COLUMN_AVATAR = 1,
|
||||
COLUMN_STATE = 2,
|
||||
COLUMN_LAST_CONTACT = 3,
|
||||
COLUMN_IP = 4
|
||||
};
|
||||
|
||||
public:
|
||||
explicit FriendList(QWidget *parent = 0);
|
||||
~FriendList();
|
||||
|
||||
// Add a tool button to the tool area
|
||||
void addToolButton(QToolButton *toolButton);
|
||||
void processSettings(bool bLoad);
|
||||
void processSettings(bool load);
|
||||
void addGroupToExpand(const std::string &groupId);
|
||||
bool getExpandedGroups(std::set<std::string> &groups) const;
|
||||
void addPeerToExpand(const std::string &gpgId);
|
||||
@ -63,6 +73,8 @@ public:
|
||||
std::string getSelectedGroupId() const;
|
||||
|
||||
virtual void updateDisplay();
|
||||
void setColumnVisible(Column column, bool visible);
|
||||
void sortByColumn(Column column, Qt::SortOrder sortOrder);
|
||||
|
||||
QColor textColorGroup() const { return mTextColorGroup; }
|
||||
QColor textColorStatusOffline() const { return mTextColorStatus[RS_STATUS_OFFLINE]; }
|
||||
@ -85,17 +97,9 @@ public slots:
|
||||
void setShowGroups(bool show);
|
||||
void setHideUnconnected(bool hidden);
|
||||
void setHideState(bool hidden);
|
||||
void setShowStatusColumn(bool show);
|
||||
void setShowLastContactColumn(bool show);
|
||||
void setShowIPColumn(bool show);
|
||||
void setShowAvatarColumn(bool show);
|
||||
void setRootIsDecorated(bool show);
|
||||
void setSortByName();
|
||||
void setSortByState();
|
||||
void setSortByLastContact();
|
||||
void setSortByIP();
|
||||
void sortPeersAscendingOrder();
|
||||
void sortPeersDescendingOrder();
|
||||
|
||||
private slots:
|
||||
void peerTreeColumnVisibleChanged(int column, bool visible);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
@ -111,7 +115,7 @@ private:
|
||||
bool mHideState;
|
||||
bool mHideUnconnected;
|
||||
|
||||
QString filterText;
|
||||
QString mFilterText;
|
||||
|
||||
bool groupsHasChanged;
|
||||
std::set<std::string> *openGroups;
|
||||
@ -122,8 +126,6 @@ private:
|
||||
QColor mTextColorStatus[RS_STATUS_COUNT];
|
||||
|
||||
QTreeWidgetItem *getCurrentPeer() const;
|
||||
static bool filterItem(QTreeWidgetItem *item, const QString &text);
|
||||
void updateHeader();
|
||||
void initializeHeader(bool afterLoadSettings);
|
||||
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds);
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="peerTreeWidget">
|
||||
<widget class="RSTreeWidget" name="peerTreeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
@ -87,9 +87,6 @@
|
||||
<property name="indentation">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -102,11 +99,8 @@
|
||||
<property name="columnCount">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<attribute name="headerCascadingSectionResizes">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
@ -144,25 +138,6 @@
|
||||
<string>Hide Offline Friends</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowStatusColumn">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortByState">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>State</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort by State</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHideState">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -174,85 +149,6 @@
|
||||
<string>Hide State</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortPeersDescendingOrder">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/sort_decrease.png</normaloff>:/images/sort_decrease.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sort Descending Order</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort Descending Order</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortPeersAscendingOrder">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/sort_incr.png</normaloff>:/images/sort_incr.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sort Ascending Order</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort Ascending Order</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowAvatarColumn">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Avatar</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show Avatar Column</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortByName">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort by Name</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortByLastContact">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last Contact</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort by last contact</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowLastContactColumn">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last Contact</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show Last Contact Column</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRootIsDecorated">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set root is Decorated</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set Root Decorated</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowGroups">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -264,28 +160,6 @@
|
||||
<string>Show Groups</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSortByIP">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Sort by IP</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowIPColumn">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show IP Column</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
@ -293,6 +167,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RSTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>gui/common/RSTreeWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
|
Loading…
Reference in New Issue
Block a user