SensorDevicesWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * \package RobotAPI::gui-plugins::RobotUnitPlugin
17 * \author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * \date 2017
19 * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <atomic>
26#include <mutex>
27
28#include <QFormLayout>
29#include <QHBoxLayout>
30#include <QLabel>
31#include <QLineEdit>
32#include <QPushButton>
33#include <QTreeWidget>
34#include <QTreeWidgetItem>
35#include <QWidget>
36
39
40#include <RobotAPI/gui-plugins/RobotUnitPlugin/ui_SensorDevicesWidget.h>
41#include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
42
43#include "RobotUnitWidgetBase.h"
44
45namespace armarx
46{
48
49 class SensorDevicesWidget : public RobotUnitWidgetTemplateBase<Ui::SensorDevicesWidget>
50 {
51 public:
52 explicit SensorDevicesWidget(QWidget* parent = 0);
53 ~SensorDevicesWidget() override;
54 void sensorDeviceStatusChanged(const SensorDeviceStatusSeq& allStatus);
55
56 protected:
57 void clearAll() override;
58 void doContentUpdate() override;
59 void getResetData() override;
60 bool addOneFromResetData() override;
61
62 private:
63 void add(const SensorDeviceDescription& desc);
64
65 std::map<std::string, SensorDevicesWidgetEntry*> entries;
66 std::map<std::string, SensorDeviceStatus> statusUpdates;
67 SensorDeviceDescriptionSeq resetData;
68
69 public:
70 static constexpr int idxName = 0;
71 static constexpr int idxTags = 1;
72 static constexpr int idxValType = 2;
73 static constexpr int idxValue = 3;
74 };
75
77 {
78
79 Q_OBJECT
80 public:
82 QTreeWidget& treeWidget,
83 const SensorDeviceDescription& desc);
84
85 void update(const SensorDeviceStatus& status);
86
87 bool matchName(const QString& name);
88 bool matchTag(const QString& tag);
89 bool matchValueType(const QString& type);
90
91 public slots:
92 void setVisible(bool vis);
93
94 private slots:
95 void hideTagList(bool hide);
96
97 private:
98 QTreeWidgetItem* header;
99 VariantWidget* value;
100 std::vector<QTreeWidgetItem*> tags;
101 };
102} // namespace armarx
bool matchValueType(const QString &type)
SensorDevicesWidgetEntry(SensorDevicesWidget &parent, QTreeWidget &treeWidget, const SensorDeviceDescription &desc)
void update(const SensorDeviceStatus &status)
void sensorDeviceStatusChanged(const SensorDeviceStatusSeq &allStatus)
static constexpr int idxValType
This file offers overloads of toIce() and fromIce() functions for STL container types.