Commit 94f6ec9f authored by Andrea Bernabei's avatar Andrea Bernabei

[styling] Add ToolBarStyle and its corresponding theme object

parent 23a2d156
...@@ -64,9 +64,7 @@ ApplicationWindow { ...@@ -64,9 +64,7 @@ ApplicationWindow {
} }
} }
toolBar: BorderImage { toolBar: ToolBar {
border.bottom: 8
source: "images/toolbar.png"
width: parent.width width: parent.width
height: 100 height: 100
......
...@@ -18,7 +18,21 @@ ...@@ -18,7 +18,21 @@
*/ */
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls.Styles.Private 1.0 import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Styles.Nemo 1.0
ToolBarStyle { Style {
padding.left: 6
padding.right: 6
padding.top: 3
padding.bottom: 3
property Component panel: Item {
implicitHeight: 75
implicitWidth: 400
Rectangle {
anchors.fill: parent
color: Theme.toolBar.background
}
}
} }
...@@ -42,6 +42,7 @@ NemoTheme::NemoTheme(QObject *parent) ...@@ -42,6 +42,7 @@ NemoTheme::NemoTheme(QObject *parent)
, m_primaryButton(new NemoThemeButton(this)) , m_primaryButton(new NemoThemeButton(this))
, m_groove(new NemoThemeGroove(this)) , m_groove(new NemoThemeGroove(this))
, m_textField(new NemoThemeTextField(this)) , m_textField(new NemoThemeTextField(this))
, m_toolBar(new NemoThemeToolBar(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");
...@@ -99,6 +100,11 @@ NemoThemeTextField * NemoTheme::textField() const ...@@ -99,6 +100,11 @@ NemoThemeTextField * NemoTheme::textField() const
return m_textField; return m_textField;
} }
NemoThemeToolBar * NemoTheme::toolBar() const
{
return m_toolBar;
}
QString NemoTheme::fontFamily() const QString NemoTheme::fontFamily() const
{ {
return m_fontFamily; return m_fontFamily;
...@@ -303,4 +309,7 @@ void NemoTheme::loadFromFile(const QString &fileName) ...@@ -303,4 +309,7 @@ void NemoTheme::loadFromFile(const QString &fileName)
QJsonObject stylesTextField = styles.value("textField").toObject(); QJsonObject stylesTextField = styles.value("textField").toObject();
m_textField->setSelectedTextColor(jsonToColor(jsonValue(stylesTextField, "selectedTextColor", "textField"), defines)); m_textField->setSelectedTextColor(jsonToColor(jsonValue(stylesTextField, "selectedTextColor", "textField"), defines));
m_textField->setSelectionColor(jsonToColor(jsonValue(stylesTextField, "selectionColor", "textField"), defines)); m_textField->setSelectionColor(jsonToColor(jsonValue(stylesTextField, "selectionColor", "textField"), defines));
// Setting properties for toolBar
QJsonObject stylesToolBar = styles.value("toolBar").toObject();
m_toolBar->setBackground(jsonToColor(jsonValue(stylesToolBar, "background", "toolBar"), defines));
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "nemothemebutton.h" #include "nemothemebutton.h"
#include "nemothemegroove.h" #include "nemothemegroove.h"
#include "nemothemetextfield.h" #include "nemothemetextfield.h"
#include "nemothemetoolbar.h"
class NemoTheme: public QObject class NemoTheme: public QObject
{ {
...@@ -38,6 +39,7 @@ class NemoTheme: public QObject ...@@ -38,6 +39,7 @@ class NemoTheme: public QObject
Q_PROPERTY(NemoThemeButton * primaryButton READ primaryButton CONSTANT) Q_PROPERTY(NemoThemeButton * primaryButton READ primaryButton CONSTANT)
Q_PROPERTY(NemoThemeGroove * groove READ groove CONSTANT) Q_PROPERTY(NemoThemeGroove * groove READ groove CONSTANT)
Q_PROPERTY(NemoThemeTextField * textField READ textField CONSTANT) Q_PROPERTY(NemoThemeTextField * textField READ textField CONSTANT)
Q_PROPERTY(NemoThemeToolBar * toolBar READ toolBar 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);
...@@ -49,6 +51,7 @@ public: ...@@ -49,6 +51,7 @@ public:
NemoThemeButton * primaryButton() const; NemoThemeButton * primaryButton() const;
NemoThemeGroove * groove() const; NemoThemeGroove * groove() const;
NemoThemeTextField * textField() const; NemoThemeTextField * textField() const;
NemoThemeToolBar * toolBar() const;
QString fontFamily() const; QString fontFamily() const;
public Q_SLOTS: public Q_SLOTS:
void loadFromFile(const QString &fileName); void loadFromFile(const QString &fileName);
...@@ -62,6 +65,7 @@ private: ...@@ -62,6 +65,7 @@ private:
NemoThemeButton * m_primaryButton; NemoThemeButton * m_primaryButton;
NemoThemeGroove * m_groove; NemoThemeGroove * m_groove;
NemoThemeTextField * m_textField; NemoThemeTextField * m_textField;
NemoThemeToolBar * m_toolBar;
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 "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
...@@ -45,6 +45,7 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri) ...@@ -45,6 +45,7 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<NemoThemeFont>(uri, 1, 0, "NemoThemeFont", reason); qmlRegisterUncreatableType<NemoThemeFont>(uri, 1, 0, "NemoThemeFont", reason);
qmlRegisterUncreatableType<NemoThemeGroove>(uri, 1, 0, "NemoThemeGroove", reason); qmlRegisterUncreatableType<NemoThemeGroove>(uri, 1, 0, "NemoThemeGroove", reason);
qmlRegisterUncreatableType<NemoThemeTextField>(uri, 1, 0, "NemoThemeTextField", reason); qmlRegisterUncreatableType<NemoThemeTextField>(uri, 1, 0, "NemoThemeTextField", reason);
qmlRegisterUncreatableType<NemoThemeToolBar>(uri, 1, 0, "NemoThemeToolBar", reason);
qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider); qmlRegisterSingletonType<QObject>(uri, 1, 0, "Theme", nemo_theme_provider);
} }
......
...@@ -84,7 +84,8 @@ HEADERS += \ ...@@ -84,7 +84,8 @@ HEADERS += \
autogenerated/nemothemebuttontext.h \ autogenerated/nemothemebuttontext.h \
autogenerated/nemothemefont.h \ autogenerated/nemothemefont.h \
autogenerated/nemothemegroove.h \ autogenerated/nemothemegroove.h \
autogenerated/nemothemetextfield.h autogenerated/nemothemetextfield.h \
autogenerated/nemothemetoolbar.h
SOURCES += \ SOURCES += \
qquicknemostyleextensionplugin.cpp \ qquicknemostyleextensionplugin.cpp \
...@@ -94,7 +95,8 @@ SOURCES += \ ...@@ -94,7 +95,8 @@ SOURCES += \
autogenerated/nemothemebuttontext.cpp \ autogenerated/nemothemebuttontext.cpp \
autogenerated/nemothemefont.cpp \ autogenerated/nemothemefont.cpp \
autogenerated/nemothemegroove.cpp \ autogenerated/nemothemegroove.cpp \
autogenerated/nemothemetextfield.cpp autogenerated/nemothemetextfield.cpp \
autogenerated/nemothemetoolbar.cpp
INSTALLS += target images qmlfiles themes INSTALLS += target images qmlfiles themes
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
"textField": { "textField": {
"selectedTextColor": "#ffffff", "selectedTextColor": "#ffffff",
"selectionColor": "#0091e5" "selectionColor": "#0091e5"
},
"toolBar": {
"background": "#000000"
} }
} }
} }
...@@ -44,6 +44,15 @@ ...@@ -44,6 +44,15 @@
} }
] ]
}, },
{
"name": "ToolBar",
"properties": [
{
"name": "background",
"type": "QColor"
}
]
},
...@@ -128,6 +137,10 @@ ...@@ -128,6 +137,10 @@
{ {
"name": "textField", "name": "textField",
"object": "TextField" "object": "TextField"
},
{
"name": "toolBar",
"object": "ToolBar"
} }
], ],
"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