forked from Shinonome/dots-hyprland
sidebar: translator: save selected language, cleaner selector
This commit is contained in:
@@ -66,8 +66,8 @@ Singleton {
|
||||
property QtObject language: QtObject {
|
||||
property QtObject translator: QtObject {
|
||||
property string engine: "auto" // Run `trans -list-engines` for available engines. auto should use google
|
||||
property string targetLanguage: "auto" // Run `trans -list-all` for available languages
|
||||
property string sourceLanguage: "auto"
|
||||
property string targetLanguage: "English" // Run `trans -list-all` for available languages
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ Item {
|
||||
property real dialogMargin: 30
|
||||
property string titleText: "Selection Dialog"
|
||||
property alias items: choiceModel.values
|
||||
property int selectedId: -1 // -1 means no selection
|
||||
property int selectedId: choiceListView.currentIndex
|
||||
property var defaultChoice
|
||||
|
||||
signal canceled();
|
||||
signal selected(var result);
|
||||
@@ -68,6 +69,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
clip: true
|
||||
currentIndex: root.defaultChoice !== undefined ? root.items.indexOf(root.defaultChoice) : -1
|
||||
|
||||
model: ScriptModel {
|
||||
id: choiceModel
|
||||
@@ -85,11 +87,11 @@ Item {
|
||||
}
|
||||
|
||||
description: modelData.toString()
|
||||
checked: index === root.selectedId
|
||||
checked: index === choiceListView.currentIndex
|
||||
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
root.selectedId = index;
|
||||
choiceListView.currentIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user