VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationModel.h

Last change on this file was 103982, checked in by vboxsync, 2 months ago

FE/Qt: bugref:10624. Replacing override and final keywords with RT_OVERRIDE and RT_FINAL defines.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: UINotificationModel.h 103982 2024-03-21 11:43:53Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UINotificationModel class declaration.
4 */
5
6/*
7 * Copyright (C) 2021-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_notificationcenter_UINotificationModel_h
29#define FEQT_INCLUDED_SRC_notificationcenter_UINotificationModel_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QList>
36#include <QMap>
37#include <QObject>
38#include <QUuid>
39
40/* GUI includes: */
41#include "UILibraryDefs.h"
42
43/* Forward declarations: */
44class UINotificationObject;
45
46/** QObject-based notification-center model. */
47class SHARED_LIBRARY_STUFF UINotificationModel : public QObject
48{
49 Q_OBJECT;
50
51signals:
52
53 /** Notifies listeners about item with specified @a uId was added. */
54 void sigItemAdded(const QUuid &uId);
55 /** Notifies listeners about item with specified @a uId was removed. */
56 void sigItemRemoved(const QUuid &uId);
57
58public:
59
60 /** Constructs notification-center model passing @a pParent to the base-class. */
61 UINotificationModel(QObject *pParent);
62 /** Destructs notification-center model. */
63 virtual ~UINotificationModel() RT_OVERRIDE RT_FINAL;
64
65 /** Appens a notification @a pObject to internal storage. */
66 QUuid appendObject(UINotificationObject *pObject);
67 /** Revokes a notification object referenced by @a uId from intenal storage. */
68 void revokeObject(const QUuid &uId);
69 /** Returns whether there is a notification object referenced by @a uId. */
70 bool hasObject(const QUuid &uId) const;
71 /** Revokes finished notification objects. */
72 void revokeFinishedObjects();
73
74 /** Returns a list of registered notification object IDs. */
75 QList<QUuid> ids() const;
76 /** Returns a notification object referenced by specified @a uId. */
77 UINotificationObject *objectById(const QUuid &uId);
78
79private slots:
80
81 /** Handles request about to close sender() notification object.
82 * @param fDismiss Brings whether message closed as dismissed. */
83 void sltHandleAboutToClose(bool fDismiss);
84
85 /** Handles broadcast request to detach COM stuff. */
86 void sltDetachCOM();
87
88private:
89
90 /** Prepares all. */
91 void prepare();
92 /** Cleanups all. */
93 void cleanup();
94
95 /** Holds the list of registered notification object IDs. */
96 QList<QUuid> m_ids;
97 /** Holds the map of notification objects registered by ID. */
98 QMap<QUuid, UINotificationObject*> m_objects;
99};
100
101#endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationModel_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use