diff options
Diffstat (limited to 'framework/theme')
-rw-r--r-- | framework/theme/CMakeLists.txt | 1 | ||||
-rw-r--r-- | framework/theme/themeplugin.cpp | 14 | ||||
-rw-r--r-- | framework/theme/unit.cpp | 29 | ||||
-rw-r--r-- | framework/theme/unit.h | 38 |
4 files changed, 80 insertions, 2 deletions
diff --git a/framework/theme/CMakeLists.txt b/framework/theme/CMakeLists.txt index 4314f662..319e3d39 100644 --- a/framework/theme/CMakeLists.txt +++ b/framework/theme/CMakeLists.txt | |||
@@ -1,6 +1,7 @@ | |||
1 | set(themeplugin_SRCS | 1 | set(themeplugin_SRCS |
2 | themeplugin.cpp | 2 | themeplugin.cpp |
3 | colorpalette.cpp | 3 | colorpalette.cpp |
4 | unit.cpp | ||
4 | ) | 5 | ) |
5 | 6 | ||
6 | add_library(themeplugin SHARED ${themeplugin_SRCS}) | 7 | add_library(themeplugin SHARED ${themeplugin_SRCS}) |
diff --git a/framework/theme/themeplugin.cpp b/framework/theme/themeplugin.cpp index 919205cf..ad9d0e1b 100644 --- a/framework/theme/themeplugin.cpp +++ b/framework/theme/themeplugin.cpp | |||
@@ -18,11 +18,12 @@ | |||
18 | 18 | ||
19 | #include "themeplugin.h" | 19 | #include "themeplugin.h" |
20 | 20 | ||
21 | #include "colorpalette.h" | ||
22 | |||
23 | #include <QtQml> | 21 | #include <QtQml> |
24 | #include <QQmlEngine> | 22 | #include <QQmlEngine> |
25 | 23 | ||
24 | #include "colorpalette.h" | ||
25 | #include "unit.h" | ||
26 | |||
26 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | 27 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) |
27 | { | 28 | { |
28 | Q_UNUSED(engine); | 29 | Q_UNUSED(engine); |
@@ -31,10 +32,19 @@ static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | |||
31 | return new ColorPalette; | 32 | return new ColorPalette; |
32 | } | 33 | } |
33 | 34 | ||
35 | static QObject *unitInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
36 | { | ||
37 | Q_UNUSED(engine); | ||
38 | Q_UNUSED(scriptEngine); | ||
39 | |||
40 | return new Unit; | ||
41 | } | ||
42 | |||
34 | void ThemePlugin::registerTypes (const char *uri) | 43 | void ThemePlugin::registerTypes (const char *uri) |
35 | { | 44 | { |
36 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); | 45 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); |
37 | 46 | ||
38 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); | 47 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); |
48 | qmlRegisterSingletonType<Unit>(uri, 1, 0, "Unit", unitInstace); | ||
39 | 49 | ||
40 | } | 50 | } |
diff --git a/framework/theme/unit.cpp b/framework/theme/unit.cpp new file mode 100644 index 00000000..1f3803cb --- /dev/null +++ b/framework/theme/unit.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program 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 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program 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 along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "unit.h" | ||
20 | |||
21 | Unit::Unit(QObject *parent) : QObject(parent), m_size(5) | ||
22 | { | ||
23 | |||
24 | } | ||
25 | |||
26 | int Unit::size() const | ||
27 | { | ||
28 | return m_size; | ||
29 | } \ No newline at end of file | ||
diff --git a/framework/theme/unit.h b/framework/theme/unit.h new file mode 100644 index 00000000..bd9b58f0 --- /dev/null +++ b/framework/theme/unit.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program 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 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program 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 along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include <QObject> | ||
20 | |||
21 | |||
22 | class Unit : public QObject | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | Q_PROPERTY (int size READ size NOTIFY unitChanged) | ||
26 | |||
27 | |||
28 | public: | ||
29 | explicit Unit(QObject *parent = Q_NULLPTR); | ||
30 | |||
31 | int size() const; | ||
32 | |||
33 | signals: | ||
34 | void unitChanged(); | ||
35 | |||
36 | private: | ||
37 | int m_size; | ||
38 | }; | ||