From 6f4d602456215d52fba9cfc6214855705b1116d8 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Thu, 17 Nov 2022 20:21:43 +0100 Subject: [PATCH] Fix advanced page range input --- harbour-seaprint.pro | 4 +--- qml/components/RangeListInputDialog.qml | 30 +++++++++++++++++++++++++ qml/components/RangeSetting.qml | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 qml/components/RangeListInputDialog.qml diff --git a/harbour-seaprint.pro b/harbour-seaprint.pro index da7001a..ce9c117 100644 --- a/harbour-seaprint.pro +++ b/harbour-seaprint.pro @@ -51,10 +51,8 @@ SOURCES += src/harbour-seaprint.cpp \ src/settings.cpp DISTFILES += qml/harbour-seaprint.qml \ - qml/components/DependentOn.qml \ - qml/components/RangeListInputDialog.qml \ qml/cover/CoverPage.qml \ - qml/components/*qml \ + qml/components/*.qml \ qml/pages/*.qml \ qml/pages/*.js \ qml/pages/*svg \ diff --git a/qml/components/RangeListInputDialog.qml b/qml/components/RangeListInputDialog.qml new file mode 100644 index 0000000..ac35709 --- /dev/null +++ b/qml/components/RangeListInputDialog.qml @@ -0,0 +1,30 @@ +import QtQuick 2.6 +import Sailfish.Silica 1.0 +import seaprint.rangelistchecker 1.0 + +Dialog { + id: dialog + allowedOrientations: Orientation.All + + property string title + property var value + canAccept: valueField.acceptableInput + + Column { + width: parent.width + + DialogHeader { } + + TextField { + id: valueField + acceptableInput: Object.keys(value).length !== 0 + width: parent.width + placeholderText: "1,2,17-42" + label: title + focus: true + labelVisible: true + onTextChanged: { dialog.value = RangeListChecker.parse(text) } + } + } + +} diff --git a/qml/components/RangeSetting.qml b/qml/components/RangeSetting.qml index 52b6dc0..265c850 100644 --- a/qml/components/RangeSetting.qml +++ b/qml/components/RangeSetting.qml @@ -146,7 +146,7 @@ Setting { visible: acceptRangeList text: qsTr("Advanced") onClicked: {var dialog = pageStack.push(Qt.resolvedUrl("RangeListInputDialog.qml"), - {value: choice, title: prettyName}); + {title: prettyName}); dialog.accepted.connect(function() { choice = dialog.value; })