Sayonara Player
Shutdown.h
1 /* Shutdown.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef SHUTDOWN_H
22 #define SHUTDOWN_H
23 
24 #ifdef WITH_DBUS
25  #define WITH_SHUTDOWN
26 #endif
27 
28 #ifdef WITH_SHUTDOWN
29 
30 
31 #include "Helper/Singleton.h"
32 #include "Helper/Settings/SayonaraClass.h"
33 
34 #include <QDBusInterface>
35 #include <QDBusConnection>
36 #include <QProcess>
37 #include <QTimer>
38 
39 class PlayManager;
41 
46 class Shutdown : public QObject, private SayonaraClass
47 {
48  Q_OBJECT
49  SINGLETON_QOBJECT(Shutdown)
50 
51 signals:
52 
53  void sig_time_to_go(quint64);
54  void sig_started(quint64);
55 
56 
57 private:
58  QTimer* _timer=nullptr;
59  QTimer* _timer_countdown=nullptr;
60  PlayManager* _play_manager=nullptr;
61 
62  quint64 _msecs2go;
63  bool _is_running;
64 
65 
66 private slots:
67  void timeout();
68  void countdown_timeout();
69  void playlist_finished();
70 
71 public:
72 
73  bool is_running() const;
74  void stop();
75  void shutdown(quint64 ms=0);
76  void shutdown_after_end();
77 };
78 
79 #endif // WITH_SHUTDOWN
80 
81 #endif // SHUTDOWN_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
Global handler for current playback state (Singleton)
Definition: PlayManager.h:37
Definition: NotificationHandler.h:37