Commit 3858cd52 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen Committed by GitHub

Merge pull request #41 from neochapay/theming

Theming
parents d20c0321 7197e400
...@@ -3,9 +3,13 @@ ...@@ -3,9 +3,13 @@
.directory .directory
*.o *.o
*.so *.so
*.qmlc
moc_* moc_*
qrc_* qrc_*
examples/touch/touch_nemo .qmake.stash
*.spec.*
documentation.list
examples/touch/glacier-components
Makefile Makefile
installroot/ installroot/
RPMS/ RPMS/
\ No newline at end of file
...@@ -83,7 +83,7 @@ Item { ...@@ -83,7 +83,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 20 anchors.rightMargin: 20
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
source: "../images/navigation_next_item.png" source: "/usr/share/glacier-components/images/navigation_next_item.png"
} }
MouseArea { MouseArea {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -54,11 +54,11 @@ Page { ...@@ -54,11 +54,11 @@ Page {
anchors.centerIn: parent anchors.centerIn: parent
Button { Button {
property bool isGlacier: Theme.name == "Glacier" property bool isGlacier: true
anchors.margins: 20 anchors.margins: 20
text: isGlacier ? "Set Ugly Theme" : "Set Nice Theme" text: isGlacier ? "Set Ugly Theme" : "Set Nice Theme"
onClicked: isGlacier ? Theme.loadFromFile("ugly.json") onClicked: isGlacier ? Theme.loadTheme("ugly")
: Theme.loadFromFile("glacier.json") : Theme.loadTheme("glacier")
} }
Button { Button {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -6,13 +6,16 @@ import QtQuick.Controls.Styles.Nemo 1.0 ...@@ -6,13 +6,16 @@ import QtQuick.Controls.Styles.Nemo 1.0
Page { Page {
id: root id: root
headerTools: HeaderToolsLayout { headerTools: HeaderToolsLayout { showBackButton: true; title: "Label" }
showBackButton: true;
title: "Roller"
}
allowedOrientations: Qt.PortraitOrientation | Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation | Qt.InvertedPortraitOrientation allowedOrientations: Qt.PortraitOrientation | Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation | Qt.InvertedPortraitOrientation
Column {
spacing: 40
width: parent.width
anchors{
top: parent.top
topMargin: 40
}
ListModel { ListModel {
id: animalsModel id: animalsModel
...@@ -33,14 +36,9 @@ Page { ...@@ -33,14 +36,9 @@ Page {
ListElement { name: "Whale";} ListElement { name: "Whale";}
} }
GlacierRoller { GlacierRoller {
id: simpleRoller id: simpleRoller
width: parent.width width: parent.width
anchors{
top: parent.top
topMargin: 40
}
clip: true clip: true
model: animalsModel model: animalsModel
...@@ -59,10 +57,6 @@ Page { ...@@ -59,10 +57,6 @@ Page {
GlacierRoller { GlacierRoller {
id: simpleRoller2 id: simpleRoller2
width: parent.width width: parent.width
anchors{
top: simpleRoller.bottom
topMargin: 40
}
clip: true clip: true
model: animalsModel model: animalsModel
...@@ -78,4 +72,5 @@ Page { ...@@ -78,4 +72,5 @@ Page {
} }
} }
} }
}
} }
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -79,7 +79,7 @@ Page { ...@@ -79,7 +79,7 @@ Page {
anchors.fill: parent anchors.fill: parent
border.bottom: size.dp(8) border.bottom: size.dp(8)
border.top: size.dp(8) border.top: size.dp(8)
source: styleData.selected ? "../images/tab_selected.png":"../images/tabs_standard.png" source: styleData.selected ? "/usr/share/glacier-components/images/tab_selected.png":"/usr/share/glacier-components/images/tabs_standard.png"
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
color: "white" color: "white"
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 //needed for the Stack attached property import QtQuick.Controls 1.0 //needed for the Stack attached property
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -71,13 +71,11 @@ Page { ...@@ -71,13 +71,11 @@ Page {
TextField { TextField {
anchors.margins: size.dp(20) anchors.margins: size.dp(20)
text: "Text input" text: "Text input"
//style: touchStyle
} }
TextField { TextField {
anchors.margins: size.dp(20) anchors.margins: size.dp(20)
text: "Readonly Text input" text: "Readonly Text input"
//style: touchStyle
readOnly: true readOnly: true
} }
...@@ -112,7 +110,7 @@ Page { ...@@ -112,7 +110,7 @@ Page {
implicitHeight: size.dp(50) implicitHeight: size.dp(50)
implicitWidth: size.dp(320) implicitWidth: size.dp(320)
BorderImage { BorderImage {
source: "../images/textinput.png" source: "/usr/share/glacier-components/images/textinput.png"
border.left: size.dp(8) border.left: size.dp(8)
border.right: size.dp(8) border.right: size.dp(8)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
......
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Glacier UI Name=Glacier components
Categories=Applications; Categories=Applications;
Exec=env QT_QUICK_CONTROLS_STYLE=Nemo /usr/lib/qt5/examples/touch_nemo Exec=env QT_QUICK_CONTROLS_STYLE=Nemo /usr/bin/glacier-components
Icon=icon-app-components Icon=icon-app-components
X-Desktop-File-Install-Version=0.20 X-Desktop-File-Install-Version=0.20
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -126,9 +126,9 @@ ApplicationWindow { ...@@ -126,9 +126,9 @@ ApplicationWindow {
id: tools id: tools
title: "Nemo Touch Gallery" title: "Nemo Touch Gallery"
tools: [ ToolButton { iconSource: "../images/icon_cog.png"}, tools: [ ToolButton { iconSource: "/usr/share/glacier-components/images/icon_cog.png"},
ToolButton { iconSource: "../images/icon_edit.png"}, ToolButton { iconSource: "/usr/share/glacier-components/images/icon_edit.png"},
ToolButton { iconSource: "../images/icon_refresh.png"} ] ToolButton { iconSource: "/usr/share/glacier-components/images/icon_refresh.png"} ]
//The parent of these items is null when this ToolsLayout is not used //The parent of these items is null when this ToolsLayout is not used
//(i.e. you're on a different page) so we need to check the parent, //(i.e. you're on a different page) so we need to check the parent,
...@@ -176,19 +176,19 @@ ApplicationWindow { ...@@ -176,19 +176,19 @@ ApplicationWindow {
id: tool1 id: tool1
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
iconSource: "../images/icon_cog.png" iconSource: "/usr/share/glacier-components/images/icon_cog.png"
} }
ToolButton { ToolButton {
id: tool2 id: tool2
anchors.right: tool1.left anchors.right: tool1.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
iconSource: "../images/icon_edit.png" iconSource: "/usr/share/glacier-components/images/icon_edit.png"
} }
ToolButton { ToolButton {
id: tool3 id: tool3
anchors.right: tool2.left anchors.right: tool2.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
iconSource: "../images/icon_refresh.png" iconSource: "/usr/share/glacier-components/images/icon_refresh.png"
} }
}, },
ButtonRow { ButtonRow {
...@@ -219,8 +219,8 @@ ApplicationWindow { ...@@ -219,8 +219,8 @@ ApplicationWindow {
model: pageModel model: pageModel
anchors.fill: parent anchors.fill: parent
clip: true clip: true
delegate: AndroidDelegate { delegate: ListViewItemWithActions {
text: title label: title
onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page)) onClicked: pageItem.Stack.view.push(Qt.resolvedUrl(page))
} }
} }
......
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>content/AndroidDelegate.qml</file>
<file>content/ButtonPage.qml</file>
<file>content/ProgressBarPage.qml</file>
<file>content/SliderPage.qml</file>
<file>content/TabBarPage.qml</file>
<file>content/TextInputPage.qml</file>
<file>images/button_default.png</file>
<file>images/button_pressed.png</file>
<file>images/navigation_next_item.png</file>
<file>images/navigation_previous_item.png</file>
<file>images/tab_selected.png</file>
<file>images/tabs_standard.png</file>
<file>images/textinput.png</file>
<file>images/toolbar.png</file>
<file>content/LiveCoding.qml</file>
<file>content/SpinnerPage.qml</file>
<file>content/LabelPage.qml</file>
<file>content/CheckboxPage.qml</file>
<file>content/ButtonRowPage.qml</file>
<file>content/QueryDialogPage.qml</file>
<file>images/dots-vertical.png</file>
<file>images/icon-triangle-left.png</file>
<file>images/icon_cog.png</file>
<file>images/icon_edit.png</file>
<file>images/icon_refresh.png</file>
</qresource>
</RCC>
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2017 Chupligin Sergey neochapay@gmail.com
** Contact: http://www.qt-project.org/legal ** Contact: http://www.qt-project.org/legal
** **
** This file is part of the Qt Quick Controls module of the Qt Toolkit. ** This file is part of the Qt Quick Controls module of the Qt Toolkit.
...@@ -37,6 +38,22 @@ ...@@ -37,6 +38,22 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#include <QtGui/QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuick/QQuickView>
#include "../../shared/qt_quick_controls_examplemain.h" int main(int argc, char *argv[])
QT_QUICK_CONTROLS_EXAMPLE_MAIN(qrc:/main.qml) {
setenv("QT_QUICK_CONTROLS_STYLE", "Nemo", 1);
QGuiApplication app(argc, argv);
QQmlApplicationEngine* engine = new QQmlApplicationEngine(QUrl("/usr/share/glacier-components/main.qml"));
QObject *topLevel = engine->rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
window->setTitle(QObject::tr("Glacier components"));
window->showFullScreen();
return app.exec();
}
SOURCES += \
$$PWD/main.cpp
TEMPLATE = app TEMPLATE = app
QT += qml quick QT += qml quick
TARGET = touch_nemo TARGET = glacier-components
target.path = /usr/lib/qt5/examples target.path = /usr/bin
qtHaveModule(widgets) { qtHaveModule(widgets) {
QT += widgets QT += widgets
} }
include(src/src.pri) mainqml.files = main.qml
mainqml.path = /usr/share/glacier-components
qml.files += \
content/AndroidDelegate.qml \
content/ButtonPage.qml \
content/ProgressBarPage.qml \
content/SliderPage.qml \
content/TabBarPage.qml \
content/TextInputPage.qml \
content/LiveCoding.qml \
content/SpinnerPage.qml \
content/LabelPage.qml \
content/CheckboxPage.qml \
content/ButtonRowPage.qml \
content/QueryDialogPage.qml \
content/ListViewPage.qml \
content/SelectRollerPage.qml
qml.path = /usr/share/glacier-components/content
images.files = images/*.png
images.path = /usr/share/glacier-components/images
OTHER_FILES += \ OTHER_FILES += \
main.qml \ main.qml \
...@@ -22,18 +44,15 @@ OTHER_FILES += \ ...@@ -22,18 +44,15 @@ OTHER_FILES += \
content/LabelPage.qml \ content/LabelPage.qml \
content/CheckboxPage.qml \ content/CheckboxPage.qml \
content/ButtonRowPage.qml \ content/ButtonRowPage.qml \
content/QueryDialogPage.qml content/QueryDialogPage.qml \
content/ListViewPage.qml \
RESOURCES += \ content/SelectRollerPage.qml
resources.qrc
INSTALLS += target
desktop.path = /usr/share/applications desktop.path = /usr/share/applications
desktop.files = glacier-gallery.desktop desktop.files = glacier-gallery.desktop
INSTALLS += desktop
DISTFILES += \ INSTALLS += desktop target qml mainqml images
content/ListViewPage.qml \
content/SelectRollerPage.qml
SOURCES += \
src/main.cpp
Name: qt5-qtquickcontrols-nemo Name: qt5-qtquickcontrols-nemo
Summary: Nemomobile Qt Quick Controls Summary: Nemomobile Qt Quick Controls
Version: 5.2.0 Version: 5.3.0
Release: nemo1 Release: nemo1
Group: Qt/Qt Group: Qt/Qt
License: LGPLv2.1 with exception or GPLv3 License: LGPLv2.1 with exception or GPLv3
...@@ -68,6 +68,7 @@ desktop-file-install --delete-original \ ...@@ -68,6 +68,7 @@ desktop-file-install --delete-original \
%files examples %files examples
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/qt5/examples/touch_nemo %{_bindir}/glacier-components
%{_datadir}/glacier-components
%{_datadir}/applications/*.desktop %{_datadir}/applications/*.desktop
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
...@@ -43,7 +43,7 @@ NemoWindow { ...@@ -43,7 +43,7 @@ NemoWindow {
//is this safe? can there be some situation in which it's neither portrait nor landscape? //is this safe? can there be some situation in which it's neither portrait nor landscape?
readonly property int isUiLandscape: !isUiPortrait readonly property int isUiLandscape: !isUiPortrait
readonly property var _bgColor: Theme.window.background readonly property var _bgColor: Theme.backgroundColor
color: _bgColor color: _bgColor
//README: allowedOrientations' default value is set in NemoWindow's c++ implementation //README: allowedOrientations' default value is set in NemoWindow's c++ implementation
...@@ -226,7 +226,7 @@ NemoWindow { ...@@ -226,7 +226,7 @@ NemoWindow {
property: "x" property: "x"
from: target.width from: target.width
to: 0 to: 0
duration: Theme.pageStack.transitionDuration duration: 500
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAnimation { PropertyAnimation {
...@@ -234,7 +234,7 @@ NemoWindow { ...@@ -234,7 +234,7 @@ NemoWindow {
property: "x" property: "x"
from: 0 from: 0
to: -target.width to: -target.width
duration: Theme.pageStack.transitionDuration duration: 500
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }
...@@ -246,7 +246,7 @@ NemoWindow { ...@@ -246,7 +246,7 @@ NemoWindow {
property: "x" property: "x"
from: -target.width from: -target.width
to: 0 to: 0
duration: Theme.pageStack.transitionDuration duration: 500
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
PropertyAnimation { PropertyAnimation {
...@@ -254,7 +254,7 @@ NemoWindow { ...@@ -254,7 +254,7 @@ NemoWindow {
property: "x" property: "x"
from: 0 from: 0
to: target.width to: target.width
duration: Theme.pageStack.transitionDuration duration: 500
easing.type: Easing.OutQuad easing.type: Easing.OutQuad
} }
} }
...@@ -287,16 +287,16 @@ NemoWindow { ...@@ -287,16 +287,16 @@ NemoWindow {
anchors.right: isUiPortrait ? parent.right : undefined anchors.right: isUiPortrait ? parent.right : undefined
anchors.bottom: isUiPortrait ? undefined : parent.bottom anchors.bottom: isUiPortrait ? undefined : parent.bottom
//we only set the size in one orientation, the anchors will take care of the other //we only set the size in one orientation, the anchors will take care of the other
width: if (!isUiPortrait) Theme.header.dimmer.height width: if (!isUiPortrait) Theme.itemHeightExtraSmall/2
height: if (isUiPortrait) Theme.header.dimmer.height height: if (isUiPortrait) Theme.itemHeightExtraSmall/2
//MAKE SURE THAT THE HEIGHT SPECIFIED BY THE THEME IS AN EVEN NUMBER, TO AVOID ROUNDING ERRORS IN THE LAYOUT //MAKE SURE THAT THE HEIGHT SPECIFIED BY THE THEME IS AN EVEN NUMBER, TO AVOID ROUNDING ERRORS IN THE LAYOUT
Rectangle { Rectangle {
id: headerDimmer id: headerDimmer
anchors.centerIn: parent anchors.centerIn: parent
gradient: Gradient { gradient: Gradient {
GradientStop { position: Theme.header.dimmer.startPosition; color: Theme.header.dimmer.startColor } GradientStop { position: 0; color: Theme.backgroundColor }
GradientStop { position: Theme.header.dimmer.endPosition; color: Theme.header.dimmer.endColor } GradientStop { position: 1; color: "transparent" }
} }
} }
} }
...@@ -324,7 +324,7 @@ NemoWindow { ...@@ -324,7 +324,7 @@ NemoWindow {
} }
PropertyChanges { PropertyChanges {
target: headerDimmer target: headerDimmer
height: Theme.header.dimmer.height height: Theme.itemHeightExtraSmall/2
width: parent.width width: parent.width
rotation: 0 rotation: 0
} }
...@@ -342,7 +342,7 @@ NemoWindow { ...@@ -342,7 +342,7 @@ NemoWindow {
} }
PropertyChanges { PropertyChanges {
target: headerDimmer target: headerDimmer
height: Theme.header.dimmer.height height: Theme.itemHeightExtraSmall/2
width: parent.height width: parent.height
rotation: -90 rotation: -90
} }
...@@ -360,7 +360,7 @@ NemoWindow { ...@@ -360,7 +360,7 @@ NemoWindow {
} }
PropertyChanges { PropertyChanges {
target: headerDimmer target: headerDimmer
height: Theme.header.dimmer.height height: Theme.itemHeightExtraSmall/2
width: parent.width width: parent.width
rotation: 0 rotation: 0
} }
...@@ -378,7 +378,7 @@ NemoWindow { ...@@ -378,7 +378,7 @@ NemoWindow {
} }
PropertyChanges { PropertyChanges {
target: headerDimmer target: headerDimmer
height: Theme.header.dimmer.height height: Theme.itemHeightExtraSmall/2
width: parent.height width: parent.height
rotation: -90 rotation: -90
} }
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
Button { Button {
......
/**************************************************************************************** /****************************************************************************************
** **
** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com> ** Copyright (C) 2014 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** Copyright (C) 2017 Sergey Chupligin <neochapay@gmail.com>
** All rights reserved. ** All rights reserved.
** **
** You may use this file under the terms of BSD license as follows: ** You may use this file under the terms of BSD license as follows:
...@@ -29,14 +30,14 @@ ...@@ -29,14 +30,14 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
Rectangle { Rectangle {
id: main id: main
width: childrenRect.width width: childrenRect.width
color: "#313131" color: Theme.fillDarkColor
height: size.dp(40) height: Theme.itemHeightSmall
property ListModel model: ListModel {} property ListModel model: ListModel {}
property bool enabled: true property bool enabled: true
property int currentIndex: -1 property int currentIndex: -1
...@@ -54,8 +55,8 @@ Rectangle { ...@@ -54,8 +55,8 @@ Rectangle {
y: size.dp(-5) y: size.dp(-5)
width: rowElement.children[main.currentIndex].width || 0 width: rowElement.children[main.currentIndex].width || 0
height: size.dp(50) height: Theme.itemHeightSmall
color: "#0091e5" color: Theme.accentColor
visible: main.currentIndex > -1 visible: main.currentIndex > -1
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
import QtQuick 2.0 import QtQuick 2.6
Item { Item {
id: glacierRoller id: glacierRoller
......
import QtQuick 2.0 import QtQuick 2.6
Rectangle{ Rectangle{
id: glacierRollerItem id: glacierRollerItem
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
...@@ -62,7 +62,7 @@ Item { ...@@ -62,7 +62,7 @@ Item {
PropertyChanges { PropertyChanges {
target: toolBarRect target: toolBarRect
width: parent.width width: parent.width
height: size.dp(75) height: Theme.itemHeightExtraLarge
} }
}, },
State { State {
...@@ -91,7 +91,7 @@ Item { ...@@ -91,7 +91,7 @@ Item {
} }
PropertyChanges { PropertyChanges {
target: toolBarRect target: toolBarRect
width: size.dp(75) width: Theme.itemHeightExtraLarge
height: parent.height height: parent.height
} }
} }
...@@ -149,14 +149,14 @@ Item { ...@@ -149,14 +149,14 @@ Item {
SequentialAnimation { SequentialAnimation {
id: changeToolsLayoutAnim id: changeToolsLayoutAnim
NumberAnimation { id: fadeOut; target: root; property: "opacity"; to: 0; NumberAnimation { id: fadeOut; target: root; property: "opacity"; to: 0;
duration: Theme.pageStack.transitionDuration/2; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 } duration: 250; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }
//headerTools may change now, so we have to close the drawer //headerTools may change now, so we have to close the drawer
ScriptAction { script: closeDrawer() } ScriptAction { script: closeDrawer() }
ScriptAction { script: updateHeaderTools() } ScriptAction { script: updateHeaderTools() }
//tell the (maybe new) layout that we're its container //tell the (maybe new) layout that we're its container
ScriptAction { script: propagateHeaderReference() } ScriptAction { script: propagateHeaderReference() }
NumberAnimation { id: fadeIn; target: root; property: "opacity"; to: 1; NumberAnimation { id: fadeIn; target: root; property: "opacity"; to: 1;
duration: Theme.pageStack.transitionDuration/2; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 } duration: 250; easing.type: Easing.OutQuad; loops: !toolBarLayout ? 0 : 1 }
} }
...@@ -181,7 +181,7 @@ Item { ...@@ -181,7 +181,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
//README: the rest of the anchors/sizes will be set by AnchorChanges! //README: the rest of the anchors/sizes will be set by AnchorChanges!
color: Theme.header.background color: Theme.backgroundColor
FilteringMouseArea { FilteringMouseArea {
id: mouseArea id: mouseArea
...@@ -305,7 +305,7 @@ Item { ...@@ -305,7 +305,7 @@ Item {
Rectangle { Rectangle {
id: drawerContainer id: drawerContainer
color: Theme.header.background color: Theme.backgroundColor
Binding on width { Binding on width {
value: drawer.width value: drawer.width
......
import QtQuick 2.0 import QtQuick 2.6
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
...@@ -26,7 +26,7 @@ Item { ...@@ -26,7 +26,7 @@ Item {
Rectangle { Rectangle {
id: backButton id: backButton
width: opacity ? size.dp(60) : 0 width: opacity ? size.dp(60) : 0
anchors.leftMargin: size.dp(20) anchors.leftMargin: Theme.itemSpacingLarge
//check if Stack.view has already been initialized as well //check if Stack.view has already been initialized as well
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
antialiasing: true antialiasing: true
...@@ -40,28 +40,30 @@ Item { ...@@ -40,28 +40,30 @@ Item {
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
source: "../Styles/Nemo/images/icon-triangle-left.png" source: "/usr/lib/qt5/qml/QtQuick/Controls/Styles/Nemo/images/icon-triangle-left.png"
} }
MouseArea { MouseArea {
id: backmouse id: backmouse
anchors.fill: parent anchors.fill: parent
anchors.margins: size.dp(-10) anchors.margins: -Theme.itemSpacingSmall
onClicked: header && header.stackView && header.stackView.pop() onClicked: header && header.stackView && header.stackView.pop()
} }
} }
Label { Label {
id: titleTxt id: titleTxt
anchors.right: toolButtonsContainer.left anchors{
anchors.left: backButton.visible ? backButton.right : parent.left right: toolButtonsContainer.left
anchors.verticalCenter: parent.verticalCenter left: backButton.visible ? backButton.right : parent.left
anchors.leftMargin: size.dp(20) verticalCenter: parent.verticalCenter
anchors.rightMargin: size.dp(20) leftMargin: Theme.itemSpacingLarge
rightMargin: Theme.itemSpacingLarge
}
clip: true clip: true
font.family: Theme.fontFamily font.family: Theme.fontFamily
color: Theme.label.color color: Theme.textColor
font.pointSize: size.dp(24) font.pointSize: Theme.fontSizeLarge
font.weight: Font.Bold font.weight: Font.Bold
LinearGradient { LinearGradient {
anchors.right: parent.right anchors.right: parent.right
...@@ -71,7 +73,7 @@ Item { ...@@ -71,7 +73,7 @@ Item {
start: Qt.point(0,0) start: Qt.point(0,0)
end: Qt.point(width,0) end: Qt.point(width,0)
gradient: Gradient { GradientStop { position: 0; color: "transparent"} gradient: Gradient { GradientStop { position: 0; color: "transparent"}
GradientStop {position: 0.9; color: Theme.header.background } } GradientStop {position: 0.9; color: Theme.backgroundColor } }
} }
} }
...@@ -106,11 +108,13 @@ Item { ...@@ -106,11 +108,13 @@ Item {
Image { Image {
id: dots id: dots
anchors.right: parent.right anchors{
anchors.rightMargin: size.dp(20) right: parent.right
anchors.verticalCenter: parent.verticalCenter rightMargin: Theme.itemSpacingLarge
verticalCenter: parent.verticalCenter
}
visible: drawerLevels && drawerLevels.length > 1 visible: drawerLevels && drawerLevels.length > 1
source: "../Styles/Nemo/images/dots-vertical.png" source: "/usr/lib/qt5/qml/QtQuick/Controls/Styles/Nemo/images/dots-vertical.png"
rotation: isUiPortrait ? 0 : 90 rotation: isUiPortrait ? 0 : 90
} }
} }
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
Text { Text {
renderType: Text.NativeRendering renderType: Text.NativeRendering
font.family: Theme.fontFamily font.family: Theme.fontFamily
color: Theme.label.color color: Theme.textColor
font.pointSize: size.dp(Theme.label.pointSize) font.pointSize: Theme.fontSizeLarge
} }
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -16,17 +16,17 @@ ListView { ...@@ -16,17 +16,17 @@ ListView {
Rectangle { Rectangle {
width: listView.width width: listView.width
height: size.dp(44) height: size.dp(44)
color: "black" color: Theme.backgroundColor
Text { Text {
id: sectionText id: sectionText
text: section text: section
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
font.pixelSize: size.dp(20) font.pixelSize: Theme.fontSizeMedium
color: "white" color: Theme.textColor
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: size.dp(10) leftMargin: Theme.itemSpacingSmall
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
} }
...@@ -34,11 +34,11 @@ ListView { ...@@ -34,11 +34,11 @@ ListView {
Rectangle{ Rectangle{
id: line id: line
height: 1 height: 1
color: "white" color: Theme.textColor
width: listView.width-sectionText.width-size.dp(30) width: listView.width-sectionText.width-size.dp(30)
anchors{ anchors{
left: sectionText.right left: sectionText.right
leftMargin: size.dp(10) leftMargin: Theme.itemSpacingSmall
verticalCenter: sectionText.verticalCenter verticalCenter: sectionText.verticalCenter
} }
} }
...@@ -59,7 +59,7 @@ ListView { ...@@ -59,7 +59,7 @@ ListView {
end: Qt.point(0, size.dp(30)) end: Qt.point(0, size.dp(30))
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" } GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: "black" } GradientStop { position: 1.0; color: Theme.backgroundColor }
} }
} }
...@@ -68,7 +68,7 @@ ListView { ...@@ -68,7 +68,7 @@ ListView {
Rectangle{ Rectangle{
id: scrollerDecorator id: scrollerDecorator
visible: (listView.showDecorator && listView.contentHeight > listView.height) visible: (listView.showDecorator && listView.contentHeight > listView.height)
color: "#0091e5" color: Theme.accentColor
width: size.dp(5) width: size.dp(5)
height: listView.height*listView.height/listView.contentHeight height: listView.height*listView.height/listView.contentHeight
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
...@@ -6,14 +6,13 @@ import QtGraphicalEffects 1.0 ...@@ -6,14 +6,13 @@ import QtGraphicalEffects 1.0
Item { Item {
id: root id: root
width: parent.width width: parent.width
height: 60 height: size.dp(60)
property string label: "" property string label: ""
property string description: "" property string description: ""
property string subdescription: "" property string subdescription: ""
property string icon: "" property string icon: ""
property string page: ""
property bool showNext: true property bool showNext: true
...@@ -36,7 +35,7 @@ Item { ...@@ -36,7 +35,7 @@ Item {
Rectangle{ Rectangle{
id: actionsArea id: actionsArea
color: "#474747" color: Theme.fillColor
anchors.right: listArea.left anchors.right: listArea.left
...@@ -70,7 +69,7 @@ Item { ...@@ -70,7 +69,7 @@ Item {
width: height width: height
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: size.dp(20) leftMargin: Theme.itemSpacingLarge
top: parent.top top: parent.top
topMargin: size.dp(5) topMargin: size.dp(5)
} }
...@@ -90,14 +89,14 @@ Item { ...@@ -90,14 +89,14 @@ Item {
anchors{ anchors{
left:itemIcon.right left:itemIcon.right
leftMargin: size.dp(20) leftMargin: Theme.itemSpacingLarge
verticalCenter: itemIcon.verticalCenter verticalCenter: itemIcon.verticalCenter
} }
color: "transparent" color: "transparent"
Text { Text {
id: labelItem id: labelItem
color: "#ffffff" color: Theme.textColor
text: label text: label
anchors{ anchors{
left: parent.left left: parent.left
...@@ -109,28 +108,28 @@ Item { ...@@ -109,28 +108,28 @@ Item {
Text{ Text{
id: descriptionItem id: descriptionItem
color: "#ffffff" color: Theme.textColor
text: description text: description
anchors{ anchors{
left: parent.left left: parent.left
right: parent.right right: parent.right
top: labelItem.bottom top: labelItem.bottom
} }
font.pixelSize: size.dp(18) font.pixelSize: Theme.fontSizeSmall
clip: true clip: true
visible: description != "" visible: description != ""
} }
Text{ Text{
id: subDescriptionItem id: subDescriptionItem
color: "#ffffff" color: Theme.textColor
text: subdescription text: subdescription
anchors{ anchors{
left: parent.left left: parent.left
right: parent.right right: parent.right
top: descriptionItem.bottom top: descriptionItem.bottom
} }
font.pixelSize: size.dp(18) font.pixelSize: Theme.fontSizeSmall
clip: true clip: true
visible: subdescription != "" visible: subdescription != ""
} }
...@@ -162,7 +161,7 @@ Item { ...@@ -162,7 +161,7 @@ Item {
anchors{ anchors{
right: parent.right right: parent.right
rightMargin: size.dp(20) rightMargin: Theme.itemSpacingLarge
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 // Needed for things like Stack attached properties import QtQuick.Controls 1.0 // Needed for things like Stack attached properties
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -70,7 +70,7 @@ NemoPage { ...@@ -70,7 +70,7 @@ NemoPage {
Rectangle { Rectangle {
id: background id: background
anchors.fill: parent anchors.fill: parent
color: Theme.page.background color: Theme.backgroundColor
} }
Item { Item {
......
import QtQuick 2.0 import QtQuick 2.6
Rectangle { Rectangle {
id: shell id: shell
anchors.fill: parent anchors.fill: parent
opacity: 0.7 opacity: 0.7
color: "black" color: Theme.backgroundColor
signal accepted() signal accepted()
signal canceled() signal canceled()
property alias cancelText: cancel.text property alias cancelText: cancel.text
......
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
Item { Item {
id: container id: container
...@@ -49,7 +49,7 @@ Item { ...@@ -49,7 +49,7 @@ Item {
targets: [circle0, circle1, circle2, circle3] targets: [circle0, circle1, circle2, circle3]
property: "opacity" property: "opacity"
to: 1 to: 1
duration: Theme.spinner.initialStateDuration duration: 1500
} }
PropertyAction { target: animations; property: "running"; value: true } PropertyAction { target: animations; property: "running"; value: true }
} }
...@@ -63,14 +63,14 @@ Item { ...@@ -63,14 +63,14 @@ Item {
PropertyAnimation { PropertyAnimation {
targets: [circle0, circle1, circle2, circle3] targets: [circle0, circle1, circle2, circle3]
property: "color"; property: "color";
to: Theme.spinner.primaryColor to: Theme.backgroundAccentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
NumberAnimation { NumberAnimation {
targets: [circle0, circle1, circle2, circle3] targets: [circle0, circle1, circle2, circle3]
property: "opacity" property: "opacity"
to: 0 to: 0
duration: Theme.spinner.initialStateDuration duration: 1500
} }
} }
} }
...@@ -84,8 +84,8 @@ Item { ...@@ -84,8 +84,8 @@ Item {
Item { Item {
id: innerRect id: innerRect
anchors.centerIn: parent anchors.centerIn: parent
width: Theme.spinner.radius + Theme.spinner.horizontalSpacing width: Theme.itemHeightExtraSmall + Theme.itemSpacingMedium
height: Theme.spinner.radius + Theme.spinner.verticalSpacing height: Theme.itemHeightExtraSmall + Theme.itemSpacingMedium
} }
Rectangle { Rectangle {
...@@ -93,10 +93,10 @@ Item { ...@@ -93,10 +93,10 @@ Item {
opacity: 0 opacity: 0
anchors.horizontalCenter: innerRect.left anchors.horizontalCenter: innerRect.left
anchors.verticalCenter: innerRect.top anchors.verticalCenter: innerRect.top
width: Theme.spinner.radius width: Theme.itemHeightExtraSmall
height: Theme.spinner.radius height: Theme.itemHeightExtraSmall
radius: Theme.spinner.radius / 2 radius: Theme.itemHeightExtraSmall / 2
color: Theme.spinner.primaryColor color: Theme.backgroundAccentColor
} }
Rectangle { Rectangle {
...@@ -104,10 +104,10 @@ Item { ...@@ -104,10 +104,10 @@ Item {
opacity: 0 opacity: 0
anchors.horizontalCenter: innerRect.right anchors.horizontalCenter: innerRect.right
anchors.verticalCenter: innerRect.top anchors.verticalCenter: innerRect.top
width: Theme.spinner.radius width: Theme.itemHeightExtraSmall
height: Theme.spinner.radius height: Theme.itemHeightExtraSmall
radius: Theme.spinner.radius / 2 radius: Theme.itemHeightExtraSmall / 2
color: Theme.spinner.primaryColor color: Theme.backgroundAccentColor
} }
Rectangle { Rectangle {
...@@ -115,10 +115,10 @@ Item { ...@@ -115,10 +115,10 @@ Item {
opacity: 0 opacity: 0
anchors.horizontalCenter: innerRect.right anchors.horizontalCenter: innerRect.right
anchors.verticalCenter: innerRect.bottom anchors.verticalCenter: innerRect.bottom
width: Theme.spinner.radius width: Theme.itemHeightExtraSmall
height: Theme.spinner.radius height: Theme.itemHeightExtraSmall
radius: Theme.spinner.radius / 2 radius: Theme.itemHeightExtraSmall / 2
color: Theme.spinner.primaryColor color: Theme.backgroundAccentColor
} }
Rectangle { Rectangle {
...@@ -126,10 +126,10 @@ Item { ...@@ -126,10 +126,10 @@ Item {
opacity: 0 opacity: 0
anchors.horizontalCenter: innerRect.left anchors.horizontalCenter: innerRect.left
anchors.verticalCenter: innerRect.bottom anchors.verticalCenter: innerRect.bottom
width: Theme.spinner.radius width: Theme.itemHeightExtraSmall
height: Theme.spinner.radius height: Theme.itemHeightExtraSmall
radius: Theme.spinner.radius / 2 radius: Theme.itemHeightExtraSmall / 2
color: Theme.spinner.primaryColor color: Theme.backgroundAccentColor
} }
SequentialAnimation { SequentialAnimation {
...@@ -139,14 +139,14 @@ Item { ...@@ -139,14 +139,14 @@ Item {
PropertyAnimation { PropertyAnimation {
target: circle0 target: circle0
property: "color" property: "color"
to: Theme.spinner.secondaryColor to: Theme.accentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
PropertyAnimation { PropertyAnimation {
target: circle3 target: circle3
property: "color" property: "color"
to: Theme.spinner.primaryColor to: Theme.backgroundAccentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
} }
...@@ -154,14 +154,14 @@ Item { ...@@ -154,14 +154,14 @@ Item {
PropertyAnimation { PropertyAnimation {
target: circle1 target: circle1
property: "color" property: "color"
to: Theme.spinner.secondaryColor to: Theme.accentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
PropertyAnimation { PropertyAnimation {
target: circle0 target: circle0
property: "color" property: "color"
to: Theme.spinner.primaryColor to: Theme.backgroundAccentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
} }
...@@ -169,14 +169,14 @@ Item { ...@@ -169,14 +169,14 @@ Item {
PropertyAnimation { PropertyAnimation {
target: circle2 target: circle2
property: "color" property: "color"
to: Theme.spinner.secondaryColor to: Theme.accentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
PropertyAnimation { PropertyAnimation {
target: circle1 target: circle1
property: "color" property: "color"
to: Theme.spinner.primaryColor to: Theme.backgroundAccentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
} }
...@@ -184,14 +184,14 @@ Item { ...@@ -184,14 +184,14 @@ Item {
PropertyAnimation { PropertyAnimation {
target: circle3 target: circle3
property: "color" property: "color"
to: Theme.spinner.secondaryColor to: Theme.accentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
PropertyAnimation { PropertyAnimation {
target: circle2 target: circle2
property: "color" property: "color"
to: Theme.spinner.primaryColor to: Theme.backgroundAccentColor
duration: Theme.spinner.transitionDuration duration: 500
} }
} }
} }
......
...@@ -35,7 +35,8 @@ HEADERS += \ ...@@ -35,7 +35,8 @@ HEADERS += \
nemoimageprovider.h \ nemoimageprovider.h \
themedaemon/mlocalthemedaemonclient.h \ themedaemon/mlocalthemedaemonclient.h \
themedaemon/mabstractthemedaemonclient.h \ themedaemon/mabstractthemedaemonclient.h \
sizing.h sizing.h \
theme.h
SOURCES += \ SOURCES += \
qquicknemocontrolsextensionplugin.cpp \ qquicknemocontrolsextensionplugin.cpp \
...@@ -46,13 +47,15 @@ SOURCES += \ ...@@ -46,13 +47,15 @@ SOURCES += \
nemoimageprovider.cpp \ nemoimageprovider.cpp \
themedaemon/mlocalthemedaemonclient.cpp \ themedaemon/mlocalthemedaemonclient.cpp \
themedaemon/mabstractthemedaemonclient.cpp \ themedaemon/mabstractthemedaemonclient.cpp \
sizing.cpp sizing.cpp \
theme.cpp
target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
qmlfiles.files = $$_PRO_FILE_PWD_/*.qml qmlfiles.files = $$_PRO_FILE_PWD_/*.qml
qmlfiles.files += $$_PRO_FILE_PWD_/qmldir qmlfiles.files += $$_PRO_FILE_PWD_/qmldir
qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH qmlfiles.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
images.files = $$_PRO_FILE_PWD_/images images.files = $$_PRO_FILE_PWD_/images
images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "qquickfilteringmousearea.h" #include "qquickfilteringmousearea.h"
#include "nemoimageprovider.h" #include "nemoimageprovider.h"
#include "sizing.h" #include "sizing.h"
#include "theme.h"
QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) : QQuickNemoControlsExtensionPlugin::QQuickNemoControlsExtensionPlugin(QObject *parent) :
QQmlExtensionPlugin(parent) QQmlExtensionPlugin(parent)
...@@ -50,10 +51,12 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri) ...@@ -50,10 +51,12 @@ void QQuickNemoControlsExtensionPlugin::registerTypes(const char *uri)
void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri) void QQuickNemoControlsExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{ {
Sizing *sizing = new Sizing(); Sizing *sizing = new Sizing();
Theme *theme = new Theme();
QQmlExtensionPlugin::initializeEngine(engine,uri); QQmlExtensionPlugin::initializeEngine(engine,uri);
QQmlContext* context = engine->rootContext(); QQmlContext* context = engine->rootContext();
context->setContextProperty("size",sizing); context->setContextProperty("size",sizing);
context->setContextProperty("Theme",theme);
engine->addImageProvider(QLatin1String("theme"), new NemoImageProvider); engine->addImageProvider(QLatin1String("theme"), new NemoImageProvider);
} }
......
...@@ -29,13 +29,13 @@ Sizing::Sizing(QObject *parent) : QObject(parent) ...@@ -29,13 +29,13 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
}else if(m_dpi >= 140 && m_dpi < 200){ }else if(m_dpi >= 140 && m_dpi < 200){
//~160dpi //~160dpi
m_densitie = mdpi; m_densitie = mdpi;
}else if(m_dpi >= 200 && m_dpi < 280){ }else if(m_dpi >= 200 && m_dpi < 300){
//~240dpi //~240dpi
m_densitie = hdpi; m_densitie = hdpi;
}else if(m_dpi >= 280 && m_dpi < 400){ }else if(m_dpi >= 300 && m_dpi < 420){
//~320dpi //~320dpi
m_densitie = xhdpi; m_densitie = xhdpi;
}else if(m_dpi >= 400 && m_dpi < 560){ }else if(m_dpi >= 420 && m_dpi < 560){
//~480dpi //~480dpi
m_densitie = xxhdpi; m_densitie = xxhdpi;
}else{ }else{
...@@ -45,7 +45,6 @@ Sizing::Sizing(QObject *parent) : QObject(parent) ...@@ -45,7 +45,6 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
if(m_p_height > 0 && m_p_width >0){ if(m_p_height > 0 && m_p_width >0){
m_valid = true; m_valid = true;
setMmScaleFactor(); setMmScaleFactor();
setDpScaleFactor();
}else{ }else{
if(m_p_height == 0){ if(m_p_height == 0){
qWarning("QT_QPA_EGLFS_PHYSICAL_HEIGHT is not set!"); qWarning("QT_QPA_EGLFS_PHYSICAL_HEIGHT is not set!");
...@@ -56,6 +55,7 @@ Sizing::Sizing(QObject *parent) : QObject(parent) ...@@ -56,6 +55,7 @@ Sizing::Sizing(QObject *parent) : QObject(parent)
} }
qWarning("Device mm sizing don`t work"); qWarning("Device mm sizing don`t work");
} }
setDpScaleFactor();
} }
void Sizing::setMmScaleFactor() void Sizing::setMmScaleFactor()
...@@ -80,7 +80,7 @@ void Sizing::setDpScaleFactor() ...@@ -80,7 +80,7 @@ void Sizing::setDpScaleFactor()
m_dp_factor = 1; m_dp_factor = 1;
break; break;
case xhdpi: case xhdpi:
m_dp_factor = 1.3; m_dp_factor = 1.5;
break; break;
case xxhdpi: case xxhdpi:
m_dp_factor = 2; m_dp_factor = 2;
...@@ -89,7 +89,7 @@ void Sizing::setDpScaleFactor() ...@@ -89,7 +89,7 @@ void Sizing::setDpScaleFactor()
m_dp_factor = 2.5; m_dp_factor = 2.5;
break; break;
default: default:
m_dp_factor = 1.3; m_dp_factor = 1.5;
break; break;
} }
......
#include "theme.h"
#include "sizing.h"
#include <QFile>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonObject>
Theme::Theme(QObject *parent) : QObject(parent)
{
Sizing *size = new Sizing;
m_dp = size->getDpScaleFactor();
//Load defaults
m_itemWidthLarge = 320*m_dp;
m_itemWidthMedium = 240*m_dp;
m_itemWidthSmall = 120*m_dp;
m_itemWidthExtraSmall = 72*m_dp;
m_itemHeightHuge = 80*m_dp;
m_itemHeightExtraLarge = 75*m_dp;
m_itemHeightLarge = 63*m_dp;
m_itemHeightMedium = 50*m_dp;
m_itemHeightSmall = 40*m_dp;
m_itemHeightExtraSmall = 32*m_dp;
m_itemSpacingHuge = 40*m_dp;
m_itemSpacingLarge = 20*m_dp;
m_itemSpacingMedium = 15*m_dp;
m_itemSpacingSmall = 10*m_dp;
m_itemSpacingExtraSmall = 8*m_dp;
m_fontSizeExtraLarge = 30*m_dp;
m_fontSizeLarge = 24*m_dp;
m_fontSizeMedium = 20*m_dp;
m_fontSizeSmall = 18*m_dp;
m_fontSizeTiny = 16*m_dp;
m_fontWeightLarge = 63*m_dp;
m_fontWeightMedium = 25*m_dp;
m_fontFamily = "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf";
m_accentColor = "#0091e5";
m_fillColor = "#474747";
m_fillDarkColor = "#313131";
m_textColor = "#ffffff";
m_backgroundColor = "#000000";
m_backgroundAccentColor = "#ffffff";
}
bool Theme::loadTheme(QString fileName)
{
QString themeJsonString;
bool updated = false;
QFile themeFile;
themeFile.setFileName(fileName);
if(!themeFile.exists())
{
qDebug() << "Theme file " << fileName << " not found";
return false;
}
themeFile.open(QIODevice::ReadOnly | QIODevice::Text);
themeJsonString = themeFile.readAll();
themeFile.close();
QJsonDocument t = QJsonDocument::fromJson(themeJsonString.toUtf8());
QJsonObject theme = t.object();
if(theme.value("itemWidthLarge").toString().toFloat() != 0 &&
theme.value("itemWidthLarge").toString().toFloat() != m_itemWidthLarge)
{
m_itemWidthLarge = theme.value("itemWidthLarge").toString().toFloat()*m_dp;
emit itemWidthLargeChanged();
updated = true;
}
if(theme.value("itemWidthMedium").toString().toFloat() != 0 &&
theme.value("itemWidthMedium").toString().toFloat() != m_itemWidthMedium)
{
m_itemWidthMedium = theme.value("itemWidthMedium").toString().toFloat()*m_dp;
emit itemWidthMediumChanged();
updated = true;
}
if(theme.value("itemWidthSmall").toString().toFloat() != 0 &&
theme.value("itemWidthSmall").toString().toFloat() != m_itemWidthSmall)
{
m_itemWidthSmall = theme.value("itemWidthSmall").toString().toFloat()*m_dp;
emit itemWidthSmallChanged();
updated = true;
}
if(theme.value("itemWidthExtraSmall").toString().toFloat() != 0 &&
theme.value("itemWidthExtraSmall").toString().toFloat() != m_itemWidthExtraSmall)
{
m_itemWidthExtraSmall = theme.value("itemWidthExtraSmall").toString().toFloat()*m_dp;
emit itemWidthExtraSmallChanged();
updated = true;
}
if(theme.value("itemHeightHuge").toString().toFloat() != 0 &&
theme.value("itemHeightHuge").toString().toFloat() != m_itemHeightHuge)
{
m_itemHeightHuge = theme.value("itemHeightHuge").toString().toFloat()*m_dp;
emit itemHeightHugeChanged();
updated = true;
}
if(theme.value("itemHeightExtraLarge").toString().toFloat() != 0 &&
theme.value("itemHeightExtraLarge").toString().toFloat() != m_itemHeightExtraLarge)
{
m_itemHeightExtraLarge = theme.value("itemHeightExtraLarge").toString().toFloat()*m_dp;
emit itemHeightExtraLargeChanged();
updated = true;
}
if(theme.value("itemHeightLarge").toString().toFloat() != 0 &&
theme.value("itemHeightLarge").toString().toFloat() != m_itemHeightLarge)
{
m_itemHeightLarge = theme.value("itemHeightLarge").toString().toFloat()*m_dp;
emit itemHeightLargeChanged();
updated = true;
}
if(theme.value("itemHeightMedium").toString().toFloat() != 0 &&
theme.value("itemHeightMedium").toString().toFloat() != m_itemHeightMedium)
{
m_itemHeightMedium = theme.value("itemHeightMedium").toString().toFloat()*m_dp;
emit itemHeightMediumChanged();
updated = true;
}
if(theme.value("itemHeightSmall").toString().toFloat() != 0 &&
theme.value("itemHeightSmall").toString().toFloat() != m_itemHeightSmall)
{
m_itemHeightSmall = theme.value("itemHeightSmall").toString().toFloat()*m_dp;
emit itemHeightSmallChanged();
updated = true;
}
if(theme.value("itemHeightExtraSmall").toString().toFloat() != 0 &&
theme.value("itemHeightExtraSmall").toString().toFloat() != m_itemHeightExtraSmall)
{
m_itemHeightExtraSmall = theme.value("itemHeightExtraSmall").toString().toFloat()*m_dp;
emit itemHeightExtraSmallChanged();
updated = true;
}
if(theme.value("itemSpacingHuge").toString().toFloat() != 0 &&
theme.value("itemSpacingHuge").toString().toFloat() != m_itemSpacingHuge)
{
m_itemSpacingHuge = theme.value("itemSpacingHuge").toString().toFloat()*m_dp;
emit itemSpacingHugeChanged();
updated = true;
}
if(theme.value("itemSpacingLarge").toString().toFloat() != 0 &&
theme.value("itemSpacingLarge").toString().toFloat() != m_itemSpacingLarge)
{
m_itemSpacingLarge = theme.value("itemSpacingLarge").toString().toFloat()*m_dp;
emit itemSpacingLargeChanged();
updated = true;
}
if(theme.value("itemSpacingMedium").toString().toFloat() != 0 &&
theme.value("itemSpacingMedium").toString().toFloat() != m_itemSpacingMedium)
{
m_itemSpacingMedium = theme.value("itemSpacingMedium").toString().toFloat()*m_dp;
emit itemSpacingMediumChanged();
updated = true;
}
if(theme.value("itemSpacingSmall").toString().toFloat() != 0 &&
theme.value("itemSpacingSmall").toString().toFloat() != m_itemSpacingSmall)
{
m_itemSpacingSmall = theme.value("itemSpacingSmall").toString().toFloat()*m_dp;
emit itemSpacingSmallChanged();
updated = true;
}
if(theme.value("itemSpacingExtraSmall").toString().toFloat() != 0 &&
theme.value("itemSpacingExtraSmall").toString().toFloat() != m_itemSpacingExtraSmall)
{
m_itemSpacingExtraSmall = theme.value("itemSpacingExtraSmall").toString().toFloat()*m_dp;
emit itemSpacingExtraSmallChanged();
updated = true;
}
if(theme.value("fontSizeExtraLarge").toInt() != 0 &&
theme.value("fontSizeExtraLarge").toInt() != m_fontSizeExtraLarge)
{
m_fontSizeExtraLarge = theme.value("itemSpacingExtraSmall").toInt()*m_dp;
emit fontSizeExtraLargeChanged();
updated = true;
}
if(theme.value("fontSizeLarge").toInt() != 0 &&
theme.value("fontSizeLarge").toInt() != m_fontSizeLarge)
{
m_fontSizeLarge = theme.value("fontSizeLarge").toInt()*m_dp;
emit fontSizeLargeChanged();
updated = true;
}
if(theme.value("fontSizeMedium").toInt() != 0 &&
theme.value("fontSizeMedium").toInt() != m_fontSizeMedium)
{
m_fontSizeMedium = theme.value("fontSizeMedium").toInt()*m_dp;
emit fontSizeMediumChanged();
updated = true;
}
if(theme.value("fontSizeSmall").toInt() != 0 &&
theme.value("fontSizeSmall").toInt() != m_fontSizeSmall)
{
m_fontSizeSmall = theme.value("fontSizeSmall").toInt()*m_dp;
emit fontSizeSmallChanged();
updated = true;
}
if(theme.value("fontSizeTiny").toInt() != 0 &&
theme.value("fontSizeTiny").toInt() != m_fontSizeTiny)
{
m_fontSizeTiny = theme.value("fontSizeTiny").toInt()*m_dp;
emit fontSizeTinyChanged();
updated = true;
}
if(theme.value("fontWeightLarge").toInt() != 0 &&
theme.value("fontWeightLarge").toInt() != m_fontWeightLarge)
{
m_fontWeightLarge = theme.value("fontWeightLarge").toInt()*m_dp;
emit fontWeightLargeChanged();
updated = true;
}
if(theme.value("fontWeightMedium").toInt() != 0 &&
theme.value("fontWeightMedium").toInt() != m_fontWeightMedium)
{
m_fontWeightMedium = theme.value("fontWeightMedium").toInt()*m_dp;
emit fontWeightMediumChanged();
updated = true;
}
if(theme.value("fontFamily").toString() != "" &&
theme.value("fontFamily").toString() != m_fontFamily)
{
QFile fontFile;
fontFile.setFileName(theme.value("fontFamily").toString());
if(!themeFile.exists())
{
qDebug() << "Font file " << fileName << " not found";
}
else
{
m_fontFamily = theme.value("fontFamily").toString();
emit fontFamilyChanged();
updated = true;
}
}
if(theme.value("accentColor").toString() != "" &&
theme.value("accentColor").toString()!= m_accentColor)
{
m_accentColor = theme.value("accentColor").toString();
emit accentColorChanged();
updated = true;
}
if(theme.value("fillColor").toString() != "" &&
theme.value("fillColor").toString() != m_fillColor)
{
m_fillColor = theme.value("fillColor").toString();
emit fillColorChanged();
updated = true;
}
if(theme.value("fillDarkColor").toString() != "" &&
theme.value("fillDarkColor").toString() != m_fillDarkColor)
{
m_fillDarkColor = theme.value("fillDarkColor").toString();
emit fillDarkColorChanged();
updated = true;
}
if(theme.value("textColor").toString() != "" &&
theme.value("textColor").toString() != m_textColor)
{
m_textColor = theme.value("textColor").toString();
emit textColorChanged();
updated = true;
}
if(theme.value("backgroundColor").toString() != "" &&
theme.value("backgroundColor").toString() != m_backgroundColor)
{
m_backgroundColor = theme.value("backgroundColor").toString();
emit backgroundColorChanged();
updated = true;
}
if(theme.value("backgroundAccentColor").toString() != "" &&
theme.value("backgroundAccentColor").toString() != m_backgroundAccentColor)
{
m_backgroundAccentColor = theme.value("backgroundAccentColor").toString();
emit backgroundAccentColorChanged();
updated = true;
}
if(updated)
{
emit themeUpdate();
return true;
}
return false;
}
#ifndef THEME_He5
#define THEME_H
#include <QObject>
class Theme : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal itemWidthLarge READ itemWidthLarge NOTIFY itemWidthLargeChanged)
Q_PROPERTY(qreal itemWidthMedium READ itemWidthMedium NOTIFY itemWidthMediumChanged)
Q_PROPERTY(qreal itemWidthSmall READ itemWidthSmall NOTIFY itemWidthSmallChanged)
Q_PROPERTY(qreal itemWidthExtraSmall READ itemWidthExtraSmall NOTIFY itemWidthExtraSmallChanged)
Q_PROPERTY(qreal itemHeightHuge READ itemHeightHuge NOTIFY itemHeightHugeChanged)
Q_PROPERTY(qreal itemHeightExtraLarge READ itemHeightExtraLarge NOTIFY itemHeightExtraLargeChanged)
Q_PROPERTY(qreal itemHeightLarge READ itemHeightLarge NOTIFY itemHeightLargeChanged)
Q_PROPERTY(qreal itemHeightMedium READ itemHeightMedium NOTIFY itemHeightMediumChanged)
Q_PROPERTY(qreal itemHeightSmall READ itemHeightSmall NOTIFY itemHeightSmallChanged)
Q_PROPERTY(qreal itemHeightExtraSmall READ itemHeightExtraSmall NOTIFY itemHeightExtraSmallChanged)
Q_PROPERTY(qreal itemSpacingHuge READ itemSpacingHuge NOTIFY itemSpacingHugeChanged)
Q_PROPERTY(qreal itemSpacingLarge READ itemSpacingLarge NOTIFY itemSpacingLargeChanged)
Q_PROPERTY(qreal itemSpacingMedium READ itemSpacingMedium NOTIFY itemSpacingMediumChanged)
Q_PROPERTY(qreal itemSpacingSmall READ itemSpacingSmall NOTIFY itemSpacingSmallChanged)
Q_PROPERTY(qreal itemSpacingExtraSmall READ itemSpacingExtraSmall NOTIFY itemSpacingExtraSmallChanged)
Q_PROPERTY(int fontSizeExtraLarge READ fontSizeExtraLarge NOTIFY fontSizeExtraLargeChanged)
Q_PROPERTY(int fontSizeLarge READ fontSizeLarge NOTIFY fontSizeLargeChanged)
Q_PROPERTY(int fontSizeMedium READ fontSizeMedium NOTIFY fontSizeMediumChanged)
Q_PROPERTY(int fontSizeSmall READ fontSizeSmall NOTIFY fontSizeSmallChanged)
Q_PROPERTY(int fontSizeTiny READ fontSizeTiny NOTIFY fontSizeTinyChanged)
Q_PROPERTY(int fontWeightLarge READ fontWeightLarge NOTIFY fontWeightLargeChanged)
Q_PROPERTY(int fontWeightMedium READ fontWeightMedium NOTIFY fontWeightMediumChanged)
Q_PROPERTY(QString fontFamily READ fontFamily NOTIFY fontFamilyChanged)
Q_PROPERTY(QString accentColor READ accentColor NOTIFY accentColorChanged)
Q_PROPERTY(QString fillColor READ fillColor NOTIFY fillColorChanged)
Q_PROPERTY(QString fillDarkColor READ fillDarkColor NOTIFY fillDarkColorChanged)
Q_PROPERTY(QString textColor READ textColor NOTIFY textColorChanged)
Q_PROPERTY(QString backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QString backgroundAccentColor READ backgroundAccentColor NOTIFY backgroundAccentColorChanged)
public:
explicit Theme(QObject *parent = 0);
bool loadTheme(QString fileName);
qreal itemWidthLarge(){return m_itemWidthLarge;}
qreal itemWidthMedium(){return m_itemWidthMedium;}
qreal itemWidthSmall(){return m_itemWidthSmall;}
qreal itemWidthExtraSmall(){return m_itemWidthExtraSmall;}
qreal itemHeightHuge(){return m_itemHeightHuge;}
qreal itemHeightExtraLarge(){return m_itemHeightExtraLarge;}
qreal itemHeightLarge(){return m_itemHeightLarge;}
qreal itemHeightMedium(){return m_itemHeightMedium;}
qreal itemHeightSmall(){return m_itemHeightSmall;}
qreal itemHeightExtraSmall(){return m_itemHeightExtraSmall;}
qreal itemSpacingHuge(){return m_itemSpacingHuge;}
qreal itemSpacingLarge(){return m_itemSpacingLarge;}
qreal itemSpacingMedium(){return m_itemSpacingMedium;}
qreal itemSpacingSmall(){return m_itemSpacingSmall;}
qreal itemSpacingExtraSmall(){return m_itemSpacingExtraSmall;}
int fontSizeExtraLarge(){return m_fontSizeExtraLarge;}
int fontSizeLarge(){return m_fontSizeLarge;}
int fontSizeMedium(){return m_fontSizeMedium;}
int fontSizeSmall(){return m_fontSizeSmall;}
int fontSizeTiny(){return m_fontSizeTiny;}
int fontWeightLarge(){return m_fontWeightLarge;}
int fontWeightMedium(){return m_fontWeightMedium;}
QString fontFamily(){return m_fontFamily;}
QString accentColor(){return m_accentColor;}
QString fillColor(){return m_fillColor;}
QString fillDarkColor(){return m_fillDarkColor;}
QString textColor(){return m_textColor;}
QString backgroundColor(){return m_backgroundColor;}
QString backgroundAccentColor(){return m_backgroundAccentColor;}
signals:
void themeUpdate();
void itemWidthLargeChanged();
void itemWidthMediumChanged();
void itemWidthSmallChanged();
void itemWidthExtraSmallChanged();
void itemHeightHugeChanged();
void itemHeightExtraLargeChanged();
void itemHeightLargeChanged();
void itemHeightMediumChanged();
void itemHeightSmallChanged();
void itemHeightExtraSmallChanged();
void itemSpacingHugeChanged();
void itemSpacingLargeChanged();
void itemSpacingMediumChanged();
void itemSpacingSmallChanged();
void itemSpacingExtraSmallChanged();
void fontSizeExtraLargeChanged();
void fontSizeLargeChanged();
void fontSizeMediumChanged();
void fontSizeSmallChanged();
void fontSizeTinyChanged();
void fontWeightLargeChanged();
void fontWeightMediumChanged();
void fontFamilyChanged();
void accentColorChanged();
void fillColorChanged();
void fillDarkColorChanged();
void textColorChanged();
void backgroundColorChanged();
void backgroundAccentColorChanged();
public slots:
private:
qreal m_itemWidthLarge; //320
qreal m_itemWidthMedium; //240
qreal m_itemWidthSmall; //120
qreal m_itemWidthExtraSmall; //72
qreal m_itemHeightHuge; //80
qreal m_itemHeightExtraLarge; //75
qreal m_itemHeightLarge; //63
qreal m_itemHeightMedium; //50
qreal m_itemHeightSmall; //40
qreal m_itemHeightExtraSmall; //32
qreal m_itemSpacingHuge; //40
qreal m_itemSpacingLarge; //20
qreal m_itemSpacingMedium; //15
qreal m_itemSpacingSmall; //10
qreal m_itemSpacingExtraSmall; //8
int m_fontSizeExtraLarge; //30
int m_fontSizeLarge; //24
int m_fontSizeMedium; //20
int m_fontSizeSmall; //18
int m_fontSizeTiny; //16
int m_fontWeightLarge; //63
int m_fontWeightMedium; //25
QString m_fontFamily; //???
QString m_accentColor; //#0091e5
QString m_fillColor; //#474747
QString m_fillDarkColor; //#313131
QString m_textColor; //#ffffff
QString m_backgroundColor; //#000000
QString m_backgroundAccentColor; //#ffffff
qreal m_dp;
};
#endif // THEME_H
...@@ -17,24 +17,23 @@ ...@@ -17,24 +17,23 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
//Styles.Nemo provides Theme import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
ButtonStyle { ButtonStyle {
id: buttonstyle id: buttonstyle
// The background of the button. // The background of the button.
background: Rectangle { background: Rectangle {
implicitWidth: size.dp(240) implicitWidth: Theme.itemWidthMedium
implicitHeight: size.dp(50) implicitHeight: Theme.itemHeightMedium
clip: true clip: true
color: control.primary ? Theme.primaryButton.background color: control.primary ? Theme.accentColor
: Theme.button.background : Theme.fillColor
Image { Image {
id: disabledImg id: disabledImg
anchors.fill: parent anchors.fill: parent
...@@ -47,20 +46,20 @@ ButtonStyle { ...@@ -47,20 +46,20 @@ ButtonStyle {
RadialGradient { RadialGradient {
x: control.pressX - width/2 x: control.pressX - width/2
y: control.pressY - height/2 y: control.pressY - height/2
width: Theme.button.pressedGradient.width width: Theme.itemWidthMedium
height: Theme.button.pressedGradient.height height: width
visible: control.pressed visible: control.pressed
gradient: Gradient { gradient: Gradient {
GradientStop { GradientStop {
position: Theme.button.pressedGradient.center; position: 0.29
color: control.primary ? Theme.primaryButton.pressedGradient.centerColor color: control.primary ? Theme.backgroundAccentColor
: Theme.button.pressedGradient.centerColor : Theme.accentColor
} }
GradientStop { GradientStop {
position: Theme.button.pressedGradient.edge; position: 0.5;
color: control.primary ? Theme.primaryButton.pressedGradient.edgeColor color: control.primary ? Theme.accentColor
: Theme.button.pressedGradient.edgeColor : "transparent"
} }
} }
} }
...@@ -72,10 +71,10 @@ ButtonStyle { ...@@ -72,10 +71,10 @@ ButtonStyle {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: control.text text: control.text
color: Theme.button.text.color color: Theme.textColor
font.family: Theme.fontFamily font.family: Theme.fontFamily
font.pointSize: Theme.button.text.font.pointSize font.pointSize: Theme.fontSizeLarge
font.weight: control.primary ? Theme.primaryButton.text.font.weight : Theme.button.text.font.weight font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium
opacity: control.enabled ? 1.0 : 0.3 opacity: control.enabled ? 1.0 : 0.3
} }
} }
...@@ -29,32 +29,30 @@ ...@@ -29,32 +29,30 @@
** **
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
//Styles.Nemo provides Theme
import QtQuick.Controls.Styles.Nemo 1.0
CheckBoxStyle { CheckBoxStyle {
indicator: Rectangle { indicator: Rectangle {
id: background id: background
color: "transparent" color: "transparent"
implicitWidth: size.dp(72) implicitWidth: Theme.itemWidthExtraSmall
implicitHeight: size.dp(32) implicitHeight: Theme.itemHeightExtraSmall
Rectangle { Rectangle {
id: back1 id: back1
implicitWidth: size.dp(72) implicitWidth: Theme.itemWidthExtraSmall
implicitHeight: size.dp(28) implicitHeight: size.dp(28)
color: Theme.checkbox.back1 color: Theme.accentColor
anchors.centerIn: parent anchors.centerIn: parent
} }
Rectangle { Rectangle {
id: back2 id: back2
implicitWidth: size.dp(72) implicitWidth: Theme.itemWidthExtraSmall
implicitHeight: size.dp(28) implicitHeight: size.dp(28)
color: Theme.checkbox.back2 color: Theme.fillDarkColor
anchors.centerIn: parent anchors.centerIn: parent
} }
...@@ -62,7 +60,7 @@ CheckBoxStyle { ...@@ -62,7 +60,7 @@ CheckBoxStyle {
Image { Image {
id: ball id: ball
width: size.dp(40) width: size.dp(40)
height: size.dp(32) height: Theme.itemHeightExtraSmall
source: "images/switch-ball.png" source: "images/switch-ball.png"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
...@@ -81,7 +79,7 @@ CheckBoxStyle { ...@@ -81,7 +79,7 @@ CheckBoxStyle {
Component.onCompleted: { Component.onCompleted: {
back1.opacity = control.checked ? 1 : 0 back1.opacity = control.checked ? 1 : 0
back2.opacity = control.checked ? 0 : 1 back2.opacity = control.checked ? 0 : 1
ball.x = control.checked ? size.dp(32) : 0 ball.x = control.checked ? Theme.itemHeightExtraSmall : 0
} }
SequentialAnimation { SequentialAnimation {
...@@ -90,7 +88,7 @@ CheckBoxStyle { ...@@ -90,7 +88,7 @@ CheckBoxStyle {
NumberAnimation { NumberAnimation {
target: ball target: ball
property: "x" property: "x"
to: size.dp(32) to: Theme.itemHeightExtraSmall
duration: 120 duration: 120
} }
NumberAnimation { NumberAnimation {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
ComboBoxStyle { ComboBoxStyle {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
......
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
Component { Component {
Rectangle { Rectangle {
implicitHeight: size.dp(16) implicitHeight: size.dp(16)
implicitWidth: size.dp(440) implicitWidth: size.dp(440)
color: Theme.groove.background color: Theme.fillColorDark
Rectangle { Rectangle {
antialiasing: true antialiasing: true
radius: 1 radius: 1
color: Theme.groove.foreground color: Theme.accentColor
height: parent.height height: parent.height
width: parent.width * control.value / control.maximumValue width: parent.width * control.value / control.maximumValue
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Private 1.0 import QtQuick.Controls.Styles.Private 1.0
GroupBoxStyle { GroupBoxStyle {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import "../../Private/style.js" as StyleHelpers import "../../Private/style.js" as StyleHelpers
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import "../../Private/style.js" as StyleHelpers import "../../Private/style.js" as StyleHelpers
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
ProgressBarStyle { ProgressBarStyle {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
RadioButtonStyle { RadioButtonStyle {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
ScrollViewStyle { ScrollViewStyle {
......
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
SliderStyle{ SliderStyle{
handle: Rectangle { handle: Rectangle {
id: handle id: handle
anchors.centerIn: parent anchors.centerIn: parent
color: "black" color: Theme.backgroundColor
border.color: "#0091e5" border.color: Theme.accentColor
border.width: 2 border.width: 2
implicitWidth: size.dp(34) implicitWidth: size.dp(34)
implicitHeight: size.dp(34) implicitHeight: size.dp(34)
...@@ -39,7 +39,7 @@ SliderStyle{ ...@@ -39,7 +39,7 @@ SliderStyle{
anchors.centerIn: parent anchors.centerIn: parent
text: parseInt(control.value*100) text: parseInt(control.value*100)
visible: control.showValue visible: control.showValue
color: "white" color: Theme.textColor
} }
} }
...@@ -48,13 +48,13 @@ SliderStyle{ ...@@ -48,13 +48,13 @@ SliderStyle{
implicitHeight: size.dp(16) implicitHeight: size.dp(16)
implicitWidth: size.dp(440) implicitWidth: size.dp(440)
color: "#313131" color: Theme.fillDarkColor
z: 1 z: 1
Rectangle{ Rectangle{
id: dataLine id: dataLine
height: parent.height height: parent.height
width: styleData.handlePosition width: styleData.handlePosition
color: "#0091e5" color: Theme.accentColor
} }
Image { Image {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// NOTE: THIS WILL NOT BE PRIVATE ANYMORE IN QtQuick.Controls 1.1!!!!!!!!! // NOTE: THIS WILL NOT BE PRIVATE ANYMORE IN QtQuick.Controls 1.1!!!!!!!!!
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Private 1.0 import QtQuick.Controls.Styles.Private 1.0
SpinBoxStyle { SpinBoxStyle {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles.Private 1.0 import QtQuick.Controls.Styles.Private 1.0
StatusBarStyle { StatusBarStyle {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
TabViewStyle { TabViewStyle {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
TableViewStyle { TableViewStyle {
......
...@@ -17,22 +17,25 @@ ...@@ -17,22 +17,25 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
TextFieldStyle { TextFieldStyle {
selectedTextColor: Theme.textField.selectedTextColor selectedTextColor: Theme.textColor
selectionColor: Theme.textField.selectionColor selectionColor: Theme.accentColor
textColor: Theme.textField.selectedTextColor textColor: Theme.textColor
font.pointSize: size.dp(14) font.pointSize: Theme.fontSizeTiny
font.family: Theme.textField.font font.family: Theme.fontFamily
background: Item { background: Item {
anchors.leftMargin: size.dp(16) anchors{
anchors.rightMargin: size.dp(16) leftMargin: Theme.itemSpacingMedium
implicitHeight: size.dp(50) rightMargin: Theme.itemSpacingMedium
implicitWidth: size.dp(320) }
implicitHeight: Theme.itemHeightMedium
implicitWidth: Theme.itemWidthLarge
opacity: control.enabled ? 1 : 0.6 opacity: control.enabled ? 1 : 0.6
Image { Image {
anchors.fill: parent anchors.fill: parent
...@@ -46,7 +49,7 @@ TextFieldStyle { ...@@ -46,7 +49,7 @@ TextFieldStyle {
anchors.right: parent.right anchors.right: parent.right
height: 2 height: 2
width: parent.width width: parent.width
color: control.readOnly ? "#313131" : Theme.textField.selectionColor color: control.readOnly ? Theme.fillDarkColor : Theme.accentColor
} }
} }
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
...@@ -28,11 +28,11 @@ Style { ...@@ -28,11 +28,11 @@ Style {
padding.bottom: 3 padding.bottom: 3
property Component panel: Item { property Component panel: Item {
implicitHeight: size.dp(75) implicitHeight:Theme.itemHeightExtraLarge
implicitWidth: size.dp(40) implicitWidth: size.dp(40)
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.toolBar.background color: Theme.backgroundColor
} }
} }
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.1 import QtQuick 2.6
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
...@@ -31,8 +31,8 @@ Style { ...@@ -31,8 +31,8 @@ Style {
id: styleitem id: styleitem
//TODO: Maybe we want to add a descriptive text at the bottom of the icon? //TODO: Maybe we want to add a descriptive text at the bottom of the icon?
implicitWidth: size.dp(50) implicitWidth: Theme.itemHeightMedium
implicitHeight: size.dp(50) implicitHeight: implicitWidth
opacity: control.pressed ? 0.5 : 1 opacity: control.pressed ? 0.5 : 1
...@@ -47,7 +47,7 @@ Style { ...@@ -47,7 +47,7 @@ Style {
id: icon id: icon
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
anchors.margins: size.dp(8) anchors.margins: Theme.itemSpacingExtraSmall
source: control.iconSource source: control.iconSource
} }
} }
......
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemotheme.h"
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonValue>
#include <QtGui/QFontDatabase>
static const char *GLACIER_THEME = "glacier.json";
static const char *THEME_NAME_KEY = "name";
static const char *THEME_DESCRIPTION_KEY = "description";
static const char *THEME_DEFINES_KEY = "defines";
static const char *THEME_STYLES_KEY = "styles";
NemoTheme::NemoTheme(QObject *parent)
: QObject(parent)
, m_button(new NemoThemeButton(this))
, m_primaryButton(new NemoThemeButton(this))
, m_groove(new NemoThemeGroove(this))
, m_textField(new NemoThemeTextField(this))
, m_toolBar(new NemoThemeToolBar(this))
, m_window(new NemoThemeWindow(this))
, m_page(new NemoThemePage(this))
, m_pageStack(new NemoThemePageStack(this))
, m_spinner(new NemoThemeSpinner(this))
, m_label(new NemoThemeLabel(this))
, m_checkbox(new NemoThemeCheckbox(this))
, m_buttonRow(new NemoThemeButtonRow(this))
, m_header(new NemoThemeHeader(this))
{
loadFromFile(GLACIER_THEME);
int id = QFontDatabase::addApplicationFont("/usr/share/fonts/google-opensans/OpenSans-Regular.ttf");
QStringList families = QFontDatabase::applicationFontFamilies(id);
if (families.isEmpty()) {
qWarning() << "W" << "Failed to load font" << QString("/usr/share/fonts/google-opensans/OpenSans-Regular.ttf");
return;
}
m_fontFamily = families.first();
}
QString NemoTheme::name() const
{
return m_name;
}
void NemoTheme::setName(const QString &name)
{
if (m_name != name) {
m_name = name;
emit nameChanged();
}
}
QString NemoTheme::description() const
{
return m_description;
}
void NemoTheme::setDescription(const QString &description)
{
if (m_description != description) {
m_description = description;
emit descriptionChanged();
}
}
NemoThemeButton * NemoTheme::button() const
{
return m_button;
}
NemoThemeButton * NemoTheme::primaryButton() const
{
return m_primaryButton;
}
NemoThemeGroove * NemoTheme::groove() const
{
return m_groove;
}
NemoThemeTextField * NemoTheme::textField() const
{
return m_textField;
}
NemoThemeToolBar * NemoTheme::toolBar() const
{
return m_toolBar;
}
NemoThemeWindow * NemoTheme::window() const
{
return m_window;
}
NemoThemePage * NemoTheme::page() const
{
return m_page;
}
NemoThemePageStack * NemoTheme::pageStack() const
{
return m_pageStack;
}
NemoThemeSpinner * NemoTheme::spinner() const
{
return m_spinner;
}
NemoThemeLabel * NemoTheme::label() const
{
return m_label;
}
NemoThemeCheckbox * NemoTheme::checkbox() const
{
return m_checkbox;
}
NemoThemeButtonRow * NemoTheme::buttonRow() const
{
return m_buttonRow;
}
NemoThemeHeader * NemoTheme::header() const
{
return m_header;
}
QString NemoTheme::fontFamily() const
{
return m_fontFamily;
}
static inline QJsonValue jsonValue(const QJsonObject &object, const QString &key,
const QString &objectName = QString())
{
if (!object.contains(key)) {
if (objectName.isEmpty()) {
qWarning() << "W" << "Root JSON object does not have value" << key;
} else {
qWarning() << "W" << "JSON Object" << objectName << "does not have value" << key;
}
return QJsonValue();
}
return object.value(key);
}
static inline QString jsonToString(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QString valueString = value.toString();
if (defines.contains(valueString)) {
return defines.value(valueString).toString();
}
return value.toString();
}
static inline QColor jsonToColor(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QString color = value.toString();
if (defines.contains(color)) {
color = defines.value(color).toString();
}
// We need to skip the warning caused by a null value,
// so we check if the color is not empty
if (!QColor::isValidColor(color) && !color.isEmpty()) {
qWarning() << "W" << color << "is not a valid color";
return QColor();
}
return QColor(color);
}
static inline int jsonToInt(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QJsonValue trueValue = value;
if (value.isString()) {
QString valueString = value.toString();
if (defines.contains(valueString)) {
trueValue = defines.value(valueString);
}
}
double doubleValue = trueValue.toDouble();
return (int) doubleValue;
}
static inline int jsonToDouble(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QJsonValue trueValue = value;
if (value.isString()) {
QString valueString = value.toString();
if (defines.contains(valueString)) {
trueValue = defines.value(valueString);
}
}
return trueValue.toDouble();
}
void NemoTheme::loadFromFile(const QString &fileName)
{
QDir dir (THEME_DIR);
if (!dir.exists(fileName)) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file" << fileName << "does not exists.";
return;
}
QFile themeFile (dir.absoluteFilePath(fileName));
if (!themeFile.open(QIODevice::ReadOnly)) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file" << fileName << "could not be read.";
return;
}
QJsonParseError error;
QJsonDocument themeDocument = QJsonDocument::fromJson(themeFile.readAll(), &error);
themeFile.close();
if (error.error != QJsonParseError::NoError) {
qWarning() << "E" << Q_FUNC_INFO << "Cannot parse theme file:" << error.errorString();
return;
}
// Fetch all the defines
QMap<QString, QJsonValue> defines;
if (!themeDocument.isObject()) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file has an invalid format";
return;
}
QJsonObject themeObject = themeDocument.object();
if (themeObject.contains(THEME_DEFINES_KEY)) {
QJsonValue definesJson = themeObject.value(THEME_DEFINES_KEY);
if (!definesJson.isObject()) {
qWarning() << "W" << Q_FUNC_INFO << "\"defines\" is not defined as an object";
} else {
QJsonObject definesObject = definesJson.toObject();
foreach (const QString key, definesObject.keys()) {
defines.insert(key, definesObject.value(key));
}
}
} else {
qWarning() << "W" << Q_FUNC_INFO
<< "Theme file does not contain a \"defines\" object. "\
"Please add an empty \"defines\" object instead";
}
// Set the global values (name, description etc.)
setName(jsonValue(themeObject, THEME_NAME_KEY).toString());
setDescription(jsonValue(themeObject, THEME_DESCRIPTION_KEY).toString());
// Parse the defined objects
QJsonObject styles = jsonValue(themeObject, THEME_STYLES_KEY).toObject();
if (styles.isEmpty()) {
return;
}
// Setting properties for button
QJsonObject stylesButton = styles.value("button").toObject();
m_button->setBackground(jsonToColor(jsonValue(stylesButton, "background", "button"), defines));
// Setting properties for text
QJsonObject stylesButtonText = stylesButton.value("text").toObject();
m_button->text()->setColor(jsonToColor(jsonValue(stylesButtonText, "color", "text"), defines));
// Setting properties for font
QJsonObject stylesButtonTextFont = stylesButtonText.value("font").toObject();
if (stylesButtonTextFont.contains("pointSize")) {
m_button->text()->font()->setPointSize(jsonToInt(stylesButtonTextFont.value("pointSize"), defines));
} else {
m_button->text()->font()->setPointSizeDefault();
}
if (stylesButtonTextFont.contains("weight")) {
m_button->text()->font()->setWeight(jsonToInt(stylesButtonTextFont.value("weight"), defines));
} else {
m_button->text()->font()->setWeightDefault();
}
// Setting properties for pressedGradient
QJsonObject stylesButtonPressedGradient = stylesButton.value("pressedGradient").toObject();
m_button->pressedGradient()->setCenterColor(jsonToColor(jsonValue(stylesButtonPressedGradient, "centerColor", "pressedGradient"), defines));
m_button->pressedGradient()->setEdgeColor(jsonToColor(jsonValue(stylesButtonPressedGradient, "edgeColor", "pressedGradient"), defines));
if (stylesButtonPressedGradient.contains("width")) {
m_button->pressedGradient()->setWidth(jsonToInt(stylesButtonPressedGradient.value("width"), defines));
} else {
m_button->pressedGradient()->setWidthDefault();
}
if (stylesButtonPressedGradient.contains("height")) {
m_button->pressedGradient()->setHeight(jsonToInt(stylesButtonPressedGradient.value("height"), defines));
} else {
m_button->pressedGradient()->setHeightDefault();
}
if (stylesButtonPressedGradient.contains("center")) {
m_button->pressedGradient()->setCenter(jsonToDouble(stylesButtonPressedGradient.value("center"), defines));
} else {
m_button->pressedGradient()->setCenterDefault();
}
if (stylesButtonPressedGradient.contains("edge")) {
m_button->pressedGradient()->setEdge(jsonToDouble(stylesButtonPressedGradient.value("edge"), defines));
} else {
m_button->pressedGradient()->setEdgeDefault();
}
// Setting properties for primaryButton
QJsonObject stylesPrimaryButton = styles.value("primaryButton").toObject();
m_primaryButton->setBackground(jsonToColor(jsonValue(stylesPrimaryButton, "background", "primaryButton"), defines));
// Setting properties for text
QJsonObject stylesPrimaryButtonText = stylesPrimaryButton.value("text").toObject();
m_primaryButton->text()->setColor(jsonToColor(jsonValue(stylesPrimaryButtonText, "color", "text"), defines));
// Setting properties for font
QJsonObject stylesPrimaryButtonTextFont = stylesPrimaryButtonText.value("font").toObject();
if (stylesPrimaryButtonTextFont.contains("pointSize")) {
m_primaryButton->text()->font()->setPointSize(jsonToInt(stylesPrimaryButtonTextFont.value("pointSize"), defines));
} else {
m_primaryButton->text()->font()->setPointSizeDefault();
}
if (stylesPrimaryButtonTextFont.contains("weight")) {
m_primaryButton->text()->font()->setWeight(jsonToInt(stylesPrimaryButtonTextFont.value("weight"), defines));
} else {
m_primaryButton->text()->font()->setWeightDefault();
}
// Setting properties for pressedGradient
QJsonObject stylesPrimaryButtonPressedGradient = stylesPrimaryButton.value("pressedGradient").toObject();
m_primaryButton->pressedGradient()->setCenterColor(jsonToColor(jsonValue(stylesPrimaryButtonPressedGradient, "centerColor", "pressedGradient"), defines));
m_primaryButton->pressedGradient()->setEdgeColor(jsonToColor(jsonValue(stylesPrimaryButtonPressedGradient, "edgeColor", "pressedGradient"), defines));
if (stylesPrimaryButtonPressedGradient.contains("width")) {
m_primaryButton->pressedGradient()->setWidth(jsonToInt(stylesPrimaryButtonPressedGradient.value("width"), defines));
} else {
m_primaryButton->pressedGradient()->setWidthDefault();
}
if (stylesPrimaryButtonPressedGradient.contains("height")) {
m_primaryButton->pressedGradient()->setHeight(jsonToInt(stylesPrimaryButtonPressedGradient.value("height"), defines));
} else {
m_primaryButton->pressedGradient()->setHeightDefault();
}
if (stylesPrimaryButtonPressedGradient.contains("center")) {
m_primaryButton->pressedGradient()->setCenter(jsonToDouble(stylesPrimaryButtonPressedGradient.value("center"), defines));
} else {
m_primaryButton->pressedGradient()->setCenterDefault();
}
if (stylesPrimaryButtonPressedGradient.contains("edge")) {
m_primaryButton->pressedGradient()->setEdge(jsonToDouble(stylesPrimaryButtonPressedGradient.value("edge"), defines));
} else {
m_primaryButton->pressedGradient()->setEdgeDefault();
}
// Setting properties for groove
QJsonObject stylesGroove = styles.value("groove").toObject();
m_groove->setBackground(jsonToColor(jsonValue(stylesGroove, "background", "groove"), defines));
m_groove->setForeground(jsonToColor(jsonValue(stylesGroove, "foreground", "groove"), defines));
// Setting properties for textField
QJsonObject stylesTextField = styles.value("textField").toObject();
m_textField->setSelectedTextColor(jsonToColor(jsonValue(stylesTextField, "selectedTextColor", "textField"), defines));
m_textField->setSelectionColor(jsonToColor(jsonValue(stylesTextField, "selectionColor", "textField"), defines));
if (stylesTextField.contains("pointSize")) {
m_textField->setPointSize(jsonToInt(stylesTextField.value("pointSize"), defines));
} else {
m_textField->setPointSizeDefault();
}
if (stylesTextField.contains("font")) {
m_textField->setFont(jsonToString(stylesTextField.value("font"), defines));
} else {
m_textField->setFontDefault();
}
// Setting properties for toolBar
QJsonObject stylesToolBar = styles.value("toolBar").toObject();
m_toolBar->setBackground(jsonToColor(jsonValue(stylesToolBar, "background", "toolBar"), defines));
// Setting properties for window
QJsonObject stylesWindow = styles.value("window").toObject();
m_window->setBackground(jsonToColor(jsonValue(stylesWindow, "background", "window"), defines));
// Setting properties for page
QJsonObject stylesPage = styles.value("page").toObject();
m_page->setBackground(jsonToColor(jsonValue(stylesPage, "background", "page"), defines));
// Setting properties for pageStack
QJsonObject stylesPageStack = styles.value("pageStack").toObject();
if (stylesPageStack.contains("transitionDuration")) {
m_pageStack->setTransitionDuration(jsonToInt(stylesPageStack.value("transitionDuration"), defines));
} else {
m_pageStack->setTransitionDurationDefault();
}
// Setting properties for spinner
QJsonObject stylesSpinner = styles.value("spinner").toObject();
if (stylesSpinner.contains("radius")) {
m_spinner->setRadius(jsonToInt(stylesSpinner.value("radius"), defines));
} else {
m_spinner->setRadiusDefault();
}
m_spinner->setPrimaryColor(jsonToColor(jsonValue(stylesSpinner, "primaryColor", "spinner"), defines));
m_spinner->setSecondaryColor(jsonToColor(jsonValue(stylesSpinner, "secondaryColor", "spinner"), defines));
if (stylesSpinner.contains("horizontalSpacing")) {
m_spinner->setHorizontalSpacing(jsonToInt(stylesSpinner.value("horizontalSpacing"), defines));
} else {
m_spinner->setHorizontalSpacingDefault();
}
if (stylesSpinner.contains("verticalSpacing")) {
m_spinner->setVerticalSpacing(jsonToInt(stylesSpinner.value("verticalSpacing"), defines));
} else {
m_spinner->setVerticalSpacingDefault();
}
if (stylesSpinner.contains("initialStateDuration")) {
m_spinner->setInitialStateDuration(jsonToInt(stylesSpinner.value("initialStateDuration"), defines));
} else {
m_spinner->setInitialStateDurationDefault();
}
if (stylesSpinner.contains("transitionDuration")) {
m_spinner->setTransitionDuration(jsonToInt(stylesSpinner.value("transitionDuration"), defines));
} else {
m_spinner->setTransitionDurationDefault();
}
// Setting properties for label
QJsonObject stylesLabel = styles.value("label").toObject();
m_label->setColor(jsonToColor(jsonValue(stylesLabel, "color", "label"), defines));
if (stylesLabel.contains("pointSize")) {
m_label->setPointSize(jsonToInt(stylesLabel.value("pointSize"), defines));
} else {
m_label->setPointSizeDefault();
}
// Setting properties for checkbox
QJsonObject stylesCheckbox = styles.value("checkbox").toObject();
m_checkbox->setBack1(jsonToColor(jsonValue(stylesCheckbox, "back1", "checkbox"), defines));
m_checkbox->setBack2(jsonToColor(jsonValue(stylesCheckbox, "back2", "checkbox"), defines));
// Setting properties for buttonRow
QJsonObject stylesButtonRow = styles.value("buttonRow").toObject();
m_buttonRow->setBackground(jsonToColor(jsonValue(stylesButtonRow, "background", "buttonRow"), defines));
m_buttonRow->setButtonColor(jsonToColor(jsonValue(stylesButtonRow, "buttonColor", "buttonRow"), defines));
// Setting properties for header
QJsonObject stylesHeader = styles.value("header").toObject();
m_header->setBackground(jsonToColor(jsonValue(stylesHeader, "background", "header"), defines));
// Setting properties for dimmer
QJsonObject stylesHeaderDimmer = stylesHeader.value("dimmer").toObject();
m_header->dimmer()->setStartColor(jsonToColor(jsonValue(stylesHeaderDimmer, "startColor", "dimmer"), defines));
m_header->dimmer()->setEndColor(jsonToColor(jsonValue(stylesHeaderDimmer, "endColor", "dimmer"), defines));
if (stylesHeaderDimmer.contains("height")) {
m_header->dimmer()->setHeight(jsonToInt(stylesHeaderDimmer.value("height"), defines));
} else {
m_header->dimmer()->setHeightDefault();
}
if (stylesHeaderDimmer.contains("startPosition")) {
m_header->dimmer()->setStartPosition(jsonToDouble(stylesHeaderDimmer.value("startPosition"), defines));
} else {
m_header->dimmer()->setStartPositionDefault();
}
if (stylesHeaderDimmer.contains("endPosition")) {
m_header->dimmer()->setEndPosition(jsonToDouble(stylesHeaderDimmer.value("endPosition"), defines));
} else {
m_header->dimmer()->setEndPositionDefault();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEME_H
#define NEMOTHEME_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include "nemothemebutton.h"
#include "nemothemegroove.h"
#include "nemothemetextfield.h"
#include "nemothemetoolbar.h"
#include "nemothemewindow.h"
#include "nemothemepage.h"
#include "nemothemepagestack.h"
#include "nemothemespinner.h"
#include "nemothemelabel.h"
#include "nemothemecheckbox.h"
#include "nemothemebuttonrow.h"
#include "nemothemeheader.h"
class NemoTheme: public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
Q_PROPERTY(NemoThemeButton * button READ button CONSTANT)
Q_PROPERTY(NemoThemeButton * primaryButton READ primaryButton CONSTANT)
Q_PROPERTY(NemoThemeGroove * groove READ groove CONSTANT)
Q_PROPERTY(NemoThemeTextField * textField READ textField CONSTANT)
Q_PROPERTY(NemoThemeToolBar * toolBar READ toolBar CONSTANT)
Q_PROPERTY(NemoThemeWindow * window READ window CONSTANT)
Q_PROPERTY(NemoThemePage * page READ page CONSTANT)
Q_PROPERTY(NemoThemePageStack * pageStack READ pageStack CONSTANT)
Q_PROPERTY(NemoThemeSpinner * spinner READ spinner CONSTANT)
Q_PROPERTY(NemoThemeLabel * label READ label CONSTANT)
Q_PROPERTY(NemoThemeCheckbox * checkbox READ checkbox CONSTANT)
Q_PROPERTY(NemoThemeButtonRow * buttonRow READ buttonRow CONSTANT)
Q_PROPERTY(NemoThemeHeader * header READ header CONSTANT)
Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT)
public:
explicit NemoTheme(QObject *parent = 0);
QString name() const;
void setName(const QString &name);
QString description() const;
void setDescription(const QString &description);
NemoThemeButton * button() const;
NemoThemeButton * primaryButton() const;
NemoThemeGroove * groove() const;
NemoThemeTextField * textField() const;
NemoThemeToolBar * toolBar() const;
NemoThemeWindow * window() const;
NemoThemePage * page() const;
NemoThemePageStack * pageStack() const;
NemoThemeSpinner * spinner() const;
NemoThemeLabel * label() const;
NemoThemeCheckbox * checkbox() const;
NemoThemeButtonRow * buttonRow() const;
NemoThemeHeader * header() const;
QString fontFamily() const;
public Q_SLOTS:
void loadFromFile(const QString &fileName);
Q_SIGNALS:
void nameChanged();
void descriptionChanged();
private:
QString m_name;
QString m_description;
NemoThemeButton * m_button;
NemoThemeButton * m_primaryButton;
NemoThemeGroove * m_groove;
NemoThemeTextField * m_textField;
NemoThemeToolBar * m_toolBar;
NemoThemeWindow * m_window;
NemoThemePage * m_page;
NemoThemePageStack * m_pageStack;
NemoThemeSpinner * m_spinner;
NemoThemeLabel * m_label;
NemoThemeCheckbox * m_checkbox;
NemoThemeButtonRow * m_buttonRow;
NemoThemeHeader * m_header;
QString m_fontFamily;
};
#endif //NEMOTHEME_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemebutton.h"
NemoThemeButton::NemoThemeButton(QObject *parent)
: QObject(parent)
, m_text(new NemoThemeButtonText(this))
, m_pressedGradient(new NemoThemeButtonPressedGradient(this))
{
}
QColor NemoThemeButton::background() const
{
return m_background;
}
void NemoThemeButton::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
NemoThemeButtonText * NemoThemeButton::text() const
{
return m_text;
}
NemoThemeButtonPressedGradient * NemoThemeButton::pressedGradient() const
{
return m_pressedGradient;
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEBUTTON_H
#define NEMOTHEMEBUTTON_H
#include <QtCore/QObject>
#include <QtGui/QColor>
#include "nemothemebuttontext.h"
#include "nemothemebuttonpressedgradient.h"
class NemoThemeButton: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
Q_PROPERTY(NemoThemeButtonText * text READ text CONSTANT)
Q_PROPERTY(NemoThemeButtonPressedGradient * pressedGradient READ pressedGradient CONSTANT)
public:
explicit NemoThemeButton(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
NemoThemeButtonText * text() const;
NemoThemeButtonPressedGradient * pressedGradient() const;
Q_SIGNALS:
void backgroundChanged();
private:
QColor m_background;
NemoThemeButtonText * m_text;
NemoThemeButtonPressedGradient * m_pressedGradient;
};
#endif //NEMOTHEMEBUTTON_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemebuttonpressedgradient.h"
NemoThemeButtonPressedGradient::NemoThemeButtonPressedGradient(QObject *parent)
: QObject(parent)
, m_width(240)
, m_height(240)
, m_center(0.29)
, m_edge(0.5)
{
}
QColor NemoThemeButtonPressedGradient::centerColor() const
{
return m_centerColor;
}
void NemoThemeButtonPressedGradient::setCenterColor(const QColor &centerColor)
{
if (m_centerColor != centerColor) {
m_centerColor = centerColor;
emit centerColorChanged();
}
}
QColor NemoThemeButtonPressedGradient::edgeColor() const
{
return m_edgeColor;
}
void NemoThemeButtonPressedGradient::setEdgeColor(const QColor &edgeColor)
{
if (m_edgeColor != edgeColor) {
m_edgeColor = edgeColor;
emit edgeColorChanged();
}
}
int NemoThemeButtonPressedGradient::width() const
{
return m_width;
}
void NemoThemeButtonPressedGradient::setWidth(int width)
{
if (m_width != width) {
m_width = width;
emit widthChanged();
}
}
void NemoThemeButtonPressedGradient::setWidthDefault()
{
if (m_width != 240) {
m_width = 240;
emit widthChanged();
}
}
int NemoThemeButtonPressedGradient::height() const
{
return m_height;
}
void NemoThemeButtonPressedGradient::setHeight(int height)
{
if (m_height != height) {
m_height = height;
emit heightChanged();
}
}
void NemoThemeButtonPressedGradient::setHeightDefault()
{
if (m_height != 240) {
m_height = 240;
emit heightChanged();
}
}
double NemoThemeButtonPressedGradient::center() const
{
return m_center;
}
void NemoThemeButtonPressedGradient::setCenter(double center)
{
if (m_center != center) {
m_center = center;
emit centerChanged();
}
}
void NemoThemeButtonPressedGradient::setCenterDefault()
{
if (m_center != 0.29) {
m_center = 0.29;
emit centerChanged();
}
}
double NemoThemeButtonPressedGradient::edge() const
{
return m_edge;
}
void NemoThemeButtonPressedGradient::setEdge(double edge)
{
if (m_edge != edge) {
m_edge = edge;
emit edgeChanged();
}
}
void NemoThemeButtonPressedGradient::setEdgeDefault()
{
if (m_edge != 0.5) {
m_edge = 0.5;
emit edgeChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEBUTTONPRESSEDGRADIENT_H
#define NEMOTHEMEBUTTONPRESSEDGRADIENT_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeButtonPressedGradient: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor centerColor READ centerColor NOTIFY centerColorChanged)
Q_PROPERTY(QColor edgeColor READ edgeColor NOTIFY edgeColorChanged)
Q_PROPERTY(int width READ width NOTIFY widthChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(double center READ center NOTIFY centerChanged)
Q_PROPERTY(double edge READ edge NOTIFY edgeChanged)
public:
explicit NemoThemeButtonPressedGradient(QObject *parent = 0);
QColor centerColor() const;
void setCenterColor(const QColor &centerColor);
QColor edgeColor() const;
void setEdgeColor(const QColor &edgeColor);
int width() const;
void setWidth(int width);
void setWidthDefault();
int height() const;
void setHeight(int height);
void setHeightDefault();
double center() const;
void setCenter(double center);
void setCenterDefault();
double edge() const;
void setEdge(double edge);
void setEdgeDefault();
Q_SIGNALS:
void centerColorChanged();
void edgeColorChanged();
void widthChanged();
void heightChanged();
void centerChanged();
void edgeChanged();
private:
QColor m_centerColor;
QColor m_edgeColor;
int m_width;
int m_height;
double m_center;
double m_edge;
};
#endif //NEMOTHEMEBUTTONPRESSEDGRADIENT_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemebuttonrow.h"
NemoThemeButtonRow::NemoThemeButtonRow(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeButtonRow::background() const
{
return m_background;
}
void NemoThemeButtonRow::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
QColor NemoThemeButtonRow::buttonColor() const
{
return m_buttonColor;
}
void NemoThemeButtonRow::setButtonColor(const QColor &buttonColor)
{
if (m_buttonColor != buttonColor) {
m_buttonColor = buttonColor;
emit buttonColorChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEBUTTONROW_H
#define NEMOTHEMEBUTTONROW_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeButtonRow: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY buttonColorChanged)
public:
explicit NemoThemeButtonRow(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
QColor buttonColor() const;
void setButtonColor(const QColor &buttonColor);
Q_SIGNALS:
void backgroundChanged();
void buttonColorChanged();
private:
QColor m_background;
QColor m_buttonColor;
};
#endif //NEMOTHEMEBUTTONROW_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemebuttontext.h"
NemoThemeButtonText::NemoThemeButtonText(QObject *parent)
: QObject(parent)
, m_font(new NemoThemeFont(this))
{
}
QColor NemoThemeButtonText::color() const
{
return m_color;
}
void NemoThemeButtonText::setColor(const QColor &color)
{
if (m_color != color) {
m_color = color;
emit colorChanged();
}
}
NemoThemeFont * NemoThemeButtonText::font() const
{
return m_font;
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEBUTTONTEXT_H
#define NEMOTHEMEBUTTONTEXT_H
#include <QtCore/QObject>
#include <QtGui/QColor>
#include "nemothemefont.h"
class NemoThemeButtonText: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor color READ color NOTIFY colorChanged)
Q_PROPERTY(NemoThemeFont * font READ font CONSTANT)
public:
explicit NemoThemeButtonText(QObject *parent = 0);
QColor color() const;
void setColor(const QColor &color);
NemoThemeFont * font() const;
Q_SIGNALS:
void colorChanged();
private:
QColor m_color;
NemoThemeFont * m_font;
};
#endif //NEMOTHEMEBUTTONTEXT_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemecheckbox.h"
NemoThemeCheckbox::NemoThemeCheckbox(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeCheckbox::back1() const
{
return m_back1;
}
void NemoThemeCheckbox::setBack1(const QColor &back1)
{
if (m_back1 != back1) {
m_back1 = back1;
emit back1Changed();
}
}
QColor NemoThemeCheckbox::back2() const
{
return m_back2;
}
void NemoThemeCheckbox::setBack2(const QColor &back2)
{
if (m_back2 != back2) {
m_back2 = back2;
emit back2Changed();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMECHECKBOX_H
#define NEMOTHEMECHECKBOX_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeCheckbox: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor back1 READ back1 NOTIFY back1Changed)
Q_PROPERTY(QColor back2 READ back2 NOTIFY back2Changed)
public:
explicit NemoThemeCheckbox(QObject *parent = 0);
QColor back1() const;
void setBack1(const QColor &back1);
QColor back2() const;
void setBack2(const QColor &back2);
Q_SIGNALS:
void back1Changed();
void back2Changed();
private:
QColor m_back1;
QColor m_back2;
};
#endif //NEMOTHEMECHECKBOX_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemefont.h"
NemoThemeFont::NemoThemeFont(QObject *parent)
: QObject(parent)
, m_pointSize(24)
, m_weight(25)
{
}
int NemoThemeFont::pointSize() const
{
return m_pointSize;
}
void NemoThemeFont::setPointSize(int pointSize)
{
if (m_pointSize != pointSize) {
m_pointSize = pointSize;
emit pointSizeChanged();
}
}
void NemoThemeFont::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
int NemoThemeFont::weight() const
{
return m_weight;
}
void NemoThemeFont::setWeight(int weight)
{
if (m_weight != weight) {
m_weight = weight;
emit weightChanged();
}
}
void NemoThemeFont::setWeightDefault()
{
if (m_weight != 25) {
m_weight = 25;
emit weightChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEFONT_H
#define NEMOTHEMEFONT_H
#include <QtCore/QObject>
class NemoThemeFont: public QObject
{
Q_OBJECT
Q_PROPERTY(int pointSize READ pointSize NOTIFY pointSizeChanged)
Q_PROPERTY(int weight READ weight NOTIFY weightChanged)
public:
explicit NemoThemeFont(QObject *parent = 0);
int pointSize() const;
void setPointSize(int pointSize);
void setPointSizeDefault();
int weight() const;
void setWeight(int weight);
void setWeightDefault();
Q_SIGNALS:
void pointSizeChanged();
void weightChanged();
private:
int m_pointSize;
int m_weight;
};
#endif //NEMOTHEMEFONT_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemegroove.h"
NemoThemeGroove::NemoThemeGroove(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeGroove::background() const
{
return m_background;
}
void NemoThemeGroove::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
QColor NemoThemeGroove::foreground() const
{
return m_foreground;
}
void NemoThemeGroove::setForeground(const QColor &foreground)
{
if (m_foreground != foreground) {
m_foreground = foreground;
emit foregroundChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEGROOVE_H
#define NEMOTHEMEGROOVE_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeGroove: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
Q_PROPERTY(QColor foreground READ foreground NOTIFY foregroundChanged)
public:
explicit NemoThemeGroove(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
QColor foreground() const;
void setForeground(const QColor &foreground);
Q_SIGNALS:
void backgroundChanged();
void foregroundChanged();
private:
QColor m_background;
QColor m_foreground;
};
#endif //NEMOTHEMEGROOVE_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemeheader.h"
NemoThemeHeader::NemoThemeHeader(QObject *parent)
: QObject(parent)
, m_dimmer(new NemoThemeHeaderDimmer(this))
{
}
QColor NemoThemeHeader::background() const
{
return m_background;
}
void NemoThemeHeader::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
NemoThemeHeaderDimmer * NemoThemeHeader::dimmer() const
{
return m_dimmer;
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEHEADER_H
#define NEMOTHEMEHEADER_H
#include <QtCore/QObject>
#include <QtGui/QColor>
#include "nemothemeheaderdimmer.h"
class NemoThemeHeader: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
Q_PROPERTY(NemoThemeHeaderDimmer * dimmer READ dimmer CONSTANT)
public:
explicit NemoThemeHeader(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
NemoThemeHeaderDimmer * dimmer() const;
Q_SIGNALS:
void backgroundChanged();
private:
QColor m_background;
NemoThemeHeaderDimmer * m_dimmer;
};
#endif //NEMOTHEMEHEADER_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemeheaderdimmer.h"
NemoThemeHeaderDimmer::NemoThemeHeaderDimmer(QObject *parent)
: QObject(parent)
, m_height(16)
, m_startPosition(0)
, m_endPosition(1.0)
{
}
QColor NemoThemeHeaderDimmer::startColor() const
{
return m_startColor;
}
void NemoThemeHeaderDimmer::setStartColor(const QColor &startColor)
{
if (m_startColor != startColor) {
m_startColor = startColor;
emit startColorChanged();
}
}
QColor NemoThemeHeaderDimmer::endColor() const
{
return m_endColor;
}
void NemoThemeHeaderDimmer::setEndColor(const QColor &endColor)
{
if (m_endColor != endColor) {
m_endColor = endColor;
emit endColorChanged();
}
}
int NemoThemeHeaderDimmer::height() const
{
return m_height;
}
void NemoThemeHeaderDimmer::setHeight(int height)
{
if (m_height != height) {
m_height = height;
emit heightChanged();
}
}
void NemoThemeHeaderDimmer::setHeightDefault()
{
if (m_height != 16) {
m_height = 16;
emit heightChanged();
}
}
double NemoThemeHeaderDimmer::startPosition() const
{
return m_startPosition;
}
void NemoThemeHeaderDimmer::setStartPosition(double startPosition)
{
if (m_startPosition != startPosition) {
m_startPosition = startPosition;
emit startPositionChanged();
}
}
void NemoThemeHeaderDimmer::setStartPositionDefault()
{
if (m_startPosition != 0) {
m_startPosition = 0;
emit startPositionChanged();
}
}
double NemoThemeHeaderDimmer::endPosition() const
{
return m_endPosition;
}
void NemoThemeHeaderDimmer::setEndPosition(double endPosition)
{
if (m_endPosition != endPosition) {
m_endPosition = endPosition;
emit endPositionChanged();
}
}
void NemoThemeHeaderDimmer::setEndPositionDefault()
{
if (m_endPosition != 1.0) {
m_endPosition = 1.0;
emit endPositionChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEHEADERDIMMER_H
#define NEMOTHEMEHEADERDIMMER_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeHeaderDimmer: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor startColor READ startColor NOTIFY startColorChanged)
Q_PROPERTY(QColor endColor READ endColor NOTIFY endColorChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(double startPosition READ startPosition NOTIFY startPositionChanged)
Q_PROPERTY(double endPosition READ endPosition NOTIFY endPositionChanged)
public:
explicit NemoThemeHeaderDimmer(QObject *parent = 0);
QColor startColor() const;
void setStartColor(const QColor &startColor);
QColor endColor() const;
void setEndColor(const QColor &endColor);
int height() const;
void setHeight(int height);
void setHeightDefault();
double startPosition() const;
void setStartPosition(double startPosition);
void setStartPositionDefault();
double endPosition() const;
void setEndPosition(double endPosition);
void setEndPositionDefault();
Q_SIGNALS:
void startColorChanged();
void endColorChanged();
void heightChanged();
void startPositionChanged();
void endPositionChanged();
private:
QColor m_startColor;
QColor m_endColor;
int m_height;
double m_startPosition;
double m_endPosition;
};
#endif //NEMOTHEMEHEADERDIMMER_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemelabel.h"
NemoThemeLabel::NemoThemeLabel(QObject *parent)
: QObject(parent)
, m_pointSize(24)
{
}
QColor NemoThemeLabel::color() const
{
return m_color;
}
void NemoThemeLabel::setColor(const QColor &color)
{
if (m_color != color) {
m_color = color;
emit colorChanged();
}
}
int NemoThemeLabel::pointSize() const
{
return m_pointSize;
}
void NemoThemeLabel::setPointSize(int pointSize)
{
if (m_pointSize != pointSize) {
m_pointSize = pointSize;
emit pointSizeChanged();
}
}
void NemoThemeLabel::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMELABEL_H
#define NEMOTHEMELABEL_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeLabel: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor color READ color NOTIFY colorChanged)
Q_PROPERTY(int pointSize READ pointSize NOTIFY pointSizeChanged)
public:
explicit NemoThemeLabel(QObject *parent = 0);
QColor color() const;
void setColor(const QColor &color);
int pointSize() const;
void setPointSize(int pointSize);
void setPointSizeDefault();
Q_SIGNALS:
void colorChanged();
void pointSizeChanged();
private:
QColor m_color;
int m_pointSize;
};
#endif //NEMOTHEMELABEL_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemepage.h"
NemoThemePage::NemoThemePage(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemePage::background() const
{
return m_background;
}
void NemoThemePage::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEPAGE_H
#define NEMOTHEMEPAGE_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemePage: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
public:
explicit NemoThemePage(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
Q_SIGNALS:
void backgroundChanged();
private:
QColor m_background;
};
#endif //NEMOTHEMEPAGE_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemepagedimmer.h"
NemoThemePageDimmer::NemoThemePageDimmer(QObject *parent)
: QObject(parent)
, m_height(16)
, m_startPosition(0)
, m_endPosition(1.0)
{
}
QColor NemoThemePageDimmer::startColor() const
{
return m_startColor;
}
void NemoThemePageDimmer::setStartColor(const QColor &startColor)
{
if (m_startColor != startColor) {
m_startColor = startColor;
emit startColorChanged();
}
}
QColor NemoThemePageDimmer::endColor() const
{
return m_endColor;
}
void NemoThemePageDimmer::setEndColor(const QColor &endColor)
{
if (m_endColor != endColor) {
m_endColor = endColor;
emit endColorChanged();
}
}
int NemoThemePageDimmer::height() const
{
return m_height;
}
void NemoThemePageDimmer::setHeight(int height)
{
if (m_height != height) {
m_height = height;
emit heightChanged();
}
}
void NemoThemePageDimmer::setHeightDefault()
{
if (m_height != 16) {
m_height = 16;
emit heightChanged();
}
}
double NemoThemePageDimmer::startPosition() const
{
return m_startPosition;
}
void NemoThemePageDimmer::setStartPosition(double startPosition)
{
if (m_startPosition != startPosition) {
m_startPosition = startPosition;
emit startPositionChanged();
}
}
void NemoThemePageDimmer::setStartPositionDefault()
{
if (m_startPosition != 0) {
m_startPosition = 0;
emit startPositionChanged();
}
}
double NemoThemePageDimmer::endPosition() const
{
return m_endPosition;
}
void NemoThemePageDimmer::setEndPosition(double endPosition)
{
if (m_endPosition != endPosition) {
m_endPosition = endPosition;
emit endPositionChanged();
}
}
void NemoThemePageDimmer::setEndPositionDefault()
{
if (m_endPosition != 1.0) {
m_endPosition = 1.0;
emit endPositionChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEPAGEDIMMER_H
#define NEMOTHEMEPAGEDIMMER_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemePageDimmer: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor startColor READ startColor NOTIFY startColorChanged)
Q_PROPERTY(QColor endColor READ endColor NOTIFY endColorChanged)
Q_PROPERTY(int height READ height NOTIFY heightChanged)
Q_PROPERTY(double startPosition READ startPosition NOTIFY startPositionChanged)
Q_PROPERTY(double endPosition READ endPosition NOTIFY endPositionChanged)
public:
explicit NemoThemePageDimmer(QObject *parent = 0);
QColor startColor() const;
void setStartColor(const QColor &startColor);
QColor endColor() const;
void setEndColor(const QColor &endColor);
int height() const;
void setHeight(int height);
void setHeightDefault();
double startPosition() const;
void setStartPosition(double startPosition);
void setStartPositionDefault();
double endPosition() const;
void setEndPosition(double endPosition);
void setEndPositionDefault();
Q_SIGNALS:
void startColorChanged();
void endColorChanged();
void heightChanged();
void startPositionChanged();
void endPositionChanged();
private:
QColor m_startColor;
QColor m_endColor;
int m_height;
double m_startPosition;
double m_endPosition;
};
#endif //NEMOTHEMEPAGEDIMMER_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemepagestack.h"
NemoThemePageStack::NemoThemePageStack(QObject *parent)
: QObject(parent)
, m_transitionDuration(500)
{
}
int NemoThemePageStack::transitionDuration() const
{
return m_transitionDuration;
}
void NemoThemePageStack::setTransitionDuration(int transitionDuration)
{
if (m_transitionDuration != transitionDuration) {
m_transitionDuration = transitionDuration;
emit transitionDurationChanged();
}
}
void NemoThemePageStack::setTransitionDurationDefault()
{
if (m_transitionDuration != 500) {
m_transitionDuration = 500;
emit transitionDurationChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEPAGESTACK_H
#define NEMOTHEMEPAGESTACK_H
#include <QtCore/QObject>
class NemoThemePageStack: public QObject
{
Q_OBJECT
Q_PROPERTY(int transitionDuration READ transitionDuration NOTIFY transitionDurationChanged)
public:
explicit NemoThemePageStack(QObject *parent = 0);
int transitionDuration() const;
void setTransitionDuration(int transitionDuration);
void setTransitionDurationDefault();
Q_SIGNALS:
void transitionDurationChanged();
private:
int m_transitionDuration;
};
#endif //NEMOTHEMEPAGESTACK_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemespinner.h"
NemoThemeSpinner::NemoThemeSpinner(QObject *parent)
: QObject(parent)
, m_radius(32)
, m_horizontalSpacing(15)
, m_verticalSpacing(15)
, m_initialStateDuration(1500)
, m_transitionDuration(500)
{
}
int NemoThemeSpinner::radius() const
{
return m_radius;
}
void NemoThemeSpinner::setRadius(int radius)
{
if (m_radius != radius) {
m_radius = radius;
emit radiusChanged();
}
}
void NemoThemeSpinner::setRadiusDefault()
{
if (m_radius != 32) {
m_radius = 32;
emit radiusChanged();
}
}
QColor NemoThemeSpinner::primaryColor() const
{
return m_primaryColor;
}
void NemoThemeSpinner::setPrimaryColor(const QColor &primaryColor)
{
if (m_primaryColor != primaryColor) {
m_primaryColor = primaryColor;
emit primaryColorChanged();
}
}
QColor NemoThemeSpinner::secondaryColor() const
{
return m_secondaryColor;
}
void NemoThemeSpinner::setSecondaryColor(const QColor &secondaryColor)
{
if (m_secondaryColor != secondaryColor) {
m_secondaryColor = secondaryColor;
emit secondaryColorChanged();
}
}
int NemoThemeSpinner::horizontalSpacing() const
{
return m_horizontalSpacing;
}
void NemoThemeSpinner::setHorizontalSpacing(int horizontalSpacing)
{
if (m_horizontalSpacing != horizontalSpacing) {
m_horizontalSpacing = horizontalSpacing;
emit horizontalSpacingChanged();
}
}
void NemoThemeSpinner::setHorizontalSpacingDefault()
{
if (m_horizontalSpacing != 15) {
m_horizontalSpacing = 15;
emit horizontalSpacingChanged();
}
}
int NemoThemeSpinner::verticalSpacing() const
{
return m_verticalSpacing;
}
void NemoThemeSpinner::setVerticalSpacing(int verticalSpacing)
{
if (m_verticalSpacing != verticalSpacing) {
m_verticalSpacing = verticalSpacing;
emit verticalSpacingChanged();
}
}
void NemoThemeSpinner::setVerticalSpacingDefault()
{
if (m_verticalSpacing != 15) {
m_verticalSpacing = 15;
emit verticalSpacingChanged();
}
}
int NemoThemeSpinner::initialStateDuration() const
{
return m_initialStateDuration;
}
void NemoThemeSpinner::setInitialStateDuration(int initialStateDuration)
{
if (m_initialStateDuration != initialStateDuration) {
m_initialStateDuration = initialStateDuration;
emit initialStateDurationChanged();
}
}
void NemoThemeSpinner::setInitialStateDurationDefault()
{
if (m_initialStateDuration != 1500) {
m_initialStateDuration = 1500;
emit initialStateDurationChanged();
}
}
int NemoThemeSpinner::transitionDuration() const
{
return m_transitionDuration;
}
void NemoThemeSpinner::setTransitionDuration(int transitionDuration)
{
if (m_transitionDuration != transitionDuration) {
m_transitionDuration = transitionDuration;
emit transitionDurationChanged();
}
}
void NemoThemeSpinner::setTransitionDurationDefault()
{
if (m_transitionDuration != 500) {
m_transitionDuration = 500;
emit transitionDurationChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMESPINNER_H
#define NEMOTHEMESPINNER_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeSpinner: public QObject
{
Q_OBJECT
Q_PROPERTY(int radius READ radius NOTIFY radiusChanged)
Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryColorChanged)
Q_PROPERTY(QColor secondaryColor READ secondaryColor NOTIFY secondaryColorChanged)
Q_PROPERTY(int horizontalSpacing READ horizontalSpacing NOTIFY horizontalSpacingChanged)
Q_PROPERTY(int verticalSpacing READ verticalSpacing NOTIFY verticalSpacingChanged)
Q_PROPERTY(int initialStateDuration READ initialStateDuration NOTIFY initialStateDurationChanged)
Q_PROPERTY(int transitionDuration READ transitionDuration NOTIFY transitionDurationChanged)
public:
explicit NemoThemeSpinner(QObject *parent = 0);
int radius() const;
void setRadius(int radius);
void setRadiusDefault();
QColor primaryColor() const;
void setPrimaryColor(const QColor &primaryColor);
QColor secondaryColor() const;
void setSecondaryColor(const QColor &secondaryColor);
int horizontalSpacing() const;
void setHorizontalSpacing(int horizontalSpacing);
void setHorizontalSpacingDefault();
int verticalSpacing() const;
void setVerticalSpacing(int verticalSpacing);
void setVerticalSpacingDefault();
int initialStateDuration() const;
void setInitialStateDuration(int initialStateDuration);
void setInitialStateDurationDefault();
int transitionDuration() const;
void setTransitionDuration(int transitionDuration);
void setTransitionDurationDefault();
Q_SIGNALS:
void radiusChanged();
void primaryColorChanged();
void secondaryColorChanged();
void horizontalSpacingChanged();
void verticalSpacingChanged();
void initialStateDurationChanged();
void transitionDurationChanged();
private:
int m_radius;
QColor m_primaryColor;
QColor m_secondaryColor;
int m_horizontalSpacing;
int m_verticalSpacing;
int m_initialStateDuration;
int m_transitionDuration;
};
#endif //NEMOTHEMESPINNER_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemetextfield.h"
NemoThemeTextField::NemoThemeTextField(QObject *parent)
: QObject(parent)
, m_pointSize(24)
, m_font("Open Sans")
{
}
QColor NemoThemeTextField::selectedTextColor() const
{
return m_selectedTextColor;
}
void NemoThemeTextField::setSelectedTextColor(const QColor &selectedTextColor)
{
if (m_selectedTextColor != selectedTextColor) {
m_selectedTextColor = selectedTextColor;
emit selectedTextColorChanged();
}
}
QColor NemoThemeTextField::selectionColor() const
{
return m_selectionColor;
}
void NemoThemeTextField::setSelectionColor(const QColor &selectionColor)
{
if (m_selectionColor != selectionColor) {
m_selectionColor = selectionColor;
emit selectionColorChanged();
}
}
int NemoThemeTextField::pointSize() const
{
return m_pointSize;
}
void NemoThemeTextField::setPointSize(int pointSize)
{
if (m_pointSize != pointSize) {
m_pointSize = pointSize;
emit pointSizeChanged();
}
}
void NemoThemeTextField::setPointSizeDefault()
{
if (m_pointSize != 24) {
m_pointSize = 24;
emit pointSizeChanged();
}
}
QString NemoThemeTextField::font() const
{
return m_font;
}
void NemoThemeTextField::setFont(const QString &font)
{
if (m_font != font) {
m_font = font;
emit fontChanged();
}
}
void NemoThemeTextField::setFontDefault()
{
if (m_font != "Open Sans") {
m_font = "Open Sans";
emit fontChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMETEXTFIELD_H
#define NEMOTHEMETEXTFIELD_H
#include <QtCore/QObject>
#include <QtGui/QColor>
#include <QtCore/QString>
class NemoThemeTextField: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor NOTIFY selectedTextColorChanged)
Q_PROPERTY(QColor selectionColor READ selectionColor NOTIFY selectionColorChanged)
Q_PROPERTY(int pointSize READ pointSize NOTIFY pointSizeChanged)
Q_PROPERTY(QString font READ font NOTIFY fontChanged)
public:
explicit NemoThemeTextField(QObject *parent = 0);
QColor selectedTextColor() const;
void setSelectedTextColor(const QColor &selectedTextColor);
QColor selectionColor() const;
void setSelectionColor(const QColor &selectionColor);
int pointSize() const;
void setPointSize(int pointSize);
void setPointSizeDefault();
QString font() const;
void setFont(const QString &font);
void setFontDefault();
Q_SIGNALS:
void selectedTextColorChanged();
void selectionColorChanged();
void pointSizeChanged();
void fontChanged();
private:
QColor m_selectedTextColor;
QColor m_selectionColor;
int m_pointSize;
QString m_font;
};
#endif //NEMOTHEMETEXTFIELD_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemetoolbar.h"
NemoThemeToolBar::NemoThemeToolBar(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeToolBar::background() const
{
return m_background;
}
void NemoThemeToolBar::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMETOOLBAR_H
#define NEMOTHEMETOOLBAR_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeToolBar: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
public:
explicit NemoThemeToolBar(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
Q_SIGNALS:
void backgroundChanged();
private:
QColor m_background;
};
#endif //NEMOTHEMETOOLBAR_H
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemewindow.h"
NemoThemeWindow::NemoThemeWindow(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeWindow::background() const
{
return m_background;
}
void NemoThemeWindow::setBackground(const QColor &background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMEWINDOW_H
#define NEMOTHEMEWINDOW_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class NemoThemeWindow: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor background READ background NOTIFY backgroundChanged)
public:
explicit NemoThemeWindow(QObject *parent = 0);
QColor background() const;
void setBackground(const QColor &background);
Q_SIGNALS:
void backgroundChanged();
private:
QColor m_background;
};
#endif //NEMOTHEMEWINDOW_H
<RCC>
<qresource prefix="/QtQuick/Controls/Styles/Nemo">
<file>themes/Colors.js</file>
<file>Images.js</file>
</qresource>
</RCC>
...@@ -20,42 +20,15 @@ ...@@ -20,42 +20,15 @@
#include "qquicknemostyleextensionplugin.h" #include "qquicknemostyleextensionplugin.h"
#include <QtQml> #include <QtQml>
#include "autogenerated/nemotheme.h"
QQuickNemoStyleExtensionPlugin::QQuickNemoStyleExtensionPlugin(QObject *parent) : QQuickNemoStyleExtensionPlugin::QQuickNemoStyleExtensionPlugin(QObject *parent) :
QQmlExtensionPlugin(parent) QQmlExtensionPlugin(parent)
{ {
} }
static QObject * nemo_theme_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
return new NemoTheme();
}
void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri) void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri)
{ {
Q_ASSERT(uri == QLatin1String("QtQuick.Controls.Styles.Nemo")); Q_ASSERT(uri == QLatin1String("QtQuick.Controls.Styles.Nemo"));
QString reason = QString("Cannot be created");
qmlRegisterUncreatableType<NemoTheme>(uri, 1, 0, "NemoTheme", reason);
qmlRegisterUncreatableType<NemoThemeButton>(uri, 1, 0, "NemoThemeButton", reason);
qmlRegisterUncreatableType<NemoThemeButtonPressedGradient>(uri, 1, 0, "NemoThemeButtonPressedGradient", reason);
qmlRegisterUncreatableType<NemoThemeButtonText>(uri, 1, 0, "NemoThemeButtonText", reason);
qmlRegisterUncreatableType<NemoThemeFont>(uri, 1, 0, "NemoThemeFont", reason);
qmlRegisterUncreatableType<NemoThemeGroove>(uri, 1, 0, "NemoThemeGroove", reason);
qmlRegisterUncreatableType<NemoThemeTextField>(uri, 1, 0, "NemoThemeTextField", reason);
qmlRegisterUncreatableType<NemoThemeToolBar>(uri, 1, 0, "NemoThemeToolBar", reason);
qmlRegisterUncreatableType<NemoThemeWindow>(uri, 1, 0, "NemoThemeWindow", reason);
qmlRegisterUncreatableType<NemoThemePage>(uri, 1, 0, "NemoThemePage", reason);
qmlRegisterUncreatableType<NemoThemeSpinner>(uri, 1, 0, "NemoThemeSpinner", reason);
qmlRegisterUncreatableType<NemoThemeLabel>(uri, 1, 0, "NemoThemeLabel", reason);
qmlRegisterUncreatableType<NemoThemeCheckbox>(uri, 1, 0, "NemoThemeCheckbox", reason);
qmlRegisterUncreatableType<NemoThemePageStack>(uri, 1, 0, "NemoThemePageStack", reason);
qmlRegisterUncreatableType<NemoThemeHeader>(uri, 1, 0, "NemoThemeHeader", reason);
qmlRegisterUncreatableType<NemoThemeHeaderDimmer>(uri, 1, 0, "NemoThemeHeaderDimmer", reason);
qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider);
} }
void QQuickNemoStyleExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri) void QQuickNemoStyleExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
......
...@@ -76,44 +76,10 @@ images.files = $$_PRO_FILE_PWD_/images/*.svg\ ...@@ -76,44 +76,10 @@ images.files = $$_PRO_FILE_PWD_/images/*.svg\
images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH/images/ images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH/images/
HEADERS += \ HEADERS += \
qquicknemostyleextensionplugin.h \ qquicknemostyleextensionplugin.h
autogenerated/nemotheme.h \
autogenerated/nemothemebutton.h \
autogenerated/nemothemebuttonpressedgradient.h \
autogenerated/nemothemebuttontext.h \
autogenerated/nemothemefont.h \
autogenerated/nemothemegroove.h \
autogenerated/nemothemetextfield.h \
autogenerated/nemothemetoolbar.h \
autogenerated/nemothemewindow.h \
autogenerated/nemothemepage.h \
autogenerated/nemothemespinner.h \
autogenerated/nemothemelabel.h \
autogenerated/nemothemecheckbox.h \
autogenerated/nemothemepagestack.h \
autogenerated/nemothemebuttonrow.h \
autogenerated/nemothemeheader.h \
autogenerated/nemothemeheaderdimmer.h
SOURCES += \ SOURCES += \
qquicknemostyleextensionplugin.cpp \ qquicknemostyleextensionplugin.cpp
autogenerated/nemotheme.cpp \
autogenerated/nemothemebutton.cpp \
autogenerated/nemothemebuttonpressedgradient.cpp \
autogenerated/nemothemebuttontext.cpp \
autogenerated/nemothemefont.cpp \
autogenerated/nemothemegroove.cpp \
autogenerated/nemothemetextfield.cpp \
autogenerated/nemothemetoolbar.cpp \
autogenerated/nemothemewindow.cpp \
autogenerated/nemothemepage.cpp \
autogenerated/nemothemespinner.cpp \
autogenerated/nemothemelabel.cpp \
autogenerated/nemothemecheckbox.cpp \
autogenerated/nemothemepagestack.cpp \
autogenerated/nemothemebuttonrow.cpp \
autogenerated/nemothemeheader.cpp \
autogenerated/nemothemeheaderdimmer.cpp
INSTALLS += target images qmlfiles themes INSTALLS += target images qmlfiles themes
......
How to use the components generator
1. Have python 2 installed (the script don't work with Python 3 yet)
2. Add the components in "components.json"
3. call "./themehelper.py components.json"
4. copy all the generated files to the style folder in src
5. qmlRegisterUncreatableType the new created components in qquicknemostyleextensionplugin.cpp and
adds them in the style.pro file
6. update theme files if needed
You can also run ./generate.sh in the tools folder instead of doing 3 and 4.
#!/usr/bin/python
# Copyright (C) 2013 Lucien Xu. <sfietkonstantin@free.fr>
#
# You may use this file under the terms of the BSD license as follows:
#
# "Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Nemo Mobile nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
import json
license = """/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
"""
# Used by formatting functions
basicTypes = ["int", "float", "double"]
# Formatting functions
def _getType(property):
if "type" in property:
return property["type"]
if "object" in property:
return "NemoTheme" + _getUpper(property["object"]) + " *"
return None
def _getArgumentType(property):
if "type" in property:
type = property["type"]
if type not in basicTypes:
return "const " + type + " &"
return type + " "
if "object" in property:
return "NemoTheme" + _getUpper(property["object"]) + " *"
return None
def _getUpper(name):
return name[0].upper() + name[1:]
# Generates some basic entries
# (includes, Q_PROPERTY macro, getter or setters etc)
def _getInclude(property):
if "type" in property:
type = property["type"]
if type in basicTypes:
return None
if type in ["QString", "QVariant", "QUrl", "QVariantMap", "QDateTime"]:
return "<QtCore/" + type + ">"
if type in ["QColor"]:
return "<QtGui/" + type + ">"
if "object" in property:
return "\"nemotheme" + property["object"].lower() + ".h\""
return None
def _getProperty(property):
propertyName = property["name"]
header = " Q_PROPERTY(" + _getType(property) + " " + propertyName
header += " READ " + propertyName
if "type" in property:
return header + " NOTIFY " + propertyName + "Changed)\n"
if "object" in property:
return header + " CONSTANT)\n"
def _getGetterSetter(property):
propertyName = property["name"]
header = " " + _getType(property) + " " + propertyName + "() const;\n"
if "type" in property:
header += " void set" + _getUpper(propertyName)
header += "(" + _getArgumentType(property) + propertyName + ");\n"
if "default" in property:
header += " void set" + _getUpper(propertyName) + "Default"
header += "();\n"
return header
def _getGetterSetterImpl(name, property):
propertyName = property["name"]
source = _getType(property) + " " + name + "::" + propertyName + "() const\n"
source += "{\n"
source += " return m_" + propertyName + ";\n"
source += "}\n"
source += "\n"
if "type" in property:
source += "void " + name + "::set" + _getUpper(propertyName)
source += "(" + _getArgumentType(property) + propertyName + ")\n"
source += "{\n"
source += " if (m_" + propertyName + " != " + propertyName + ") {\n"
source += " m_" + propertyName + " = " + propertyName + ";\n"
source += " emit " + propertyName + "Changed();\n"
source += " }\n"
source += "}\n"
source += "\n"
if "default" in property:
default = str(property["default"])
if isinstance(property["default"], str) or isinstance(property["default"], unicode):
default = "\"" + default + "\""
source += "void " + name + "::set" + _getUpper(propertyName) + "Default"
source += "()\n"
source += "{\n"
source += " if (m_" + propertyName + " != " + default + ") {\n"
source += " m_" + propertyName + " = " + default + ";\n"
source += " emit " + propertyName + "Changed();\n"
source += " }\n"
source += "}\n"
source += "\n"
return source
def _getSignal(property):
if "object" in property:
return ""
return " void " + property["name"] + "Changed();\n"
def _getLoadFromFile(name, data):
# Write helper methods that are used to parse theme file
source = """
static inline QJsonValue jsonValue(const QJsonObject &object, const QString &key,
const QString &objectName = QString())
{
if (!object.contains(key)) {
if (objectName.isEmpty()) {
qWarning() << "W" << "Root JSON object does not have value" << key;
} else {
qWarning() << "W" << "JSON Object" << objectName << "does not have value" << key;
}
return QJsonValue();
}
return object.value(key);
}
static inline QString jsonToString(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QString valueString = value.toString();
if (defines.contains(valueString)) {
return defines.value(valueString).toString();
}
return value.toString();
}
static inline QColor jsonToColor(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QString color = value.toString();
if (defines.contains(color)) {
color = defines.value(color).toString();
}
// We need to skip the warning caused by a null value,
// so we check if the color is not empty
if (!QColor::isValidColor(color) && !color.isEmpty()) {
qWarning() << "W" << color << "is not a valid color";
return QColor();
}
return QColor(color);
}
static inline int jsonToInt(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QJsonValue trueValue = value;
if (value.isString()) {
QString valueString = value.toString();
if (defines.contains(valueString)) {
trueValue = defines.value(valueString);
}
}
double doubleValue = trueValue.toDouble();
return (int) doubleValue;
}
static inline int jsonToDouble(const QJsonValue &value,
const QMap<QString, QJsonValue> &defines)
{
QJsonValue trueValue = value;
if (value.isString()) {
QString valueString = value.toString();
if (defines.contains(valueString)) {
trueValue = defines.value(valueString);
}
}
return trueValue.toDouble();
}
"""
# Generate the method that loads from file
source += "void " + name + "::loadFromFile(const QString &fileName)\n"
source += """{
QDir dir (THEME_DIR);
if (!dir.exists(fileName)) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file" << fileName << "does not exists.";
return;
}
QFile themeFile (dir.absoluteFilePath(fileName));
if (!themeFile.open(QIODevice::ReadOnly)) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file" << fileName << "could not be read.";
return;
}
QJsonParseError error;
QJsonDocument themeDocument = QJsonDocument::fromJson(themeFile.readAll(), &error);
themeFile.close();
if (error.error != QJsonParseError::NoError) {
qWarning() << "E" << Q_FUNC_INFO << "Cannot parse theme file:" << error.errorString();
return;
}
// Fetch all the defines
QMap<QString, QJsonValue> defines;
if (!themeDocument.isObject()) {
qWarning() << "E" << Q_FUNC_INFO << "Theme file has an invalid format";
return;
}
QJsonObject themeObject = themeDocument.object();
if (themeObject.contains(THEME_DEFINES_KEY)) {
QJsonValue definesJson = themeObject.value(THEME_DEFINES_KEY);
if (!definesJson.isObject()) {
qWarning() << "W" << Q_FUNC_INFO << "\\"defines\\" is not defined as an object";
} else {
QJsonObject definesObject = definesJson.toObject();
foreach (const QString key, definesObject.keys()) {
defines.insert(key, definesObject.value(key));
}
}
} else {
qWarning() << "W" << Q_FUNC_INFO
<< "Theme file does not contain a \\"defines\\" object. "\\
"Please add an empty \\"defines\\" object instead";
}
// Set the global values (name, description etc.)
setName(jsonValue(themeObject, THEME_NAME_KEY).toString());
setDescription(jsonValue(themeObject, THEME_DESCRIPTION_KEY).toString());
// Parse the defined objects
QJsonObject styles = jsonValue(themeObject, THEME_STYLES_KEY).toObject();
if (styles.isEmpty()) {
return;
}
"""
# We create a map of components that can be used
# to quickly retrieve a component based on the name
components = {}
for component in data["components"]:
components[component["name"]] = component["properties"]
for property in data["properties"]:
if "object" in property:
name = property["name"]
type = property["object"]
source += _getSetObject("styles", "m_" + name, name, components[type], components)
source += "}\n"
return source
def _getCasted(property, jsonObject, name, cppObject):
type = property["type"]
castedValue = None
value = "jsonValue(" + jsonObject + _getUpper(name) + ", \""
value += property["name"] + "\", \"" + name + "\")"
if "default" in property:
value = jsonObject + _getUpper(name) + ".value(\"" + property["name"] + "\")"
if type == "QString":
castedValue = "jsonToString(" + value + ", defines)"
elif type == "QColor":
castedValue = "jsonToColor(" + value + ", defines)"
elif type == "int":
castedValue = "jsonToInt(" + value + ", defines)"
elif type == "double":
castedValue = "jsonToDouble(" + value + ", defines)"
else:
print "\"" + type + "\" is not a known type. TODO !"
if castedValue == None:
return ""
if "default" in property:
data = " if (" + jsonObject + _getUpper(name) + ".contains(\""
data += property["name"] + "\")) {\n"
data += " " + cppObject + "->set" + _getUpper(property["name"])
data += "(" + castedValue + ");\n"
data += " } else {\n"
data += " " + cppObject + "->set" + _getUpper(property["name"]) + "Default();\n"
data += " }\n"
return data
else:
data = " " + cppObject + "->set" + _getUpper(property["name"])
data += "(" + castedValue + ");\n"
return data
# This method is used to generate the tree of components and set calls
# it will start with a root component property, try to load all properties
# from theme file (and ignore those already defined), and continue
# with children components.
def _getSetObject(jsonObject, cppObject, name, properties, components):
data = " // Setting properties for " + name + "\n"
data += " QJsonObject " + jsonObject + _getUpper(name) + " = " + jsonObject
data += ".value(\"" + name + "\").toObject();\n"
for property in properties:
if "object" in property:
type = property["object"]
data += _getSetObject(jsonObject + _getUpper(name),
cppObject + "->" + property["name"] + "()",
property["name"], components[type], components)
if "type" in property:
data += _getCasted(property, jsonObject, name, cppObject)
return data
def generate(data, writeThemeObject = False):
# If we have a name, we are generating a component,
# otherwise, we are generating the global theme object
if "name" in data:
name = "NemoTheme" + _getUpper(data["name"])
else:
name = "NemoTheme"
properties = []
if writeThemeObject:
properties.append({"name": "name", "type": "QString"})
properties.append({"name": "description", "type": "QString"})
for property in data["properties"]:
properties.append(property)
header = license
header += "#ifndef " + name.upper() + "_H\n"
header += "#define " + name.upper() + "_H\n"
header += "\n"
header += "#include <QtCore/QObject>\n"
includes = []
for property in properties:
include = _getInclude(property)
if include != None and not include in includes:
includes.append(include)
for include in includes:
header += "#include " + include + "\n"
header += "\n"
header += "class " + name + ": public QObject\n"
header += "{\n"
header += " Q_OBJECT\n"
# Generate properties
for property in properties:
header += _getProperty(property)
if writeThemeObject:
header += " Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT)\n"
header += "public:\n"
# Constructor
header += " explicit " + name + "(QObject *parent = 0);\n"
# Generates getters and setters
for property in properties:
header += _getGetterSetter(property)
if writeThemeObject:
header += " QString fontFamily() const;\n"
header += "public Q_SLOTS:\n"
header += " void loadFromFile(const QString &fileName);\n"
header += "Q_SIGNALS:\n"
# Generate signals
for property in properties:
header += _getSignal(property)
header += "private:\n"
# Generate private members
for property in properties:
header += " " + _getType(property) + " m_" + property["name"] + ";\n"
if writeThemeObject:
header += " QString m_fontFamily;\n"
header += "};\n"
header += "\n"
header += "#endif //" + name.upper() + "_H\n"
try:
f = open(name.lower() + ".h", "w")
f.write(header)
f.close()
except:
print "Failed to write to " + name.lower() + ".h"
return
source = license
source += "#include \"" + name.lower() + ".h\"\n"
if writeThemeObject:
# Adds the additional includes
source += "#include <QtCore/QDebug>\n#include <QtCore/QDir>\n#include <QtCore/QFile>\n"
source += "#include <QtCore/QJsonDocument>\n#include <QtCore/QJsonArray>\n"
source += "#include <QtCore/QJsonObject>\n#include <QtCore/QJsonValue>\n"
source += "#include <QtGui/QFontDatabase>\n"
source += "\n"
if writeThemeObject:
# Adds the additional defines
source += "static const char *GLACIER_THEME = \"glacier.json\";\n"
source += "static const char *THEME_NAME_KEY = \"name\";\n"
source += "static const char *THEME_DESCRIPTION_KEY = \"description\";\n"
source += "static const char *THEME_DEFINES_KEY = \"defines\";\n"
source += "static const char *THEME_STYLES_KEY = \"styles\";\n"
source += "\n"
# Generate constructor
source += name + "::" + name + "(QObject *parent)\n"
source += " : QObject(parent)\n"
# Init members if needed
for property in properties:
if "type" in property:
if "default" in property:
default = str(property["default"])
if isinstance(property["default"], str) or isinstance(property["default"], unicode):
default = "\"" + default + "\""
source += " , m_" + property["name"] + "(" + default + ")\n"
else:
if property["type"] in basicTypes:
if property["type"] == "int":
source += " , m_" + property["name"] + "(0)\n"
else:
source += " , m_" + property["name"] + "(0.)\n"
elif "object" in property:
source += " , m_" + property["name"] + "(new NemoTheme" + _getUpper(property["object"])
source += "(this))\n"
source += "{\n"
if writeThemeObject:
source += """ loadFromFile(GLACIER_THEME);
int id = QFontDatabase::addApplicationFont(\"""" + data["font"] + """\");
QStringList families = QFontDatabase::applicationFontFamilies(id);
if (families.isEmpty()) {
qWarning() << "W" << "Failed to load font" << QString(\"""" + data["font"] + """\");
return;
}
m_fontFamily = families.first();
"""
source += "}\n"
source += "\n"
# Generate getters and setters
for property in properties:
source += _getGetterSetterImpl(name, property)
source = source[:-1]
if writeThemeObject:
source += "\n"
source += "QString " + name + "::fontFamily() const\n"
source += "{\n"
source += " return m_fontFamily;\n"
source += "}\n"
source += _getLoadFromFile(name, data)
try:
f = open(name.lower() + ".cpp", "w")
f.write(source)
f.close()
except:
print "Failed to write to " + name.lower() + ".cpp"
return
{
"components": [
{
"name": "Button",
"properties": [
{
"name": "background",
"type": "QColor"
},
{
"name": "text",
"object": "ButtonText"
},
{
"name": "pressedGradient",
"object": "ButtonPressedGradient"
}
]
},
{
"name": "Groove",
"properties": [
{
"name": "background",
"type": "QColor"
},
{
"name": "foreground",
"type": "QColor"
}
]
},
{
"name": "TextField",
"properties": [
{
"name": "selectedTextColor",
"type": "QColor"
},
{
"name": "selectionColor",
"type": "QColor"
},
{
"name": "pointSize",
"type": "int",
"default": 24
},
{
"name": "font",
"type": "QString",
"default": "Open Sans"
}
]
},
{
"name": "ToolBar",
"properties": [
{
"name": "background",
"type": "QColor"
}
]
},
{
"name": "Window",
"properties": [
{
"name": "background",
"type": "QColor"
}
]
},
{
"name": "Page",
"properties": [
{
"name": "background",
"type": "QColor"
}
]
},
{
"name": "ButtonPressedGradient",
"properties": [
{
"name": "centerColor",
"type": "QColor"
},
{
"name": "edgeColor",
"type": "QColor"
},
{
"name": "width",
"type": "int",
"default": 240
},
{
"name": "height",
"type": "int",
"default": 240
},
{
"name": "center",
"type": "double",
"default": 0.29
},
{
"name": "edge",
"type": "double",
"default": 0.5
}
]
},
{
"name": "ButtonText",
"properties": [
{
"name": "color",
"type": "QColor"
},
{
"name": "font",
"object": "Font"
}
]
},
{
"name": "Font",
"properties": [
{
"name": "pointSize",
"type": "int",
"default": 24
},
{
"name": "weight",
"type": "int",
"default": 25
}
]
},
{
"name": "Spinner",
"properties": [
{
"name": "radius",
"type": "int",
"default": 32
},
{
"name": "primaryColor",
"type": "QColor"
},
{
"name": "secondaryColor",
"type": "QColor"
},
{
"name": "horizontalSpacing",
"type": "int",
"default": 15
},
{
"name": "verticalSpacing",
"type": "int",
"default": 15
},
{
"name": "initialStateDuration",
"type": "int",
"default": 1500
},
{
"name": "transitionDuration",
"type": "int",
"default": 500
}
]
},
{
"name": "Label",
"properties": [
{
"name":"color",
"type":"QColor"
},
{
"name": "pointSize",
"type": "int",
"default": 24
}
]
},
{
"name": "Checkbox",
"properties": [
{
"name": "back1",
"type": "QColor"
},
{
"name": "back2",
"type": "QColor"
}
]
},
{
"name": "PageStack",
"properties": [
{
"name": "transitionDuration",
"type": "int",
"default": 500
}
]
},
{
"name": "ButtonRow",
"properties": [
{
"name": "background",
"type": "QColor"
},
{
"name": "buttonColor",
"type": "QColor"
}
]
},
{
"name": "Header",
"properties": [
{
"name": "background",
"type": "QColor"
},
{
"name": "dimmer",
"object": "HeaderDimmer"
}
]
},
{
"name": "HeaderDimmer",
"properties": [
{
"name": "startColor",
"type": "QColor"
},
{
"name": "endColor",
"type": "QColor"
},
{
"name": "height",
"type": "int",
"default": 16
},
{
"name": "startPosition",
"type": "double",
"default": 0
},
{
"name": "endPosition",
"type": "double",
"default": 1.0
}
]
}
],
"properties": [
{
"name": "button",
"object": "Button"
},
{
"name": "primaryButton",
"object": "Button"
},
{
"name": "groove",
"object": "Groove"
},
{
"name": "textField",
"object": "TextField"
},
{
"name": "toolBar",
"object": "ToolBar"
},
{
"name": "window",
"object": "Window"
},
{
"name": "page",
"object": "Page"
},
{
"name": "pageStack",
"object": "PageStack"
},
{
"name": "spinner",
"object": "Spinner"
},
{
"name": "label",
"object": "Label"
},
{
"name": "checkbox",
"object": "Checkbox"
},
{
"name": "buttonRow",
"object": "ButtonRow"
},
{
"name": "header",
"object": "Header"
}
],
"font": "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"
}
# Copyright (C) 2013 Jolla Ltd. <chris.adams@jollamobile.com>
#
# You may use this file under the terms of the BSD license as follows:
#
# "Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Nemo Mobile nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
def includeGuard(name):
return name.replace("_", "").upper() + "_H"
def upperCamelCase(name):
camelCased = camelCase(split(name))
return camelCased[0].upper() + camelCased[1:]
def camelCase(name):
splitted = split(name)
newSplitted = []
for splittedWord in splitted:
splittedWord = splittedWord.lower()
splittedWord = splittedWord[0].upper() + splittedWord[1:]
newSplitted.append(splittedWord)
camelCase = "".join(newSplitted)
camelCase = camelCase[0].lower() + camelCase[1:]
return camelCase
def split(name):
return name.split("_")
def addSpaces(string, size):
spacesToAdd = max(size - len(string), 0)
return string + (" " * spacesToAdd)
#!/bin/sh
./themehelper.py components.json
mv *.h ../../src/styles/autogenerated/
mv *.cpp ../../src/styles/autogenerated/
#!/usr/bin/python
# Copyright (C) 2013 Lucien Xu. <sfietkonstantin@free.fr>
#
# You may use this file under the terms of the BSD license as follows:
#
# "Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Nemo Mobile nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
# Generates components from a JSON description file
#
# This script generates components from a JSON description file.
# The JSON description file have the following organization
# {
# "components": [
# list of components
# ],
# "properties": [ list of properties ],
# "font": "/path/to/some_font.ttf"
# }
#
# The "components" is the list of components that should be generated.
# Each component have a "name", and a list of "properties". A property
# is a list of objects defined this way:
# {
# "name": "someName",
# "type": "some_type",
# ["default": some_value]
# }
# or
# {
# "name": "someName",
# "object": "some_object"
# }
#
# The first variation defines a simple property. "type" field should
# contain the name of either a basic type, like int, or float, or
# a Qt object, like QColor and QString. The optional "default" field
# contains a default value that is embedded in the component.
# Properties with default values don't need to be defined in the
# theme file.
#
# The second variation contains an object definition. Usually, an
# object defines a complex type, that needs several basic types to be
# defined, like a gradient, that needs 2 colors, and maybe a radius.
#
# The "properties" field of the root object behave the same, and
# describes the properties that the Theme object have. Note that
# "name" and "description" are automatically provided by the
# script, and don't need to be defined in the properties.
#
# The last field is the font. It provides the default font that
# is available from the Theme object.
import json
import classgenerator
import argparse
def generate(descriptionFile):
# First, we try to open JSON description file
try:
f = open(descriptionFile)
except:
print "Failed to open " + descriptionFile
return
data = json.load(f)
classgenerator.generate(data, True)
for componentData in data["components"]:
classgenerator.generate(componentData)
# Main
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Theme helper')
parser.add_argument('description_file', metavar='description_file', type=str,
help="""Input description file (JSON)""")
args = parser.parse_args()
description_file = args.description_file
generate(description_file)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment