VirtualBox

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

Last change on this file since 85486 was 85486, checked in by vboxsync, 4 years ago

FE/Qt: bugref:9722: VirtualBox Manager: Allow terminal applications registered via Cloud Console Manager to have own argument without any profiles; Profiles will be overriding argument if created, s.a. r139521.

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