From cc92fdfc8138d38b24d32b65c555bbbd19caa7f0 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 30 Aug 2013 12:24:39 +0000 Subject: [PATCH] Moved the filter edit and the display button from FriendsDialog and MessengerWindow into FriendList. Updated english translation git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6649 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/FriendsDialog.cpp | 5 - retroshare-gui/src/gui/FriendsDialog.ui | 50 --------- retroshare-gui/src/gui/MessengerWindow.cpp | 18 +-- retroshare-gui/src/gui/MessengerWindow.ui | 105 ++---------------- retroshare-gui/src/gui/common/FriendList.cpp | 26 ++++- retroshare-gui/src/gui/common/FriendList.h | 6 +- retroshare-gui/src/gui/common/FriendList.ui | 65 ++++++++++- .../src/gui/common/GroupTreeWidget.h | 2 +- retroshare-gui/src/lang/retroshare_en.ts | 20 +--- 9 files changed, 115 insertions(+), 182 deletions(-) diff --git a/retroshare-gui/src/gui/FriendsDialog.cpp b/retroshare-gui/src/gui/FriendsDialog.cpp index 3fede942c..9ea095d12 100644 --- a/retroshare-gui/src/gui/FriendsDialog.cpp +++ b/retroshare-gui/src/gui/FriendsDialog.cpp @@ -90,10 +90,6 @@ FriendsDialog::FriendsDialog(QWidget *parent) connect( ui.actionAdd_Friend, SIGNAL(triggered()), this, SLOT(addFriend())); connect( ui.actionFriendRecommendations, SIGNAL(triggered()), this, SLOT(recommendFriends())); connect( ui.actionServicePermission, SIGNAL(triggered()), this, SLOT(servicePermission())); - connect( ui.filter_lineEdit, SIGNAL(textChanged(QString)), ui.friendList, SLOT(filterItems(QString))); - - ui.filter_lineEdit->setPlaceholderText(tr("Search")) ; - ui.filter_lineEdit->showFilterIcon(); ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME); ui.avatar->setOwnId(); @@ -194,7 +190,6 @@ FriendsDialog::FriendsDialog(QWidget *parent) ui.splitter_2->setSizes(sizes); loadmypersonalstatus(); - ui.displayButton->setMenu(ui.friendList->createDisplayMenu()); // load settings RsAutoUpdatePage::lockAllEvents(); diff --git a/retroshare-gui/src/gui/FriendsDialog.ui b/retroshare-gui/src/gui/FriendsDialog.ui index 5b646c3a4..9c39f6d52 100644 --- a/retroshare-gui/src/gui/FriendsDialog.ui +++ b/retroshare-gui/src/gui/FriendsDialog.ui @@ -96,51 +96,6 @@ 2 - - - - 0 - - - 0 - - - - - - - - - 30 - 0 - - - - Qt::NoFocus - - - Display - - - - :/images/looknfeel.png:/images/looknfeel.png - - - - 32 - 16 - - - - QToolButton::InstantPopup - - - true - - - - - @@ -895,11 +850,6 @@ - - LineEditClear - QLineEdit -
gui/common/LineEditClear.h
-
LinkTextBrowser QTextBrowser diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index dcc6e074e..efd5500dc 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -103,11 +103,7 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags) ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME); ui.avatar->setOwnId(); - connect( ui.shareButton, SIGNAL(clicked()), SLOT(openShareManager())); - connect( ui.addIMAccountButton, SIGNAL(clicked( bool ) ), this , SLOT( addFriend() ) ); - connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage())); - connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), ui.friendList, SLOT(filterItems(QString))); connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateAvatar())); connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage())); @@ -131,10 +127,18 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WFlags flags) ui.messagelineEdit->setMinimumWidth(20); - ui.displaytoolButton->setMenu(ui.friendList->createDisplayMenu()); + /* Initialize friend list */ + QToolButton *button = new QToolButton(this); + button->setIcon(QIcon(":/images/user/add_user24.png")); + button->setToolTip(tr("Add a Friend")); + connect(button, SIGNAL(clicked()), this, SLOT(addFriend())); + ui.friendList->addToolButton(button); - ui.filterLineEdit->setPlaceholderText(tr("Search")) ; - ui.filterLineEdit->showFilterIcon(); + button = new QToolButton(this); + button->setIcon(QIcon(":/images/friendsfolder24.png")); + button->setToolTip(tr("Share files for your friends")); + connect(button, SIGNAL(clicked()), this, SLOT(openShareManager())); + ui.friendList->addToolButton(button); // load settings RsAutoUpdatePage::lockAllEvents(); diff --git a/retroshare-gui/src/gui/MessengerWindow.ui b/retroshare-gui/src/gui/MessengerWindow.ui index c49a8b59d..368dd2164 100644 --- a/retroshare-gui/src/gui/MessengerWindow.ui +++ b/retroshare-gui/src/gui/MessengerWindow.ui @@ -14,7 +14,7 @@ RetroShare Messenger - + :/images/rstray3.png:/images/rstray3.png @@ -99,95 +99,7 @@
- - - - - 16777215 - 32 - - - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - Search Friends - - - - - - - Add a Friend - - - - :/images/user/add_user24.png:/images/user/add_user24.png - - - - 24 - 24 - - - - true - - - - - - - Share files for your friends - - - - :/images/friendsfolder24.png:/images/friendsfolder24.png - - - - 24 - 24 - - - - true - - - - - - - - :/images/looknfeel.png:/images/looknfeel.png - - - - 32 - 24 - - - - QToolButton::InstantPopup - - - true - - - - - - - + @@ -203,7 +115,7 @@ - + @@ -230,17 +142,12 @@ 0 0 258 - 20 + 21 - - LineEditClear - QLineEdit -
gui/common/LineEditClear.h
-
AvatarWidget QLabel @@ -260,6 +167,8 @@ 1
- + + + diff --git a/retroshare-gui/src/gui/common/FriendList.cpp b/retroshare-gui/src/gui/common/FriendList.cpp index 3c4b23eaf..8a2d1e52e 100644 --- a/retroshare-gui/src/gui/common/FriendList.cpp +++ b/retroshare-gui/src/gui/common/FriendList.cpp @@ -156,6 +156,11 @@ FriendList::FriendList(QWidget *parent) : 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")) ; + ui->filterLineEdit->showFilterIcon(); + initializeHeader(false); ui->peerTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder); @@ -170,6 +175,9 @@ FriendList::FriendList(QWidget *parent) : // http://bugreports.qt.nokia.com/browse/QTBUG-8270 QShortcut *Shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->peerTreeWidget, 0, 0, Qt::WidgetShortcut); connect(Shortcut, SIGNAL(activated()), this, SLOT(removefriend())); + + /* Initialize display menu */ + createDisplayMenu(); } FriendList::~FriendList() @@ -178,6 +186,20 @@ FriendList::~FriendList() delete(m_compareRole); } +void FriendList::addToolButton(QToolButton *toolButton) +{ + if (!toolButton) { + return; + } + + /* Initialize button */ + toolButton->setAutoRaise(true); + toolButton->setIconSize(ui->displayButton->iconSize()); + toolButton->setFocusPolicy(ui->displayButton->focusPolicy()); + + ui->titleBarFrame->layout()->addWidget(toolButton); +} + void FriendList::processSettings(bool bLoad) { int peerTreeVersion = 2; // version number for the settings to solve problems when modifying the column count @@ -1965,7 +1987,7 @@ void FriendList::addPeerToExpand(const std::string &gpgId) openPeers->insert(gpgId); } -QMenu *FriendList::createDisplayMenu() +void FriendList::createDisplayMenu() { QMenu *displayMenu = new QMenu(this); connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); @@ -1993,7 +2015,7 @@ QMenu *FriendList::createDisplayMenu() // group->addAction(ui->actionSortByLastContact); // group->addAction(ui->actionSortByIP); - return displayMenu; + ui->displayButton->setMenu(displayMenu); } void FriendList::updateMenu() diff --git a/retroshare-gui/src/gui/common/FriendList.h b/retroshare-gui/src/gui/common/FriendList.h index f39ab2a4e..ec35f0ad7 100644 --- a/retroshare-gui/src/gui/common/FriendList.h +++ b/retroshare-gui/src/gui/common/FriendList.h @@ -35,7 +35,7 @@ namespace Ui { class RSTreeWidgetItemCompareRole; class QTreeWidgetItem; -class QMenu; +class QToolButton; class FriendList : public RsAutoUpdatePage { @@ -52,7 +52,8 @@ public: explicit FriendList(QWidget *parent = 0); ~FriendList(); - QMenu *createDisplayMenu(); + // Add a tool button to the tool area + void addToolButton(QToolButton *toolButton); void processSettings(bool bLoad); void addGroupToExpand(const std::string &groupId); bool getExpandedGroups(std::set &groups) const; @@ -98,6 +99,7 @@ public slots: protected: void changeEvent(QEvent *e); + void createDisplayMenu(); private: Ui::FriendList *ui; diff --git a/retroshare-gui/src/gui/common/FriendList.ui b/retroshare-gui/src/gui/common/FriendList.ui index 72bb5f303..d1d78da1e 100644 --- a/retroshare-gui/src/gui/common/FriendList.ui +++ b/retroshare-gui/src/gui/common/FriendList.ui @@ -10,10 +10,66 @@ 229 - + + + 0 + 0 + + + + QFrame::Box + + + QFrame::Sunken + + + + 3 + + + 2 + + + + + + + + + 30 + 0 + + + + Qt::NoFocus + + + Display + + + + :/images/looknfeel.png:/images/looknfeel.png + + + + 32 + 16 + + + + QToolButton::InstantPopup + + + true + + + + + + @@ -238,6 +294,13 @@ + + + LineEditClear + QLineEdit +
gui/common/LineEditClear.h
+
+
diff --git a/retroshare-gui/src/gui/common/GroupTreeWidget.h b/retroshare-gui/src/gui/common/GroupTreeWidget.h index f36d9ef9a..dd7326ac3 100644 --- a/retroshare-gui/src/gui/common/GroupTreeWidget.h +++ b/retroshare-gui/src/gui/common/GroupTreeWidget.h @@ -73,7 +73,7 @@ public: GroupTreeWidget(QWidget *parent = 0); ~GroupTreeWidget(); - // Add a widget to the tool area + // Add a tool button to the tool area void addToolButton(QToolButton *toolButton); // Load and save settings (group must be startet from the caller) diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts index 86154a3d5..46a113319 100644 --- a/retroshare-gui/src/lang/retroshare_en.ts +++ b/retroshare-gui/src/lang/retroshare_en.ts @@ -5538,6 +5538,10 @@ p, li { white-space: pre-wrap; } Service permissions matrix + + Display + + FriendRecommendDialog @@ -5610,10 +5614,6 @@ p, li { white-space: pre-wrap; } Friends - - Display - - Edit status message @@ -5722,10 +5722,6 @@ p, li { white-space: pre-wrap; } Service permissions - - Search - - Local network @@ -9172,10 +9168,6 @@ Do you want to save message ? RetroShare Messenger - - Search Friends - - Add a Friend @@ -9184,10 +9176,6 @@ Do you want to save message ? Share files for your friends - - Search - - MsgItem