diff options
-rw-r--r-- | components/package/contents/ui/FocusComposer.qml | 4 | ||||
-rw-r--r-- | framework/theme/CMakeLists.txt | 13 | ||||
-rw-r--r-- | framework/theme/colorpalette.cpp | 45 | ||||
-rw-r--r-- | framework/theme/colorpalette.h | 47 | ||||
-rw-r--r-- | framework/theme/qmldir | 3 | ||||
-rw-r--r-- | framework/theme/themeplugin.cpp | 40 | ||||
-rw-r--r-- | framework/theme/themeplugin.h | 31 |
7 files changed, 182 insertions, 1 deletions
diff --git a/components/package/contents/ui/FocusComposer.qml b/components/package/contents/ui/FocusComposer.qml index 8ec01cc9..5c4d88d7 100644 --- a/components/package/contents/ui/FocusComposer.qml +++ b/components/package/contents/ui/FocusComposer.qml | |||
@@ -19,13 +19,15 @@ import QtQuick 2.4 | |||
19 | import QtQuick.Controls 1.4 | 19 | import QtQuick.Controls 1.4 |
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
21 | 21 | ||
22 | import org.kube.framework.theme 1.0 | ||
23 | |||
22 | Rectangle { | 24 | Rectangle { |
23 | id: root | 25 | id: root |
24 | property variant originalMessage | 26 | property variant originalMessage |
25 | 27 | ||
26 | visible: false | 28 | visible: false |
27 | 29 | ||
28 | color: colorPalette.border | 30 | color: ColorPalette.border |
29 | 31 | ||
30 | opacity: 0.9 | 32 | opacity: 0.9 |
31 | 33 | ||
diff --git a/framework/theme/CMakeLists.txt b/framework/theme/CMakeLists.txt new file mode 100644 index 00000000..4314f662 --- /dev/null +++ b/framework/theme/CMakeLists.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | set(themeplugin_SRCS | ||
2 | themeplugin.cpp | ||
3 | colorpalette.cpp | ||
4 | ) | ||
5 | |||
6 | add_library(themeplugin SHARED ${themeplugin_SRCS}) | ||
7 | |||
8 | qt5_use_modules(themeplugin Core Quick Qml) | ||
9 | |||
10 | target_link_libraries(themeplugin) | ||
11 | |||
12 | install(TARGETS themeplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/framework/theme) | ||
13 | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/framework/theme) | ||
diff --git a/framework/theme/colorpalette.cpp b/framework/theme/colorpalette.cpp new file mode 100644 index 00000000..a321a292 --- /dev/null +++ b/framework/theme/colorpalette.cpp | |||
@@ -0,0 +1,45 @@ | |||
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 "colorpalette.h" | ||
20 | |||
21 | ColorPalette::ColorPalette(QObject *parent) : QObject(parent), m_background("#fcfcfc"), m_selected("#3daee9"), m_read("#232629"), m_border("#232629") | ||
22 | { | ||
23 | |||
24 | } | ||
25 | |||
26 | QString ColorPalette::background() const | ||
27 | { | ||
28 | return m_background; | ||
29 | } | ||
30 | |||
31 | QString ColorPalette::read() const | ||
32 | { | ||
33 | return m_read; | ||
34 | } | ||
35 | |||
36 | QString ColorPalette::selected() const | ||
37 | { | ||
38 | return m_selected; | ||
39 | } | ||
40 | |||
41 | QString ColorPalette::border() const | ||
42 | { | ||
43 | return m_border; | ||
44 | } | ||
45 | |||
diff --git a/framework/theme/colorpalette.h b/framework/theme/colorpalette.h new file mode 100644 index 00000000..a06783f3 --- /dev/null +++ b/framework/theme/colorpalette.h | |||
@@ -0,0 +1,47 @@ | |||
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 | #include <QString> | ||
21 | |||
22 | class ColorPalette : public QObject | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | |||
26 | Q_PROPERTY (QString background READ background NOTIFY themeChanged) | ||
27 | Q_PROPERTY (QString selected READ background NOTIFY themeChanged) | ||
28 | Q_PROPERTY (QString read READ read NOTIFY themeChanged) | ||
29 | Q_PROPERTY (QString border READ border NOTIFY themeChanged) | ||
30 | |||
31 | public: | ||
32 | explicit ColorPalette(QObject *parent = Q_NULLPTR); | ||
33 | |||
34 | QString background() const; | ||
35 | QString selected() const; | ||
36 | QString read() const; | ||
37 | QString border() const; | ||
38 | |||
39 | signals: | ||
40 | void themeChanged(); | ||
41 | |||
42 | private: | ||
43 | QString m_background; | ||
44 | QString m_selected; | ||
45 | QString m_read; | ||
46 | QString m_border; | ||
47 | }; | ||
diff --git a/framework/theme/qmldir b/framework/theme/qmldir new file mode 100644 index 00000000..489a71ca --- /dev/null +++ b/framework/theme/qmldir | |||
@@ -0,0 +1,3 @@ | |||
1 | module org.kube.framework.theme | ||
2 | |||
3 | plugin themeplugin | ||
diff --git a/framework/theme/themeplugin.cpp b/framework/theme/themeplugin.cpp new file mode 100644 index 00000000..919205cf --- /dev/null +++ b/framework/theme/themeplugin.cpp | |||
@@ -0,0 +1,40 @@ | |||
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 "themeplugin.h" | ||
20 | |||
21 | #include "colorpalette.h" | ||
22 | |||
23 | #include <QtQml> | ||
24 | #include <QQmlEngine> | ||
25 | |||
26 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
27 | { | ||
28 | Q_UNUSED(engine); | ||
29 | Q_UNUSED(scriptEngine); | ||
30 | |||
31 | return new ColorPalette; | ||
32 | } | ||
33 | |||
34 | void ThemePlugin::registerTypes (const char *uri) | ||
35 | { | ||
36 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); | ||
37 | |||
38 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); | ||
39 | |||
40 | } | ||
diff --git a/framework/theme/themeplugin.h b/framework/theme/themeplugin.h new file mode 100644 index 00000000..d8ae43c1 --- /dev/null +++ b/framework/theme/themeplugin.h | |||
@@ -0,0 +1,31 @@ | |||
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 | #pragma once | ||
20 | |||
21 | #include <QQmlEngine> | ||
22 | #include <QQmlExtensionPlugin> | ||
23 | |||
24 | class ThemePlugin : public QQmlExtensionPlugin | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
28 | |||
29 | public: | ||
30 | virtual void registerTypes(const char *uri); | ||
31 | }; \ No newline at end of file | ||