signal_collection_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_GUI_INCLUDE_CORBO_GUI_SIGNAL_COLLECTION_WIDGET_H_
26 #define SRC_GUI_INCLUDE_CORBO_GUI_SIGNAL_COLLECTION_WIDGET_H_
27 
32 #include <QDateTime>
33 #include <QFileDialog>
34 #include <QHash>
35 #include <QList>
36 #include <QMenu>
37 #include <QString>
38 #include <QTreeWidget>
39 #include <QVBoxLayout>
40 #include <QWidget>
41 
42 #include <tuple>
43 
44 namespace corbo {
45 namespace gui {
46 
47 class SignalCollectionWidget : public QWidget
48 {
49  Q_OBJECT
50 
51  public:
52  explicit SignalCollectionWidget(SignalHelper::Ptr signal_helper, QWidget* parent = 0);
53  virtual ~SignalCollectionWidget();
54 
55  QSize sizeHint() const override;
56 
57  public slots:
58  void addSignal(const QString& key, SignalHelper::SignalData& signal_data);
59  void moveToRecent(const QDateTime& dtime);
60  void removeTreeItem(const QString& key, int value_idx);
61 
62  signals:
63  void requestTaskParameterBackup(int task_id);
64  void taskRemoved(int task_id);
65 
66  protected:
67  ExtendedTreeWidget* createSignalTree();
68  void createHistoryArea();
69 
70  void getGroupInfo(const QTreeWidget* tree, const QTreeWidgetItem* item, QString* name_out, int* id_out);
71  void removeSignal(QTreeWidget* tree, QTreeWidgetItem* item);
72 
73  void namespaceContextMenu(const QPoint& point, QTreeWidget* tree);
74  void recentGroupContextMenu(const QPoint& point, CollapsableGroupBox* group, int task_id);
75 
76  void addContextActionsSingleValueSignal(SignalWidget& signal_widget, QMenu& menu);
77  void addContextActionsMultiValueSignal(SignalInterface::Ptr signal, QMenu& menu, QMenu& menu_export);
78 
79  void addContextActionsTimeSeriesSignal(TimeSeriesSignal::Ptr ts_signal, QMenu& menu, int signal_value_idx, QMenu* menu_export = nullptr);
80  void addContextActionsTimeSeriesSignal(TimeSeriesSignal::Ptr ts_signal, QMenu& menu, QMenu* menu_export = nullptr);
81  void addContextActionsTimeSeriesSequenceSignal(TimeSeriesSequenceSignal::Ptr ts_seq_signal, QMenu& menu, int signal_value_idx,
82  QMenu* menu_export = nullptr);
83  void addContextActionsTimeSeriesSequenceSignal(TimeSeriesSequenceSignal::Ptr ts_seq_signal, QMenu& menu, QMenu* menu_export = nullptr);
84  void addContextActionsIndexedValuesSetSignal(IndexedValuesSetSignal::Ptr ivs_signal, QMenu& menu, QMenu* menu_export = nullptr);
85 
86  void addContextActionsMatrixSignal(MatrixSignal::Ptr mat_signal, QMenu& menu, QMenu* menu_export = nullptr);
87  void addContextActionsMatrixSetSignal(MatrixSetSignal::Ptr mat_set_signal, QMenu& menu, QMenu* menu_export = nullptr);
88 
89  private:
91 
92  QVBoxLayout* _main_layout;
93 
94  QVector<std::tuple<CollapsableGroupBox*, QWidget*, int>> _recent_signals; // groupbox + extended_tree_widget + task_id
96  int _current_task_id = 0;
97 };
98 
99 } // namespace gui
100 } // namespace corbo
101 
102 #endif // SRC_GUI_INCLUDE_CORBO_GUI_SIGNAL_COLLECTION_WIDGET_H_
corbo::MatrixSignal::Ptr
std::shared_ptr< MatrixSignal > Ptr
Definition: signals.h:564
corbo::gui::SignalCollectionWidget::addContextActionsTimeSeriesSequenceSignal
void addContextActionsTimeSeriesSequenceSignal(TimeSeriesSequenceSignal::Ptr ts_seq_signal, QMenu &menu, int signal_value_idx, QMenu *menu_export=nullptr)
Definition: signal_collection_widget.cpp:717
corbo::gui::SignalCollectionWidget::SignalCollectionWidget
SignalCollectionWidget(SignalHelper::Ptr signal_helper, QWidget *parent=0)
Definition: signal_collection_widget.cpp:84
corbo::gui::SignalCollectionWidget::removeTreeItem
void removeTreeItem(const QString &key, int value_idx)
Definition: signal_collection_widget.cpp:256
corbo::gui::SignalCollectionWidget::addContextActionsMultiValueSignal
void addContextActionsMultiValueSignal(SignalInterface::Ptr signal, QMenu &menu, QMenu &menu_export)
Definition: signal_collection_widget.cpp:611
corbo::gui::SignalCollectionWidget::requestTaskParameterBackup
void requestTaskParameterBackup(int task_id)
corbo::gui::SignalCollectionWidget::_signal_tree
ExtendedTreeWidget * _signal_tree
Definition: signal_collection_widget.h:161
corbo
Definition: communication/include/corbo-communication/utilities.h:37
corbo::gui::SignalCollectionWidget::addContextActionsMatrixSignal
void addContextActionsMatrixSignal(MatrixSignal::Ptr mat_signal, QMenu &menu, QMenu *menu_export=nullptr)
Definition: signal_collection_widget.cpp:802
corbo::gui::SignalCollectionWidget::addContextActionsIndexedValuesSetSignal
void addContextActionsIndexedValuesSetSignal(IndexedValuesSetSignal::Ptr ivs_signal, QMenu &menu, QMenu *menu_export=nullptr)
Definition: signal_collection_widget.cpp:774
signal_widget.h
corbo::SignalInterface::Ptr
std::shared_ptr< SignalInterface > Ptr
Definition: signals.h:158
corbo::gui::SignalCollectionWidget::~SignalCollectionWidget
virtual ~SignalCollectionWidget()
Definition: signal_collection_widget.cpp:108
corbo::gui::SignalCollectionWidget::recentGroupContextMenu
void recentGroupContextMenu(const QPoint &point, CollapsableGroupBox *group, int task_id)
Definition: signal_collection_widget.cpp:422
corbo::gui::SignalCollectionWidget::moveToRecent
void moveToRecent(const QDateTime &dtime)
Definition: signal_collection_widget.cpp:219
signal_helper.h
corbo::MatrixSetSignal::Ptr
std::shared_ptr< MatrixSetSignal > Ptr
Definition: signals.h:632
corbo::gui::SignalCollectionWidget::_signal_helper
SignalHelper::Ptr _signal_helper
Definition: signal_collection_widget.h:156
extended_tree_widget.h
corbo::gui::SignalCollectionWidget::getGroupInfo
void getGroupInfo(const QTreeWidget *tree, const QTreeWidgetItem *item, QString *name_out, int *id_out)
Definition: signal_collection_widget.cpp:370
corbo::gui::SignalCollectionWidget::namespaceContextMenu
void namespaceContextMenu(const QPoint &point, QTreeWidget *tree)
Definition: signal_collection_widget.cpp:481
corbo::gui::SignalCollectionWidget::createSignalTree
ExtendedTreeWidget * createSignalTree()
Definition: signal_collection_widget.cpp:112
corbo::gui::SignalCollectionWidget::addContextActionsTimeSeriesSignal
void addContextActionsTimeSeriesSignal(TimeSeriesSignal::Ptr ts_signal, QMenu &menu, int signal_value_idx, QMenu *menu_export=nullptr)
Definition: signal_collection_widget.cpp:635
corbo::gui::SignalCollectionWidget::addContextActionsSingleValueSignal
void addContextActionsSingleValueSignal(SignalWidget &signal_widget, QMenu &menu)
Definition: signal_collection_widget.cpp:568
corbo::gui::SignalCollectionWidget::sizeHint
QSize sizeHint() const override
Definition: signal_collection_widget.cpp:110
corbo::gui::SignalCollectionWidget::addSignal
void addSignal(const QString &key, SignalHelper::SignalData &signal_data)
Definition: signal_collection_widget.cpp:130
corbo::gui::SignalCollectionWidget::removeSignal
void removeSignal(QTreeWidget *tree, QTreeWidgetItem *item)
Definition: signal_collection_widget.cpp:394
collapsable_groupbox.h
corbo::gui::SignalCollectionWidget::taskRemoved
void taskRemoved(int task_id)
corbo::IndexedValuesSetSignal::Ptr
std::shared_ptr< IndexedValuesSetSignal > Ptr
Definition: signals.h:499
corbo::gui::SignalCollectionWidget::_current_task_id
int _current_task_id
Definition: signal_collection_widget.h:162
corbo::gui::SignalCollectionWidget::createHistoryArea
void createHistoryArea()
corbo::gui::ExtendedTreeWidget
Definition: extended_tree_widget.h:79
corbo::gui::SignalCollectionWidget::_recent_signals
QVector< std::tuple< CollapsableGroupBox *, QWidget *, int > > _recent_signals
Definition: signal_collection_widget.h:160
corbo::TimeSeriesSequenceSignal::Ptr
std::shared_ptr< TimeSeriesSequenceSignal > Ptr
Definition: signals.h:358
corbo::gui::SignalCollectionWidget::_main_layout
QVBoxLayout * _main_layout
Definition: signal_collection_widget.h:158
corbo::gui::SignalHelper::Ptr
std::shared_ptr< SignalHelper > Ptr
Definition: signal_helper.h:111
corbo::gui::SignalCollectionWidget::addContextActionsMatrixSetSignal
void addContextActionsMatrixSetSignal(MatrixSetSignal::Ptr mat_set_signal, QMenu &menu, QMenu *menu_export=nullptr)
Definition: signal_collection_widget.cpp:830
corbo::TimeSeriesSignal::Ptr
std::shared_ptr< TimeSeriesSignal > Ptr
Definition: signals.h:269


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:06:12