From a5ef26277ea86b9332393b542d95eb23b01826b8 Mon Sep 17 00:00:00 2001 From: dorian Date: Wed, 27 Mar 2019 22:24:59 +0100 Subject: [PATCH] - implemented new delegates --- qml/SettingsDialog.qml | 64 +++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/qml/SettingsDialog.qml b/qml/SettingsDialog.qml index 7853305..b470c4c 100644 --- a/qml/SettingsDialog.qml +++ b/qml/SettingsDialog.qml @@ -211,7 +211,7 @@ Popup { top: parent.top left: parent.left leftMargin: ( parent.width - headlineUnderline.width ) / 2 - topMargin: headlineUnderline.anchors.topMargin * 0.8 + topMargin: headlineUnderline.anchors.topMargin * 0.95 bottom: parent.bottom } @@ -248,36 +248,15 @@ Popup { } /*----Style Settings----*/ - ItemDelegate { - id: style_del - text: qsTr("change style") - width: parent.width + SmoothSwitchDelegate { + id: styleDel + text: qsTr("dark mode") - contentItem: Text { - text: parent.text - color: appTheme.style.textColor - font.pixelSize: options_stack.text_pixelSize - } + checked: speedBackend.readSetting("theme") === "Dark" - onClicked: { - appTheme.changeTheme() - } - } - - /*----Error Dialog----*/ - ItemDelegate { - id: error_del - text: qsTr("open error popup") - width: parent.width - - contentItem: Text { - text: parent.text - color: appTheme.style.textColor - font.pixelSize: options_stack.text_pixelSize - } - - onClicked: { - errorDialog.open() + onCheckedChanged: { + speedBackend.writeSetting("theme", checked ? "Dark":"Light") + appTheme.refreshTheme() } } } @@ -300,7 +279,7 @@ Popup { type: "baseStation" width: parent.width - font.pixelSize: options_stack.text_pixelSize + font.pixelSize: height * 0.6 } NextPageDelegate { @@ -340,7 +319,7 @@ Popup { return val } - SwitchDelegate { + SmoothSwitchDelegate { id: ready_del text: qsTr("say 'ready'") contentItem: Text { @@ -363,7 +342,7 @@ Popup { indicator: SimpleIndicator{} } - ItemDelegate { + SmoothItemDelegate { id: ready_delay_del text: qsTr("delay (ms)") contentItem: Text { @@ -394,7 +373,7 @@ Popup { } } - SwitchDelegate { + SmoothSwitchDelegate { id: at_marks_del text: qsTr("say\n'at your marks'") contentItem: Text { @@ -416,7 +395,7 @@ Popup { indicator: SimpleIndicator{} } - ItemDelegate { + SmoothItemDelegate { id: at_marks_delay_del text: qsTr("delay (ms)") contentItem: Text { @@ -456,13 +435,16 @@ Popup { ListView { id: baseStationConnections_list property string title: qsTr("connections") - property int delegateHeight: height*0.18 + property int delegateHeight: height * 0.18 + + boundsBehavior: Flickable.StopAtBounds + model: speedBackend.baseStationConnections.length delegate: ConnectionDelegate { enabled: false - font.pixelSize: options_stack.text_pixelSize + font.pixelSize: height * 0.6 width: parent.width - height: baseStationConnections_list.delegateHeight + //height: baseStationConnections_list.delegateHeight text: speedBackend.baseStationConnections[index]["name"] status: {'status': speedBackend.baseStationConnections[index]["state"], 'progress': speedBackend.baseStationConnections[index]["progress"]} @@ -477,7 +459,7 @@ Popup { property: "opacity" from: 0 to: 1 - duration: 200 + duration: 300 easing.type: Easing.InOutQuad } } @@ -486,7 +468,7 @@ Popup { property: "opacity" from: 1 to: 0 - duration: 200 + duration: 300 easing.type: Easing.InOutQuad } } @@ -496,7 +478,7 @@ Popup { property: "opacity" from: 1 to: 0 - duration: 200 + duration: 300 easing.type: Easing.InOutQuad } } @@ -505,7 +487,7 @@ Popup { property: "opacity" from: 0 to: 1 - duration: 200 + duration: 300 easing.type: Easing.InOutQuad } }