ImageProviderConfigWidget.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package VisionX::gui-plugins::ImageRecorder
19 * @author Christian R. G. Dreher <c.dreher@kit.edu>
20 * @date 2020
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#pragma once
27
28
29// STD/STL
30#include <optional>
31#include <string>
32
33// Qt
34#include <QPointer>
35#include <QTimer>
36#include <QWidget>
37
38// ArmarX
40
42
43#include <VisionX/gui-plugins/ImageRecorder/ui_ImageProviderConfigWidget.h>
44#include <VisionX/interface/core/ImageProviderInterface.h>
46
47namespace visionx
48{
49
52
53 enum class ViewMode
54 {
57 };
58
59 class ImageProviderConfigWidget : public QWidget
60 {
61
62 Q_OBJECT
63
64 private:
65 Ui::image_provider_config_widget m_widget;
66 QPointer<armarx::IceProxyFinder<RecordingImageProviderInterfacePrx>> m_ice_proxy_finder;
67 QPointer<QTimer> m_blink_timer;
68 armarx::IceManagerPtr m_iceman;
69 std::string m_image_provider_name;
70 std::vector<ChannelConfigWidget*> m_channel_config_widgets;
71 bool m_icon_blink = false;
72 std::string m_current_icon_name;
73 std::optional<imrec::State> m_current_state;
74 imrec::Status m_current_status;
75
76 public:
77 ImageProviderConfigWidget(QWidget* parent,
79 const std::string& image_provider_name,
80 const visionx::imrec::ChannelConfigs& channel_configs);
81
83
84 void confirmImageProviderName(const std::string& new_name);
85
86 void rejectImageProviderName(const std::string& new_name);
87
88 std::vector<visionx::imrec::ChannelConfig> toChannelConfigs() const;
89
90 void setImageProviderStatus(std::optional<visionx::imrec::Status> status);
91
92 void setViewMode(ViewMode viewMode);
93
94 private:
95 void build_ui_from_configs(const std::vector<imrec::ChannelConfig>& configs,
96 const std::vector<imrec::ChannelPreferences>& prefs_list);
97
98 void add_channel_conf_widget(const imrec::ChannelConfig& channel_config,
99 const imrec::ChannelPreferences& channel_prefs);
100
101 void update_channel_list();
102
103 std::vector<imrec::ChannelPreferences> get_channel_prefs();
104
105 bool is_channel_name_unique(const std::string& name);
106
107 signals:
108
109 void imageProviderRenamed(const std::string& old_name, const std::string& new_name);
110
111 void imageProviderRemoved(const std::string& name);
112
113 void imageProviderStateChanged(std::optional<imrec::State> old_state,
114 std::optional<imrec::State> new_state);
115
116 private slots:
117
118 void state_changed(std::optional<imrec::State> old_state,
119 std::optional<imrec::State> new_state);
120
121 void blink();
122
123 void channel_renamed(const std::string& old_name, const std::string& new_name);
124
125 void image_provider_renamed(const QString& name);
126
127 void image_provider_removed();
128 };
129
130} // namespace visionx
void rejectImageProviderName(const std::string &new_name)
void confirmImageProviderName(const std::string &new_name)
void setImageProviderStatus(std::optional< visionx::imrec::Status > status)
void imageProviderStateChanged(std::optional< imrec::State > old_state, std::optional< imrec::State > new_state)
std::vector< visionx::imrec::ChannelConfig > toChannelConfigs() const
ImageProviderConfigWidget(QWidget *parent, armarx::IceManagerPtr iceman, const std::string &image_provider_name, const visionx::imrec::ChannelConfigs &channel_configs)
void imageProviderRemoved(const std::string &name)
void imageProviderRenamed(const std::string &old_name, const std::string &new_name)
IceUtil::Handle< IceManager > IceManagerPtr
IceManager smart pointer.
Definition ArmarXFwd.h:39
ArmarX headers.