Sayonara Player
Shutdown.h
1 /* Shutdown.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef SHUTDOWN_H
24 #define SHUTDOWN_H
25 
26 #ifdef WITH_DBUS
27  #define WITH_SHUTDOWN
28 #endif
29 
30 #ifdef WITH_SHUTDOWN
31 
32 
33 
34 #include "Helper/globals.h"
35 #include "Helper/Settings/SayonaraClass.h"
36 
37 #include <QDBusInterface>
38 #include <QDBusConnection>
39 #include <QProcess>
40 #include <QTimer>
41 
42 class PlayManager;
44 
49 class Shutdown : public QObject, private SayonaraClass {
50 
51  Q_OBJECT
52  SINGLETON_QOBJECT(Shutdown)
53 
54 signals:
55 
56  void sig_time_to_go(quint64);
57  void sig_started(quint64);
58 
59 
60 private:
61  QTimer* _timer=nullptr;
62  QTimer* _timer_countdown=nullptr;
63  PlayManager* _play_manager=nullptr;
64 
65  quint64 _msecs2go;
66  bool _is_running;
67 
68 
69 private slots:
70  void timeout();
71  void countdown_timeout();
72  void playlist_finished();
73 
74 public:
75 
76  bool is_running() const;
77  void stop();
78  void shutdown(quint64 ms=0);
79  void shutdown_after_end();
80 };
81 
82 #endif // WITH_SHUTDOWN
83 
84 #endif // SHUTDOWN_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Global handler for current playback state (Singleton)
Definition: PlayManager.h:67
Definition: NotificationHandler.h:38