harbour-seaprint/qml/components/LargeChoiceDialog.qml

46 lines
1.1 KiB
QML
Raw Permalink Normal View History

2021-07-11 15:27:03 +03:00
import QtQuick 2.6
import Sailfish.Silica 1.0
import "../pages/utils.js" as Utils
Dialog {
id: dialog
2020-08-06 18:34:14 +03:00
allowedOrientations: Orientation.All
property string name
property string choice
property string new_choice: choice
property var choices
2021-06-21 22:31:36 +03:00
property var preferred_choices
property string preferred_choice_suffix
2022-01-15 00:14:06 +03:00
property var strings
canAccept: false
SilicaListView
{
anchors.fill: parent
header: DialogHeader {}
model: choices
delegate: BackgroundItem {
onClicked: {
new_choice=choices[index]
dialog.canAccept = true
}
Label {
x: Theme.paddingLarge
anchors.verticalCenter: parent.verticalCenter
highlighted: choices[index]==new_choice
2022-01-15 00:14:06 +03:00
text: Utils.ippName(name, choices[index], strings)
2021-06-21 22:31:36 +03:00
+ (Utils.has(preferred_choices, choices[index]) ? " "+preferred_choice_suffix : "")
}
}
}
onDone: {
if (result == DialogResult.Accepted) {
choice = new_choice
}
}
}