fix(ui): address main window KDE HIG findings
This commit was merged in pull request #4.
This commit is contained in:
1 parent
0cd03335f7
commit
0bfaf3c9db
8 files changed
+248
-157
No files matched your search
+38
-7
@@ -12,6 +12,13 @@ import org.kde.kirigami as Kirigami
|
||||
ToolBar {
|
||||
id: root
|
||||
|
||||
// Space activates the focused control before the window's playback action.
|
||||
Keys.onShortcutOverride: event => {
|
||||
if (event.key === Qt.Key_Space && event.modifiers === Qt.NoModifier) {
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
|
||||
required property Actions actions
|
||||
required property MpvItem mpv
|
||||
required property TranslationService translator
|
||||
@@ -19,7 +26,7 @@ ToolBar {
|
||||
property bool shown: true
|
||||
property bool menuBarShown: true
|
||||
|
||||
readonly property bool isSmallSize: width < 600
|
||||
readonly property bool isSmallSize: width < Kirigami.Units.gridUnit * 34
|
||||
readonly property int buttonSize: isSmallSize ? Kirigami.Units.iconSizes.small : Kirigami.Units.iconSizes.smallMedium
|
||||
|
||||
position: ToolBar.Header
|
||||
@@ -27,29 +34,39 @@ ToolBar {
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
spacing: Kirigami.Units.mediumSpacing
|
||||
|
||||
HamburgerMenu {
|
||||
actions: root.actions
|
||||
mpv: root.mpv
|
||||
visible: !root.menuBarShown
|
||||
focusPolicy: Qt.StrongFocus
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
action: root.actions.openFile
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
action: root.actions.openUrl
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
|
||||
ToolSeparator {}
|
||||
@@ -60,10 +77,15 @@ ToolBar {
|
||||
icon.name: "add-subtitle"
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
enabled: root.mpv.fileLoaded
|
||||
opacity: enabled ? 1.0 : 0.6
|
||||
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
Accessible.role: Accessible.ButtonMenu
|
||||
down: subtitleMenu.visible
|
||||
onPressed: subtitleMenu.open()
|
||||
|
||||
@@ -89,10 +111,15 @@ ToolBar {
|
||||
icon.name: "audio-volume-high"
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
enabled: root.mpv.audioTracks.length > 0
|
||||
opacity: enabled ? 1.0 : 0.6
|
||||
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
Accessible.role: Accessible.ButtonMenu
|
||||
down: audioMenu.visible
|
||||
onPressed: audioMenu.open()
|
||||
|
||||
@@ -135,7 +162,7 @@ ToolBar {
|
||||
ToolButton {
|
||||
action: root.actions.cancelTranslation
|
||||
display: AbstractButton.IconOnly
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
@@ -149,10 +176,14 @@ ToolBar {
|
||||
|
||||
ToolButton {
|
||||
action: root.actions.configure
|
||||
focusPolicy: Qt.NoFocus
|
||||
focusPolicy: Qt.StrongFocus
|
||||
icon.width: root.buttonSize
|
||||
icon.height: root.buttonSize
|
||||
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
|
||||
|
||||
ToolTip.text: text
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user