Music Hub  ..
A session-wide music playback service
client_death_observer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  * Copyright © 2022 UBports Foundation.
4  *
5  * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License version 3,
9  * as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Authored by: Thomas Voß <thomas.voss@canonical.com>
20  */
21 
22 #ifndef LOMIRI_MEDIAHUBSERVICE_CLIENT_DEATH_OBSERVER_H
23 #define LOMIRI_MEDIAHUBSERVICE_CLIENT_DEATH_OBSERVER_H
24 
25 #include "player.h"
26 
27 #include <QObject>
28 #include <QScopedPointer>
29 #include <QSharedPointer>
30 
31 namespace lomiri
32 {
33 namespace MediaHubService
34 {
35 // Models functionality to be notified whenever a client
36 // of the service goes away, and thus allows us to clean
37 // up in that case.
38 class ClientDeathObserverPrivate;
40 {
41  Q_OBJECT
42 
43 public:
44  // To save us some typing.
45  typedef QSharedPointer<ClientDeathObserver> Ptr;
46 
47  ClientDeathObserver(QObject *parent = nullptr);
49  virtual ~ClientDeathObserver();
50 
52 
53  // Registers the given client for death notifications.
55 
56 Q_SIGNALS:
57  // Emitted whenever a client dies, reporting the key under which the
58  // respective client was known.
59  void clientDied(const Player::Client &client);
60 
61 private:
62  Q_DECLARE_PRIVATE(ClientDeathObserver);
63  QScopedPointer<ClientDeathObserverPrivate> d_ptr;
64 };
65 
66 }
67 }
68 
69 #endif // LOMIRI_MEDIAHUBSERVICE_CLIENT_DEATH_OBSERVER_H
QObject
lomiri::MediaHubService::ClientDeathObserver::~ClientDeathObserver
virtual ~ClientDeathObserver()
lomiri::MediaHubService::ClientDeathObserver::clientDied
void clientDied(const Player::Client &client)
lomiri::MediaHubService::ClientDeathObserver
Definition: client_death_observer.h:39
lomiri::MediaHubService::Player::Client
Definition: player.h:61
lomiri::MediaHubService::ClientDeathObserver::Ptr
QSharedPointer< ClientDeathObserver > Ptr
Definition: client_death_observer.h:45
lomiri::MediaHubService::ClientDeathObserver::operator=
ClientDeathObserver & operator=(const ClientDeathObserver &)=delete
lomiri::MediaHubService::ClientDeathObserver::ClientDeathObserver
ClientDeathObserver(QObject *parent=nullptr)
Definition: client_death_observer.cpp:54
lomiri::MediaHubService::ClientDeathObserver::registerForDeathNotifications
void registerForDeathNotifications(const Player::Client &client)
Definition: client_death_observer.cpp:63
player.h
lomiri
Definition: dbus_utils.h:24