Commit 0548bed8 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

[font] Set TextField font to Open Sans, fixes NEMO#711.

Also set the font via Theme object as instructed. This is now indicated in glacier.json.
parent c1c8f53b
......@@ -26,6 +26,7 @@ TextFieldStyle {
selectionColor: Theme.textField.selectionColor
textColor: Theme.textField.selectedTextColor
font.pixelSize: Theme.textField.pointSize
font.family: Theme.textField.font
background: Item {
implicitHeight: 40
implicitWidth: 320
......
......@@ -386,6 +386,11 @@ void NemoTheme::loadFromFile(const QString &fileName)
} 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));
......
......@@ -25,6 +25,7 @@
NemoThemeTextField::NemoThemeTextField(QObject *parent)
: QObject(parent)
, m_pointSize(24)
, m_font("Open Sans")
{
}
......@@ -74,3 +75,24 @@ void NemoThemeTextField::setPointSizeDefault()
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();
}
}
......@@ -25,6 +25,7 @@
#include <QtCore/QObject>
#include <QtGui/QColor>
#include <QtCore/QString>
class NemoThemeTextField: public QObject
{
......@@ -32,6 +33,7 @@ class NemoThemeTextField: public QObject
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;
......@@ -41,14 +43,19 @@ public:
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
......@@ -36,7 +36,8 @@
},
"textField": {
"selectedTextColor": "#ffffff",
"selectionColor": "#0091e5"
"selectionColor": "#0091e5",
"font": "Open Sans"
},
"toolBar": {
"background": "#000000"
......
......@@ -46,7 +46,12 @@
"name": "pointSize",
"type": "int",
"default": 24
}
},
{
"name": "font",
"type": "QString",
"default": "Open Sans"
}
]
},
{
......
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