VirtualBox

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

Last change on this file since 85530 was 85530, checked in by vboxsync, 5 years ago

FE/Qt: bugref:9722: Cloud Console Manager: Translation simplification.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.5 KB
Line 
1/* $Id: UICloudConsoleDetailsWidget.h 85530 2020-07-29 17:37:17Z 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
152private slots:
153
154 /** @name Change handling stuff.
155 * @{ */
156 /** Handles console application name change. */
157 void sltApplicationNameChanged(const QString &strName);
158 /** Handles console application path change. */
159 void sltApplicationPathChanged(const QString &strPath);
160 /** Handles console application argument change. */
161 void sltApplicationArgumentChanged(const QString &strArgument);
162 /** Handles console profile name change. */
163 void sltProfileNameChanged(const QString &strName);
164 /** Handles console profile argument change. */
165 void sltProfileArgumentChanged(const QString &strArgument);
166
167 /** Handles button-box button click. */
168 void sltHandleButtonBoxClick(QAbstractButton *pButton);
169 /** @} */
170
171private:
172
173 /** @name Prepare/cleanup cascade.
174 * @{ */
175 /** Prepares all. */
176 void prepare();
177 /** Prepares widgets. */
178 void prepareWidgets();
179 /** @} */
180
181 /** @name Loading stuff.
182 * @{ */
183 /** Loads data. */
184 void loadData();
185 /** @} */
186
187 /** @name Change handling stuff.
188 * @{ */
189 /** Revalidates changes for passed @a pWidget. */
190 void revalidate(QWidget *pWidget = 0);
191
192 /** Retranslates validation for passed @a pWidget. */
193 void retranslateValidation(QWidget *pWidget = 0);
194
195 /** Updates button states. */
196 void updateButtonStates();
197 /** @} */
198
199 /** @name General variables.
200 * @{ */
201 /** Holds the parent widget embedding type. */
202 const EmbedTo m_enmEmbedding;
203
204 /** Holds the old console application data copy. */
205 UIDataCloudConsoleApplication m_oldApplicationData;
206 /** Holds the new console application data copy. */
207 UIDataCloudConsoleApplication m_newApplicationData;
208
209 /** Holds the old console profile data copy. */
210 UIDataCloudConsoleProfile m_oldProfileData;
211 /** Holds the new console profile data copy. */
212 UIDataCloudConsoleProfile m_newProfileData;
213 /** @} */
214
215 /** @name Widget variables.
216 * @{ */
217 /** Holds the stacked layout isntance. */
218 QStackedLayout *m_pStackedLayout;
219
220 /** Holds the application name label instance. */
221 QLabel *m_pLabelApplicationName;
222 /** Holds the application name editor instance. */
223 QLineEdit *m_pEditorApplicationName;
224 /** Holds the application path label instance. */
225 QLabel *m_pLabelApplicationPath;
226 /** Holds the application path editor instance. */
227 QLineEdit *m_pEditorApplicationPath;
228 /** Holds the application argument label instance. */
229 QLabel *m_pLabelApplicationArgument;
230 /** Holds the application argument editor instance. */
231 QLineEdit *m_pEditorApplicationArgument;
232
233 /** Holds the profile name label instance. */
234 QLabel *m_pLabelProfileName;
235 /** Holds the profile name editor instance. */
236 QLineEdit *m_pEditorProfileName;
237 /** Holds the profile argument label instance. */
238 QLabel *m_pLabelProfileArgument;
239 /** Holds the profile argument editor instance. */
240 QLineEdit *m_pEditorProfileArgument;
241
242 /** Holds the button-box instance. */
243 QIDialogButtonBox *m_pButtonBox;
244 /** @} */
245};
246
247
248#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