Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Elisa
Commits
c3f0f379
Commit
c3f0f379
authored
Sep 08, 2020
by
Matthieu Gallien
🎵
Browse files
The sort button now display the selected sort role
parent
645550df
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/qml/NavigationActionBar.qml
View file @
c3f0f379
...
...
@@ -137,15 +137,20 @@ ColumnLayout {
onClicked
:
showArtist
()
},
FlatButtonWithToolTip
{
id
:
sortMenuButton
objectName
:
'
sortMenuButton
'
visible
:
enableSorting
&&
!
showCreateRadioButton
text
:
i18nc
(
"
Sort By Menu
"
,
"
Sort By
"
)
text
:
(
sortMenu
.
sortRoleName
!==
""
?
sortMenu
.
sortRoleName
:
i18nc
(
"
Sort By Menu Title with no sort selected
"
,
"
Sort
"
))
display
:
AbstractButton
.
TextOnly
icon.name
:
"
view-sort
"
onClicked
:
{
sortMenu
.
sortOrder
=
navigationBar
.
sortOrder
sortMenu
.
open
()
}
Layout.preferredWidth
:
textSize
.
width
+
Kirigami
.
Units
.
smallSpacing
*
2
SortMenu
{
id
:
sortMenu
...
...
@@ -153,6 +158,13 @@ ColumnLayout {
onSortRoleChanged
:
if
(
viewManager
)
viewManager
.
sortRoleChanged
(
sortRole
)
}
TextMetrics
{
id
:
textSize
text
:
sortMenuButton
.
text
font
:
sortMenuButton
.
font
}
},
FlatButtonWithToolTip
{
objectName
:
'
showFilterButton
'
...
...
src/qml/SortMenu.qml
View file @
c3f0f379
...
...
@@ -11,6 +11,7 @@ Menu {
id
:
sortMenu
property
int
sortRole
property
string
sortRoleName
property
var
sortRoles
property
var
sortRoleNames
property
var
sortOrder
...
...
@@ -27,6 +28,7 @@ Menu {
if
(
sortRoles
[
i
]
===
sortMenu
.
sortRole
&&
sortMenu
.
sortOrderNames
.
length
>=
(
i
*
2
+
1
))
{
ascendingSortOrder
.
text
=
sortMenu
.
sortOrderNames
[
i
*
2
]
descendingSortOrder
.
text
=
sortMenu
.
sortOrderNames
[
i
*
2
+
1
]
sortMenu
.
sortRoleName
=
sortMenu
.
sortRoleNames
[
i
]
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment