cleanup runtime debug prints
This commit is contained in:
parent
6ed42e12b7
commit
b8f8c510ee
@ -88,6 +88,12 @@ AppLogController *AppLogController::instance()
|
|||||||
|
|
||||||
AppLogController::AppLogController(QObject *parent) : QObject(parent)
|
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);
|
m_loggingCategories = new LoggingCategories(this);
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@ -95,7 +101,12 @@ AppLogController::AppLogController(QObject *parent) : QObject(parent)
|
|||||||
foreach (const QString &category, nymeaLoggingCategories()) {
|
foreach (const QString &category, nymeaLoggingCategories()) {
|
||||||
m_logLevels[category] = static_cast<LogLevel>(settings.value(category, LogLevelWarning).toInt());
|
m_logLevels[category] = static_cast<LogLevel>(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();
|
settings.endGroup();
|
||||||
|
|
||||||
updateFilters();
|
updateFilters();
|
||||||
|
|
||||||
// Finally, install the logMessageHandler
|
// Finally, install the logMessageHandler
|
||||||
|
|||||||
@ -68,12 +68,6 @@ int main(int argc, char *argv[])
|
|||||||
qputenv("QT_WEBVIEW_PLUGIN", "native");
|
qputenv("QT_WEBVIEW_PLUGIN", "native");
|
||||||
#endif
|
#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);
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QApplication application(argc, argv);
|
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
|
// Initialize app log controller as early as possible, but after setting app name and printing initial startup info
|
||||||
AppLogController::instance();
|
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()) {
|
foreach (const QString &argument, application.arguments()) {
|
||||||
if (argument.startsWith("nymea://notification")) {
|
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));
|
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
application.installTranslator(&qtTranslator);
|
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;
|
QTranslator appTranslator;
|
||||||
bool translationResult = appTranslator.load("nymea-app-" + QLocale().name(), ":/translations/");
|
bool translationResult = appTranslator.load("nymea-app-" + QLocale().name(), ":/translations/");
|
||||||
|
|||||||
@ -304,8 +304,8 @@ Page {
|
|||||||
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: app.margins }
|
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: Style.margins }
|
||||||
spacing: app.margins
|
spacing: Style.margins
|
||||||
visible: engine.thingManager.fetchingData
|
visible: engine.thingManager.fetchingData
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
@ -313,9 +313,8 @@ Page {
|
|||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Loading data...")
|
text: qsTr("Loading data...")
|
||||||
font.pixelSize: app.largeFont
|
font: Style.bigFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,6 +170,9 @@ Item {
|
|||||||
function init() {
|
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)
|
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()
|
pageStack.clear()
|
||||||
|
// var page = pageStack.push(Qt.resolvedUrl("connection/ConnectingPage.qml"));
|
||||||
|
// return
|
||||||
|
|
||||||
if (!engine.jsonRpcClient.currentHost) {
|
if (!engine.jsonRpcClient.currentHost) {
|
||||||
print("pushing ConnectPage")
|
print("pushing ConnectPage")
|
||||||
pageStack.push(Configuration.connectionWizard)
|
pageStack.push(Configuration.connectionWizard)
|
||||||
|
|||||||
@ -104,6 +104,7 @@ RowLayout {
|
|||||||
case "light":
|
case "light":
|
||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
|
case "powersocket":
|
||||||
return ""
|
return ""
|
||||||
case "garagedoor":
|
case "garagedoor":
|
||||||
var thing = root.thing ? root.thing : root.thingsProxy.get(0)
|
var thing = root.thing ? root.thing : root.thingsProxy.get(0)
|
||||||
@ -206,6 +207,7 @@ RowLayout {
|
|||||||
case "light":
|
case "light":
|
||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
|
case "powersocket":
|
||||||
return ""
|
return ""
|
||||||
case "garagedoor":
|
case "garagedoor":
|
||||||
var dev = root.thing ? root.thing : thingsProxy.get(0)
|
var dev = root.thing ? root.thing : thingsProxy.get(0)
|
||||||
|
|||||||
@ -59,39 +59,37 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: layout
|
||||||
|
anchors { left: parent.left; top: parent.top; right: parent.right }
|
||||||
|
|
||||||
RowLayout {
|
HeaderButton {
|
||||||
id: layout
|
id: menuButton
|
||||||
anchors { left: parent.left; top: parent.top; right: parent.right }
|
objectName: "headerMenuButton"
|
||||||
|
imageSource: "../images/navigation-menu.svg"
|
||||||
HeaderButton {
|
visible: false
|
||||||
id: menuButton
|
onClicked: root.menuPressed();
|
||||||
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: 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 {
|
Pane {
|
||||||
id: infoPane
|
id: infoPane
|
||||||
@ -113,7 +111,7 @@ Item {
|
|||||||
implicitHeight: contentRow.implicitHeight
|
implicitHeight: contentRow.implicitHeight
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: contentRow
|
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 {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
height: Style.iconSize
|
height: Style.iconSize
|
||||||
@ -121,7 +119,7 @@ Item {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: infoPane.text
|
text: infoPane.text
|
||||||
font.pixelSize: app.smallFont
|
font: Style.smallFont
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Controls.Material 2.1
|
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import Nymea 1.0
|
import Nymea 1.0
|
||||||
|
|
||||||
@ -47,6 +46,7 @@ Page {
|
|||||||
property alias busyText: busyOverlay.text
|
property alias busyText: busyOverlay.text
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
|
id: flickable
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentHeight: contentColumn.height + Style.margins
|
contentHeight: contentColumn.height + Style.margins
|
||||||
interactive: contentHeight > height
|
interactive: contentHeight > height
|
||||||
@ -57,7 +57,7 @@ Page {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: contentColumn
|
id: contentColumn
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: Math.min(500, parent.width)
|
width: Math.min(500, flickable.width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,16 +103,16 @@ Page {
|
|||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: Style.delegateHeight
|
Layout.preferredHeight: Style.delegateHeight
|
||||||
|
Label {
|
||||||
|
id: extraButtonLabel
|
||||||
|
anchors { left: parent.left; verticalCenter: parent.verticalCenter }
|
||||||
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: extraButton
|
id: extraButton
|
||||||
anchors { left: parent.left; verticalCenter: parent.verticalCenter }
|
anchors { left: parent.left; verticalCenter: parent.verticalCenter }
|
||||||
height: Style.delegateHeight
|
height: Style.delegateHeight
|
||||||
width: childrenRect.width
|
width: extraButtonLabel.width
|
||||||
visible: false
|
visible: false
|
||||||
Label {
|
|
||||||
id: extraButtonLabel
|
|
||||||
anchors.centerIn: parent
|
|
||||||
}
|
|
||||||
onClicked: root.extraButtonPressed()
|
onClicked: root.extraButtonPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,15 +57,15 @@ Page {
|
|||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: columnLayout
|
id: columnLayout
|
||||||
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: app.margins }
|
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: Style.margins }
|
||||||
spacing: app.margins
|
spacing: Style.margins
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
running: parent.visible
|
running: parent.visible
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Connecting...")
|
text: qsTr("Connecting...")
|
||||||
font.pixelSize: app.largeFont
|
font: Style.bigFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@ -73,8 +73,8 @@ Page {
|
|||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: engine.jsonRpcClient.currentHost.name.length > 0 ? engine.jsonRpcClient.currentHost.name : engine.jsonRpcClient.currentHost.uuid
|
text: engine.jsonRpcClient.currentHost.name.length > 0 ? engine.jsonRpcClient.currentHost.name : engine.jsonRpcClient.currentHost.uuid
|
||||||
font.pixelSize: app.smallFont
|
font: Style.smallFont
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
elide: Text.ElideRight
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
@ -119,7 +119,7 @@ Page {
|
|||||||
}
|
}
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
}
|
}
|
||||||
font.pixelSize: app.smallFont
|
font: Style.smallFont
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,11 +86,11 @@ SettingsPageBase {
|
|||||||
id: contentColumn
|
id: contentColumn
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
spacing: app.margins
|
spacing: Style.margins
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.margins: app.margins
|
Layout.margins: Style.margins
|
||||||
spacing: app.margins
|
spacing: Style.margins
|
||||||
|
|
||||||
ColorIcon {
|
ColorIcon {
|
||||||
Layout.preferredHeight: Style.iconSize * 2
|
Layout.preferredHeight: Style.iconSize * 2
|
||||||
|
|||||||
@ -156,12 +156,12 @@ MainPageTile {
|
|||||||
id: inlineControlLoader
|
id: inlineControlLoader
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
leftMargin: app.margins / 2
|
leftMargin: Style.margins / 2
|
||||||
rightMargin: app.margins / 2
|
rightMargin: Style.margins / 2
|
||||||
}
|
}
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if (!root.iface) {
|
if (!root.iface) {
|
||||||
return null
|
return labelComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (iface.name) {
|
switch (iface.name) {
|
||||||
@ -176,7 +176,6 @@ MainPageTile {
|
|||||||
case "cooling":
|
case "cooling":
|
||||||
case "thermostat":
|
case "thermostat":
|
||||||
return sensorComponent;
|
return sensorComponent;
|
||||||
// return labelComponent;
|
|
||||||
|
|
||||||
case "light":
|
case "light":
|
||||||
case "garagedoor":
|
case "garagedoor":
|
||||||
@ -199,7 +198,7 @@ MainPageTile {
|
|||||||
case "media":
|
case "media":
|
||||||
return mediaControlComponent
|
return mediaControlComponent
|
||||||
default:
|
default:
|
||||||
console.warn("InterfaceTile, inlineControl: Unhandled interface", iface.name)
|
return labelComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -283,11 +282,9 @@ MainPageTile {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
property Thing thing: thingsProxy.get(0)
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: parent.thing.name
|
text: qsTr("%n things", "", thingsProxy.count)
|
||||||
font.pixelSize: app.smallFont
|
font: Style.smallFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
@ -380,8 +377,8 @@ MainPageTile {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: app.margins / 2
|
anchors.margins: Style.margins / 2
|
||||||
spacing: app.margins / 2
|
spacing: Style.margins / 2
|
||||||
|
|
||||||
ColorIcon {
|
ColorIcon {
|
||||||
Layout.preferredHeight: Style.iconSize
|
Layout.preferredHeight: Style.iconSize
|
||||||
@ -393,7 +390,7 @@ MainPageTile {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Label {
|
Label {
|
||||||
text: sensorsRoot.thing.name
|
text: sensorsRoot.thing.name
|
||||||
font.pixelSize: app.smallFont
|
font: Style.smallFont
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
@ -402,7 +399,7 @@ MainPageTile {
|
|||||||
text: sensorsRoot.shownStateType
|
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)
|
? (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
|
Layout.fillWidth: true
|
||||||
visible: sensorsRoot.shownStateType && sensorsRoot.shownStateType.type.toLowerCase() !== "bool"
|
visible: sensorsRoot.shownStateType && sensorsRoot.shownStateType.type.toLowerCase() !== "bool"
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|||||||
@ -786,7 +786,7 @@ Item {
|
|||||||
margins: Style.smallMargins
|
margins: Style.smallMargins
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: toolTip.entry.timestamp.toLocaleString(Qt.locale(), Locale.ShortFormat)
|
text: toolTip.entry ? toolTip.entry.timestamp.toLocaleString(Qt.locale(), Locale.ShortFormat) : ""
|
||||||
font: Style.smallFont
|
font: Style.smallFont
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,8 +798,9 @@ Item {
|
|||||||
: 0
|
: 0
|
||||||
property bool translate: value >= 1000
|
property bool translate: value >= 1000
|
||||||
property double translatedValue: value / (translate ? 1000 : 1)
|
property double translatedValue: value / (translate ? 1000 : 1)
|
||||||
text: toolTip.entry.acquisition >= 0 ? qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
text: toolTip.entry && toolTip.entry.acquisition >= 0
|
||||||
: qsTr("Produced: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
? 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
|
font: Style.smallFont
|
||||||
}
|
}
|
||||||
// Label {
|
// Label {
|
||||||
@ -814,7 +815,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
width: Style.extraSmallFont.pixelSize
|
width: Style.extraSmallFont.pixelSize
|
||||||
height: width
|
height: width
|
||||||
color: toolTip.entry.acquisition >= 0 ? Style.red : Style.yellow
|
color: toolTip.entry && toolTip.entry.acquisition >= 0 ? Style.red : Style.yellow
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@ -827,7 +828,7 @@ Item {
|
|||||||
property double value: toolTip.entry ? Math.abs(toolTip.entry.acquisition) : 0
|
property double value: toolTip.entry ? Math.abs(toolTip.entry.acquisition) : 0
|
||||||
property bool translate: value >= 1000
|
property bool translate: value >= 1000
|
||||||
property double translatedValue: value / (translate ? 1000 : 1)
|
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")
|
: qsTr("To grid: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
||||||
font: Style.extraSmallFont
|
font: Style.extraSmallFont
|
||||||
}
|
}
|
||||||
@ -849,7 +850,7 @@ Item {
|
|||||||
property double value: toolTip.entry ? Math.min(Math.max(0, toolTip.entry.consumption), -toolTip.entry.production) : 0
|
property double value: toolTip.entry ? Math.min(Math.max(0, toolTip.entry.consumption), -toolTip.entry.production) : 0
|
||||||
property bool translate: value >= 1000
|
property bool translate: value >= 1000
|
||||||
property double translatedValue: value / (translate ? 1000 : 1)
|
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")
|
: qsTr("Consumed: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
||||||
font: Style.extraSmallFont
|
font: Style.extraSmallFont
|
||||||
}
|
}
|
||||||
@ -859,7 +860,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
width: Style.extraSmallFont.pixelSize
|
width: Style.extraSmallFont.pixelSize
|
||||||
height: width
|
height: width
|
||||||
color: toolTip.entry.storage > 0 ? Style.purple : Style.orange
|
color: toolTip.entry && toolTip.entry.storage > 0 ? Style.purple : Style.orange
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@ -872,7 +873,7 @@ Item {
|
|||||||
property double value: toolTip.entry ? Math.abs(toolTip.entry.storage) : 0
|
property double value: toolTip.entry ? Math.abs(toolTip.entry.storage) : 0
|
||||||
property bool translate: value >= 1000
|
property bool translate: value >= 1000
|
||||||
property double translatedValue: value / (translate ? 1000 : 1)
|
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")
|
qsTr("From battery: %1 %2").arg(translatedValue.toFixed(2)).arg(translate ? "kW" : "W")
|
||||||
font: Style.extraSmallFont
|
font: Style.extraSmallFont
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user