Skip to content
Snippets Groups Projects
Commit 4961fc99 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

added search in SystemStateMonitor

parent 7d00b49f
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@
#include <vector>
#include <ArmarXCore/core/IceGridAdmin.h>
#include <Ice/Ice.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/InfixFilterModel.h>
#include <QVector>
......@@ -43,6 +44,8 @@ SystemStateMonitorWidget::SystemStateMonitorWidget()
setupModel();
setupView();
qRegisterMetaType<StateUpdateMap>("StateUpdateMap");
filterExpansionTimer.setSingleShot(true);
connect(&filterExpansionTimer, SIGNAL(timeout()), this, SLOT(delayedFilterExpansion()));
}
......@@ -85,7 +88,13 @@ void SystemStateMonitorWidget::setupView()
connect(managerRepositoryDialog, SIGNAL(accepted()), this, SLOT(acceptConfig()));
connect(managerRepositoryDialog, SIGNAL(requestedManagerScan()), this, SLOT(retrieveOnlineManagers()));
ui.monitoredManagersTree->setModel(monitoredManagerModel);
auto proxyModel = new InfixFilterModel(this);
proxyModel->setSourceModel(monitoredManagerModel);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui.monitoredManagersTree->setModel(proxyModel);
connect(ui.lineEditFilter, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString)));
connect(ui.lineEditFilter, SIGNAL(textChanged(QString)), this, SLOT(expandFilterSelection(QString)), Qt::QueuedConnection);
connect(ui.configureButton, SIGNAL(clicked()), this, SLOT(openManagerRepositoryDialog()));
......@@ -270,3 +279,22 @@ void SystemStateMonitorWidget::prefillView()
ui.monitoredManagersTree->expandToDepth(1);
}
void SystemStateMonitorWidget::expandFilterSelection(QString filterStr)
{
ARMARX_INFO_S << VAROUT(filterStr);
if (filterStr.length() == 0)
{
ui.monitoredManagersTree->collapseAll();
// ui.monitoredManagersTree->expandToDepth(1);
}
else
{
filterExpansionTimer.start(500);
}
}
void SystemStateMonitorWidget::delayedFilterExpansion()
{
InfixFilterModel::ExpandFilterResults(ui.monitoredManagersTree);
}
......@@ -147,6 +147,8 @@ namespace armarx
* Prefills the widgets view with all currently existing components
*/
void prefillView();
void expandFilterSelection(QString filterStr);
void delayedFilterExpansion();
private:
......@@ -163,7 +165,7 @@ namespace armarx
Mutex managerPrxMapMutex;
ManagerPrxMap currentManagerPrxMap;
QTimer filterExpansionTimer;
/**
* Main widget
*/
......
......@@ -25,64 +25,67 @@
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTreeView" name="monitoredManagersTree">
<property name="autoExpandDelay">
<number>0</number>
<widget class="QToolButton" name="configureButton">
<property name="toolTip">
<string>Configure</string>
</property>
<property name="itemsExpandable">
<bool>true</bool>
<property name="statusTip">
<string>Configure monitored objects</string>
</property>
<property name="sortingEnabled">
<bool>true</bool>
<property name="text">
<string>...</string>
</property>
<property name="animated">
<bool>true</bool>
<property name="icon">
<iconset resource="../../libraries/ArmarXGuiBase/armarxicons.qrc">
<normaloff>:/icons/configure-3.png</normaloff>:/icons/configure-3.png</iconset>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFilter">
<property name="placeholderText">
<string>Filter component list...</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QToolButton" name="configureButton">
<property name="toolTip">
<string>Configure</string>
</property>
<property name="statusTip">
<string>Configure monitored objects</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../libraries/ArmarXGuiBase/armarxicons.qrc">
<normaloff>:/icons/configure-3.png</normaloff>:/icons/configure-3.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="monitoredManagersTree">
<property name="autoExpandDelay">
<number>0</number>
</property>
<property name="itemsExpandable">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment