Fix advanced page range input

This commit is contained in:
Anton Thomasson 2022-11-17 20:21:43 +01:00
parent 3d8ade0bef
commit 6f4d602456
3 changed files with 32 additions and 4 deletions

View file

@ -51,10 +51,8 @@ SOURCES += src/harbour-seaprint.cpp \
src/settings.cpp src/settings.cpp
DISTFILES += qml/harbour-seaprint.qml \ DISTFILES += qml/harbour-seaprint.qml \
qml/components/DependentOn.qml \
qml/components/RangeListInputDialog.qml \
qml/cover/CoverPage.qml \ qml/cover/CoverPage.qml \
qml/components/*qml \ qml/components/*.qml \
qml/pages/*.qml \ qml/pages/*.qml \
qml/pages/*.js \ qml/pages/*.js \
qml/pages/*svg \ qml/pages/*svg \

View file

@ -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) }
}
}
}

View file

@ -146,7 +146,7 @@ Setting {
visible: acceptRangeList visible: acceptRangeList
text: qsTr("Advanced") text: qsTr("Advanced")
onClicked: {var dialog = pageStack.push(Qt.resolvedUrl("RangeListInputDialog.qml"), onClicked: {var dialog = pageStack.push(Qt.resolvedUrl("RangeListInputDialog.qml"),
{value: choice, title: prettyName}); {title: prettyName});
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
choice = dialog.value; choice = dialog.value;
}) })