diff --git a/libnymea-app/applogcontroller.cpp b/libnymea-app/applogcontroller.cpp index ae6d723f..476350ce 100644 --- a/libnymea-app/applogcontroller.cpp +++ b/libnymea-app/applogcontroller.cpp @@ -88,6 +88,12 @@ AppLogController *AppLogController::instance() AppLogController::AppLogController(QObject *parent) : QObject(parent) { + // qt.qml.connections warnings are disabled since the replace only exists + // in Qt 5.12. Remove that once 5.12 is the minimum supported version. + QLoggingCategory::setFilterRules("*.debug=false\n" + "qt.qml.connections.warning=false\n" + ); + m_loggingCategories = new LoggingCategories(this); QSettings settings; @@ -95,7 +101,12 @@ AppLogController::AppLogController(QObject *parent) : QObject(parent) foreach (const QString &category, nymeaLoggingCategories()) { m_logLevels[category] = static_cast(settings.value(category, LogLevelWarning).toInt()); } + // Unless specified otherwise by the user, Application info messages are enabled by default for basic information + if (!settings.childKeys().contains("Application")) { + m_logLevels["Application"] = LogLevelInfo; + } settings.endGroup(); + updateFilters(); // Finally, install the logMessageHandler diff --git a/nymea-app/main.cpp b/nymea-app/main.cpp index 83c6509d..105b106c 100644 --- a/nymea-app/main.cpp +++ b/nymea-app/main.cpp @@ -68,12 +68,6 @@ int main(int argc, char *argv[]) qputenv("QT_WEBVIEW_PLUGIN", "native"); #endif - // qt.qml.connections warnings are disabled since the replace only exists - // in Qt 5.12. Remove that once 5.12 is the minimum supported version. - QLoggingCategory::setFilterRules("*.debug=false\n" - "Application.debug=true\n" - "qt.qml.connections.warning=false\n" - ); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication application(argc, argv); @@ -99,7 +93,10 @@ int main(int argc, char *argv[]) // Initialize app log controller as early as possible, but after setting app name and printing initial startup info AppLogController::instance(); - qCInfo(dcApplication()) << "*** nymea:app starting ***" << QDateTime::currentDateTime().toString() << application.arguments(); + qCInfo(dcApplication()) << "-->" << application.applicationName() << APP_VERSION << QDateTime::currentDateTime().toString(); + qCInfo(dcApplication()) << "Command line:" << application.arguments().join(" "); + qCInfo(dcApplication()) << "System:" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion() << PlatformHelper::instance()->deviceManufacturer() << PlatformHelper::instance()->deviceModel(); + qCInfo(dcApplication()) << "Locale:" << QLocale() << QLocale().name() << QLocale().language(); foreach (const QString &argument, application.arguments()) { if (argument.startsWith("nymea://notification")) { @@ -111,8 +108,6 @@ int main(int argc, char *argv[]) qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); application.installTranslator(&qtTranslator); - qCInfo(dcApplication()) << application.applicationName() << APP_VERSION << "running on" << QSysInfo::machineHostName() << QSysInfo::prettyProductName() << QSysInfo::productType() << QSysInfo::productVersion() << PlatformHelper::instance()->deviceManufacturer() << PlatformHelper::instance()->deviceModel(); - qCInfo(dcApplication()) << "Locale info:" << QLocale() << QLocale().name() << QLocale().language() << QLocale().system(); QTranslator appTranslator; bool translationResult = appTranslator.load("nymea-app-" + QLocale().name(), ":/translations/"); diff --git a/nymea-app/ui/MainPage.qml b/nymea-app/ui/MainPage.qml index 1fff8b7b..77c7d713 100644 --- a/nymea-app/ui/MainPage.qml +++ b/nymea-app/ui/MainPage.qml @@ -304,8 +304,8 @@ Page { ColumnLayout { - anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: app.margins } - spacing: app.margins + anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: Style.margins } + spacing: Style.margins visible: engine.thingManager.fetchingData BusyIndicator { Layout.alignment: Qt.AlignHCenter @@ -313,9 +313,8 @@ Page { } Label { text: qsTr("Loading data...") - font.pixelSize: app.largeFont + font: Style.bigFont Layout.fillWidth: true - wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter } } diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index 1436403b..1d85a3a6 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -170,6 +170,9 @@ Item { function init() { print("calling init. Auth required:", engine.jsonRpcClient.authenticationRequired, "initial setup required:", engine.jsonRpcClient.initialSetupRequired, "jsonrpc connected:", engine.jsonRpcClient.connected, "Current host:", engine.jsonRpcClient.currentHost) pageStack.clear() +// var page = pageStack.push(Qt.resolvedUrl("connection/ConnectingPage.qml")); +// return + if (!engine.jsonRpcClient.currentHost) { print("pushing ConnectPage") pageStack.push(Configuration.connectionWizard) diff --git a/nymea-app/ui/components/ButtonControls.qml b/nymea-app/ui/components/ButtonControls.qml index 965d376a..143f333b 100644 --- a/nymea-app/ui/components/ButtonControls.qml +++ b/nymea-app/ui/components/ButtonControls.qml @@ -104,6 +104,7 @@ RowLayout { case "light": case "irrigation": case "ventilation": + case "powersocket": return "" case "garagedoor": var thing = root.thing ? root.thing : root.thingsProxy.get(0) @@ -206,6 +207,7 @@ RowLayout { case "light": case "irrigation": case "ventilation": + case "powersocket": return "" case "garagedoor": var dev = root.thing ? root.thing : thingsProxy.get(0) diff --git a/nymea-app/ui/components/NymeaHeader.qml b/nymea-app/ui/components/NymeaHeader.qml index 503d72c6..c1ea4333 100644 --- a/nymea-app/ui/components/NymeaHeader.qml +++ b/nymea-app/ui/components/NymeaHeader.qml @@ -59,39 +59,37 @@ Item { } } + RowLayout { + id: layout + anchors { left: parent.left; top: parent.top; right: parent.right } - RowLayout { - id: layout - anchors { left: parent.left; top: parent.top; right: parent.right } - - HeaderButton { - id: menuButton - objectName: "headerMenuButton" - imageSource: "../images/navigation-menu.svg" - visible: false - onClicked: root.menuPressed(); - } - - HeaderButton { - id: backButton - objectName: "backButton" - imageSource: "../images/back.svg" - onClicked: root.backPressed(); - } - Label { - id: label - Layout.fillWidth: true - Layout.maximumWidth: layout.width - x * 2 - Layout.fillHeight: true - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - elide: Text.ElideRight - text: root.text -// visible: text.length > 0 - font: Style.bigFont - } + HeaderButton { + id: menuButton + objectName: "headerMenuButton" + imageSource: "../images/navigation-menu.svg" + visible: false + onClicked: root.menuPressed(); } + HeaderButton { + id: backButton + objectName: "backButton" + imageSource: "../images/back.svg" + onClicked: root.backPressed(); + } + Label { + id: label + Layout.fillWidth: true + Layout.maximumWidth: layout.width - Style.iconSize * 2 + Layout.fillHeight: true + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + text: root.text + font: Style.bigFont + } + } + Pane { id: infoPane @@ -113,7 +111,7 @@ Item { implicitHeight: contentRow.implicitHeight RowLayout { id: contentRow - anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: app.margins; rightMargin: app.margins } + anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: Style.margins; rightMargin: Style.margins } Item { Layout.fillWidth: true height: Style.iconSize @@ -121,7 +119,7 @@ Item { Label { text: infoPane.text - font.pixelSize: app.smallFont + font: Style.smallFont color: "white" } diff --git a/nymea-app/ui/components/SettingsPageBase.qml b/nymea-app/ui/components/SettingsPageBase.qml index c34acc84..7329f977 100644 --- a/nymea-app/ui/components/SettingsPageBase.qml +++ b/nymea-app/ui/components/SettingsPageBase.qml @@ -30,7 +30,6 @@ import QtQuick 2.5 import QtQuick.Controls 2.1 -import QtQuick.Controls.Material 2.1 import QtQuick.Layouts 1.1 import Nymea 1.0 @@ -47,6 +46,7 @@ Page { property alias busyText: busyOverlay.text Flickable { + id: flickable anchors.fill: parent contentHeight: contentColumn.height + Style.margins interactive: contentHeight > height @@ -57,7 +57,7 @@ Page { ColumnLayout { id: contentColumn anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(500, parent.width) + width: Math.min(500, flickable.width) } } diff --git a/nymea-app/ui/components/WizardPageBase.qml b/nymea-app/ui/components/WizardPageBase.qml index c5a2cb4f..d4fddfbe 100644 --- a/nymea-app/ui/components/WizardPageBase.qml +++ b/nymea-app/ui/components/WizardPageBase.qml @@ -103,16 +103,16 @@ Page { Item { Layout.fillWidth: true Layout.preferredHeight: Style.delegateHeight + Label { + id: extraButtonLabel + anchors { left: parent.left; verticalCenter: parent.verticalCenter } + } MouseArea { id: extraButton anchors { left: parent.left; verticalCenter: parent.verticalCenter } height: Style.delegateHeight - width: childrenRect.width + width: extraButtonLabel.width visible: false - Label { - id: extraButtonLabel - anchors.centerIn: parent - } onClicked: root.extraButtonPressed() } } diff --git a/nymea-app/ui/connection/ConnectingPage.qml b/nymea-app/ui/connection/ConnectingPage.qml index 0af4aa53..fdfcb3c4 100644 --- a/nymea-app/ui/connection/ConnectingPage.qml +++ b/nymea-app/ui/connection/ConnectingPage.qml @@ -57,15 +57,15 @@ Page { ColumnLayout { id: columnLayout - anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: app.margins } - spacing: app.margins + anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: Style.margins } + spacing: Style.margins BusyIndicator { Layout.alignment: Qt.AlignHCenter running: parent.visible } Label { text: qsTr("Connecting...") - font.pixelSize: app.largeFont + font: Style.bigFont Layout.fillWidth: true wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter @@ -73,8 +73,8 @@ Page { Label { Layout.fillWidth: true text: engine.jsonRpcClient.currentHost.name.length > 0 ? engine.jsonRpcClient.currentHost.name : engine.jsonRpcClient.currentHost.uuid - font.pixelSize: app.smallFont - wrapMode: Text.WrapAtWordBoundaryOrAnywhere + font: Style.smallFont + elide: Text.ElideRight horizontalAlignment: Text.AlignHCenter } Label { @@ -119,7 +119,7 @@ Page { } return errorMessage; } - font.pixelSize: app.smallFont + font: Style.smallFont wrapMode: Text.WrapAtWordBoundaryOrAnywhere horizontalAlignment: Text.AlignHCenter } diff --git a/nymea-app/ui/connection/LoginPage.qml b/nymea-app/ui/connection/LoginPage.qml index 13da4153..e0d316d8 100644 --- a/nymea-app/ui/connection/LoginPage.qml +++ b/nymea-app/ui/connection/LoginPage.qml @@ -86,11 +86,11 @@ SettingsPageBase { id: contentColumn width: parent.width - spacing: app.margins + spacing: Style.margins RowLayout { - Layout.margins: app.margins - spacing: app.margins + Layout.margins: Style.margins + spacing: Style.margins ColorIcon { Layout.preferredHeight: Style.iconSize * 2 diff --git a/nymea-app/ui/delegates/InterfaceTile.qml b/nymea-app/ui/delegates/InterfaceTile.qml index c6b34d54..c5c39829 100644 --- a/nymea-app/ui/delegates/InterfaceTile.qml +++ b/nymea-app/ui/delegates/InterfaceTile.qml @@ -156,12 +156,12 @@ MainPageTile { id: inlineControlLoader anchors { fill: parent - leftMargin: app.margins / 2 - rightMargin: app.margins / 2 + leftMargin: Style.margins / 2 + rightMargin: Style.margins / 2 } sourceComponent: { if (!root.iface) { - return null + return labelComponent } switch (iface.name) { @@ -176,7 +176,6 @@ MainPageTile { case "cooling": case "thermostat": return sensorComponent; - // return labelComponent; case "light": case "garagedoor": @@ -199,7 +198,7 @@ MainPageTile { case "media": return mediaControlComponent default: - console.warn("InterfaceTile, inlineControl: Unhandled interface", iface.name) + return labelComponent } } @@ -283,11 +282,9 @@ MainPageTile { ColumnLayout { spacing: 0 - property Thing thing: thingsProxy.get(0) - Label { - text: parent.thing.name - font.pixelSize: app.smallFont + text: qsTr("%n things", "", thingsProxy.count) + font: Style.smallFont Layout.fillWidth: true elide: Text.ElideRight } @@ -380,8 +377,8 @@ MainPageTile { RowLayout { anchors.fill: parent - anchors.margins: app.margins / 2 - spacing: app.margins / 2 + anchors.margins: Style.margins / 2 + spacing: Style.margins / 2 ColorIcon { Layout.preferredHeight: Style.iconSize @@ -393,7 +390,7 @@ MainPageTile { ColumnLayout { Label { text: sensorsRoot.thing.name - font.pixelSize: app.smallFont + font: Style.smallFont Layout.fillWidth: true elide: Text.ElideRight } @@ -402,7 +399,7 @@ MainPageTile { text: sensorsRoot.shownStateType ? (Math.round(Types.toUiValue(sensorsRoot.thing.states.getState(sensorsRoot.shownStateType.id).value, sensorsRoot.shownStateType.unit) * 100) / 100) + " " + Types.toUiUnit(sensorsRoot.shownStateType.unit) : "" - font.pixelSize: app.smallFont + font: Style.smallFont Layout.fillWidth: true visible: sensorsRoot.shownStateType && sensorsRoot.shownStateType.type.toLowerCase() !== "bool" elide: Text.ElideRight diff --git a/nymea-app/ui/mainviews/energy/PowerBalanceHistory.qml b/nymea-app/ui/mainviews/energy/PowerBalanceHistory.qml index 3ecab8af..27387068 100644 --- a/nymea-app/ui/mainviews/energy/PowerBalanceHistory.qml +++ b/nymea-app/ui/mainviews/energy/PowerBalanceHistory.qml @@ -788,7 +788,7 @@ Item { margins: Style.smallMargins } Label { - text: toolTip.entry.timestamp.toLocaleString(Qt.locale(), Locale.ShortFormat) + text: toolTip.entry ? toolTip.entry.timestamp.toLocaleString(Qt.locale(), Locale.ShortFormat) : "" font: Style.smallFont } @@ -800,8 +800,9 @@ Item { : 0 property bool translate: value >= 1000 property double translatedValue: value / (translate ? 1000 : 1) - text: toolTip.entry.acquisition >= 0 ? qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") - : qsTr("Produced: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + text: toolTip.entry && toolTip.entry.acquisition >= 0 + ? qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + : qsTr("Produced: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.smallFont } // Label { @@ -816,7 +817,7 @@ Item { Rectangle { width: Style.extraSmallFont.pixelSize height: width - color: toolTip.entry.acquisition >= 0 ? Style.red : Style.yellow + color: toolTip.entry && toolTip.entry.acquisition >= 0 ? Style.red : Style.yellow } Label { @@ -829,7 +830,7 @@ Item { property double value: toolTip.entry ? Math.abs(toolTip.entry.acquisition) : 0 property bool translate: value >= 1000 property double translatedValue: value / (translate ? 1000 : 1) - text: toolTip.entry.acquisition >= 0 ? qsTr("From grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + text: toolTip.entry && toolTip.entry.acquisition >= 0 ? qsTr("From grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") : qsTr("To grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } @@ -851,7 +852,7 @@ Item { property double value: toolTip.entry ? Math.min(Math.max(0, toolTip.entry.consumption), -toolTip.entry.production) : 0 property bool translate: value >= 1000 property double translatedValue: value / (translate ? 1000 : 1) - text: toolTip.entry.acquisition >= 0 ? qsTr("From self production: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") + text: toolTip.entry && toolTip.entry.acquisition >= 0 ? qsTr("From self production: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") : qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont } @@ -861,7 +862,7 @@ Item { Rectangle { width: Style.extraSmallFont.pixelSize height: width - color: toolTip.entry.storage > 0 ? Style.purple : Style.orange + color: toolTip.entry && toolTip.entry.storage > 0 ? Style.purple : Style.orange } Label { @@ -874,7 +875,7 @@ Item { property double value: toolTip.entry ? Math.abs(toolTip.entry.storage) : 0 property bool translate: value >= 1000 property double translatedValue: value / (translate ? 1000 : 1) - text: toolTip.entry.storage > 0 ? qsTr("To battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") : + text: toolTip.entry && toolTip.entry.storage > 0 ? qsTr("To battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") : qsTr("From battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W") font: Style.extraSmallFont }