1 | /* $Id: UIProgressEventHandler.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIProgressEventHandler class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-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_globals_UIProgressEventHandler_h
|
---|
29 | #define FEQT_INCLUDED_SRC_globals_UIProgressEventHandler_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIMainEventListener.h"
|
---|
36 |
|
---|
37 | /* COM includes: */
|
---|
38 | # include "CEventListener.h"
|
---|
39 | # include "CEventSource.h"
|
---|
40 | # include "CProgress.h"
|
---|
41 |
|
---|
42 |
|
---|
43 | /** Private QObject extension
|
---|
44 | * providing UIExtraDataManager with the CVirtualBox event-source. */
|
---|
45 | class SHARED_LIBRARY_STUFF UIProgressEventHandler : public QObject
|
---|
46 | {
|
---|
47 | Q_OBJECT;
|
---|
48 |
|
---|
49 | signals:
|
---|
50 |
|
---|
51 | /** Notifies about @a iPercent change for progress with @a uProgressId. */
|
---|
52 | void sigProgressPercentageChange(const QUuid &uProgressId, const int iPercent);
|
---|
53 | /** Notifies about task complete for progress with @a uProgressId. */
|
---|
54 | void sigProgressTaskComplete(const QUuid &uProgressId);
|
---|
55 | /** Notifies about handling has finished. */
|
---|
56 | void sigHandlingFinished();
|
---|
57 |
|
---|
58 | public:
|
---|
59 |
|
---|
60 | /** Constructs event proxy object on the basis of passed @a pParent. */
|
---|
61 | UIProgressEventHandler(QObject *pParent, const CProgress &comProgress);
|
---|
62 | /** Destructs event proxy object. */
|
---|
63 | virtual ~UIProgressEventHandler() RT_OVERRIDE;
|
---|
64 |
|
---|
65 | protected:
|
---|
66 |
|
---|
67 | /** @name Prepare/Cleanup cascade.
|
---|
68 | * @{ */
|
---|
69 | /** Prepares all. */
|
---|
70 | void prepare();
|
---|
71 | /** Prepares listener. */
|
---|
72 | void prepareListener();
|
---|
73 | /** Prepares connections. */
|
---|
74 | void prepareConnections();
|
---|
75 |
|
---|
76 | /** Cleanups connections. */
|
---|
77 | void cleanupConnections();
|
---|
78 | /** Cleanups listener. */
|
---|
79 | void cleanupListener();
|
---|
80 | /** Cleanups all. */
|
---|
81 | void cleanup();
|
---|
82 | /** @} */
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | /** Holds the progress wrapper. */
|
---|
87 | CProgress m_comProgress;
|
---|
88 |
|
---|
89 | /** Holds the Qt event listener instance. */
|
---|
90 | ComObjPtr<UIMainEventListenerImpl> m_pQtListener;
|
---|
91 | /** Holds the COM event listener instance. */
|
---|
92 | CEventListener m_comEventListener;
|
---|
93 | };
|
---|
94 |
|
---|
95 |
|
---|
96 | #endif /* !FEQT_INCLUDED_SRC_globals_UIProgressEventHandler_h */
|
---|