Changed media player to initialize in boot.
[jspeed] / src / themescheduler.h
1 /*
2  * This file is part of jSpeed.
3  *
4  * jSpeed is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * jSpeed is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with jSpeed.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18
19 #ifndef THEMESCHEDULER_H
20 #define THEMESCHEDULER_H
21
22 #include <QtCore/QObject>
23 #include <QtCore/QList>
24 #include <QtCore/QTime>
25 #include <QtCore/QTimer>
26
27 class QString;
28
29 class ThemeScheduler : public QObject
30 {
31     Q_OBJECT
32
33 public:
34
35     struct SchedulerItem
36     {
37         QTime time;
38         QString theme;
39     };
40
41     ~ThemeScheduler();
42     static ThemeScheduler& instance();
43     static QString const& getDefaultTheme();
44     void addItem(QTime const& time, QString const& theme);
45     void removeItem(QTime const& time);
46     void setEnabled(bool enabled);
47     bool isEnabled() const;
48     QString currentTheme() const;
49     void clear();
50     void getItems(QList<SchedulerItem>& items);
51     bool isEmpty() const;
52
53 public slots:
54     void store();
55
56 signals:
57     void themeChanged();
58
59 private slots:
60     void emitThemeChanged();
61
62 private:
63     struct ItemDetails
64     {
65         QTime time;
66         QString theme;
67         QTimer timer;
68     };
69
70     ThemeScheduler();
71     void loadConfig();
72     void sort();
73     bool enabled_;
74     QList<ItemDetails*> items_;
75
76
77 };
78
79 #endif