fix(menus): align menus and actions with KDE HIG

This commit is contained in:
tri committed 2026-11-07 20:08:28 +07:00
1 parent 309801d059
commit 0cd03335f7
18 files changed
+170 -47

No files matched your search

+42 -7
View File
@@ -22,6 +22,9 @@ Item {
readonly property bool hasFile: mpv.fileLoaded
readonly property bool subtitlesVisible: mpv.subtitleVisible
readonly property bool deinterlacingEnabled: mpv.deinterlace
signal openFileRequested()
// Open a known file, such as one from Recent Files.
signal fileOpenRequested(url: url)
@@ -115,7 +118,7 @@ Item {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Restart Playback")
icon.name: "edit-reset"
shortcut: "F5"
shortcut: "Ctrl+Shift+R"
onTriggered: root.mpv.seek(0)
}
@@ -138,6 +141,7 @@ Item {
property Action seekForwardSmall: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Small Step Forward")
icon.name: "go-next"
shortcut: "Right"
onTriggered: root.seekBy(QtPotatoSettings.seekSmallStep)
}
@@ -145,6 +149,7 @@ Item {
property Action seekBackwardSmall: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Small Step Backward")
icon.name: "go-previous"
shortcut: "Left"
onTriggered: root.seekBy(-QtPotatoSettings.seekSmallStep)
}
@@ -152,6 +157,7 @@ Item {
property Action seekForwardMedium: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Medium Step Forward")
icon.name: "media-seek-forward"
shortcut: "Shift+Right"
onTriggered: root.seekBy(QtPotatoSettings.seekMediumStep)
}
@@ -159,6 +165,7 @@ Item {
property Action seekBackwardMedium: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Medium Step Backward")
icon.name: "media-seek-backward"
shortcut: "Shift+Left"
onTriggered: root.seekBy(-QtPotatoSettings.seekMediumStep)
}
@@ -166,6 +173,7 @@ Item {
property Action seekForwardBig: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Big Step Forward")
icon.name: "arrow-right-double"
shortcut: "Up"
onTriggered: root.seekBy(QtPotatoSettings.seekBigStep)
}
@@ -173,6 +181,7 @@ Item {
property Action seekBackwardBig: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek Big Step Backward")
icon.name: "arrow-left-double"
shortcut: "Down"
onTriggered: root.seekBy(-QtPotatoSettings.seekBigStep)
}
@@ -180,6 +189,7 @@ Item {
property Action seekNextSubtitle: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek To Next Subtitle")
icon.name: "go-down"
shortcut: "Ctrl+Right"
onTriggered: root.mpv.commandAsync(["sub-seek", "1"])
}
@@ -187,6 +197,7 @@ Item {
property Action seekPreviousSubtitle: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Seek To Previous Subtitle")
icon.name: "go-up"
shortcut: "Ctrl+Left"
onTriggered: root.mpv.commandAsync(["sub-seek", "-1"])
}
@@ -194,6 +205,7 @@ Item {
property Action seekNextChapter: Action {
enabled: root.shortcutsEnabled && root.mpv.chapters.length > 0
text: KI18n.i18nc("@action", "Seek To Next Chapter")
icon.name: "go-last"
shortcut: "PgUp"
onTriggered: root.mpv.commandAsync(["add", "chapter", "1"])
}
@@ -201,6 +213,7 @@ Item {
property Action seekPreviousChapter: Action {
enabled: root.shortcutsEnabled && root.mpv.chapters.length > 0
text: KI18n.i18nc("@action", "Seek To Previous Chapter")
icon.name: "go-first"
shortcut: "PgDown"
onTriggered: root.mpv.commandAsync(["add", "chapter", "-1"])
}
@@ -208,6 +221,7 @@ Item {
property Action frameStepForward: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Step Frame Forward")
icon.name: "keyframe-next"
shortcut: "."
onTriggered: root.mpv.frameStep(true)
}
@@ -215,6 +229,7 @@ Item {
property Action frameStepBackward: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Step Frame Backward")
icon.name: "keyframe-previous"
shortcut: ","
onTriggered: root.mpv.frameStep(false)
}
@@ -222,6 +237,7 @@ Item {
property Action speedUp: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Increase Playback Speed")
icon.name: "media-seek-forward"
shortcut: "]"
onTriggered: root.changeSpeed(0.1)
}
@@ -229,6 +245,7 @@ Item {
property Action speedDown: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Decrease Playback Speed")
icon.name: "media-seek-backward"
shortcut: "["
onTriggered: root.changeSpeed(-0.1)
}
@@ -236,6 +253,7 @@ Item {
property Action speedReset: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Reset Playback Speed")
icon.name: "speedometer"
shortcut: "Backspace"
onTriggered: root.changeSpeed(0)
}
@@ -270,6 +288,7 @@ Item {
property Action audioCycleUp: Action {
enabled: root.shortcutsEnabled && root.mpv.audioTracks.length > 1
text: KI18n.i18nc("@action", "Cycle Up Audio Track")
icon.name: "go-up"
shortcut: "Shift+3"
onTriggered: root.mpv.audioId = root.cycleTrack(root.mpv.audioTracks, root.mpv.audioId, 1)
}
@@ -277,6 +296,7 @@ Item {
property Action audioCycleDown: Action {
enabled: root.shortcutsEnabled && root.mpv.audioTracks.length > 1
text: KI18n.i18nc("@action", "Cycle Down Audio Track")
icon.name: "go-down"
shortcut: "Shift+2"
onTriggered: root.mpv.audioId = root.cycleTrack(root.mpv.audioTracks, root.mpv.audioId, -1)
}
@@ -291,12 +311,16 @@ Item {
property Action subtitleToggle: Action {
enabled: root.shortcutsEnabled && root.mpv.subtitleTracks.length > 0
text: KI18n.i18nc("@action", "Toggle Subtitles")
text: KI18n.i18nc("@action", "Show Subtitles")
icon.name: "media-view-subtitles-symbolic"
checkable: true
checked: root.subtitlesVisible
shortcut: "Ctrl+S"
onTriggered: {
const visible = root.mpv.getProperty("sub-visibility")
root.mpv.setPropertyAsync("sub-visibility", !visible)
root.mpv.setPropertyAsync("secondary-sub-visibility", !visible)
checked = Qt.binding(() => root.subtitlesVisible)
root.osd.message(visible ? KI18n.i18nc("@info:osd", "Subtitles hidden") : KI18n.i18nc("@info:osd", "Subtitles shown"))
}
}
@@ -304,6 +328,7 @@ Item {
property Action subtitleCycleUp: Action {
enabled: root.shortcutsEnabled && root.mpv.subtitleTracks.length > 0
text: KI18n.i18nc("@action", "Cycle Up Subtitle")
icon.name: "go-up"
shortcut: "J"
onTriggered: root.mpv.subtitleId = root.cycleTrack(root.mpv.subtitleTracks, root.mpv.subtitleId, 1)
}
@@ -311,6 +336,7 @@ Item {
property Action subtitleCycleDown: Action {
enabled: root.shortcutsEnabled && root.mpv.subtitleTracks.length > 0
text: KI18n.i18nc("@action", "Cycle Down Subtitle")
icon.name: "go-down"
shortcut: "Shift+J"
onTriggered: root.mpv.subtitleId = root.cycleTrack(root.mpv.subtitleTracks, root.mpv.subtitleId, -1)
}
@@ -318,6 +344,7 @@ Item {
property Action subtitleEarlier: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Show Subtitles Earlier")
icon.name: "go-previous"
shortcut: "Z"
onTriggered: root.changeSubtitleDelay(-0.1)
}
@@ -325,6 +352,7 @@ Item {
property Action subtitleLater: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Show Subtitles Later")
icon.name: "go-next"
shortcut: "Shift+Z"
onTriggered: root.changeSubtitleDelay(0.1)
}
@@ -332,12 +360,14 @@ Item {
property Action subtitleDelayReset: Action {
enabled: root.shortcutsEnabled && root.hasFile && root.mpv.subtitleDelay !== 0
text: KI18n.i18nc("@action", "Reset Subtitle Delay")
icon.name: "edit-reset"
onTriggered: root.changeSubtitleDelay(-root.mpv.subtitleDelay)
}
property Action subtitleBigger: Action {
enabled: root.shortcutsEnabled
text: KI18n.i18nc("@action", "Increase Subtitle Font Size")
icon.name: "format-font-size-more"
shortcut: "Ctrl+Z"
onTriggered: {
QtPotatoSettings.subtitleFontSize = Math.min(150, QtPotatoSettings.subtitleFontSize + 2)
@@ -349,6 +379,7 @@ Item {
property Action subtitleSmaller: Action {
enabled: root.shortcutsEnabled
text: KI18n.i18nc("@action", "Decrease Subtitle Font Size")
icon.name: "format-font-size-less"
shortcut: "Ctrl+X"
onTriggered: {
QtPotatoSettings.subtitleFontSize = Math.max(20, QtPotatoSettings.subtitleFontSize - 2)
@@ -392,11 +423,15 @@ Item {
property Action toggleDeinterlacing: Action {
enabled: root.shortcutsEnabled && root.hasFile
text: KI18n.i18nc("@action", "Toggle Deinterlacing")
text: KI18n.i18nc("@action", "Deinterlace")
icon.name: "view-filter"
checkable: true
checked: root.deinterlacingEnabled
shortcut: "D"
onTriggered: {
const enabled = root.mpv.getProperty("deinterlace") === "yes"
root.mpv.setPropertyAsync("deinterlace", enabled ? "no" : "yes")
const enabled = root.mpv.getProperty("deinterlace") === true
root.mpv.setPropertyAsync("deinterlace", !enabled)
checked = Qt.binding(() => root.deinterlacingEnabled)
root.osd.message(enabled ? KI18n.i18nc("@info:osd", "Deinterlacing off") : KI18n.i18nc("@info:osd", "Deinterlacing on"))
}
}
@@ -476,6 +511,7 @@ Item {
property Action toggleHeader: Action {
enabled: root.shortcutsEnabled
text: QtPotatoSettings.showHeader ? KI18n.i18nc("@action", "Hide Toolbar") : KI18n.i18nc("@action", "Show Toolbar")
icon.name: "configure-toolbars"
shortcut: "Ctrl+H"
onTriggered: root.headerToggleRequested()
}
@@ -489,7 +525,7 @@ Item {
}
property Action configure: Action {
text: KI18n.i18nc("@action", "Settings")
text: KI18n.i18nc("@action", "Configure QtPotato…")
icon.name: "configure"
shortcut: "Ctrl+Shift+,"
onTriggered: root.settingsRequested("general")
@@ -498,7 +534,6 @@ Item {
property Action about: Action {
text: KI18n.i18nc("@action", "About QtPotato")
icon.name: "help-about"
shortcut: "F1"
onTriggered: root.settingsRequested("about")
}