1 | /* $Id: UISnapshotDetailsWidget.h 104358 2024-04-18 05:33:40Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UISnapshotDetailsWidget class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2008-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_snapshots_UISnapshotDetailsWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_snapshots_UISnapshotDetailsWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QWidget>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UIExtraDataDefs.h"
|
---|
39 |
|
---|
40 | /* COM includes: */
|
---|
41 | #include "CGraphicsAdapter.h"
|
---|
42 | #include "CMachine.h"
|
---|
43 | #include "CSnapshot.h"
|
---|
44 |
|
---|
45 | /* Forward declarations: */
|
---|
46 | class CNetworkAdapter;
|
---|
47 | class QGridLayout;
|
---|
48 | class QLabel;
|
---|
49 | class QLineEdit;
|
---|
50 | class QScrollArea;
|
---|
51 | class QTabWidget;
|
---|
52 | class QTextEdit;
|
---|
53 | class QVBoxLayout;
|
---|
54 | class QWidget;
|
---|
55 | class QIDialogButtonBox;
|
---|
56 | class UISnapshotDetailsElement;
|
---|
57 |
|
---|
58 |
|
---|
59 | /** Snapshot pane: Snapshot data. */
|
---|
60 | class UIDataSnapshot
|
---|
61 | {
|
---|
62 | public:
|
---|
63 |
|
---|
64 | /** Constructs data. */
|
---|
65 | UIDataSnapshot()
|
---|
66 | : m_strName(QString())
|
---|
67 | , m_strDescription(QString())
|
---|
68 | {}
|
---|
69 |
|
---|
70 | /** Returns name. */
|
---|
71 | QString name() const { return m_strName; }
|
---|
72 | /** Defines @a strName. */
|
---|
73 | void setName(const QString &strName) { m_strName = strName; }
|
---|
74 |
|
---|
75 | /** Returns description. */
|
---|
76 | QString description() const { return m_strDescription; }
|
---|
77 | /** Defines @a strDescription. */
|
---|
78 | void setDescription(const QString &strDescription) { m_strDescription = strDescription; }
|
---|
79 |
|
---|
80 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
81 | bool equal(const UIDataSnapshot &other) const
|
---|
82 | {
|
---|
83 | return true
|
---|
84 | && (m_strName == other.m_strName)
|
---|
85 | && (m_strDescription == other.m_strDescription)
|
---|
86 | ;
|
---|
87 | }
|
---|
88 |
|
---|
89 | /** Returns whether the @a other passed data is equal to this one. */
|
---|
90 | bool operator==(const UIDataSnapshot &other) const { return equal(other); }
|
---|
91 | /** Returns whether the @a other passed data is different from this one. */
|
---|
92 | bool operator!=(const UIDataSnapshot &other) const { return !equal(other); }
|
---|
93 |
|
---|
94 | protected:
|
---|
95 |
|
---|
96 | /** Holds the name. */
|
---|
97 | QString m_strName;
|
---|
98 | /** Holds the description. */
|
---|
99 | QString m_strDescription;
|
---|
100 | };
|
---|
101 |
|
---|
102 |
|
---|
103 | /** QWidget extension providing GUI with snapshot details-widget. */
|
---|
104 | class UISnapshotDetailsWidget : public QWidget
|
---|
105 | {
|
---|
106 | Q_OBJECT;
|
---|
107 |
|
---|
108 | signals:
|
---|
109 |
|
---|
110 | /** Notifies listeners about data change accepted and should be applied. */
|
---|
111 | void sigDataChangeAccepted();
|
---|
112 |
|
---|
113 | public:
|
---|
114 |
|
---|
115 | /** Constructs snapshot details-widget passing @a pParent to the base-class. */
|
---|
116 | UISnapshotDetailsWidget(QWidget *pParent = 0);
|
---|
117 |
|
---|
118 | /** Returns the snapshot data. */
|
---|
119 | const UIDataSnapshot &data() const { return m_newData; }
|
---|
120 | /** Defines the @a comMachine. */
|
---|
121 | void setData(const CMachine &comMachine);
|
---|
122 | /** Defines the @a comSnapshot and it's @a data. */
|
---|
123 | void setData(const UIDataSnapshot &data, const CSnapshot &comSnapshot);
|
---|
124 | /** Clears the snapshot data. */
|
---|
125 | void clearData();
|
---|
126 |
|
---|
127 | protected:
|
---|
128 |
|
---|
129 | /** Handles buttons translation. */
|
---|
130 | void retranslateButtons();
|
---|
131 |
|
---|
132 | private slots:
|
---|
133 |
|
---|
134 | /** Handles snapshot name change. */
|
---|
135 | void sltHandleNameChange();
|
---|
136 | /** Handles snapshot description change. */
|
---|
137 | void sltHandleDescriptionChange();
|
---|
138 |
|
---|
139 | /** Handles snapshot details anchor clicks. */
|
---|
140 | void sltHandleAnchorClicked(const QUrl &link);
|
---|
141 |
|
---|
142 | /** Handles snapshot details change accepting. */
|
---|
143 | void sltHandleChangeAccepted();
|
---|
144 | /** Handles snapshot details change rejecting. */
|
---|
145 | void sltHandleChangeRejected();
|
---|
146 | /** Handles translation event. */
|
---|
147 | void sltRetranslateUI();
|
---|
148 |
|
---|
149 | private:
|
---|
150 |
|
---|
151 | /** Prepares all. */
|
---|
152 | void prepare();
|
---|
153 | /** Prepares tab-widget. */
|
---|
154 | void prepareTabWidget();
|
---|
155 | /** Prepares 'Options' tab. */
|
---|
156 | void prepareTabOptions();
|
---|
157 | /** Prepares 'Details' tab. */
|
---|
158 | void prepareTabDetails();
|
---|
159 |
|
---|
160 | /** Creates details element of passed @a enmType. */
|
---|
161 | static UISnapshotDetailsElement *createDetailsElement(DetailsElementType enmType);
|
---|
162 |
|
---|
163 | /** Loads snapshot data. */
|
---|
164 | void loadSnapshotData();
|
---|
165 |
|
---|
166 | /** Revalidates changes for passed @a pWidget. */
|
---|
167 | void revalidate(QWidget *pWidget = 0);
|
---|
168 | /** Retranslates validation for passed @a pWidget. */
|
---|
169 | void retranslateValidation(QWidget *pWidget = 0);
|
---|
170 | /** Updates button states. */
|
---|
171 | void updateButtonStates();
|
---|
172 |
|
---|
173 | /** Returns details report of requested @a enmType for a given @a comMachine. */
|
---|
174 | QString detailsReport(DetailsElementType enmType, const CMachine &comMachine, const CSnapshot &comSnapshot = CSnapshot()) const;
|
---|
175 |
|
---|
176 | /** Acquires @a comMachine group report. */
|
---|
177 | static QString groupReport(const CMachine &comMachine);
|
---|
178 | /** Acquires @a comMachine boot order report. */
|
---|
179 | static QString bootOrderReport(const CMachine &comMachine);
|
---|
180 | /** Acquires @a comMachine efi state report. */
|
---|
181 | static QString efiStateReport(const CMachine &comMachine);
|
---|
182 | /** Acquires @a comMachine acceleration report. */
|
---|
183 | static QString accelerationReport(const CMachine &comMachine);
|
---|
184 | /** Acquires @a comMachine scale-factor report. */
|
---|
185 | static double scaleFactorReport(CMachine comMachine);
|
---|
186 | /** Acquires @a comMachine display acceleration report. */
|
---|
187 | static QString displayAccelerationReport(CGraphicsAdapter comGraphics);
|
---|
188 | /** Acquires @a comMachine VRDE server report. */
|
---|
189 | static QStringList vrdeServerReport(CMachine comMachine);
|
---|
190 | /** Acquires @a comMachine recording report. */
|
---|
191 | static QStringList recordingReport(CMachine comMachine);
|
---|
192 | /** Acquires @a comMachine storage report. */
|
---|
193 | static QPair<QStringList, QList<QMap<QString, QString> > > storageReport(CMachine comMachine);
|
---|
194 | /** Acquires @a comMachine audio report. */
|
---|
195 | static QStringList audioReport(CMachine comMachine);
|
---|
196 | /** Acquires @a comMachine network report. */
|
---|
197 | static QStringList networkReport(CMachine comMachine);
|
---|
198 | /** Acquires @a comMachine serial report. */
|
---|
199 | static QStringList serialReport(CMachine comMachine);
|
---|
200 | /** Acquires @a comMachine usb report. */
|
---|
201 | static QStringList usbReport(CMachine comMachine);
|
---|
202 |
|
---|
203 | /** Wipes the HTML stuff from the passed @a strString. */
|
---|
204 | static QString wipeHtmlStuff(const QString &strString);
|
---|
205 |
|
---|
206 | /** Prepares emhasized report for a given @a strValue, comparing to @a strOldValue. */
|
---|
207 | static QString empReport(const QString &strValue, const QString &strOldValue);
|
---|
208 | /** Prepares emhasized report for a given @a strValue, depending on @a fDo flag. */
|
---|
209 | static QString empReport(const QString &strValue, bool fIgnore);
|
---|
210 |
|
---|
211 | /** Holds the machine object to load data from. */
|
---|
212 | CMachine m_comMachine;
|
---|
213 | /** Holds the snapshot object to load data from. */
|
---|
214 | CSnapshot m_comSnapshot;
|
---|
215 |
|
---|
216 | /** Holds the old data copy. */
|
---|
217 | UIDataSnapshot m_oldData;
|
---|
218 | /** Holds the new data copy. */
|
---|
219 | UIDataSnapshot m_newData;
|
---|
220 |
|
---|
221 | /** Holds the cached screenshot. */
|
---|
222 | QPixmap m_pixmapScreenshot;
|
---|
223 |
|
---|
224 | /** Holds the tab-widget instance. */
|
---|
225 | QTabWidget *m_pTabWidget;
|
---|
226 |
|
---|
227 | /** Holds the 'Options' layout instance. */
|
---|
228 | QGridLayout *m_pLayoutOptions;
|
---|
229 |
|
---|
230 | /** Holds the name label instance. */
|
---|
231 | QLabel *m_pLabelName;
|
---|
232 | /** Holds the name editor instance. */
|
---|
233 | QLineEdit *m_pEditorName;
|
---|
234 | /** Holds the name error pane. */
|
---|
235 | QLabel *m_pErrorPaneName;
|
---|
236 |
|
---|
237 | /** Holds the description label instance. */
|
---|
238 | QLabel *m_pLabelDescription;
|
---|
239 | /** Holds the description editor instance. */
|
---|
240 | QTextEdit *m_pBrowserDescription;
|
---|
241 | /** Holds the description error pane. */
|
---|
242 | QLabel *m_pErrorPaneDescription;
|
---|
243 |
|
---|
244 | /** Holds the button-box instance. */
|
---|
245 | QIDialogButtonBox *m_pButtonBox;
|
---|
246 |
|
---|
247 | /** Holds the 'Details' layout instance. */
|
---|
248 | QVBoxLayout *m_pLayoutDetails;
|
---|
249 |
|
---|
250 | /** Holds the details scroll-area instance. */
|
---|
251 | QScrollArea *m_pScrollAreaDetails;
|
---|
252 |
|
---|
253 | /** Holds the details element map. */
|
---|
254 | QMap<DetailsElementType, UISnapshotDetailsElement*> m_details;
|
---|
255 | };
|
---|
256 |
|
---|
257 | #endif /* !FEQT_INCLUDED_SRC_snapshots_UISnapshotDetailsWidget_h */
|
---|