Music Hub  ..
A session-wide music playback service
output_observer_p.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2021-2022 UBports Foundation.
3  *
4  * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_P_H
20 #define LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_P_H
21 
22 #include "audio/output_observer.h"
23 
24 namespace lomiri {
25 namespace MediaHubService {
26 namespace audio {
27 
29 {
30  Q_DECLARE_PUBLIC(OutputObserver)
31 
32 public:
34  m_outputState(OutputState::Speaker),
35  q_ptr(q)
36  {
37  }
38 
39  OutputState outputState() const { return m_outputState; }
40 
41 protected:
43  Q_Q(OutputObserver);
44  if (state == m_outputState) return;
45  m_outputState = state;
46  Q_EMIT q->outputStateChanged();
47  }
48 
49 private:
50  OutputState m_outputState;
51  OutputObserver *q_ptr;
52 };
53 
54 }}} // namespace
55 
56 #endif // LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_P_H
lomiri::MediaHubService::audio::OutputObserverPrivate::outputState
OutputState outputState() const
Definition: output_observer_p.h:39
lomiri::MediaHubService::audio::OutputObserverPrivate
Definition: output_observer_p.h:28
lomiri::MediaHubService::audio::OutputState::Speaker
@ Speaker
lomiri::MediaHubService::audio
Definition: ostream_reporter.h:33
output_observer.h
lomiri::MediaHubService::audio::OutputObserver
Definition: output_observer.h:50
lomiri::MediaHubService::audio::OutputState
OutputState
Definition: output_observer.h:35
lomiri::MediaHubService::audio::OutputObserverPrivate::setOutputState
void setOutputState(OutputState state)
Definition: output_observer_p.h:42
lomiri::MediaHubService::audio::OutputObserverPrivate::OutputObserverPrivate
OutputObserverPrivate(OutputObserver *q)
Definition: output_observer_p.h:33
lomiri
Definition: dbus_utils.h:24