- 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
This commit is contained in:
thunder2 2013-06-19 13:18:15 +00:00
parent 771ae5ba58
commit cac96b8317
7 changed files with 55 additions and 19 deletions

View File

@ -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
}

View File

@ -42,12 +42,4 @@ class CreateMsgLinkDialog : public QDialog, public Ui::CreateMsgLinkDialog
private:
time_t computeValidityDuration() const ;
/** Qt Designer generated object */
FriendSelectionWidget *_gpg_selection ;
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>590</width>
<height>179</height>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
@ -118,8 +118,26 @@
</item>
</layout>
</item>
<item>
<widget class="FriendSelectionWidget" name="friendSelectionWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -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;
}
}
}
}

View File

@ -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<std::string> &ids, bool onlyDirectSelected);

View File

@ -11,6 +11,9 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="friendList">
<property name="minimumSize">

View File

@ -14,7 +14,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="general">
<attribute name="title">