Add phase selection widget to charging speed screen
This commit is contained in:
@@ -114,6 +114,7 @@ qt_add_qml_module(evcharger-app
|
||||
SchedulerPage.qml
|
||||
SecurityPage.qml
|
||||
SelectLogicModeItem.qml
|
||||
SelectPhaseSwitchModeItem.qml
|
||||
SensorsConfigurationPage.qml
|
||||
SetPriceLimitPage.qml
|
||||
SettingsTabPage.qml
|
||||
|
@@ -190,10 +190,32 @@ AnimatedStackView {
|
||||
component: "DailyTripPage.qml"
|
||||
}
|
||||
|
||||
ApiKeyValueHelper {
|
||||
id: requestedCurrent
|
||||
deviceConnection: theDeviceConnection
|
||||
apiKey: "amp"
|
||||
}
|
||||
|
||||
ApiKeyValueHelper {
|
||||
id: phaseSwitchMode
|
||||
deviceConnection: theDeviceConnection
|
||||
apiKey: "psm"
|
||||
}
|
||||
|
||||
NavigationItem {
|
||||
iconSource: "material-icons/grid_guides.svg"
|
||||
title: qsTr("Charging speed")
|
||||
description: qsTr("%0 Ampere & %1-phase").arg(0).arg(0)
|
||||
description: qsTr("%0 & %1")
|
||||
.arg(qsTr("%0 Ampere").arg(requestedCurrent.value))
|
||||
.arg((function(){
|
||||
switch (phaseSwitchMode.value)
|
||||
{
|
||||
case 0: return qsTr("Automatic phase selection");
|
||||
case 1: return qsTr("1-phase");
|
||||
case 2: return qsTr("3-phase");
|
||||
case 3: return qsTr("Unknown phase selection (%0)").arg(phaseSwitchMode.value);
|
||||
}
|
||||
})())
|
||||
component: "ChargingSpeedPage.qml"
|
||||
}
|
||||
}
|
||||
|
@@ -6,8 +6,12 @@ NavigationPage {
|
||||
title: qsTr("Charging Speed")
|
||||
|
||||
Text {
|
||||
text: "TODO"
|
||||
text: "current limits TODO"
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
SelectPhaseSwitchModeItem {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
61
SelectPhaseSwitchModeItem.qml
Normal file
61
SelectPhaseSwitchModeItem.qml
Normal file
@@ -0,0 +1,61 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import EVChargerApp
|
||||
|
||||
WhiteBox {
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
SetValueHelper {
|
||||
id: valueChanger
|
||||
deviceConnection: theDeviceConnection
|
||||
apiKey: "psm"
|
||||
onResponseChanged: {
|
||||
automaticButton.checked = Qt.binding(() => automaticButton.selectedMode)
|
||||
singlePhaseButton.checked = Qt.binding(() => singlePhaseButton.selectedMode)
|
||||
threePhaseButton.checked = Qt.binding(() => threePhaseButton.selectedMode)
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
|
||||
font.bold: true
|
||||
text: qsTr("Phase switching")
|
||||
}
|
||||
|
||||
TabBar {
|
||||
id: tabBar
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
Component.onCompleted: {
|
||||
background.color = "#EEEEEE"
|
||||
background.radius = 5
|
||||
}
|
||||
|
||||
TabButton {
|
||||
id: automaticButton
|
||||
property bool selectedMode: phaseSwitchMode.value == 0
|
||||
checked: selectedMode
|
||||
text: qsTr("Automatic")
|
||||
onClicked: valueChanger.setValue(0)
|
||||
}
|
||||
TabButton {
|
||||
id: singlePhaseButton
|
||||
property bool selectedMode: phaseSwitchMode.value == 1
|
||||
checked: selectedMode
|
||||
text: qsTr("1-Phase")
|
||||
onClicked: valueChanger.setValue(1)
|
||||
}
|
||||
TabButton {
|
||||
id: threePhaseButton
|
||||
property bool selectedMode: phaseSwitchMode.value == 2
|
||||
checked: selectedMode
|
||||
text: qsTr("3-Phase")
|
||||
onClicked: valueChanger.setValue(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -162,19 +162,18 @@ bool DevicesModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
|
||||
void DevicesModel::error(QZeroConf::error_t error)
|
||||
{
|
||||
qDebug() << "error()" << error;
|
||||
qDebug() << error;
|
||||
}
|
||||
|
||||
void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
{
|
||||
qDebug() << "serviceAdded()" << service->host();
|
||||
|
||||
auto txt = service->txt();
|
||||
|
||||
auto serialIter = txt.find("serial");
|
||||
if (serialIter == txt.end())
|
||||
{
|
||||
qWarning() << "serial missing" << txt;
|
||||
qWarning() << service->host() << "serial missing" << txt;
|
||||
return;
|
||||
}
|
||||
auto serial = *serialIter;
|
||||
@@ -182,7 +181,7 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
auto manufacturerIter = txt.find("manufacturer");
|
||||
if (manufacturerIter == txt.end())
|
||||
{
|
||||
qWarning() << "manufacturer missing" << txt;
|
||||
qWarning() << service->host() << "manufacturer missing" << txt;
|
||||
return;
|
||||
}
|
||||
auto manufacturer = *manufacturerIter;
|
||||
@@ -190,7 +189,7 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
auto deviceTypeIter = txt.find("devicetype");
|
||||
if (deviceTypeIter == txt.end())
|
||||
{
|
||||
qWarning() << "devicetype missing" << txt;
|
||||
qWarning() << service->host() << "devicetype missing" << txt;
|
||||
return;
|
||||
}
|
||||
auto deviceType = *deviceTypeIter;
|
||||
@@ -198,7 +197,7 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
auto friendlyNameIter = txt.find("friendly_name");
|
||||
if (friendlyNameIter == txt.end())
|
||||
{
|
||||
qWarning() << "friendly_name missing" << txt;
|
||||
qWarning() << service->host() << "friendly_name missing" << txt;
|
||||
return;
|
||||
}
|
||||
auto friendlyName = *friendlyNameIter;
|
||||
@@ -209,6 +208,8 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
|
||||
if (iter == std::end(m_foundDevices))
|
||||
{
|
||||
qDebug() << "new device" << service->host() << serial << manufacturer << deviceType << friendlyName;
|
||||
|
||||
beginInsertRows({}, m_foundDevices.size(), m_foundDevices.size());
|
||||
m_foundDevices.emplace_back(FoundDevice {
|
||||
/*.serial{ */ std::move(serial) /*}*/,
|
||||
@@ -224,6 +225,8 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "device already in list" << service->host() << serial << manufacturer << deviceType << friendlyName;
|
||||
|
||||
iter->manufacturer = std::move(manufacturer);
|
||||
iter->deviceType = std::move(deviceType);
|
||||
iter->friendlyName = std::move(friendlyName);
|
||||
@@ -243,21 +246,19 @@ void DevicesModel::serviceAdded(QZeroConfService service)
|
||||
|
||||
void DevicesModel::serviceUpdated(QZeroConfService service)
|
||||
{
|
||||
qDebug() << "serviceUpdated()" << service->host();
|
||||
qDebug() << service->host();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void DevicesModel::serviceRemoved(QZeroConfService service)
|
||||
{
|
||||
qDebug() << "serviceRemoved()" << service->host();
|
||||
|
||||
const auto &txt = service->txt();
|
||||
|
||||
auto serialIter = txt.find("serial");
|
||||
if (serialIter == txt.constEnd())
|
||||
{
|
||||
qWarning() << "serial missing" << txt;
|
||||
qWarning() << service->host() << "serial missing" << txt;
|
||||
return;
|
||||
}
|
||||
auto serial = *serialIter;
|
||||
@@ -268,12 +269,14 @@ void DevicesModel::serviceRemoved(QZeroConfService service)
|
||||
|
||||
if (iter == std::end(m_foundDevices))
|
||||
{
|
||||
qWarning() << "serial not found!" << serial;
|
||||
qWarning() << service->host() << "serial not found!" << serial;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!iter->saved)
|
||||
{
|
||||
qDebug() << "device removed" << service->host() << serial;
|
||||
|
||||
const auto row = std::distance(std::begin(m_foundDevices), iter);
|
||||
beginRemoveRows({}, row, row);
|
||||
m_foundDevices.erase(iter);
|
||||
@@ -281,6 +284,8 @@ void DevicesModel::serviceRemoved(QZeroConfService service)
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "device kept" << service->host() << serial;
|
||||
|
||||
iter->hostName.clear();
|
||||
iter->ip = {};
|
||||
const auto index = createIndex(std::distance(std::begin(m_foundDevices), iter), 0);
|
||||
|
@@ -393,16 +393,50 @@
|
||||
<translation>%0 km</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="195"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="195"/>
|
||||
<location filename="../ChargerTabPage.qml" line="207"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="207"/>
|
||||
<source>Charging speed</source>
|
||||
<translation>Ladegeschwindigkeit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="196"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="196"/>
|
||||
<location filename="../ChargerTabPage.qml" line="208"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="208"/>
|
||||
<source>%0 & %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="209"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="209"/>
|
||||
<source>%0 Ampere</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="213"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="213"/>
|
||||
<source>Automatic phase selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="214"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="214"/>
|
||||
<source>1-phase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="215"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="215"/>
|
||||
<source>3-phase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ChargerTabPage.qml" line="216"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/ChargerTabPage.qml" line="216"/>
|
||||
<source>Unknown phase selection (%0)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%0 Ampere & %1-phase</source>
|
||||
<translation>%0 Ampere & %1-phasic</translation>
|
||||
<translation type="vanished">%0 Ampere & %1-phasic</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Connect the cable to charge your car</source>
|
||||
@@ -2110,6 +2144,33 @@
|
||||
<translation>Energie zur bestimmten Zeit</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SelectPhaseSwitchModeItem</name>
|
||||
<message>
|
||||
<location filename="../SelectPhaseSwitchModeItem.qml" line="25"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/SelectPhaseSwitchModeItem.qml" line="25"/>
|
||||
<source>Phase switching</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../SelectPhaseSwitchModeItem.qml" line="42"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/SelectPhaseSwitchModeItem.qml" line="42"/>
|
||||
<source>Automatic</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../SelectPhaseSwitchModeItem.qml" line="49"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/SelectPhaseSwitchModeItem.qml" line="49"/>
|
||||
<source>1-Phase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../SelectPhaseSwitchModeItem.qml" line="56"/>
|
||||
<location filename="../build/Desktop-Debug/EVChargerApp/SelectPhaseSwitchModeItem.qml" line="56"/>
|
||||
<source>3-Phase</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SendMessageHelper</name>
|
||||
<message>
|
||||
|
1
qmldir
1
qmldir
@@ -64,6 +64,7 @@ EVChargerApp 1.0 SchedulerDayPage.qml
|
||||
EVChargerApp 1.0 SchedulerPage.qml
|
||||
EVChargerApp 1.0 SecurityPage.qml
|
||||
EVChargerApp 1.0 SelectLogicModeItem.qml
|
||||
EVChargerApp 1.0 SelectPhaseSwitchModeItem.qml
|
||||
EVChargerApp 1.0 SensorsConfigurationPage.qml
|
||||
EVChargerApp 1.0 SetPriceLimitPage.qml
|
||||
EVChargerApp 1.0 SettingsTabPage.qml
|
||||
|
Reference in New Issue
Block a user