fix(menus): align menus and actions with KDE HIG
This commit is contained in:
1 parent
309801d059
commit
0cd03335f7
18 files changed
+170
-47
No files matched your search
@@ -11,6 +11,7 @@ import org.kde.ki18n
|
||||
// Checkable list of subtitle tracks, for the primary or the secondary subtitle.
|
||||
AppMenu {
|
||||
id: root
|
||||
icon.name: isPrimary ? "text-x-generic" : "text-x-script"
|
||||
|
||||
required property MpvItem mpv
|
||||
property bool isPrimary: true
|
||||
@@ -36,13 +37,16 @@ AppMenu {
|
||||
|
||||
enabled: mpv.subtitleTracks.length > 0
|
||||
|
||||
ButtonGroup { id: tracksGroup; exclusive: true }
|
||||
|
||||
AppMenuItem {
|
||||
text: KI18n.i18nc("@item:inmenu no subtitle", "None")
|
||||
checkable: true
|
||||
ButtonGroup.group: tracksGroup
|
||||
checked: root.selectedId === 0
|
||||
onTriggered: {
|
||||
root.select(0)
|
||||
// Clicking a checked item unchecks it, which drops the binding.
|
||||
// Keep mpv authoritative after MenuItem updates its checked state.
|
||||
checked = Qt.binding(() => root.selectedId === 0)
|
||||
}
|
||||
}
|
||||
@@ -50,13 +54,18 @@ AppMenu {
|
||||
Instantiator {
|
||||
model: root.mpv.subtitleTracks
|
||||
delegate: AppMenuItem {
|
||||
id: trackItem
|
||||
required property var modelData
|
||||
text: root.trackLabel(modelData)
|
||||
checkable: true
|
||||
ButtonGroup.group: tracksGroup
|
||||
checked: modelData.id === root.selectedId
|
||||
// mpv cannot show one track in both places.
|
||||
enabled: modelData.id !== root.otherId
|
||||
onTriggered: root.select(modelData.id)
|
||||
onTriggered: {
|
||||
root.select(modelData.id)
|
||||
checked = Qt.binding(() => trackItem.modelData.id === root.selectedId)
|
||||
}
|
||||
}
|
||||
onObjectAdded: (index, object) => root.insertItem(index + 1, object)
|
||||
onObjectRemoved: (index, object) => root.removeItem(object)
|
||||
|
||||
Reference in new issue
Block a user