VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1/* $Id: UICloudConsoleDetailsWidget.h 98103 2023-01-17 14:15:46Z 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#include "QIWithRetranslateUI.h"
41
42/* Forward declarations: */
43class QAbstractButton;
44class QLabel;
45class QLineEdit;
46class QStackedLayout;
47class QIDialogButtonBox;
48
49
50/** Cloud Console Application data structure. */
51struct UIDataCloudConsoleApplication
52{
53 /** Constructs data. */
54 UIDataCloudConsoleApplication()
55 : m_fRestricted(false)
56 {}
57
58 /** Returns whether the @a other passed data is equal to this one. */
59 bool equal(const UIDataCloudConsoleApplication &other) const
60 {
61 return true
62 && (m_strId == other.m_strId)
63 && (m_strName == other.m_strName)
64 && (m_strPath == other.m_strPath)
65 && (m_strArgument == other.m_strArgument)
66 && (m_fRestricted == other.m_fRestricted)
67 ;
68 }
69
70 /** Returns whether the @a other passed data is equal to this one. */
71 bool operator==(const UIDataCloudConsoleApplication &other) const { return equal(other); }
72 /** Returns whether the @a other passed data is different from this one. */
73 bool operator!=(const UIDataCloudConsoleApplication &other) const { return !equal(other); }
74
75 /** Holds the console application ID. */
76 QString m_strId;
77 /** Holds the console application name. */
78 QString m_strName;
79 /** Holds the console application path. */
80 QString m_strPath;
81 /** Holds the console application argument. */
82 QString m_strArgument;
83 /** Holds whether console application is restricted. */
84 bool m_fRestricted;
85};
86
87/** Cloud Console Profile data structure. */
88struct UIDataCloudConsoleProfile
89{
90 /** Constructs data. */
91 UIDataCloudConsoleProfile()
92 : m_fRestricted(false)
93 {}
94
95 /** Returns whether the @a other passed data is equal to this one. */
96 bool equal(const UIDataCloudConsoleProfile &other) const
97 {
98 return true
99 && (m_strApplicationId == other.m_strApplicationId)
100 && (m_strId == other.m_strId)
101 && (m_strName == other.m_strName)
102 && (m_strArgument == other.m_strArgument)
103 && (m_fRestricted == other.m_fRestricted)
104 ;
105 }
106
107 /** Returns whether the @a other passed data is equal to this one. */
108 bool operator==(const UIDataCloudConsoleProfile &other) const { return equal(other); }
109 /** Returns whether the @a other passed data is different from this one. */
110 bool operator!=(const UIDataCloudConsoleProfile &other) const { return !equal(other); }
111
112 /** Holds the console profile application ID. */
113 QString m_strApplicationId;
114 /** Holds the console profile ID. */
115 QString m_strId;
116 /** Holds the console profile name. */
117 QString m_strName;
118 /** Holds the console profile argument. */
119 QString m_strArgument;
120 /** Holds whether console profile is restricted. */
121 bool m_fRestricted;
122};
123
124
125/** Cloud Console details widget. */
126class UICloudConsoleDetailsWidget : public QIWithRetranslateUI<QWidget>
127{
128 Q_OBJECT;
129
130signals:
131
132 /** Notifies listeners about data changed and whether it @a fDiffers. */
133 void sigDataChanged(bool fDiffers);
134
135 /** Notifies listeners about data change rejected and should be reseted. */
136 void sigDataChangeRejected();
137 /** Notifies listeners about data change accepted and should be applied. */
138 void sigDataChangeAccepted();
139
140public:
141
142 /** Constructs cloud console details widget passing @a pParent to the base-class.
143 * @param enmEmbedding Brings embedding type. */
144 UICloudConsoleDetailsWidget(EmbedTo enmEmbedding, QWidget *pParent = 0);
145
146 /** Returns the cloud console application data. */
147 const UIDataCloudConsoleApplication &applicationData() const { return m_newApplicationData; }
148 /** Returns the cloud console profile data. */
149 const UIDataCloudConsoleProfile &profileData() const { return m_newProfileData; }
150 /** Defines the cloud console application @a data. */
151 void setApplicationData(const UIDataCloudConsoleApplication &data);
152 /** Defines the cloud console profile @a data. */
153 void setProfileData(const UIDataCloudConsoleProfile &data);
154 /** Clears all the console data. */
155 void clearData();
156
157protected:
158
159 /** Handles translation event. */
160 virtual void retranslateUi() RT_OVERRIDE;
161
162private slots:
163
164 /** @name Change handling stuff.
165 * @{ */
166 /** Handles console application name change. */
167 void sltApplicationNameChanged(const QString &strName);
168 /** Handles console application path change. */
169 void sltApplicationPathChanged(const QString &strPath);
170 /** Handles console application argument change. */
171 void sltApplicationArgumentChanged(const QString &strArgument);
172 /** Handles console profile name change. */
173 void sltProfileNameChanged(const QString &strName);
174 /** Handles console profile argument change. */
175 void sltProfileArgumentChanged(const QString &strArgument);
176
177 /** Handles button-box button click. */
178 void sltHandleButtonBoxClick(QAbstractButton *pButton);
179 /** @} */
180
181private:
182
183 /** @name Prepare/cleanup cascade.
184 * @{ */
185 /** Prepares all. */
186 void prepare();
187 /** Prepares widgets. */
188 void prepareWidgets();
189 /** @} */
190
191 /** @name Loading stuff.
192 * @{ */
193 /** Loads data. */
194 void loadData();
195 /** @} */
196
197 /** @name Change handling stuff.
198 * @{ */
199 /** Revalidates changes for passed @a pWidget. */
200 void revalidate(QWidget *pWidget = 0);
201
202 /** Retranslates validation for passed @a pWidget. */
203 void retranslateValidation(QWidget *pWidget = 0);
204
205 /** Updates button states. */
206 void updateButtonStates();
207 /** @} */
208
209 /** @name General variables.
210 * @{ */
211 /** Holds the parent widget embedding type. */
212 const EmbedTo m_enmEmbedding;
213
214 /** Holds the old console application data copy. */
215 UIDataCloudConsoleApplication m_oldApplicationData;
216 /** Holds the new console application data copy. */
217 UIDataCloudConsoleApplication m_newApplicationData;
218
219 /** Holds the old console profile data copy. */
220 UIDataCloudConsoleProfile m_oldProfileData;
221 /** Holds the new console profile data copy. */
222 UIDataCloudConsoleProfile m_newProfileData;
223 /** @} */
224
225 /** @name Widget variables.
226 * @{ */
227 /** Holds the stacked layout isntance. */
228 QStackedLayout *m_pStackedLayout;
229
230 /** Holds the application name label instance. */
231 QLabel *m_pLabelApplicationName;
232 /** Holds the application name editor instance. */
233 QLineEdit *m_pEditorApplicationName;
234 /** Holds the application path label instance. */
235 QLabel *m_pLabelApplicationPath;
236 /** Holds the application path editor instance. */
237 QLineEdit *m_pEditorApplicationPath;
238 /** Holds the application argument label instance. */
239 QLabel *m_pLabelApplicationArgument;
240 /** Holds the application argument editor instance. */
241 QLineEdit *m_pEditorApplicationArgument;
242
243 /** Holds the profile name label instance. */
244 QLabel *m_pLabelProfileName;
245 /** Holds the profile name editor instance. */
246 QLineEdit *m_pEditorProfileName;
247 /** Holds the profile argument label instance. */
248 QLabel *m_pLabelProfileArgument;
249 /** Holds the profile argument editor instance. */
250 QLineEdit *m_pEditorProfileArgument;
251
252 /** Holds the button-box instance. */
253 QIDialogButtonBox *m_pButtonBox;
254 /** @} */
255};
256
257
258#endif /* !FEQT_INCLUDED_SRC_cloud_consolemanager_UICloudConsoleDetailsWidget_h */
Note: See TracBrowser for help on using the repository browser.

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