VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h@ 104273

Last change on this file since 104273 was 104273, checked in by vboxsync, 10 months ago

FE/Qt. bugref:10622. Using new UITranslationEventListener in the cloud related UI classes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 KB
Line 
1/* $Id: UICloudConsoleDetailsWidget.h 104273 2024-04-10 12:24:28Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UICloudConsoleDetailsWidget class declaration.
4 */
5
6/*
7 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleDetailsWidget_h
29#define FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleDetailsWidget_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QMap>
36#include <QWidget>
37
38/* GUI includes: */
39#include "QIManagerDialog.h"
40
41/* Forward declarations: */
42class QAbstractButton;
43class QLabel;
44class QLineEdit;
45class QStackedLayout;
46class QIDialogButtonBox;
47
48
49/** Cloud Console Application data structure. */
50struct UIDataCloudConsoleApplication
51{
52 /** Constructs data. */
53 UIDataCloudConsoleApplication()
54 : m_fRestricted(false)
55 {}
56
57 /** Returns whether the @a other passed data is equal to this one. */
58 bool equal(const UIDataCloudConsoleApplication &other) const
59 {
60 return true
61 && (m_strId == other.m_strId)
62 && (m_strName == other.m_strName)
63 && (m_strPath == other.m_strPath)
64 && (m_strArgument == other.m_strArgument)
65 && (m_fRestricted == other.m_fRestricted)
66 ;
67 }
68
69 /** Returns whether the @a other passed data is equal to this one. */
70 bool operator==(const UIDataCloudConsoleApplication &other) const { return equal(other); }
71 /** Returns whether the @a other passed data is different from this one. */
72 bool operator!=(const UIDataCloudConsoleApplication &other) const { return !equal(other); }
73
74 /** Holds the console application ID. */
75 QString m_strId;
76 /** Holds the console application name. */
77 QString m_strName;
78 /** Holds the console application path. */
79 QString m_strPath;
80 /** Holds the console application argument. */
81 QString m_strArgument;
82 /** Holds whether console application is restricted. */
83 bool m_fRestricted;
84};
85
86/** Cloud Console Profile data structure. */
87struct UIDataCloudConsoleProfile
88{
89 /** Constructs data. */
90 UIDataCloudConsoleProfile()
91 : m_fRestricted(false)
92 {}
93
94 /** Returns whether the @a other passed data is equal to this one. */
95 bool equal(const UIDataCloudConsoleProfile &other) const
96 {
97 return true
98 && (m_strApplicationId == other.m_strApplicationId)
99 && (m_strId == other.m_strId)
100 && (m_strName == other.m_strName)
101 && (m_strArgument == other.m_strArgument)
102 && (m_fRestricted == other.m_fRestricted)
103 ;
104 }
105
106 /** Returns whether the @a other passed data is equal to this one. */
107 bool operator==(const UIDataCloudConsoleProfile &other) const { return equal(other); }
108 /** Returns whether the @a other passed data is different from this one. */
109 bool operator!=(const UIDataCloudConsoleProfile &other) const { return !equal(other); }
110
111 /** Holds the console profile application ID. */
112 QString m_strApplicationId;
113 /** Holds the console profile ID. */
114 QString m_strId;
115 /** Holds the console profile name. */
116 QString m_strName;
117 /** Holds the console profile argument. */
118 QString m_strArgument;
119 /** Holds whether console profile is restricted. */
120 bool m_fRestricted;
121};
122
123
124/** Cloud Console details widget. */
125class UICloudConsoleDetailsWidget : public QWidget
126{
127 Q_OBJECT;
128
129signals:
130
131 /** Notifies listeners about data changed and whether it @a fDiffers. */
132 void sigDataChanged(bool fDiffers);
133
134 /** Notifies listeners about data change rejected and should be reseted. */
135 void sigDataChangeRejected();
136 /** Notifies listeners about data change accepted and should be applied. */
137 void sigDataChangeAccepted();
138
139public:
140
141 /** Constructs cloud console details widget passing @a pParent to the base-class.
142 * @param enmEmbedding Brings embedding type. */
143 UICloudConsoleDetailsWidget(EmbedTo enmEmbedding, QWidget *pParent = 0);
144
145 /** Returns the cloud console application data. */
146 const UIDataCloudConsoleApplication &applicationData() const { return m_newApplicationData; }
147 /** Returns the cloud console profile data. */
148 const UIDataCloudConsoleProfile &profileData() const { return m_newProfileData; }
149 /** Defines the cloud console application @a data. */
150 void setApplicationData(const UIDataCloudConsoleApplication &data);
151 /** Defines the cloud console profile @a data. */
152 void setProfileData(const UIDataCloudConsoleProfile &data);
153 /** Clears all the console data. */
154 void clearData();
155
156private slots:
157
158 /** @name Change handling stuff.
159 * @{ */
160 /** Handles console application name change. */
161 void sltApplicationNameChanged(const QString &strName);
162 /** Handles console application path change. */
163 void sltApplicationPathChanged(const QString &strPath);
164 /** Handles console application argument change. */
165 void sltApplicationArgumentChanged(const QString &strArgument);
166 /** Handles console profile name change. */
167 void sltProfileNameChanged(const QString &strName);
168 /** Handles console profile argument change. */
169 void sltProfileArgumentChanged(const QString &strArgument);
170
171 /** Handles button-box button click. */
172 void sltHandleButtonBoxClick(QAbstractButton *pButton);
173 /** @} */
174
175 /** Handles translation event. */
176 void sltRetranslateUI();
177
178private:
179
180 /** @name Prepare/cleanup cascade.
181 * @{ */
182 /** Prepares all. */
183 void prepare();
184 /** Prepares widgets. */
185 void prepareWidgets();
186 /** @} */
187
188 /** @name Loading stuff.
189 * @{ */
190 /** Loads data. */
191 void loadData();
192 /** @} */
193
194 /** @name Change handling stuff.
195 * @{ */
196 /** Revalidates changes for passed @a pWidget. */
197 void revalidate(QWidget *pWidget = 0);
198
199 /** Retranslates validation for passed @a pWidget. */
200 void retranslateValidation(QWidget *pWidget = 0);
201
202 /** Updates button states. */
203 void updateButtonStates();
204 /** @} */
205
206 /** @name General variables.
207 * @{ */
208 /** Holds the parent widget embedding type. */
209 const EmbedTo m_enmEmbedding;
210
211 /** Holds the old console application data copy. */
212 UIDataCloudConsoleApplication m_oldApplicationData;
213 /** Holds the new console application data copy. */
214 UIDataCloudConsoleApplication m_newApplicationData;
215
216 /** Holds the old console profile data copy. */
217 UIDataCloudConsoleProfile m_oldProfileData;
218 /** Holds the new console profile data copy. */
219 UIDataCloudConsoleProfile m_newProfileData;
220 /** @} */
221
222 /** @name Widget variables.
223 * @{ */
224 /** Holds the stacked layout isntance. */
225 QStackedLayout *m_pStackedLayout;
226
227 /** Holds the application name label instance. */
228 QLabel *m_pLabelApplicationName;
229 /** Holds the application name editor instance. */
230 QLineEdit *m_pEditorApplicationName;
231 /** Holds the application path label instance. */
232 QLabel *m_pLabelApplicationPath;
233 /** Holds the application path editor instance. */
234 QLineEdit *m_pEditorApplicationPath;
235 /** Holds the application argument label instance. */
236 QLabel *m_pLabelApplicationArgument;
237 /** Holds the application argument editor instance. */
238 QLineEdit *m_pEditorApplicationArgument;
239
240 /** Holds the profile name label instance. */
241 QLabel *m_pLabelProfileName;
242 /** Holds the profile name editor instance. */
243 QLineEdit *m_pEditorProfileName;
244 /** Holds the profile argument label instance. */
245 QLabel *m_pLabelProfileArgument;
246 /** Holds the profile argument editor instance. */
247 QLineEdit *m_pEditorProfileArgument;
248
249 /** Holds the button-box instance. */
250 QIDialogButtonBox *m_pButtonBox;
251 /** @} */
252};
253
254
255#endif /* !FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleDetailsWidget_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette