Merge PR #476: Some fixes for regressions after the style changes

This commit is contained in:
Jenkins nymea 2020-12-07 15:35:56 +01:00
commit e47546f8ad
5 changed files with 39 additions and 13 deletions

View File

@ -10,24 +10,37 @@ ApplicationWindow {
id: app
visible: true
visibility: ApplicationWindow.FullScreen
color: Material.background
// Those variables must be present in the Style
title: appName
Material.primary: primaryColor
Material.accent: accentColor
Material.foreground: foregroundColor
Material.theme: NymeaUtils.isDark(Style.backgroundColor) ? Material.Dark : Material.Light
Material.background: Style.backgroundColor
Material.primary: Style.headerBackgroundColor
Material.accent: Style.accentColor
Material.foreground: Style.foregroundColor
font.pixelSize: mediumFont
font.weight: Font.Normal
font.capitalization: Font.MixedCase
font.family: Style.fontFamily
property string appName: "appBranding" in app ? app.appBranding : "nymea:app"
property string systemName: "coreBranding" in app ? app.coreBranding : "nymea"
property int margins: 16
property int bigMargins: 20
property int extraSmallFont: 10
property int smallFont: 13
property int mediumFont: 16
property int largeFont: 20
property int iconSize: 30
property int smallIconSize: 16
property int iconSize: 24
property int largeIconSize: 40
property int hugeIconSize: 64
property int delegateHeight: 60
property color backgroundColor: Material.background
readonly property bool landscape: app.width > app.height

View File

@ -46,6 +46,20 @@ DeviceControlApplication::DeviceControlApplication(int argc, char *argv[]) : QAp
qmlRegisterSingletonType<NfcHelper>("Nymea", 1, 0, "NfcHelper", NfcHelper::nfcHelperProvider);
StyleController *styleController = new StyleController(this);
QQmlFileSelector *styleSelector = new QQmlFileSelector(m_qmlEngine);
styleSelector->setExtraSelectors({styleController->currentStyle()});
foreach (const QFileInfo &fi, QDir(":/ui/fonts/").entryInfoList()) {
QFontDatabase::addApplicationFont(fi.absoluteFilePath());
}
foreach (const QFileInfo &fi, QDir(":/styles/" + styleController->currentStyle() + "/fonts/").entryInfoList()) {
qDebug() << "Adding style font:" << fi.absoluteFilePath();
QFontDatabase::addApplicationFont(fi.absoluteFilePath());
}
qmlRegisterSingletonType(QUrl("qrc:///styles/" + styleController->currentStyle() + "/Style.qml"), "Nymea", 1, 0, "Style" );
m_qmlEngine->rootContext()->setContextProperty("styleController", styleController);
m_qmlEngine->rootContext()->setContextProperty("engine", m_engine);
m_qmlEngine->rootContext()->setContextProperty("_engine", m_engine);

View File

@ -34,6 +34,7 @@ import QtQuick.Controls 2.2
import QtQuick.Controls.impl 2.2
import QtQuick.Controls.Material 2.2
import QtQuick.Controls.Material.impl 2.2
import Nymea 1.0
T.Button {
id: control
@ -64,7 +65,7 @@ T.Button {
font.overline: control.font.overline
font.pixelSize: app.smallFont
font.weight: Font.Bold
color: app.primaryColor
color: Style.backgroundColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight

View File

@ -83,8 +83,7 @@ Page {
Material.elevation: 1
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
contentItem: Rectangle {
color: app.primaryColor
contentItem: Item {
clip: true
RowLayout {
anchors.fill: parent

View File

@ -56,8 +56,7 @@ Page {
z: 1
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
contentItem: Rectangle {
color: app.primaryColor
contentItem: Item {
clip: true
GridLayout {
anchors.fill: parent