[55401] | 1 | /* $Id: UIVMCloseDialog.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
[8332] | 2 | /** @file
|
---|
[52727] | 3 | * VBox Qt GUI - UIVMCloseDialog class declaration.
|
---|
[8332] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[106061] | 7 | * Copyright (C) 2006-2024 Oracle and/or its affiliates.
|
---|
[8332] | 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
|
---|
[8332] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_runtime_UIVMCloseDialog_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_runtime_UIVMCloseDialog_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[8332] | 33 |
|
---|
[72887] | 34 | /* Qt includes: */
|
---|
| 35 | #include <QIcon>
|
---|
| 36 |
|
---|
[45206] | 37 | /* GUI includes: */
|
---|
[72887] | 38 | #include "QIDialog.h"
|
---|
[51188] | 39 | #include "UIExtraDataDefs.h"
|
---|
[8332] | 40 |
|
---|
[45212] | 41 | /* Forward declarations: */
|
---|
[72887] | 42 | class QCheckBox;
|
---|
| 43 | class QGridLayout;
|
---|
| 44 | class QHBoxLayout;
|
---|
[45212] | 45 | class QLabel;
|
---|
| 46 | class QRadioButton;
|
---|
[72887] | 47 | class QVBoxLayout;
|
---|
[98675] | 48 | class UIMachine;
|
---|
[45212] | 49 |
|
---|
[72887] | 50 | /** QIDialog extension to handle Runtime UI close-event. */
|
---|
[104290] | 51 | class UIVMCloseDialog : public QIDialog
|
---|
[8332] | 52 | {
|
---|
[9729] | 53 | Q_OBJECT;
|
---|
[8332] | 54 |
|
---|
| 55 | public:
|
---|
| 56 |
|
---|
[72887] | 57 | /** Constructs close dialog passing @a pParent to the base-class.
|
---|
[98675] | 58 | * @param pMachine Brings the machine UI dialog created for.
|
---|
[72887] | 59 | * @param fIsACPIEnabled Brings whether ACPI is enabled.
|
---|
| 60 | * @param restictedCloseActions Brings a set of restricted actions. */
|
---|
[98675] | 61 | UIVMCloseDialog(QWidget *pParent, UIMachine *pMachine,
|
---|
[49468] | 62 | bool fIsACPIEnabled, MachineCloseAction restictedCloseActions);
|
---|
[9056] | 63 |
|
---|
[72887] | 64 | /** Returns whether dialog is valid. */
|
---|
[45212] | 65 | bool isValid() const { return m_fValid; }
|
---|
| 66 |
|
---|
[72887] | 67 | /** Defines dialog @a icon. */
|
---|
| 68 | void setIcon(const QIcon &icon);
|
---|
[66660] | 69 |
|
---|
[72887] | 70 | protected:
|
---|
| 71 |
|
---|
| 72 | /** Preprocesses any Qt @a pEvent for passed @a pObject. */
|
---|
[93990] | 73 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
[72887] | 74 |
|
---|
| 75 | /** Handles any Qt @a pEvent. */
|
---|
[93990] | 76 | virtual bool event(QEvent *pEvent) RT_OVERRIDE;
|
---|
[72887] | 77 |
|
---|
[75672] | 78 | /** Handles show @a pEvent. */
|
---|
[93990] | 79 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
[75672] | 80 |
|
---|
[104290] | 81 | private slots:
|
---|
| 82 |
|
---|
[72887] | 83 | /** Handles translation event. */
|
---|
[104290] | 84 | void sltRetranslateUI();
|
---|
[72887] | 85 |
|
---|
[98524] | 86 | /** Updates widgets availability. */
|
---|
| 87 | void sltUpdateWidgetAvailability();
|
---|
| 88 |
|
---|
[72887] | 89 | /** Accepts the dialog. */
|
---|
[103977] | 90 | void accept() RT_OVERRIDE;
|
---|
[45212] | 91 |
|
---|
[45206] | 92 | private:
|
---|
[9056] | 93 |
|
---|
[72887] | 94 | /** Defines whether 'Detach' button is enabled. */
|
---|
| 95 | void setButtonEnabledDetach(bool fEnabled);
|
---|
| 96 | /** Defines whether 'Detach' button is visible. */
|
---|
| 97 | void setButtonVisibleDetach(bool fVisible);
|
---|
[45212] | 98 |
|
---|
[72887] | 99 | /** Defines whether 'Save' button is enabled. */
|
---|
| 100 | void setButtonEnabledSave(bool fEnabled);
|
---|
| 101 | /** Defines whether 'Save' button is visible. */
|
---|
| 102 | void setButtonVisibleSave(bool fVisible);
|
---|
| 103 |
|
---|
| 104 | /** Defines whether 'Shutdown' button is enabled. */
|
---|
| 105 | void setButtonEnabledShutdown(bool fEnabled);
|
---|
| 106 | /** Defines whether 'Shutdown' button is visible. */
|
---|
| 107 | void setButtonVisibleShutdown(bool fVisible);
|
---|
| 108 |
|
---|
| 109 | /** Defines whether 'PowerOff' button is enabled. */
|
---|
| 110 | void setButtonEnabledPowerOff(bool fEnabled);
|
---|
| 111 | /** Defines whether 'PowerOff' button is visible. */
|
---|
| 112 | void setButtonVisiblePowerOff(bool fVisible);
|
---|
| 113 |
|
---|
[98524] | 114 | /** Defines whether 'Discard' check-box is visible. */
|
---|
| 115 | void setCheckBoxVisibleDiscard(bool fVisible);
|
---|
| 116 |
|
---|
[72887] | 117 | /** Prepares all. */
|
---|
[45212] | 118 | void prepare();
|
---|
[72887] | 119 | /** Prepares main layout. */
|
---|
| 120 | void prepareMainLayout();
|
---|
| 121 | /** Prepares top layout. */
|
---|
| 122 | void prepareTopLayout();
|
---|
| 123 | /** Prepares top-left layout. */
|
---|
| 124 | void prepareTopLeftLayout();
|
---|
| 125 | /** Prepares top-right layout. */
|
---|
| 126 | void prepareTopRightLayout();
|
---|
| 127 | /** Prepares choice layout. */
|
---|
| 128 | void prepareChoiceLayout();
|
---|
| 129 | /** Prepares button-box. */
|
---|
| 130 | void prepareButtonBox();
|
---|
| 131 |
|
---|
| 132 | /** Configures dialog. */
|
---|
[49465] | 133 | void configure();
|
---|
[45212] | 134 |
|
---|
[72887] | 135 | /** Updates pixmaps. */
|
---|
| 136 | void updatePixmaps();
|
---|
[45206] | 137 |
|
---|
[98675] | 138 | /** Holds the machine UI reference. */
|
---|
| 139 | UIMachine *m_pMachine;
|
---|
[72887] | 140 | /** Holds whether ACPI is enabled. */
|
---|
| 141 | bool m_fIsACPIEnabled;
|
---|
| 142 | /** Holds a set of restricted actions. */
|
---|
| 143 | const MachineCloseAction m_restictedCloseActions;
|
---|
[47398] | 144 |
|
---|
[72887] | 145 | /** Holds whether dialog is valid. */
|
---|
| 146 | bool m_fValid;
|
---|
[45212] | 147 |
|
---|
[72887] | 148 | /** Holds the dialog icon. */
|
---|
| 149 | QIcon m_icon;
|
---|
[45212] | 150 |
|
---|
[72887] | 151 | /** Holds the main layout instance. */
|
---|
| 152 | QVBoxLayout *m_pMainLayout;
|
---|
| 153 | /** Holds the top layout instance. */
|
---|
| 154 | QHBoxLayout *m_pTopLayout;
|
---|
| 155 | /** Holds the top-left layout instance. */
|
---|
| 156 | QVBoxLayout *m_pTopLeftLayout;
|
---|
| 157 | /** Holds the top-right layout instance. */
|
---|
| 158 | QVBoxLayout *m_pTopRightLayout;
|
---|
| 159 | /** Holds the choice layout instance. */
|
---|
| 160 | QGridLayout *m_pChoiceLayout;
|
---|
| 161 |
|
---|
| 162 | /** Holds the icon label instance. */
|
---|
| 163 | QLabel *m_pLabelIcon;
|
---|
| 164 | /** Holds the text label instance. */
|
---|
| 165 | QLabel *m_pLabelText;
|
---|
| 166 |
|
---|
| 167 | /** Holds the 'Detach' icon label instance. */
|
---|
| 168 | QLabel *m_pLabelIconDetach;
|
---|
| 169 | /** Holds the 'Detach' radio-button instance. */
|
---|
| 170 | QRadioButton *m_pRadioButtonDetach;
|
---|
| 171 | /** Holds the 'Save' icon label instance. */
|
---|
| 172 | QLabel *m_pLabelIconSave;
|
---|
| 173 | /** Holds the 'Save' radio-button instance. */
|
---|
| 174 | QRadioButton *m_pRadioButtonSave;
|
---|
| 175 | /** Holds the 'Shutdown' icon label instance. */
|
---|
| 176 | QLabel *m_pLabelIconShutdown;
|
---|
| 177 | /** Holds the 'Shutdown' radio-button instance. */
|
---|
| 178 | QRadioButton *m_pRadioButtonShutdown;
|
---|
| 179 | /** Holds the 'PowerOff' icon label instance. */
|
---|
| 180 | QLabel *m_pLabelIconPowerOff;
|
---|
| 181 | /** Holds the 'PowerOff' radio-button instance. */
|
---|
| 182 | QRadioButton *m_pRadioButtonPowerOff;
|
---|
| 183 |
|
---|
[98524] | 184 | /** Holds the 'Discard' check-box instance. */
|
---|
| 185 | QCheckBox *m_pCheckBoxDiscard;
|
---|
| 186 | /** Holds the 'Discard' check-box text. */
|
---|
| 187 | QString m_strDiscardCheckBoxText;
|
---|
| 188 |
|
---|
[72887] | 189 | /** Holds the last close action. */
|
---|
| 190 | MachineCloseAction m_enmLastCloseAction;
|
---|
[8332] | 191 | };
|
---|
| 192 |
|
---|
[76581] | 193 | #endif /* !FEQT_INCLUDED_SRC_runtime_UIVMCloseDialog_h */
|
---|