diff --git a/src/controls/qml/Button.qml b/src/controls/qml/Button.qml index 0ac4f39..0bf80db 100644 --- a/src/controls/qml/Button.qml +++ b/src/controls/qml/Button.qml @@ -96,14 +96,19 @@ Button { // The label of the button. contentItem: Text { - renderType: Text.NativeRendering + FontLoader { + id: localFont + source: Theme.fontPath + } + verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter text: control.text color: Theme.textColor - font.family: Theme.fontFamily font.pixelSize: Theme.fontSizeMedium font.weight: control.primary ? Theme.fontWeightLarge : Theme.fontWeightMedium + font.family: localFont.font.family + font.styleName: localFont.font.styleName opacity: control.enabled ? 1.0 : 0.7 } } diff --git a/src/controls/qml/HeaderToolsLayout.qml b/src/controls/qml/HeaderToolsLayout.qml index 896f166..e51cb9e 100644 --- a/src/controls/qml/HeaderToolsLayout.qml +++ b/src/controls/qml/HeaderToolsLayout.qml @@ -119,7 +119,7 @@ Item { right: parent.right verticalCenter: parent.verticalCenter } - height: toolsLayoutItem.height + height: toolsLayoutItem.height/2 width: height visible: drawerLevels && drawerLevels.length > 1 diff --git a/src/controls/qml/Label.qml b/src/controls/qml/Label.qml index 76c3cb3..31609ce 100644 --- a/src/controls/qml/Label.qml +++ b/src/controls/qml/Label.qml @@ -32,10 +32,13 @@ import QtQuick 2.6 import Nemo Text { - renderType: Text.NativeRendering - font.family: Theme.fontFamily + FontLoader { + id: localFont + source: Theme.fontPath + } color: Theme.textColor font.pixelSize: Theme.fontSizeMedium - font.weight: Font.Light + font.family: localFont.font.family + font.styleName: localFont.font.styleName elide: horizontalAlignment == Text.AlignLeft ? Text.ElideRight : (horizontalAlignment == Text.AlignRight ? Text.ElideLeft : Text.ElideMiddle) } diff --git a/src/controls/qml/TextField.qml b/src/controls/qml/TextField.qml index 5873632..1ab0273 100644 --- a/src/controls/qml/TextField.qml +++ b/src/controls/qml/TextField.qml @@ -41,12 +41,21 @@ TextField { selectedTextColor: Theme.textColor selectionColor: Theme.accentColor font.pixelSize: Theme.fontSizeMedium - font.family: Theme.fontFamily + font.family: localFont.font.family + font.styleName: localFont.font.styleName placeholderTextColor: Theme.fillColor + FontLoader { + id: localFont + source: Theme.fontPath + } + onActiveFocusChanged: { - if(activeFocus) NemoFocus.nemoregister(this) - else NemoFocus.nemoregister(null) + if(activeFocus) { + NemoFocus.nemoregister(this) + } else { + NemoFocus.nemoregister(null) + } } background: Item { diff --git a/src/controls/qml/ToolButton.qml b/src/controls/qml/ToolButton.qml index d959dac..981ff5a 100644 --- a/src/controls/qml/ToolButton.qml +++ b/src/controls/qml/ToolButton.qml @@ -51,11 +51,10 @@ Item { id: iconImage width: toolButton.height/2 height: toolButton.height/2 - color: bMouseArea.pressed ? Theme.accentColor : active ? Theme.accentColor : Theme.textColor anchors.centerIn: parent fillMode: Image.PreserveAspectFit anchors.margins: Theme.itemSpacingExtraSmall - source: toolButton.iconSource + "?" + (active ? Theme.accentColor : Theme.textColor) + source: toolButton.iconSource + "?" + ( active ? Theme.accentColor : Theme.textColor) } Rectangle{ @@ -89,5 +88,7 @@ Item { id: bMouseArea anchors.fill: parent onClicked: toolButton.clicked() + onPressed: iconImage.source = toolButton.iconSource + "?" + Theme.accentColor + onReleased: iconImage.source = toolButton.iconSource + "?" + ( active ? Theme.accentColor : Theme.textColor) } } diff --git a/src/core/theme.cpp b/src/core/theme.cpp index c0a4a9e..385732e 100644 --- a/src/core/theme.cpp +++ b/src/core/theme.cpp @@ -209,14 +209,14 @@ void Theme::setThemeValues() updated = true; } - if (theme.value("fontFamily").toString() != "" && theme.value("fontFamily").toString() != m_fontFamily) { + if (theme.value("fontPath").toString() != "" && theme.value("fontPath").toString() != m_fontPath) { QFile fontFile; - fontFile.setFileName(theme.value("fontFamily").toString()); + fontFile.setFileName(theme.value("fontPath").toString()); if (!themeFile.exists()) { qDebug() << "Font file " << fontFile.fileName() << " not found"; } else { - m_fontFamily = theme.value("fontFamily").toString(); - emit fontFamilyChanged(); + m_fontPath = theme.value("fontPath").toString(); + emit fontPathChanged(); updated = true; } } @@ -298,7 +298,7 @@ void Theme::loadDefaultValue() m_fontSizeTiny = floor(14 * size->dpScaleFactor()); m_fontWeightLarge = 63 * size->dpScaleFactor(); m_fontWeightMedium = 25 * size->dpScaleFactor(); - m_fontFamily = "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"; + m_fontPath = "/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"; m_accentColor = "#0091e5"; m_fillColor = "#474747"; diff --git a/src/core/theme.h b/src/core/theme.h index 8516a1a..ec2cfe3 100644 --- a/src/core/theme.h +++ b/src/core/theme.h @@ -37,7 +37,7 @@ class Theme : public QObject { 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 fontPath READ fontPath NOTIFY fontPathChanged) Q_PROPERTY(QString accentColor READ accentColor NOTIFY accentColorChanged) Q_PROPERTY(QString fillColor READ fillColor NOTIFY fillColorChanged) @@ -79,7 +79,7 @@ class Theme : public QObject { int fontWeightLarge() { return m_fontWeightLarge; } int fontWeightMedium() { return m_fontWeightMedium; } - QString fontFamily() { return m_fontFamily; } + QString fontPath() { return m_fontPath; } QString accentColor() { return m_accentColor; } QString fillColor() { return m_fillColor; } @@ -126,7 +126,7 @@ class Theme : public QObject { void fontSizeTinyChanged(); void fontWeightLargeChanged(); void fontWeightMediumChanged(); - void fontFamilyChanged(); + void fontPathChanged(); void accentColorChanged(); void fillColorChanged(); @@ -174,7 +174,7 @@ private slots: int m_fontSizeTiny; // 16 int m_fontWeightLarge; // 63 int m_fontWeightMedium; // 25 - QString m_fontFamily; //??? + QString m_fontPath; //??? QString m_accentColor; //#0091e5 QString m_fillColor; //#474747