1 | /* $Id: UICloudProfileDetailsWidget.h 76581 2019-01-01 06:24:57Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UICloudProfileDetailsWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2019 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_UICloudProfileDetailsWidget_h
|
---|
19 | #define FEQT_INCLUDED_SRC_cloud_UICloudProfileDetailsWidget_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QMap>
|
---|
26 | #include <QUuid>
|
---|
27 | #include <QWidget>
|
---|
28 |
|
---|
29 | /* GUI includes: */
|
---|
30 | #include "QIManagerDialog.h"
|
---|
31 | #include "QIWithRetranslateUI.h"
|
---|
32 |
|
---|
33 | /* Forward declarations: */
|
---|
34 | class QAbstractButton;
|
---|
35 | class QLabel;
|
---|
36 | class QLineEdit;
|
---|
37 | class QTableWidget;
|
---|
38 | class QTableWidgetItem;
|
---|
39 | class QIDialogButtonBox;
|
---|
40 |
|
---|
41 |
|
---|
42 | /** Cloud Provider data structure. */
|
---|
43 | struct UIDataCloudProvider
|
---|
44 | {
|
---|
45 | /** Constructs data. */
|
---|
46 | UIDataCloudProvider()
|
---|
47 | : m_strName(QString())
|
---|
48 | {}
|
---|
49 |
|
---|
50 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
51 | bool equal(const UIDataCloudProvider &other) const
|
---|
52 | {
|
---|
53 | return true
|
---|
54 | && (m_uuid == other.m_uuid)
|
---|
55 | && (m_strName == other.m_strName)
|
---|
56 | ;
|
---|
57 | }
|
---|
58 |
|
---|
59 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
60 | bool operator==(const UIDataCloudProvider &other) const { return equal(other); }
|
---|
61 | /** Returns whether the @a other passed data is different from this one. */
|
---|
62 | bool operator!=(const UIDataCloudProvider &other) const { return !equal(other); }
|
---|
63 |
|
---|
64 | /** Holds the provider ID. */
|
---|
65 | QUuid m_uuid;
|
---|
66 | /** Holds the provider name. */
|
---|
67 | QString m_strName;
|
---|
68 |
|
---|
69 | /** Holds the profile supported property descriptions. */
|
---|
70 | QMap<QString, QString> m_propertyDescriptions;
|
---|
71 | };
|
---|
72 |
|
---|
73 | /** Cloud Profile data structure. */
|
---|
74 | struct UIDataCloudProfile
|
---|
75 | {
|
---|
76 | /** Constructs data. */
|
---|
77 | UIDataCloudProfile()
|
---|
78 | : m_strName(QString())
|
---|
79 | {}
|
---|
80 |
|
---|
81 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
82 | bool equal(const UIDataCloudProfile &other) const
|
---|
83 | {
|
---|
84 | return true
|
---|
85 | && (m_strName == other.m_strName)
|
---|
86 | && (m_data == other.m_data)
|
---|
87 | ;
|
---|
88 | }
|
---|
89 |
|
---|
90 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
91 | bool operator==(const UIDataCloudProfile &other) const { return equal(other); }
|
---|
92 | /** Returns whether the @a other passed data is different from this one. */
|
---|
93 | bool operator!=(const UIDataCloudProfile &other) const { return !equal(other); }
|
---|
94 |
|
---|
95 | /** Holds the profile name. */
|
---|
96 | QString m_strName;
|
---|
97 |
|
---|
98 | /** Holds the profile data. */
|
---|
99 | QMap<QString, QPair<QString, QString> > m_data;
|
---|
100 | };
|
---|
101 |
|
---|
102 |
|
---|
103 | /** Cloud Profile details widget. */
|
---|
104 | class UICloudProfileDetailsWidget : public QIWithRetranslateUI<QWidget>
|
---|
105 | {
|
---|
106 | Q_OBJECT;
|
---|
107 |
|
---|
108 | signals:
|
---|
109 |
|
---|
110 | /** Notifies listeners about data changed and whether it @a fDiffers. */
|
---|
111 | void sigDataChanged(bool fDiffers);
|
---|
112 |
|
---|
113 | /** Notifies listeners about data change rejected and should be reseted. */
|
---|
114 | void sigDataChangeRejected();
|
---|
115 | /** Notifies listeners about data change accepted and should be applied. */
|
---|
116 | void sigDataChangeAccepted();
|
---|
117 |
|
---|
118 | public:
|
---|
119 |
|
---|
120 | /** Constructs cloud profile details widget passing @a pParent to the base-class.
|
---|
121 | * @param enmEmbedding Brings embedding type. */
|
---|
122 | UICloudProfileDetailsWidget(EmbedTo enmEmbedding, QWidget *pParent = 0);
|
---|
123 |
|
---|
124 | /** Returns the cloud profile data. */
|
---|
125 | const UIDataCloudProfile &data() const { return m_newData; }
|
---|
126 | /** Defines the cloud profile @a data. */
|
---|
127 | void setData(const UIDataCloudProfile &data);
|
---|
128 |
|
---|
129 | protected:
|
---|
130 |
|
---|
131 | /** Handles translation event. */
|
---|
132 | virtual void retranslateUi() /* override */;
|
---|
133 | /** Handles editor translation. */
|
---|
134 | void retranslateEditor();
|
---|
135 | /** Handles buttons translation. */
|
---|
136 | void retranslateButtons();
|
---|
137 |
|
---|
138 | private slots:
|
---|
139 |
|
---|
140 | /** @name Change handling stuff.
|
---|
141 | * @{ */
|
---|
142 | /** Handles name change. */
|
---|
143 | void sltNameChanged(const QString &strName);
|
---|
144 | /** Handles table change. */
|
---|
145 | void sltTableChanged(QTableWidgetItem *pItem);
|
---|
146 |
|
---|
147 | /** Handles button-box button click. */
|
---|
148 | void sltHandleButtonBoxClick(QAbstractButton *pButton);
|
---|
149 | /** @} */
|
---|
150 |
|
---|
151 | private:
|
---|
152 |
|
---|
153 | /** @name Prepare/cleanup cascade.
|
---|
154 | * @{ */
|
---|
155 | /** Prepares all. */
|
---|
156 | void prepare();
|
---|
157 | /** Prepares widgets. */
|
---|
158 | void prepareWidgets();
|
---|
159 | /** @} */
|
---|
160 |
|
---|
161 | /** @name Loading stuff.
|
---|
162 | * @{ */
|
---|
163 | /** Loads data. */
|
---|
164 | void loadData();
|
---|
165 | /** @} */
|
---|
166 |
|
---|
167 | /** @name Change handling stuff.
|
---|
168 | * @{ */
|
---|
169 | /** Revalidates changes for passed @a pWidget. */
|
---|
170 | void revalidate(QWidget *pWidget = 0);
|
---|
171 |
|
---|
172 | /** Retranslates validation for passed @a pWidget. */
|
---|
173 | void retranslateValidation(QWidget *pWidget = 0);
|
---|
174 |
|
---|
175 | /** Updates table tooltips. */
|
---|
176 | void updateTableToolTips();
|
---|
177 | /** Adjusts table contents. */
|
---|
178 | void adjustTableContents();
|
---|
179 |
|
---|
180 | /** Updates button states. */
|
---|
181 | void updateButtonStates();
|
---|
182 | /** @} */
|
---|
183 |
|
---|
184 | /** @name General variables.
|
---|
185 | * @{ */
|
---|
186 | /** Holds the parent widget embedding type. */
|
---|
187 | const EmbedTo m_enmEmbedding;
|
---|
188 |
|
---|
189 | /** Holds the old data copy. */
|
---|
190 | UIDataCloudProfile m_oldData;
|
---|
191 | /** Holds the new data copy. */
|
---|
192 | UIDataCloudProfile m_newData;
|
---|
193 | /** @} */
|
---|
194 |
|
---|
195 | /** @name Widget variables.
|
---|
196 | * @{ */
|
---|
197 | /** Holds the name label instance. */
|
---|
198 | QLabel *m_pLabelName;
|
---|
199 | /** Holds the name editor instance. */
|
---|
200 | QLineEdit *m_pEditorName;
|
---|
201 |
|
---|
202 | /** Holds the table-widget label instance. */
|
---|
203 | QLabel *m_pLabelTableWidget;
|
---|
204 | /** Holds the table-widget instance. */
|
---|
205 | QTableWidget *m_pTableWidget;
|
---|
206 |
|
---|
207 | /** Holds the server button-box instance. */
|
---|
208 | QIDialogButtonBox *m_pButtonBox;
|
---|
209 | /** @} */
|
---|
210 | };
|
---|
211 |
|
---|
212 |
|
---|
213 | #endif /* !FEQT_INCLUDED_SRC_cloud_UICloudProfileDetailsWidget_h */
|
---|