From cac96b83174916d8dad5cecc22151bba0be0a8dd Mon Sep 17 00:00:00 2001 From: thunder2 Date: Wed, 19 Jun 2013 13:18:15 +0000 Subject: [PATCH] - Added some performance optimizations in FriendSelectionWidget::peerStatusChanged - Fixed some ui design git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6442 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/CreateMsgLinkDialog.cpp | 12 ++++----- retroshare-gui/src/gui/CreateMsgLinkDialog.h | 8 ------ retroshare-gui/src/gui/CreateMsgLinkDialog.ui | 20 +++++++++++++- .../src/gui/common/FriendSelectionWidget.cpp | 27 ++++++++++++++++++- .../src/gui/common/FriendSelectionWidget.h | 2 +- .../src/gui/common/FriendSelectionWidget.ui | 3 +++ retroshare-gui/src/gui/settings/ChatPage.ui | 2 +- 7 files changed, 55 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/CreateMsgLinkDialog.cpp b/retroshare-gui/src/gui/CreateMsgLinkDialog.cpp index 752454f0f..c25d415c6 100644 --- a/retroshare-gui/src/gui/CreateMsgLinkDialog.cpp +++ b/retroshare-gui/src/gui/CreateMsgLinkDialog.cpp @@ -36,13 +36,12 @@ CreateMsgLinkDialog::CreateMsgLinkDialog() setAttribute(Qt::WA_DeleteOnClose, false); - layout()->addWidget( _gpg_selection = new FriendSelectionWidget(this) ) ; QObject::connect(_create_link_PB,SIGNAL(clicked()),this,SLOT(createLink())) ; - _gpg_selection->setModus(FriendSelectionWidget::MODUS_SINGLE) ; - _gpg_selection->setShowType(FriendSelectionWidget::SHOW_NON_FRIEND_GPG | FriendSelectionWidget::SHOW_GPG) ; - _gpg_selection->setHeaderText(QObject::tr("Select who can contact you:")) ; - _gpg_selection->start() ; + friendSelectionWidget->setModus(FriendSelectionWidget::MODUS_SINGLE) ; + friendSelectionWidget->setShowType(FriendSelectionWidget::SHOW_NON_FRIEND_GPG | FriendSelectionWidget::SHOW_GPG) ; + friendSelectionWidget->setHeaderText(QObject::tr("Select who can contact you:")) ; + friendSelectionWidget->start() ; layout()->update() ; update() ; @@ -83,7 +82,7 @@ void CreateMsgLinkDialog::createLink() time_t validity_duration = computeValidityDuration() ; FriendSelectionWidget::IdType type ; - std::string current_pgp_id = _gpg_selection->selectedId(type) ; + std::string current_pgp_id = friendSelectionWidget->selectedId(type) ; std::string encrypted_string ; @@ -132,4 +131,3 @@ void CreateMsgLinkDialog::createLink() QMessageBox::information(NULL,tr("Messenging invite created"),tr("Your new messenging chat invite has been copied to clipboard. You can now paste it as a Retroshare link.")) ; #endif } - diff --git a/retroshare-gui/src/gui/CreateMsgLinkDialog.h b/retroshare-gui/src/gui/CreateMsgLinkDialog.h index 1a7656fe7..ebaa12e58 100644 --- a/retroshare-gui/src/gui/CreateMsgLinkDialog.h +++ b/retroshare-gui/src/gui/CreateMsgLinkDialog.h @@ -42,12 +42,4 @@ class CreateMsgLinkDialog : public QDialog, public Ui::CreateMsgLinkDialog private: time_t computeValidityDuration() const ; - - /** Qt Designer generated object */ - FriendSelectionWidget *_gpg_selection ; }; - - - - - diff --git a/retroshare-gui/src/gui/CreateMsgLinkDialog.ui b/retroshare-gui/src/gui/CreateMsgLinkDialog.ui index 89e873df5..27a3572d3 100644 --- a/retroshare-gui/src/gui/CreateMsgLinkDialog.ui +++ b/retroshare-gui/src/gui/CreateMsgLinkDialog.ui @@ -7,7 +7,7 @@ 0 0 590 - 179 + 427 @@ -118,8 +118,26 @@ + + + + + 0 + 0 + + + + + + + FriendSelectionWidget + QWidget +
gui/common/FriendSelectionWidget.h
+ 1 +
+
diff --git a/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp b/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp index 674b1319a..9c2287b3a 100644 --- a/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp +++ b/retroshare-gui/src/gui/common/FriendSelectionWidget.cpp @@ -533,6 +533,9 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status) while ((item = *itemIterator) != NULL) { itemIterator++; + bool bFoundGPG = false; + bool bFoundSSL = false; + switch (idTypeFromItem(item)) { case IDTYPE_NONE: case IDTYPE_GROUP: @@ -549,6 +552,8 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status) item->setTextColor(COLUMN_NAME, color); item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(gpgStatus))); + + bFoundGPG = true; } } break; @@ -564,11 +569,31 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status) item->setTextColor(COLUMN_NAME, color); item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(status))); + + bFoundSSL = true; } } break; } - // friend can assigned to groups more than one + + if (bFoundGPG) { + if (mShowTypes & SHOW_GROUP) { + // a friend can be assigned to more than one group + } else { + if (mShowTypes & SHOW_SSL) { + // search for ssl id + } else { + break; + } + } + } + if (bFoundSSL) { + if (mShowTypes & SHOW_GROUP) { + // a friend can be assigned to more than one group + } else { + break; + } + } } } diff --git a/retroshare-gui/src/gui/common/FriendSelectionWidget.h b/retroshare-gui/src/gui/common/FriendSelectionWidget.h index fc55ec9ad..ea58c2bb5 100644 --- a/retroshare-gui/src/gui/common/FriendSelectionWidget.h +++ b/retroshare-gui/src/gui/common/FriendSelectionWidget.h @@ -106,7 +106,6 @@ signals: private slots: void fillList(); - void secured_fillList(); void peerStatusChanged(const QString& peerId, int status); void filterItems(const QString &text); void contextMenuRequested(const QPoint &pos); @@ -116,6 +115,7 @@ private slots: void deselectAll() ; private: + void secured_fillList(); bool filterItem(QTreeWidgetItem *item, const QString &text); void selectedIds(IdType idType, std::list &ids, bool onlyDirectSelected); diff --git a/retroshare-gui/src/gui/common/FriendSelectionWidget.ui b/retroshare-gui/src/gui/common/FriendSelectionWidget.ui index 2b1b860be..b371dfe82 100644 --- a/retroshare-gui/src/gui/common/FriendSelectionWidget.ui +++ b/retroshare-gui/src/gui/common/FriendSelectionWidget.ui @@ -11,6 +11,9 @@
+ + 0 + diff --git a/retroshare-gui/src/gui/settings/ChatPage.ui b/retroshare-gui/src/gui/settings/ChatPage.ui index 00d2194c2..0e9a0d27f 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.ui +++ b/retroshare-gui/src/gui/settings/ChatPage.ui @@ -14,7 +14,7 @@ - 1 + 0