summaryrefslogtreecommitdiffstats
path: root/framework/theme
diff options
context:
space:
mode:
Diffstat (limited to 'framework/theme')
-rw-r--r--framework/theme/CMakeLists.txt14
-rw-r--r--framework/theme/colorpalette.cpp45
-rw-r--r--framework/theme/colorpalette.h47
-rw-r--r--framework/theme/qmldir3
-rw-r--r--framework/theme/themeplugin.cpp50
-rw-r--r--framework/theme/themeplugin.h31
-rw-r--r--framework/theme/unit.cpp29
-rw-r--r--framework/theme/unit.h38
8 files changed, 257 insertions, 0 deletions
diff --git a/framework/theme/CMakeLists.txt b/framework/theme/CMakeLists.txt
new file mode 100644
index 00000000..319e3d39
--- /dev/null
+++ b/framework/theme/CMakeLists.txt
@@ -0,0 +1,14 @@
1set(themeplugin_SRCS
2 themeplugin.cpp
3 colorpalette.cpp
4 unit.cpp
5)
6
7add_library(themeplugin SHARED ${themeplugin_SRCS})
8
9qt5_use_modules(themeplugin Core Quick Qml)
10
11target_link_libraries(themeplugin)
12
13install(TARGETS themeplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/framework/theme)
14install(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
21ColorPalette::ColorPalette(QObject *parent) : QObject(parent), m_background("#fcfcfc"), m_selected("#3daee9"), m_read("#232629"), m_border("#232629")
22{
23
24}
25
26QString ColorPalette::background() const
27{
28 return m_background;
29}
30
31QString ColorPalette::read() const
32{
33 return m_read;
34}
35
36QString ColorPalette::selected() const
37{
38 return m_selected;
39}
40
41QString 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
22class 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
31public:
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
39signals:
40 void themeChanged();
41
42private:
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 @@
1module org.kube.framework.theme
2
3plugin themeplugin
diff --git a/framework/theme/themeplugin.cpp b/framework/theme/themeplugin.cpp
new file mode 100644
index 00000000..ad9d0e1b
--- /dev/null
+++ b/framework/theme/themeplugin.cpp
@@ -0,0 +1,50 @@
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 <QtQml>
22#include <QQmlEngine>
23
24#include "colorpalette.h"
25#include "unit.h"
26
27static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine)
28{
29 Q_UNUSED(engine);
30 Q_UNUSED(scriptEngine);
31
32 return new ColorPalette;
33}
34
35static QObject *unitInstace(QQmlEngine *engine, QJSEngine *scriptEngine)
36{
37 Q_UNUSED(engine);
38 Q_UNUSED(scriptEngine);
39
40 return new Unit;
41}
42
43void ThemePlugin::registerTypes (const char *uri)
44{
45 Q_ASSERT(uri == QLatin1String("org.kube.framework.theme"));
46
47 qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace);
48 qmlRegisterSingletonType<Unit>(uri, 1, 0, "Unit", unitInstace);
49
50}
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
24class ThemePlugin : public QQmlExtensionPlugin
25{
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28
29public:
30 virtual void registerTypes(const char *uri);
31}; \ No newline at end of file
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
21Unit::Unit(QObject *parent) : QObject(parent), m_size(5)
22{
23
24}
25
26int 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
22class Unit : public QObject
23{
24 Q_OBJECT
25 Q_PROPERTY (int size READ size NOTIFY unitChanged)
26
27
28public:
29 explicit Unit(QObject *parent = Q_NULLPTR);
30
31 int size() const;
32
33signals:
34 void unitChanged();
35
36private:
37 int m_size;
38};