mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added search filter for participants list.
This commit is contained in:
parent
ab82c4a73c
commit
0e1c0c2eb3
@ -76,6 +76,8 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
|
||||
connect(ui.participantsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(participantsTreeWidgetCustomPopupMenu(QPoint)));
|
||||
connect(ui.participantsList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(participantsTreeWidgetDoubleClicked(QTreeWidgetItem*,int)));
|
||||
|
||||
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
|
||||
int S = QFontMetricsF(font()).height() ;
|
||||
ui.participantsList->setIconSize(QSize(1.3*S,1.3*S));
|
||||
|
||||
@ -108,6 +110,11 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
|
||||
|
||||
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
|
||||
|
||||
/* Add filter actions */
|
||||
QTreeWidgetItem *headerItem = ui.participantsList->headerItem();
|
||||
QString headerText = headerItem->text(COLUMN_NAME );
|
||||
ui.filterLineEdit->addFilter(QIcon(), headerText, COLUMN_NAME , QString("%1 %2").arg(tr("Search"), headerText));
|
||||
|
||||
// Add a button to invite friends.
|
||||
//
|
||||
@ -557,6 +564,7 @@ void ChatLobbyDialog::updateParticipantsList()
|
||||
}
|
||||
ui.participantsList->setSortingEnabled(true);
|
||||
sortParcipants();
|
||||
filterIds();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -857,3 +865,16 @@ void ChatLobbyDialog::sortParcipants()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::filterChanged(const QString& /*text*/)
|
||||
{
|
||||
filterIds();
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::filterIds()
|
||||
{
|
||||
int filterColumn = ui.filterLineEdit->currentFilter();
|
||||
QString text = ui.filterLineEdit->text();
|
||||
|
||||
ui.participantsList->filterItems(filterColumn, text);
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ private slots:
|
||||
void participantsTreeWidgetCustomPopupMenu( QPoint point );
|
||||
void inviteFriends() ;
|
||||
void leaveLobby() ;
|
||||
void filterChanged(const QString &text);
|
||||
|
||||
signals:
|
||||
void lobbyLeave(ChatLobbyId) ;
|
||||
@ -83,6 +84,8 @@ protected slots:
|
||||
|
||||
private:
|
||||
void updateParticipantsList();
|
||||
|
||||
void filterIds();
|
||||
|
||||
QString getParticipantName(const RsGxsId& id) const;
|
||||
void muteParticipant(const RsGxsId& id);
|
||||
|
@ -14,7 +14,16 @@
|
||||
<string notr="true">MainWindow</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="ChatLobbyDialogHLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -57,16 +66,43 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="participantsList">
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="LineEditClear" name="filterLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="RSTreeWidget" name="participantsList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
@ -114,6 +150,11 @@
|
||||
<string>Participants</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -128,13 +169,26 @@
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ChatWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">gui/chat/ChatWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RSTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>gui/common/RSTreeWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user