Make the controller landing page less ugly

This commit is contained in:
2024-09-14 21:11:22 +02:00
parent 7147b4bf00
commit d485faeea7
7 changed files with 195 additions and 168 deletions

View File

@@ -78,6 +78,7 @@ qt_add_qml_module(evcharger-app
CurrentLevelsPage.qml CurrentLevelsPage.qml
DailyTripPage.qml DailyTripPage.qml
DateAndTimePage.qml DateAndTimePage.qml
DeviceHeaderBar.qml
DeviceListScreen.qml DeviceListScreen.qml
DeviceScreen.qml DeviceScreen.qml
DisplaySettingsPage.qml DisplaySettingsPage.qml

View File

@@ -19,39 +19,10 @@ AnimatedStackView {
} }
initialItem: ColumnLayout { initialItem: ColumnLayout {
ToolBar { DeviceHeaderBar {
id: toolBar
Layout.fillWidth: true Layout.fillWidth: true
background: Rectangle { onCloseRequested: stackView.closeRequested()
color: "lightblue"
}
RowLayout {
anchors.fill: parent
Text {
Layout.fillWidth: true
Layout.fillHeight: true
ApiKeyValueHelper {
id: friendlyName
deviceConnection: theDeviceConnection
apiKey: "fna"
}
text: friendlyName.value
verticalAlignment: Text.AlignVCenter
}
Button {
Layout.fillHeight: true
text: qsTr("Devices")
onClicked: closeRequested()
}
}
} }
Flickable { Flickable {

View File

@@ -3,121 +3,128 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import EVChargerApp import EVChargerApp
Page { AnimatedStackView {
id: stackView
signal closeRequested() signal closeRequested()
function backPressed() { function backPressed() {
if (depth > 1) {
pop()
return true
}
return false return false
} }
header: ToolBar { initialItem: ColumnLayout {
id: toolBar DeviceHeaderBar {
background: Rectangle {
color: "lightblue"
}
RowLayout {
anchors.fill: parent
Text {
Layout.fillWidth: true
Layout.fillHeight: true
ApiKeyValueHelper {
id: friendlyName
deviceConnection: theDeviceConnection
apiKey: "fna"
}
text: friendlyName.value
verticalAlignment: Text.AlignVCenter
}
Button {
Layout.fillHeight: true
text: qsTr("Devices")
onClicked: closeRequested()
}
}
}
Flickable {
anchors.fill: parent
ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
RowLayout { onCloseRequested: stackView.closeRequested()
Layout.fillWidth: true }
ColumnLayout { Flickable {
id: flickable
Layout.fillWidth: true
Layout.fillHeight: true
contentHeight: columnLayout.implicitHeight
clip: true
ColumnLayout {
id: columnLayout
width: flickable.width - 30
x: 15
spacing: 5
RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
Text { ColumnLayout {
//Layout.fillWidth: true Layout.fillWidth: true
width: 100 Layout.fillHeight: true
text: qsTr("Connected") Text {
font.pixelSize: 20 Layout.fillWidth: true
font.bold: true width: 100
wrapMode: Text.Wrap
text: qsTr("Connected")
font.pixelSize: 20
font.bold: true
wrapMode: Text.Wrap
}
}
Image {
Layout.preferredWidth: parent.width / 3
Layout.preferredHeight: paintedHeight
fillMode: Image.PreserveAspectFit
source: "images/controller.png"
} }
} }
Image { WhiteBox {
Layout.fillHeight: true GridLayout {
// width: 200 colums: 3
// height: 200
Layout.preferredWidth: 100
fillMode: Image.PreserveAspectFit
source: "images/controller.png" Pane {
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
}
Pane {
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
}
Pane {
Component.onCompleted: {
background.color = "white"
background.radius = 5
}
}
}
} }
}
Text { Text {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
text: "Controller TODO" text: "Controller TODO"
} }
Text { Text {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true
text: "Controller TODO" text: "Controller TODO"
} }
Text { Text {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true <
text: "Controller TODO"
}
text: "Controller TODO" Text {
} Layout.fillWidth: true
Text { text: "Controller TODO"
Layout.fillWidth: true }
Layout.fillHeight: true
text: "Controller TODO" Text {
} Layout.fillWidth: true
Text { text: "Controller TODO"
Layout.fillWidth: true }
Layout.fillHeight: true
text: "Controller TODO" Text {
} Layout.fillWidth: true
Text { text: "Controller TODO"
Layout.fillWidth: true }
Layout.fillHeight: true
text: "Controller TODO"
} }
} }
} }

39
DeviceHeaderBar.qml Normal file
View File

@@ -0,0 +1,39 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import EVChargerApp
ToolBar {
id: toolBar
signal closeRequested()
background: Rectangle {
color: "lightblue"
}
RowLayout {
anchors.fill: parent
Text {
Layout.fillWidth: true
Layout.fillHeight: true
ApiKeyValueHelper {
id: friendlyName
deviceConnection: theDeviceConnection
apiKey: "fna"
}
text: friendlyName.value
verticalAlignment: Text.AlignVCenter
}
Button {
Layout.fillHeight: true
text: qsTr("Devices")
onClicked: closeRequested()
}
}
}

View File

@@ -363,128 +363,126 @@
<context> <context>
<name>ChargerTabPage</name> <name>ChargerTabPage</name>
<message> <message>
<location filename="../ChargerTabPage.qml" line="51"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="51"/>
<source>Devices</source> <source>Devices</source>
<translation>Geräte</translation> <translation type="vanished">Geräte</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="88"/> <location filename="../ChargerTabPage.qml" line="59"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="88"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="59"/>
<source>Internal error</source> <source>Internal error</source>
<translation>Interner Fehler</translation> <translation>Interner Fehler</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="89"/> <location filename="../ChargerTabPage.qml" line="60"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="89"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="60"/>
<source>No car connected</source> <source>No car connected</source>
<translation>Kein Auto angeschlossen</translation> <translation>Kein Auto angeschlossen</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="90"/> <location filename="../ChargerTabPage.qml" line="61"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="90"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="61"/>
<source>Car is charging</source> <source>Car is charging</source>
<translation>Auto wird geladen</translation> <translation>Auto wird geladen</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="91"/> <location filename="../ChargerTabPage.qml" line="62"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="91"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="62"/>
<source>Connecting to your car...</source> <source>Connecting to your car...</source>
<translation>Verbinde mit Auto...</translation> <translation>Verbinde mit Auto...</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="92"/> <location filename="../ChargerTabPage.qml" line="63"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="92"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="63"/>
<source>Charging completed</source> <source>Charging completed</source>
<translation>Ladevorgang abgeschlossen</translation> <translation>Ladevorgang abgeschlossen</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="93"/> <location filename="../ChargerTabPage.qml" line="64"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="93"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="64"/>
<source>Unknown error %0</source> <source>Unknown error %0</source>
<translation>Unbekannter Fehler %0</translation> <translation>Unbekannter Fehler %0</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="108"/> <location filename="../ChargerTabPage.qml" line="79"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="108"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="79"/>
<source>Plug in the cable to start charging your car</source> <source>Plug in the cable to start charging your car</source>
<translation>Stecke das Kabel ein, um dein Auto aufzuladen</translation> <translation>Stecke das Kabel ein, um dein Auto aufzuladen</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="110"/> <location filename="../ChargerTabPage.qml" line="81"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="110"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="81"/>
<source>Charger is connecting to your car, it usually takes a few seconds</source> <source>Charger is connecting to your car, it usually takes a few seconds</source>
<translation>Der Charger stellt die Verbindung zu deinem Auto her, das dauert in der Regel ein paar Sekunden</translation> <translation>Der Charger stellt die Verbindung zu deinem Auto her, das dauert in der Regel ein paar Sekunden</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="111"/> <location filename="../ChargerTabPage.qml" line="82"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="111"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="82"/>
<source>Let&apos;s go-e :)</source> <source>Let&apos;s go-e :)</source>
<translation>Let&apos;s go-e :)</translation> <translation>Let&apos;s go-e :)</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="183"/> <location filename="../ChargerTabPage.qml" line="154"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="183"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="154"/>
<source>Price limit</source> <source>Price limit</source>
<translation>Preisgrenze</translation> <translation>Preisgrenze</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="184"/> <location filename="../ChargerTabPage.qml" line="155"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="184"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="155"/>
<source>%0 ct/kWh</source> <source>%0 ct/kWh</source>
<translation>%0 ct/kWh</translation> <translation>%0 ct/kWh</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="192"/> <location filename="../ChargerTabPage.qml" line="163"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="192"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="163"/>
<source>By %0 with %1</source> <source>By %0 with %1</source>
<translation>Bis %0 mit %1</translation> <translation>Bis %0 mit %1</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="192"/> <location filename="../ChargerTabPage.qml" line="163"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="192"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="163"/>
<source>%0 km</source> <source>%0 km</source>
<translation>%0 km</translation> <translation>%0 km</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="210"/> <location filename="../ChargerTabPage.qml" line="181"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="210"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="181"/>
<source>Charging speed</source> <source>Charging speed</source>
<translation>Ladegeschwindigkeit</translation> <translation>Ladegeschwindigkeit</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="211"/> <location filename="../ChargerTabPage.qml" line="182"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="211"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="182"/>
<source>%0 &amp; %1</source> <source>%0 &amp; %1</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="212"/> <location filename="../ChargerTabPage.qml" line="183"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="212"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="183"/>
<source>%0 Ampere</source> <source>%0 Ampere</source>
<translation>%0 Ampere</translation> <translation>%0 Ampere</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="216"/> <location filename="../ChargerTabPage.qml" line="187"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="216"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="187"/>
<source>Automatic phase selection</source> <source>Automatic phase selection</source>
<translation>Automatische Phasenwahl</translation> <translation>Automatische Phasenwahl</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="217"/> <location filename="../ChargerTabPage.qml" line="188"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="217"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="188"/>
<source>1-phase</source> <source>1-phase</source>
<translation>1-phasig</translation> <translation>1-phasig</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="218"/> <location filename="../ChargerTabPage.qml" line="189"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="218"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="189"/>
<source>3-phase</source> <source>3-phase</source>
<translation>3-phasig</translation> <translation>3-phasig</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="219"/> <location filename="../ChargerTabPage.qml" line="190"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="219"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="190"/>
<source>Unknown phase selection (%0)</source> <source>Unknown phase selection (%0)</source>
<translation>Unbekannte Phasen Selektion (%0)</translation> <translation>Unbekannte Phasen Selektion (%0)</translation>
</message> </message>
@@ -501,8 +499,8 @@
<translation type="vanished">Start</translation> <translation type="vanished">Start</translation>
</message> </message>
<message> <message>
<location filename="../ChargerTabPage.qml" line="191"/> <location filename="../ChargerTabPage.qml" line="162"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="191"/> <location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="162"/>
<source>Daily trip</source> <source>Daily trip</source>
<translation>Daily trip</translation> <translation>Daily trip</translation>
</message> </message>
@@ -780,14 +778,12 @@
<context> <context>
<name>ControllerTabPage</name> <name>ControllerTabPage</name>
<message> <message>
<location filename="../ControllerTabPage.qml" line="40"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ControllerTabPage.qml" line="40"/>
<source>Devices</source> <source>Devices</source>
<translation>Geräte</translation> <translation type="vanished">Geräte</translation>
</message> </message>
<message> <message>
<location filename="../ControllerTabPage.qml" line="63"/> <location filename="../ControllerTabPage.qml" line="51"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ControllerTabPage.qml" line="63"/> <location filename="../build/Desktop-Debug/EVChargerApp/ControllerTabPage.qml" line="51"/>
<source>Connected</source> <source>Connected</source>
<translation>Verbunden</translation> <translation>Verbunden</translation>
</message> </message>
@@ -1032,6 +1028,15 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>DeviceHeaderBar</name>
<message>
<location filename="../DeviceHeaderBar.qml" line="35"/>
<location filename="../build/Desktop-Debug/EVChargerApp/DeviceHeaderBar.qml" line="35"/>
<source>Devices</source>
<translation type="unfinished">Geräte</translation>
</message>
</context>
<context> <context>
<name>DeviceListScreen</name> <name>DeviceListScreen</name>
<message> <message>

1
qmldir
View File

@@ -28,6 +28,7 @@ EVChargerApp 1.0 ControllerTabPage.qml
EVChargerApp 1.0 CurrentLevelsPage.qml EVChargerApp 1.0 CurrentLevelsPage.qml
EVChargerApp 1.0 DailyTripPage.qml EVChargerApp 1.0 DailyTripPage.qml
EVChargerApp 1.0 DateAndTimePage.qml EVChargerApp 1.0 DateAndTimePage.qml
EVChargerApp 1.0 DeviceHeaderBar.qml
EVChargerApp 1.0 DeviceListScreen.qml EVChargerApp 1.0 DeviceListScreen.qml
EVChargerApp 1.0 DeviceScreen.qml EVChargerApp 1.0 DeviceScreen.qml
EVChargerApp 1.0 DisplaySettingsPage.qml EVChargerApp 1.0 DisplaySettingsPage.qml

3
update_qmldir.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
( echo "module EVChargerApp" ; echo ; for i in *.qml ; do echo "$([[ "$i" == "Constants.qml" ]] && printf "singleton ")EVChargerApp 1.0 $i" ; done ) > qmldir