Commit da72638a authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Merge pull request #29 from locusf/master

[font] Set TextField font to Open Sans, fixes NEMO#711.
parents c1c8f53b 0548bed8
...@@ -26,6 +26,7 @@ TextFieldStyle { ...@@ -26,6 +26,7 @@ TextFieldStyle {
selectionColor: Theme.textField.selectionColor selectionColor: Theme.textField.selectionColor
textColor: Theme.textField.selectedTextColor textColor: Theme.textField.selectedTextColor
font.pixelSize: Theme.textField.pointSize font.pixelSize: Theme.textField.pointSize
font.family: Theme.textField.font
background: Item { background: Item {
implicitHeight: 40 implicitHeight: 40
implicitWidth: 320 implicitWidth: 320
......
...@@ -386,6 +386,11 @@ void NemoTheme::loadFromFile(const QString &fileName) ...@@ -386,6 +386,11 @@ void NemoTheme::loadFromFile(const QString &fileName)
} else { } else {
m_textField->setPointSizeDefault(); m_textField->setPointSizeDefault();
} }
if (stylesTextField.contains("font")) {
m_textField->setFont(jsonToString(stylesTextField.value("font"), defines));
} else {
m_textField->setFontDefault();
}
// Setting properties for toolBar // Setting properties for toolBar
QJsonObject stylesToolBar = styles.value("toolBar").toObject(); QJsonObject stylesToolBar = styles.value("toolBar").toObject();
m_toolBar->setBackground(jsonToColor(jsonValue(stylesToolBar, "background", "toolBar"), defines)); m_toolBar->setBackground(jsonToColor(jsonValue(stylesToolBar, "background", "toolBar"), defines));
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
NemoThemeTextField::NemoThemeTextField(QObject *parent) NemoThemeTextField::NemoThemeTextField(QObject *parent)
: QObject(parent) : QObject(parent)
, m_pointSize(24) , m_pointSize(24)
, m_font("Open Sans")
{ {
} }
...@@ -74,3 +75,24 @@ void NemoThemeTextField::setPointSizeDefault() ...@@ -74,3 +75,24 @@ void NemoThemeTextField::setPointSizeDefault()
emit pointSizeChanged(); 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 @@ ...@@ -25,6 +25,7 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtCore/QString>
class NemoThemeTextField: public QObject class NemoThemeTextField: public QObject
{ {
...@@ -32,6 +33,7 @@ class NemoThemeTextField: public QObject ...@@ -32,6 +33,7 @@ class NemoThemeTextField: public QObject
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor NOTIFY selectedTextColorChanged)
Q_PROPERTY(QColor selectionColor READ selectionColor NOTIFY selectionColorChanged) Q_PROPERTY(QColor selectionColor READ selectionColor NOTIFY selectionColorChanged)
Q_PROPERTY(int pointSize READ pointSize NOTIFY pointSizeChanged) Q_PROPERTY(int pointSize READ pointSize NOTIFY pointSizeChanged)
Q_PROPERTY(QString font READ font NOTIFY fontChanged)
public: public:
explicit NemoThemeTextField(QObject *parent = 0); explicit NemoThemeTextField(QObject *parent = 0);
QColor selectedTextColor() const; QColor selectedTextColor() const;
...@@ -41,14 +43,19 @@ public: ...@@ -41,14 +43,19 @@ public:
int pointSize() const; int pointSize() const;
void setPointSize(int pointSize); void setPointSize(int pointSize);
void setPointSizeDefault(); void setPointSizeDefault();
QString font() const;
void setFont(const QString &font);
void setFontDefault();
Q_SIGNALS: Q_SIGNALS:
void selectedTextColorChanged(); void selectedTextColorChanged();
void selectionColorChanged(); void selectionColorChanged();
void pointSizeChanged(); void pointSizeChanged();
void fontChanged();
private: private:
QColor m_selectedTextColor; QColor m_selectedTextColor;
QColor m_selectionColor; QColor m_selectionColor;
int m_pointSize; int m_pointSize;
QString m_font;
}; };
#endif //NEMOTHEMETEXTFIELD_H #endif //NEMOTHEMETEXTFIELD_H
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
}, },
"textField": { "textField": {
"selectedTextColor": "#ffffff", "selectedTextColor": "#ffffff",
"selectionColor": "#0091e5" "selectionColor": "#0091e5",
"font": "Open Sans"
}, },
"toolBar": { "toolBar": {
"background": "#000000" "background": "#000000"
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
"name": "pointSize", "name": "pointSize",
"type": "int", "type": "int",
"default": 24 "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