From ddbde5130e928c69e905728d633d70f339e77f74 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 18 Jan 2021 20:49:17 +0100 Subject: [PATCH] Some fixes in the energy view --- libnymea-app/models/logsmodel.cpp | 1 + nymea-app/ui/mainviews/EnergyView.qml | 9 ++++++--- nymea-app/ui/mainviews/FavoritesView.qml | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libnymea-app/models/logsmodel.cpp b/libnymea-app/models/logsmodel.cpp index b4baa62a..13857c80 100644 --- a/libnymea-app/models/logsmodel.cpp +++ b/libnymea-app/models/logsmodel.cpp @@ -262,6 +262,7 @@ void LogsModel::logsReply(int /*commandId*/, const QVariantMap &data) m_busyInternal = false; if (m_viewStartTime.isValid() && m_list.count() > 0 && m_list.last()->timestamp() > m_viewStartTime && m_canFetchMore) { +// qDebug() << "Fetching more because of viewStartTime" << m_viewStartTime.toString() << "last" << m_list.last()->timestamp().toString(); fetchMore(); } else { m_busy = false; diff --git a/nymea-app/ui/mainviews/EnergyView.qml b/nymea-app/ui/mainviews/EnergyView.qml index 168d40a7..29fcbe9e 100644 --- a/nymea-app/ui/mainviews/EnergyView.qml +++ b/nymea-app/ui/mainviews/EnergyView.qml @@ -53,7 +53,7 @@ MainViewBase { Flickable { anchors.fill: parent - topMargin: app.margins + anchors.margins: app.margins / 2 contentHeight: energyGrid.childrenRect.height GridLayout { @@ -62,9 +62,11 @@ MainViewBase { visible: consumers.count > 0 columns: root.width > 600 ? 2 : 1 rowSpacing: 0 + columnSpacing: 0 SmartMeterChart { - Layout.preferredWidth: energyGrid.width / energyGrid.columns + Layout.fillWidth: true +// Layout.preferredWidth: energyGrid.width / energyGrid.columns Layout.preferredHeight: width * .7 meters: consumers title: qsTr("Total consumed energy") @@ -75,7 +77,8 @@ MainViewBase { ChartView { id: chartView Layout.fillWidth: true - Layout.preferredHeight: width * .75 +// Layout.preferredWidth: energyGrid.width / energyGrid.columns + Layout.preferredHeight: width * .7 legend.alignment: Qt.AlignBottom legend.font.pixelSize: app.smallFont legend.visible: false diff --git a/nymea-app/ui/mainviews/FavoritesView.qml b/nymea-app/ui/mainviews/FavoritesView.qml index d54f10b9..0fa3dae5 100644 --- a/nymea-app/ui/mainviews/FavoritesView.qml +++ b/nymea-app/ui/mainviews/FavoritesView.qml @@ -57,12 +57,15 @@ MainViewBase { cellWidth: gridView.width / tilesPerRow cellHeight: cellWidth + moveDisplaced: Transition { NumberAnimation { properties: "x,y"; duration: 150; easing.type: Easing.InOutQuad } } + model: tagsProxy delegate: ThingTile { id: delegateRoot width: gridView.cellWidth height: gridView.cellHeight device: engine.deviceManager.devices.getDevice(deviceId) + visible: thingId !== fakeDragItem.deviceId onClicked: pageStack.push(Qt.resolvedUrl("../devicepages/" + NymeaUtils.interfaceListToDevicePage(deviceClass.interfaces)), {device: device}) @@ -76,6 +79,8 @@ MainViewBase { NumberAnimation { from: 3; to: -3; target: delegateRoot; duration: 150; property: "rotation" } NumberAnimation { from: -3; to: 0; target: delegateRoot; duration: 75; property: "rotation" } } + + } MouseArea { @@ -103,6 +108,7 @@ MainViewBase { onReleased: { drag.target = null draggedItem = null + fakeDragItem.deviceId = "" } onClicked: { @@ -115,8 +121,8 @@ MainViewBase { width: gridView.cellWidth height: gridView.cellHeight Drag.active: dragArea.drag.active - visible: Drag.active - property var deviceId + visible: deviceId !== "" + property var deviceId: "" } DropArea {