VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotDetailsWidget.h@ 102493

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