[55401] | 1 | /* $Id: QIDialog.h 103977 2024-03-21 02:04:52Z vboxsync $ */
|
---|
[25177] | 2 | /** @file
|
---|
[71900] | 3 | * VBox Qt GUI - Qt extensions: QIDialog class declaration.
|
---|
[25177] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2008-2023 Oracle and/or its affiliates.
|
---|
[25177] | 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
|
---|
[25177] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_extensions_QIDialog_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_extensions_QIDialog_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[25177] | 33 |
|
---|
[45162] | 34 | /* Qt includes: */
|
---|
[25177] | 35 | #include <QDialog>
|
---|
[41175] | 36 | #include <QPointer>
|
---|
[25177] | 37 |
|
---|
[71630] | 38 | /* GUI includes: */
|
---|
| 39 | #include "UILibraryDefs.h"
|
---|
| 40 |
|
---|
[45162] | 41 | /* Forward declarations: */
|
---|
[25177] | 42 | class QEventLoop;
|
---|
| 43 |
|
---|
[62216] | 44 | /** QDialog extension providing the GUI with
|
---|
| 45 | * the advanced capabilities like delayed show. */
|
---|
[71630] | 46 | class SHARED_LIBRARY_STUFF QIDialog : public QDialog
|
---|
[25177] | 47 | {
|
---|
| 48 | Q_OBJECT;
|
---|
| 49 |
|
---|
| 50 | public:
|
---|
| 51 |
|
---|
[71396] | 52 | /** Constructs the dialog passing @a pParent and @a enmFlags to the base-class. */
|
---|
[87718] | 53 | QIDialog(QWidget *pParent = 0, Qt::WindowFlags enmFlags = Qt::WindowFlags());
|
---|
[45162] | 54 |
|
---|
[62216] | 55 | /** Defines whether the dialog is @a fVisible. */
|
---|
[103977] | 56 | void setVisible(bool fVisible) RT_OVERRIDE;
|
---|
[45162] | 57 |
|
---|
[25177] | 58 | public slots:
|
---|
| 59 |
|
---|
[62216] | 60 | /** Shows the dialog as a modal one, blocking until the user closes it.
|
---|
[71396] | 61 | * @param fShow Brings whether the dialog should be shown instantly.
|
---|
| 62 | * @param fApplicationModal Brings whether the dialog should be application-modal. */
|
---|
[61241] | 63 | virtual int execute(bool fShow = true, bool fApplicationModal = false);
|
---|
[45162] | 64 |
|
---|
[71396] | 65 | /** Shows the dialog as a modal one, blocking until the user closes it. */
|
---|
[93990] | 66 | virtual int exec() RT_OVERRIDE { return execute(); }
|
---|
[61241] | 67 |
|
---|
[100871] | 68 | /** Closes the dialog and sets its result code to iResult. */
|
---|
| 69 | virtual void done(int iResult) RT_OVERRIDE;
|
---|
| 70 |
|
---|
[25177] | 71 | protected:
|
---|
| 72 |
|
---|
[62216] | 73 | /** Handles show @a pEvent. */
|
---|
[93990] | 74 | virtual void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
[62216] | 75 | /** Handles show @a pEvent sent for the first time. */
|
---|
[45205] | 76 | virtual void polishEvent(QShowEvent *pEvent);
|
---|
| 77 |
|
---|
[25177] | 78 | private:
|
---|
[45162] | 79 |
|
---|
[62216] | 80 | /** Holds whether the dialog is polished. */
|
---|
[45162] | 81 | bool m_fPolished;
|
---|
[62216] | 82 |
|
---|
| 83 | /** Holds the separate event-loop instance.
|
---|
| 84 | * @note This event-loop is only used when the dialog being executed via the execute()
|
---|
| 85 | * functionality, allowing for the delayed show and advanced modality flag. */
|
---|
[45162] | 86 | QPointer<QEventLoop> m_pEventLoop;
|
---|
[25177] | 87 | };
|
---|
| 88 |
|
---|
[62216] | 89 | /** Safe pointer to the QIDialog class. */
|
---|
[48085] | 90 | typedef QPointer<QIDialog> UISafePointerDialog;
|
---|
| 91 |
|
---|
[76581] | 92 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIDialog_h */
|
---|