[55401] | 1 | /* $Id: UISnapshotDetailsWidget.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[8740] | 2 | /** @file
|
---|
[67160] | 3 | * VBox Qt GUI - UISnapshotDetailsWidget class declaration.
|
---|
[8740] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2008-2024 Oracle and/or its affiliates.
|
---|
[8740] | 8 | *
|
---|
[96407] | 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
|
---|
[8740] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_snapshots_UISnapshotDetailsWidget_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_snapshots_UISnapshotDetailsWidget_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[8740] | 33 |
|
---|
[67168] | 34 | /* Qt includes: */
|
---|
| 35 | #include <QWidget>
|
---|
| 36 |
|
---|
[41587] | 37 | /* GUI includes: */
|
---|
[67308] | 38 | #include "UIExtraDataDefs.h"
|
---|
[8740] | 39 |
|
---|
[41587] | 40 | /* COM includes: */
|
---|
[81964] | 41 | #include "CGraphicsAdapter.h"
|
---|
[68722] | 42 | #include "CMachine.h"
|
---|
[41587] | 43 | #include "CSnapshot.h"
|
---|
| 44 |
|
---|
[67168] | 45 | /* Forward declarations: */
|
---|
[68365] | 46 | class CNetworkAdapter;
|
---|
[67173] | 47 | class QGridLayout;
|
---|
[67168] | 48 | class QLabel;
|
---|
| 49 | class QLineEdit;
|
---|
[67308] | 50 | class QScrollArea;
|
---|
[67173] | 51 | class QTabWidget;
|
---|
[67168] | 52 | class QTextEdit;
|
---|
[67375] | 53 | class QVBoxLayout;
|
---|
[67246] | 54 | class QWidget;
|
---|
[67517] | 55 | class QIDialogButtonBox;
|
---|
[67308] | 56 | class UISnapshotDetailsElement;
|
---|
[24732] | 57 |
|
---|
[67168] | 58 |
|
---|
[96658] | 59 | /** Snapshot pane: Snapshot data. */
|
---|
| 60 | class UIDataSnapshot
|
---|
[67147] | 61 | {
|
---|
[96658] | 62 | public:
|
---|
| 63 |
|
---|
[67147] | 64 | /** Constructs data. */
|
---|
| 65 | UIDataSnapshot()
|
---|
| 66 | : m_strName(QString())
|
---|
| 67 | , m_strDescription(QString())
|
---|
| 68 | {}
|
---|
| 69 |
|
---|
[96658] | 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 |
|
---|
[67147] | 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 |
|
---|
[96658] | 94 | protected:
|
---|
| 95 |
|
---|
| 96 | /** Holds the name. */
|
---|
| 97 | QString m_strName;
|
---|
| 98 | /** Holds the description. */
|
---|
| 99 | QString m_strDescription;
|
---|
[67147] | 100 | };
|
---|
| 101 |
|
---|
| 102 |
|
---|
[67160] | 103 | /** QWidget extension providing GUI with snapshot details-widget. */
|
---|
[104358] | 104 | class UISnapshotDetailsWidget : public QWidget
|
---|
[8740] | 105 | {
|
---|
[9729] | 106 | Q_OBJECT;
|
---|
[8740] | 107 |
|
---|
[67160] | 108 | signals:
|
---|
| 109 |
|
---|
[67517] | 110 | /** Notifies listeners about data change accepted and should be applied. */
|
---|
| 111 | void sigDataChangeAccepted();
|
---|
[67160] | 112 |
|
---|
[8740] | 113 | public:
|
---|
| 114 |
|
---|
[67160] | 115 | /** Constructs snapshot details-widget passing @a pParent to the base-class. */
|
---|
| 116 | UISnapshotDetailsWidget(QWidget *pParent = 0);
|
---|
[8740] | 117 |
|
---|
[67160] | 118 | /** Returns the snapshot data. */
|
---|
| 119 | const UIDataSnapshot &data() const { return m_newData; }
|
---|
[68722] | 120 | /** Defines the @a comMachine. */
|
---|
| 121 | void setData(const CMachine &comMachine);
|
---|
| 122 | /** Defines the @a comSnapshot and it's @a data. */
|
---|
[67147] | 123 | void setData(const UIDataSnapshot &data, const CSnapshot &comSnapshot);
|
---|
[67160] | 124 | /** Clears the snapshot data. */
|
---|
| 125 | void clearData();
|
---|
[8740] | 126 |
|
---|
[9056] | 127 | protected:
|
---|
| 128 |
|
---|
[68722] | 129 | /** Handles buttons translation. */
|
---|
| 130 | void retranslateButtons();
|
---|
[24732] | 131 |
|
---|
[8740] | 132 | private slots:
|
---|
| 133 |
|
---|
[67160] | 134 | /** Handles snapshot name change. */
|
---|
| 135 | void sltHandleNameChange();
|
---|
[67147] | 136 | /** Handles snapshot description change. */
|
---|
| 137 | void sltHandleDescriptionChange();
|
---|
[8740] | 138 |
|
---|
[67312] | 139 | /** Handles snapshot details anchor clicks. */
|
---|
| 140 | void sltHandleAnchorClicked(const QUrl &link);
|
---|
| 141 |
|
---|
[67517] | 142 | /** Handles snapshot details change accepting. */
|
---|
| 143 | void sltHandleChangeAccepted();
|
---|
| 144 | /** Handles snapshot details change rejecting. */
|
---|
| 145 | void sltHandleChangeRejected();
|
---|
[104358] | 146 | /** Handles translation event. */
|
---|
| 147 | void sltRetranslateUI();
|
---|
[67517] | 148 |
|
---|
[8740] | 149 | private:
|
---|
| 150 |
|
---|
[67146] | 151 | /** Prepares all. */
|
---|
| 152 | void prepare();
|
---|
[67173] | 153 | /** Prepares tab-widget. */
|
---|
| 154 | void prepareTabWidget();
|
---|
| 155 | /** Prepares 'Options' tab. */
|
---|
| 156 | void prepareTabOptions();
|
---|
| 157 | /** Prepares 'Details' tab. */
|
---|
| 158 | void prepareTabDetails();
|
---|
[24732] | 159 |
|
---|
[67308] | 160 | /** Creates details element of passed @a enmType. */
|
---|
| 161 | static UISnapshotDetailsElement *createDetailsElement(DetailsElementType enmType);
|
---|
| 162 |
|
---|
[67160] | 163 | /** Loads snapshot data. */
|
---|
| 164 | void loadSnapshotData();
|
---|
| 165 |
|
---|
[67409] | 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);
|
---|
[67517] | 170 | /** Updates button states. */
|
---|
| 171 | void updateButtonStates();
|
---|
[67160] | 172 |
|
---|
[68744] | 173 | /** Returns details report of requested @a enmType for a given @a comMachine. */
|
---|
[68764] | 174 | QString detailsReport(DetailsElementType enmType, const CMachine &comMachine, const CSnapshot &comSnapshot = CSnapshot()) const;
|
---|
[67277] | 175 |
|
---|
[68762] | 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. */
|
---|
[68763] | 185 | static double scaleFactorReport(CMachine comMachine);
|
---|
[68762] | 186 | /** Acquires @a comMachine VRDE server report. */
|
---|
| 187 | static QStringList vrdeServerReport(CMachine comMachine);
|
---|
[75291] | 188 | /** Acquires @a comMachine recording report. */
|
---|
| 189 | static QStringList recordingReport(CMachine comMachine);
|
---|
[68762] | 190 | /** Acquires @a comMachine storage report. */
|
---|
| 191 | static QPair<QStringList, QList<QMap<QString, QString> > > storageReport(CMachine comMachine);
|
---|
| 192 | /** Acquires @a comMachine audio report. */
|
---|
| 193 | static QStringList audioReport(CMachine comMachine);
|
---|
| 194 | /** Acquires @a comMachine network report. */
|
---|
| 195 | static QStringList networkReport(CMachine comMachine);
|
---|
| 196 | /** Acquires @a comMachine serial report. */
|
---|
| 197 | static QStringList serialReport(CMachine comMachine);
|
---|
| 198 | /** Acquires @a comMachine usb report. */
|
---|
| 199 | static QStringList usbReport(CMachine comMachine);
|
---|
| 200 |
|
---|
[68735] | 201 | /** Wipes the HTML stuff from the passed @a strString. */
|
---|
| 202 | static QString wipeHtmlStuff(const QString &strString);
|
---|
| 203 |
|
---|
[68764] | 204 | /** Prepares emhasized report for a given @a strValue, comparing to @a strOldValue. */
|
---|
| 205 | static QString empReport(const QString &strValue, const QString &strOldValue);
|
---|
| 206 | /** Prepares emhasized report for a given @a strValue, depending on @a fDo flag. */
|
---|
| 207 | static QString empReport(const QString &strValue, bool fIgnore);
|
---|
| 208 |
|
---|
[68722] | 209 | /** Holds the machine object to load data from. */
|
---|
| 210 | CMachine m_comMachine;
|
---|
[67146] | 211 | /** Holds the snapshot object to load data from. */
|
---|
[67164] | 212 | CSnapshot m_comSnapshot;
|
---|
[67146] | 213 |
|
---|
[67147] | 214 | /** Holds the old data copy. */
|
---|
| 215 | UIDataSnapshot m_oldData;
|
---|
| 216 | /** Holds the new data copy. */
|
---|
| 217 | UIDataSnapshot m_newData;
|
---|
| 218 |
|
---|
[67146] | 219 | /** Holds the cached screenshot. */
|
---|
[67164] | 220 | QPixmap m_pixmapScreenshot;
|
---|
[67168] | 221 |
|
---|
[67173] | 222 | /** Holds the tab-widget instance. */
|
---|
| 223 | QTabWidget *m_pTabWidget;
|
---|
[67168] | 224 |
|
---|
[67173] | 225 | /** Holds the 'Options' layout instance. */
|
---|
| 226 | QGridLayout *m_pLayoutOptions;
|
---|
| 227 |
|
---|
| 228 | /** Holds the name label instance. */
|
---|
| 229 | QLabel *m_pLabelName;
|
---|
| 230 | /** Holds the name editor instance. */
|
---|
| 231 | QLineEdit *m_pEditorName;
|
---|
[67409] | 232 | /** Holds the name error pane. */
|
---|
| 233 | QLabel *m_pErrorPaneName;
|
---|
[67173] | 234 |
|
---|
[67168] | 235 | /** Holds the description label instance. */
|
---|
| 236 | QLabel *m_pLabelDescription;
|
---|
| 237 | /** Holds the description editor instance. */
|
---|
| 238 | QTextEdit *m_pBrowserDescription;
|
---|
[67409] | 239 | /** Holds the description error pane. */
|
---|
| 240 | QLabel *m_pErrorPaneDescription;
|
---|
[67168] | 241 |
|
---|
[67517] | 242 | /** Holds the button-box instance. */
|
---|
| 243 | QIDialogButtonBox *m_pButtonBox;
|
---|
| 244 |
|
---|
[67173] | 245 | /** Holds the 'Details' layout instance. */
|
---|
[67375] | 246 | QVBoxLayout *m_pLayoutDetails;
|
---|
[67173] | 247 |
|
---|
[67308] | 248 | /** Holds the details scroll-area instance. */
|
---|
| 249 | QScrollArea *m_pScrollAreaDetails;
|
---|
| 250 |
|
---|
| 251 | /** Holds the details element map. */
|
---|
| 252 | QMap<DetailsElementType, UISnapshotDetailsElement*> m_details;
|
---|
[8740] | 253 | };
|
---|
| 254 |
|
---|
[76581] | 255 | #endif /* !FEQT_INCLUDED_SRC_snapshots_UISnapshotDetailsWidget_h */
|
---|