ImageRecorderWidgetController.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 VisionX::gui-plugins::ImageRecorder
17 * @author Christian R. G. Dreher <c.dreher@kit.edu>
18 * @date 2020
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23
24#pragma once
25
26
27// STD/STL
28
29
30// Qt
31#include <QDialog>
32#include <QPointer>
33#include <QString>
34#include <QTimer>
35
36// ArmarX
40
41#include <VisionX/components/ImageRecordingManager/ImageRecordingManagerInterface.h>
43#include <VisionX/gui-plugins/ImageRecorder/ui_ImageRecorderWidget.h>
44
45namespace visionx
46{
47
49
51 public armarx::ArmarXComponentWidgetControllerTemplate<ImageRecorderWidgetController>
52 {
53
54 Q_OBJECT
55
56 private:
57 QPointer<QTimer> m_poll_timer;
58
59 QPointer<armarx::SimpleConfigDialog> m_config_dialog;
60
61 Ui::image_recorder_widget m_widget;
62
63 std::string m_imrecman_name;
64
65 ImageRecordingManagerInterfacePrx m_imrecman;
66
67 std::map<std::string, ImageProviderConfigWidget*> m_config_widgets;
68
69 unsigned int m_image_provider_ctr = 0;
70
71 public:
73
74 void onInitComponent() override;
75
76 void onConnectComponent() override;
77
78 void onDisconnectComponent() override;
79
80 void onExitComponent() override;
81
82 static QString
84 {
85 return "VisionX.ImageRecorder";
86 }
87
88 static QIcon
90 {
91 return QIcon{"://icons/image_recorder.svg"};
92 }
93
94 static QIcon
96 {
97 return QIcon{"://icons/eye.svg"};
98 }
99
100 void loadSettings(QSettings* settings) override;
101
102 void saveSettings(QSettings* settings) override;
103
104 QPointer<QDialog> getConfigDialog(QWidget* parent) override;
105
106 void configured() override;
107
108 //QPointer<QWidget> getCustomTitlebarWidget(QWidget* parent) override;
109
110 void build_ui_from_config(const std::map<std::string, imrec::Config>& configs);
111
112 void update_statuses(const std::map<std::string, visionx::imrec::Status>& statuses);
113
114 void add_image_provider_conf_widget(const std::string& image_provider_name,
115 const imrec::Config& config);
116
117 std::map<std::string, imrec::Config> to_config_map();
118
119 signals:
120
122
124
125 private slots:
126
127 void init_gui();
128
129 void uninit_gui();
130
131 void poll_statuses();
132
133 void get_config_from_imrecman();
134
135 void set_config_at_imrecman();
136
137 void add_image_provider();
138
139 void remove_image_provider(const std::string& name);
140
141 void copy_config_json_to_clipboard();
142
143 void update_start_rec_label();
144
145 void start_recordings();
146
147 void stop_recordings();
148
149 void edit_mode_changed(int state);
150
151 void rename_image_provider(const std::string& old_name, const std::string& new_name);
152 };
153} // namespace visionx
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void add_image_provider_conf_widget(const std::string &image_provider_name, const imrec::Config &config)
std::map< std::string, imrec::Config > to_config_map()
void build_ui_from_config(const std::map< std::string, imrec::Config > &configs)
void onConnectComponent() override
Pure virtual hook for the subclass.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
void update_statuses(const std::map< std::string, visionx::imrec::Status > &statuses)
ArmarX headers.