Commit aafd0897 authored by Lucien XU's avatar Lucien XU

Added support for groove and text field

parent 99c67307
...@@ -24,11 +24,11 @@ Component { ...@@ -24,11 +24,11 @@ Component {
Rectangle { Rectangle {
implicitHeight: 16 implicitHeight: 16
implicitWidth: 440 implicitWidth: 440
color: Theme.groove.backgroundColor color: Theme.groove.background
Rectangle { Rectangle {
antialiasing: true antialiasing: true
radius: 1 radius: 1
color: Theme.groove.foregroundColor color: Theme.groove.foreground
height: parent.height height: parent.height
width: parent.width * control.value / control.maximumValue width: parent.width * control.value / control.maximumValue
} }
......
...@@ -40,6 +40,8 @@ NemoTheme::NemoTheme(QObject *parent) ...@@ -40,6 +40,8 @@ NemoTheme::NemoTheme(QObject *parent)
: QObject(parent) : QObject(parent)
, m_button(new NemoThemeButton(this)) , m_button(new NemoThemeButton(this))
, m_primaryButton(new NemoThemeButton(this)) , m_primaryButton(new NemoThemeButton(this))
, m_groove(new NemoThemeGroove(this))
, m_textField(new NemoThemeTextField(this))
{ {
loadFromFile(GLACIER_THEME); loadFromFile(GLACIER_THEME);
int id = QFontDatabase::addApplicationFont("/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"); int id = QFontDatabase::addApplicationFont("/usr/share/fonts/google-opensans/OpenSans-Regular.ttf");
...@@ -87,6 +89,16 @@ NemoThemeButton * NemoTheme::primaryButton() const ...@@ -87,6 +89,16 @@ NemoThemeButton * NemoTheme::primaryButton() const
return m_primaryButton; return m_primaryButton;
} }
NemoThemeGroove * NemoTheme::groove() const
{
return m_groove;
}
NemoThemeTextField * NemoTheme::textField() const
{
return m_textField;
}
QString NemoTheme::fontFamily() const QString NemoTheme::fontFamily() const
{ {
return m_fontFamily; return m_fontFamily;
...@@ -281,4 +293,12 @@ void NemoTheme::loadFromFile(const QString &fileName) ...@@ -281,4 +293,12 @@ void NemoTheme::loadFromFile(const QString &fileName)
if (stylesPrimaryButtonPressedGradient.contains("edge")) { if (stylesPrimaryButtonPressedGradient.contains("edge")) {
m_primaryButton->pressedGradient()->setEdge(jsonToDouble(stylesPrimaryButton.value("pressedGradient"), defines)); m_primaryButton->pressedGradient()->setEdge(jsonToDouble(stylesPrimaryButton.value("pressedGradient"), defines));
} }
// 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));
} }
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QString> #include <QtCore/QString>
#include "nemothemebutton.h" #include "nemothemebutton.h"
#include "nemothemegroove.h"
#include "nemothemetextfield.h"
class NemoTheme: public QObject class NemoTheme: public QObject
{ {
...@@ -34,6 +36,8 @@ class NemoTheme: public QObject ...@@ -34,6 +36,8 @@ class NemoTheme: public QObject
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
Q_PROPERTY(NemoThemeButton * button READ button CONSTANT) Q_PROPERTY(NemoThemeButton * button READ button CONSTANT)
Q_PROPERTY(NemoThemeButton * primaryButton READ primaryButton CONSTANT) Q_PROPERTY(NemoThemeButton * primaryButton READ primaryButton CONSTANT)
Q_PROPERTY(NemoThemeGroove * groove READ groove CONSTANT)
Q_PROPERTY(NemoThemeTextField * textField READ textField CONSTANT)
Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT) Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT)
public: public:
explicit NemoTheme(QObject *parent = 0); explicit NemoTheme(QObject *parent = 0);
...@@ -43,6 +47,8 @@ public: ...@@ -43,6 +47,8 @@ public:
void setDescription(QString description); void setDescription(QString description);
NemoThemeButton * button() const; NemoThemeButton * button() const;
NemoThemeButton * primaryButton() const; NemoThemeButton * primaryButton() const;
NemoThemeGroove * groove() const;
NemoThemeTextField * textField() const;
QString fontFamily() const; QString fontFamily() const;
public Q_SLOTS: public Q_SLOTS:
void loadFromFile(const QString &fileName); void loadFromFile(const QString &fileName);
...@@ -54,6 +60,8 @@ private: ...@@ -54,6 +60,8 @@ private:
QString m_description; QString m_description;
NemoThemeButton * m_button; NemoThemeButton * m_button;
NemoThemeButton * m_primaryButton; NemoThemeButton * m_primaryButton;
NemoThemeGroove * m_groove;
NemoThemeTextField * m_textField;
QString m_fontFamily; QString m_fontFamily;
}; };
......
/*
* 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(QColor background)
{
if (m_background != background) {
m_background = background;
emit backgroundChanged();
}
}
QColor NemoThemeGroove::foreground() const
{
return m_foreground;
}
void NemoThemeGroove::setForeground(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(QColor background);
QColor foreground() const;
void setForeground(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 "nemothemetextfield.h"
NemoThemeTextField::NemoThemeTextField(QObject *parent)
: QObject(parent)
{
}
QColor NemoThemeTextField::selectedTextColor() const
{
return m_selectedTextColor;
}
void NemoThemeTextField::setSelectedTextColor(QColor selectedTextColor)
{
if (m_selectedTextColor != selectedTextColor) {
m_selectedTextColor = selectedTextColor;
emit selectedTextColorChanged();
}
}
QColor NemoThemeTextField::selectionColor() const
{
return m_selectionColor;
}
void NemoThemeTextField::setSelectionColor(QColor selectionColor)
{
if (m_selectionColor != selectionColor) {
m_selectionColor = selectionColor;
emit selectionColorChanged();
}
}
/*
* 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>
class NemoThemeTextField: public QObject
{
Q_OBJECT
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor NOTIFY selectedTextColorChanged)
Q_PROPERTY(QColor selectionColor READ selectionColor NOTIFY selectionColorChanged)
public:
explicit NemoThemeTextField(QObject *parent = 0);
QColor selectedTextColor() const;
void setSelectedTextColor(QColor selectedTextColor);
QColor selectionColor() const;
void setSelectionColor(QColor selectionColor);
Q_SIGNALS:
void selectedTextColorChanged();
void selectionColorChanged();
private:
QColor m_selectedTextColor;
QColor m_selectionColor;
};
#endif //NEMOTHEMETEXTFIELD_H
...@@ -43,6 +43,8 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri) ...@@ -43,6 +43,8 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<NemoThemeButtonPressedGradient>(uri, 1, 0, "NemoThemeButtonPressedGradient", reason); qmlRegisterUncreatableType<NemoThemeButtonPressedGradient>(uri, 1, 0, "NemoThemeButtonPressedGradient", reason);
qmlRegisterUncreatableType<NemoThemeButtonText>(uri, 1, 0, "NemoThemeButtonText", reason); qmlRegisterUncreatableType<NemoThemeButtonText>(uri, 1, 0, "NemoThemeButtonText", reason);
qmlRegisterUncreatableType<NemoThemeFont>(uri, 1, 0, "NemoThemeFont", reason); qmlRegisterUncreatableType<NemoThemeFont>(uri, 1, 0, "NemoThemeFont", reason);
qmlRegisterUncreatableType<NemoThemeGroove>(uri, 1, 0, "NemoThemeGroove", reason);
qmlRegisterUncreatableType<NemoThemeTextField>(uri, 1, 0, "NemoThemeTextField", reason);
qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider); qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider);
} }
......
...@@ -82,6 +82,8 @@ HEADERS += \ ...@@ -82,6 +82,8 @@ HEADERS += \
nemothemebuttonpressedgradient.h \ nemothemebuttonpressedgradient.h \
nemothemebuttontext.h \ nemothemebuttontext.h \
nemothemefont.h \ nemothemefont.h \
nemothemegroove.h \
nemothemetextfield.h \
nemotheme.h nemotheme.h
SOURCES += \ SOURCES += \
...@@ -90,6 +92,8 @@ SOURCES += \ ...@@ -90,6 +92,8 @@ SOURCES += \
nemothemebuttonpressedgradient.cpp \ nemothemebuttonpressedgradient.cpp \
nemothemebuttontext.cpp \ nemothemebuttontext.cpp \
nemothemefont.cpp \ nemothemefont.cpp \
nemothemegroove.cpp \
nemothemetextfield.cpp \
nemotheme.cpp nemotheme.cpp
INSTALLS += target images qmlfiles themes INSTALLS += target images qmlfiles themes
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"description": "Glacier theme", "description": "Glacier theme",
"defines": { "defines": {
"accentColor": "#0091e5", "accentColor": "#0091e5",
"fillColor": "#474747" "fillColor": "#474747",
"fillColorDark": "#313131"
}, },
"styles": { "styles": {
"button": { "button": {
...@@ -28,6 +29,14 @@ ...@@ -28,6 +29,14 @@
"centerColor": "white", "centerColor": "white",
"edgeColor": "accentColor" "edgeColor": "accentColor"
} }
},
"groove": {
"foreground": "accentColor",
"background": "fillColorDark"
},
"textField": {
"selectedTextColor": "#ffffff",
"selectionColor": "#0091e5"
} }
} }
} }
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
"description": "Ugly test theme", "description": "Ugly test theme",
"defines": { "defines": {
"accentColor": "#FF7F00", "accentColor": "#FF7F00",
"fillColor": "#474747" "fillColor": "#474747",
"fillColorDark": "#202020"
}, },
"styles": { "styles": {
"button": { "button": {
...@@ -28,6 +29,14 @@ ...@@ -28,6 +29,14 @@
"centerColor": "white", "centerColor": "white",
"edgeColor": "accentColor" "edgeColor": "accentColor"
} }
},
"groove": {
"foreground": "accentColor",
"background": "fillColorDark"
},
"textField": {
"selectedTextColor": "#ffffff",
"selectionColor": "#0091e5"
} }
} }
} }
...@@ -77,6 +77,33 @@ ...@@ -77,6 +77,33 @@
"default": 25 "default": 25
} }
] ]
},
{
"name": "Groove",
"properties": [
{
"name": "background",
"type": "QColor"
},
{
"name": "foreground",
"type": "QColor"
}
]
},
{
"name": "TextField",
"properties": [
{
"name": "selectedTextColor",
"type": "QColor"
},
{
"name": "selectionColor",
"type": "QColor"
}
]
} }
], ],
"properties": [ "properties": [
...@@ -87,6 +114,14 @@ ...@@ -87,6 +114,14 @@
{ {
"name": "primaryButton", "name": "primaryButton",
"object": "Button" "object": "Button"
},
{
"name": "groove",
"object": "Groove"
},
{
"name": "textField",
"object": "TextField"
} }
], ],
"font": "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf" "font": "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"
......
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