GCC Code Coverage Report


./
File: modules/io/dimse/pacs_configuration_editor.hpp
Date: 2025-01-21 16:21:04
Lines:
0/2
0.0%
Functions:
0/6
0.0%
Branches:
0/13
0.0%

Line Branch Exec Source
1 /************************************************************************
2 *
3 * Copyright (C) 2009-2024 IRCAD France
4 * Copyright (C) 2012-2020 IHU Strasbourg
5 *
6 * This file is part of Sight.
7 *
8 * Sight is free software: you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Sight is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
20 *
21 ***********************************************************************/
22
23 #pragma once
24
25 #include <core/thread/worker.hpp>
26
27 #include <io/dimse/data/pacs_configuration.hpp>
28 #include <io/dimse/series_enquirer.hpp>
29
30 #include <service/notifier.hpp>
31
32 #include <ui/__/editor.hpp>
33
34 #include <QComboBox>
35 #include <QLineEdit>
36 #include <QObject>
37 #include <QPointer>
38 #include <QPushButton>
39 #include <QSpinBox>
40 #include <QWidget>
41
42 #include <filesystem>
43
44 namespace sight::module::io::dimse
45 {
46
47 /**
48 * @brief This editor is used to edit a pacs configuration.
49 *
50 * @section XML XML Configuration
51 * @code{.xml}
52 <service type="sight::module::io::dimse::pacs_configuration_editor">
53 <inout key="config" uid="..." />
54 <config showDialog="true" />
55 </service>
56 @endcode
57 *
58 * @subsection In-Out In-Out
59 * - \b config [sight::io::dimse::data::pacs_configuration]: pacs configuration.
60 *
61 * @subsection Configuration Configuration:
62 * - \b showDialog (optional, bool, default=true): display dialog message for the ping result, or just send the
63 * notification.
64 */
65 class pacs_configuration_editor : public QObject,
66 public sight::ui::editor,
67 private sight::service::notifier
68 {
69 Q_OBJECT;
70
71 public:
72
73 /// Generates default methods as New, dynamicCast, ...
74 SIGHT_DECLARE_SERVICE(pacs_configuration_editor, sight::ui::editor);
75
76 /// Creates the service.
77 pacs_configuration_editor() noexcept;
78
79 /// Destroyes the service.
80 ~pacs_configuration_editor() noexcept override = default;
81
82 protected:
83
84 /// Configures the editor.
85 void configuring() override;
86
87 /// Creates the UI.
88 void starting() override;
89
90 /// Does nothing.
91 void updating() override;
92
93 /// Destroyes the UI.
94 void stopping() override;
95
96 private:
97
98 /**
99 * @brief Sends a modified signal on the configuration.
100 * @param _pacs_configuration the modified data .
101 */
102 void modified_notify(sight::io::dimse::data::pacs_configuration::sptr _pacs_configuration);
103
104 /**
105 * @brief Displays an information dialog.
106 * @param _title title of the dialog.
107 * @param _message message of the dialog.
108 */
109 static void show_dialog(const std::string _title, const std::string _message);
110
111 /// Contains the AET of the SCU (client name) editor.
112 QPointer<QLineEdit> m_scu_app_entity_title_edit;
113
114 /// Contains the AET of the SCP (server name) editor.
115 QPointer<QLineEdit> m_scp_app_entity_title_edit;
116
117 /// Contains the SCP host name (server address) editor.
118 QPointer<QLineEdit> m_scp_host_name_edit;
119
120 /// Contains the SCP port (server port) editor.
121 QPointer<QSpinBox> m_scp_port_edit;
122
123 /// Contains the request mode, GET or MOVE, editor.
124 QPointer<QComboBox> m_retrieve_method_widget;
125
126 /**
127 * @brief Contains the move AET editor. This AET is use to receive C-MOVE responses.
128 *
129 * C-MOVE request are sent from the SCU to the SCP. The SCP will send its response based on its configuration.
130 * Usually the configuration contains an IP and a port that match SCU configuration.
131 * For more information, see the link bellow:
132 * https://book.orthanc-server.com/dicom-guide.html#dicom-network-protocol.
133 */
134 QPointer<QLineEdit> m_move_app_entity_title_edit;
135
136 /// Contains the move port editor. This port is use to receive C-MOVE responses.
137 QPointer<QSpinBox> m_move_port;
138
139 /// Contains the test button, sends a C-ECHO request to the PACS.
140 QPointer<QPushButton> m_ping_pacs_button_widget;
141
142 /// Contains the worker of the series enquire thread.
143 core::thread::worker::sptr m_request_worker;
144
145 /// Defines whether or not the dialog message should be displayed for the ping result.
146 bool m_show_dialog {true};
147
148 /// Contains the slot to show a dialog in the main thread.
149 core::com::slot<void(const std::string, const std::string)>::sptr m_slot_show_dialog {nullptr};
150
151 private Q_SLOTS:
152
153 /// Calls for pinging the pacs.
154 void ping_pacs();
155
156 /// Calls for changing AET of the SCU.
157 void on_scu_app_entity_title_changed();
158
159 /// Calls for changing AET of the SCP.
160 void on_scp_app_entity_title_changed();
161
162 /// Calls for changing the IP of the SCP.
163 void on_scp_host_name_changed();
164
165 /**
166 * @brief Calls for changing the port of the SCP.
167 * @param _value the PACS application port.
168 */
169 void on_scp_port_changed(int _value);
170
171 /**
172 * @brief Calls for changing the retrieve method.
173 * @param _index the retrieve method index.
174 */
175 void on_retrieve_method_changed(int _index);
176
177 /// Calls for changing the move AET.
178 void on_move_app_entity_title_changed();
179
180 /**
181 * @brief Calls for changing the move IP.
182 * @param _value the move application port.
183 */
184 void on_move_port_changed(int _value);
185
186 private:
187
188 data::ptr<sight::io::dimse::data::pacs_configuration, data::access::inout> m_config {this, "config"};
189 };
190
191 } // namespace sight::module::io::dimse.
192