Merge PR #476: Some fixes for regressions after the style changes
This commit is contained in:
commit
e47546f8ad
@ -10,24 +10,37 @@ ApplicationWindow {
|
|||||||
id: app
|
id: app
|
||||||
visible: true
|
visible: true
|
||||||
visibility: ApplicationWindow.FullScreen
|
visibility: ApplicationWindow.FullScreen
|
||||||
|
|
||||||
color: Material.background
|
color: Material.background
|
||||||
|
|
||||||
// Those variables must be present in the Style
|
|
||||||
title: appName
|
title: appName
|
||||||
Material.primary: primaryColor
|
|
||||||
Material.accent: accentColor
|
Material.theme: NymeaUtils.isDark(Style.backgroundColor) ? Material.Dark : Material.Light
|
||||||
Material.foreground: foregroundColor
|
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 margins: 16
|
||||||
property int bigMargins: 20
|
property int bigMargins: 20
|
||||||
|
|
||||||
property int extraSmallFont: 10
|
property int extraSmallFont: 10
|
||||||
property int smallFont: 13
|
property int smallFont: 13
|
||||||
property int mediumFont: 16
|
property int mediumFont: 16
|
||||||
property int largeFont: 20
|
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 int delegateHeight: 60
|
||||||
property color backgroundColor: Material.background
|
|
||||||
|
|
||||||
readonly property bool landscape: app.width > app.height
|
readonly property bool landscape: app.width > app.height
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,20 @@ DeviceControlApplication::DeviceControlApplication(int argc, char *argv[]) : QAp
|
|||||||
qmlRegisterSingletonType<NfcHelper>("Nymea", 1, 0, "NfcHelper", NfcHelper::nfcHelperProvider);
|
qmlRegisterSingletonType<NfcHelper>("Nymea", 1, 0, "NfcHelper", NfcHelper::nfcHelperProvider);
|
||||||
|
|
||||||
StyleController *styleController = new StyleController(this);
|
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("styleController", styleController);
|
||||||
m_qmlEngine->rootContext()->setContextProperty("engine", m_engine);
|
m_qmlEngine->rootContext()->setContextProperty("engine", m_engine);
|
||||||
m_qmlEngine->rootContext()->setContextProperty("_engine", m_engine);
|
m_qmlEngine->rootContext()->setContextProperty("_engine", m_engine);
|
||||||
|
|||||||
@ -34,6 +34,7 @@ import QtQuick.Controls 2.2
|
|||||||
import QtQuick.Controls.impl 2.2
|
import QtQuick.Controls.impl 2.2
|
||||||
import QtQuick.Controls.Material 2.2
|
import QtQuick.Controls.Material 2.2
|
||||||
import QtQuick.Controls.Material.impl 2.2
|
import QtQuick.Controls.Material.impl 2.2
|
||||||
|
import Nymea 1.0
|
||||||
|
|
||||||
T.Button {
|
T.Button {
|
||||||
id: control
|
id: control
|
||||||
@ -64,7 +65,7 @@ T.Button {
|
|||||||
font.overline: control.font.overline
|
font.overline: control.font.overline
|
||||||
font.pixelSize: app.smallFont
|
font.pixelSize: app.smallFont
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: app.primaryColor
|
color: Style.backgroundColor
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|||||||
@ -83,8 +83,7 @@ Page {
|
|||||||
Material.elevation: 1
|
Material.elevation: 1
|
||||||
|
|
||||||
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
|
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
|
||||||
contentItem: Rectangle {
|
contentItem: Item {
|
||||||
color: app.primaryColor
|
|
||||||
clip: true
|
clip: true
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@ -56,8 +56,7 @@ Page {
|
|||||||
z: 1
|
z: 1
|
||||||
|
|
||||||
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
|
leftPadding: 0; rightPadding: 0; topPadding: 0; bottomPadding: 0
|
||||||
contentItem: Rectangle {
|
contentItem: Item {
|
||||||
color: app.primaryColor
|
|
||||||
clip: true
|
clip: true
|
||||||
GridLayout {
|
GridLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user