[vlc-commits] qml: use a custom property in IconToolButton to set the icon glyph
Pierre Lamot
git at videolan.org
Tue Nov 19 16:50:15 CET 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Nov 13 12:30:35 2019 +0100| [26266e22830011d1580f19862cfd74004c2caba9] | committer: Jean-Baptiste Kempf
qml: use a custom property in IconToolButton to set the icon glyph
the text property of Quick Controls buttons is used for accessibility,
so we need to use another property for the visual aspect of the button
and use the the text property as the accessible label
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=26266e22830011d1580f19862cfd74004c2caba9
---
modules/gui/qt/qml/BannerSources.qml | 10 ++---
modules/gui/qt/qml/about/About.qml | 2 +-
.../mediacenter/MusicAlbumsGridExpandDelegate.qml | 4 +-
.../qt/qml/mediacenter/VideoInfoExpandPanel.qml | 2 +-
modules/gui/qt/qml/player/ControlButtons.qml | 48 +++++++++++-----------
modules/gui/qt/qml/player/TeletextWidget.qml | 14 +++----
modules/gui/qt/qml/player/TopBar.qml | 4 +-
modules/gui/qt/qml/player/VolumeWidget.qml | 2 +-
modules/gui/qt/qml/utils/IconToolButton.qml | 3 +-
modules/gui/qt/qml/utils/ListItem.qml | 6 +--
modules/gui/qt/qml/utils/SearchBox.qml | 2 +-
modules/gui/qt/qml/utils/SortControl.qml | 2 +-
12 files changed, 50 insertions(+), 49 deletions(-)
diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index 7536db68f0..6244df6333 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -97,7 +97,7 @@ Utils.NavigableFocusScope {
Utils.IconToolButton {
id: history_back
size: VLCStyle.icon_normal
- text: VLCIcons.topbar_previous
+ iconText: VLCIcons.topbar_previous
onClicked: history.previous(History.Go)
enabled: !history.previousEmpty
}
@@ -105,7 +105,7 @@ Utils.NavigableFocusScope {
Utils.IconToolButton {
id: history_next
size: VLCStyle.icon_normal
- text: VLCIcons.topbar_next
+ iconText: VLCIcons.topbar_next
onClicked: history.next(History.Go)
enabled: !history.nextEmpty
}
@@ -161,7 +161,7 @@ Utils.NavigableFocusScope {
id: menu_selector
size: VLCStyle.icon_normal
- text: VLCIcons.menu
+ iconText: VLCIcons.menu
onClicked: mainMenu.openBelow(this)
@@ -202,7 +202,7 @@ Utils.NavigableFocusScope {
Utils.IconToolButton {
id: list_grid_btn
size: VLCStyle.icon_normal
- text: medialib.gridView ? VLCIcons.list : VLCIcons.grid
+ iconText: medialib.gridView ? VLCIcons.list : VLCIcons.grid
onClicked: medialib.gridView = !medialib.gridView
}
@@ -283,7 +283,7 @@ Utils.NavigableFocusScope {
id: playlist_btn
size: VLCStyle.icon_normal
- text: VLCIcons.playlist
+ iconText: VLCIcons.playlist
onClicked: rootWindow.playlistVisible = !rootWindow.playlistVisible
}
diff --git a/modules/gui/qt/qml/about/About.qml b/modules/gui/qt/qml/about/About.qml
index 3f52fcfe95..e7bb6e4377 100644
--- a/modules/gui/qt/qml/about/About.qml
+++ b/modules/gui/qt/qml/about/About.qml
@@ -93,7 +93,7 @@ Utils.NavigableFocusScope {
Utils.IconToolButton {
id: backBtn
size: VLCStyle.icon_large
- text: VLCIcons.exit
+ iconText: VLCIcons.exit
Layout.alignment: Qt.AlignLeft | Qt.AlignBottom
KeyNavigation.right: textScroll
diff --git a/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml b/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
index cc2f36a050..cfa3a014b7 100644
--- a/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
@@ -84,7 +84,7 @@ Utils.NavigableFocusScope {
size: VLCStyle.icon_normal
Layout.alignment: Qt.AlignHCenter
- text: VLCIcons.add
+ iconText: VLCIcons.add
onClicked: medialib.addToPlaylist(model.id)
@@ -98,7 +98,7 @@ Utils.NavigableFocusScope {
Layout.alignment: Qt.AlignHCenter
size: VLCStyle.icon_normal
- text: VLCIcons.play
+ iconText: VLCIcons.play
onClicked: medialib.addAndPlay(model.id)
diff --git a/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml b/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
index f35c180325..3cad9fcba7 100644
--- a/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
+++ b/modules/gui/qt/qml/mediacenter/VideoInfoExpandPanel.qml
@@ -259,7 +259,7 @@ Utils.NavigableFocusScope {
id: closeButtonId
size: VLCStyle.icon_normal
- text: VLCIcons.close
+ iconText: VLCIcons.close
color: VLCStyle.colors.lightText
focus: true
diff --git a/modules/gui/qt/qml/player/ControlButtons.qml b/modules/gui/qt/qml/player/ControlButtons.qml
index 6fb35c6d40..352631bbef 100644
--- a/modules/gui/qt/qml/player/ControlButtons.qml
+++ b/modules/gui/qt/qml/player/ControlButtons.qml
@@ -102,7 +102,7 @@ Item{
Utils.IconToolButton {
id: backBtn
size: VLCStyle.icon_medium
- text: VLCIcons.exit
+ iconText: VLCIcons.exit
onClicked: history.previous(History.Go)
property bool acceptFocus: true
}
@@ -114,7 +114,7 @@ Item{
id: randomBtn
size: VLCStyle.icon_medium
checked: mainPlaylistController.random
- text: VLCIcons.shuffle_on
+ iconText: VLCIcons.shuffle_on
onClicked: mainPlaylistController.toggleRandom()
property bool acceptFocus: true
}
@@ -125,7 +125,7 @@ Item{
Utils.IconToolButton {
id: prevBtn
size: VLCStyle.icon_medium
- text: VLCIcons.previous
+ iconText: VLCIcons.previous
onClicked: mainPlaylistController.prev()
property bool acceptFocus: true
}
@@ -136,7 +136,7 @@ Item{
Utils.IconToolButton {
id: playBtn
size: VLCStyle.icon_medium
- text: (player.playingState !== PlayerController.PLAYING_STATE_PAUSED
+ iconText: (player.playingState !== PlayerController.PLAYING_STATE_PAUSED
&& player.playingState !== PlayerController.PLAYING_STATE_STOPPED)
? VLCIcons.pause
: VLCIcons.play
@@ -150,7 +150,7 @@ Item{
Utils.IconToolButton {
id: nextBtn
size: VLCStyle.icon_medium
- text: VLCIcons.next
+ iconText: VLCIcons.next
onClicked: mainPlaylistController.next()
property bool acceptFocus: true
}
@@ -162,7 +162,7 @@ Item{
id: chapterPreviousBtnDelegate
size: VLCStyle.icon_medium
width: visible? VLCStyle.icon_medium : 0
- text: VLCIcons.dvd_prev
+ iconText: VLCIcons.dvd_prev
onClicked: player.chapterPrev()
visible: player.hasChapters
enabled: visible
@@ -177,7 +177,7 @@ Item{
id: chapterPreviousBtnDelegate
size: VLCStyle.icon_medium
width: visible? VLCStyle.icon_medium : 0
- text: VLCIcons.dvd_next
+ iconText: VLCIcons.dvd_next
onClicked: player.chapterNext()
visible: player.hasChapters
enabled: visible
@@ -192,7 +192,7 @@ Item{
id: repeatBtn
size: VLCStyle.icon_medium
checked: mainPlaylistController.repeatMode !== PlaylistControllerModel.PLAYBACK_REPEAT_NONE
- text: (mainPlaylistController.repeatMode === PlaylistControllerModel.PLAYBACK_REPEAT_CURRENT)
+ iconText: (mainPlaylistController.repeatMode === PlaylistControllerModel.PLAYBACK_REPEAT_CURRENT)
? VLCIcons.repeat_one
: VLCIcons.repeat_all
onClicked: mainPlaylistController.toggleRepeatMode()
@@ -205,7 +205,7 @@ Item{
Utils.IconToolButton {
id: langBtn
size: VLCStyle.icon_medium
- text: VLCIcons.audiosub
+ iconText: VLCIcons.audiosub
onClicked: {
root._lockAutoHide += 1
@@ -306,7 +306,7 @@ Item{
Utils.IconToolButton {
id: playlistBtn
size: VLCStyle.icon_medium
- text: VLCIcons.playlist
+ iconText: VLCIcons.playlist
onClicked: {
rootWindow.playlistVisible = !rootWindow.playlistVisible
if (rootWindow.playlistVisible && rootWindow.playlistDocked) {
@@ -323,7 +323,7 @@ Item{
Utils.IconToolButton {
id: menuBtn
size: VLCStyle.icon_medium
- text: VLCIcons.menu
+ iconText: VLCIcons.menu
onClicked: {
root._lockAutoHide += 1
mainMenu.openAbove(this)
@@ -402,7 +402,7 @@ Item{
Utils.IconToolButton{
id: fullScreenBtn
size: VLCStyle.icon_medium
- text: rootWindow.interfaceFullScreen ?VLCIcons.defullscreen :VLCIcons.fullscreen
+ iconText: rootWindow.interfaceFullScreen ?VLCIcons.defullscreen :VLCIcons.fullscreen
onClicked: rootWindow.interfaceFullScreen = !rootWindow.interfaceFullScreen
property bool acceptFocus: true
}
@@ -413,7 +413,7 @@ Item{
Utils.IconToolButton{
id: recordBtn
size: VLCStyle.icon_medium
- text: VLCIcons.record
+ iconText: VLCIcons.record
enabled: !paintOnly && player.isPlaying
checked: player.isRecording
onClicked: player.toggleRecord()
@@ -427,7 +427,7 @@ Item{
id: abBtn
size: VLCStyle.icon_medium
checked: player.ABloopState !== PlayerController.ABLOOP_STATE_NONE
- text: switch(player.ABloopState) {
+ iconText: switch(player.ABloopState) {
case PlayerController.ABLOOP_STATE_A: return VLCIcons.atob_bg_b
case PlayerController.ABLOOP_STATE_B: return VLCIcons.atob_bg_none
case PlayerController.ABLOOP_STATE_NONE: return VLCIcons.atob_bg_ab
@@ -450,7 +450,7 @@ Item{
id: snapshotBtn
size: VLCStyle.icon_medium
enabled: !paintOnly && player.isPlaying
- text: VLCIcons.snapshot
+ iconText: VLCIcons.snapshot
onClicked: player.snapshot()
property bool acceptFocus: true
}
@@ -463,7 +463,7 @@ Item{
id: stopBtn
size: VLCStyle.icon_medium
enabled: !paintOnly && player.isPlaying
- text: VLCIcons.stop
+ iconText: VLCIcons.stop
onClicked: mainPlaylistController.stop()
property bool acceptFocus: true
}
@@ -475,7 +475,7 @@ Item{
id: infoBtn
size: VLCStyle.icon_medium
enabled: !paintOnly && player.isPlaying
- text: VLCIcons.info
+ iconText: VLCIcons.info
onClicked: dialogProvider.mediaInfoDialog()
property bool acceptFocus: true
}
@@ -488,7 +488,7 @@ Item{
id: frameBtn
size: VLCStyle.icon_medium
enabled: !paintOnly && player.isPlaying
- text: VLCIcons.frame_by_frame
+ iconText: VLCIcons.frame_by_frame
onClicked: player.frameNext()
property bool acceptFocus: true
}
@@ -500,7 +500,7 @@ Item{
Utils.IconToolButton{
id: fasterBtn
size: VLCStyle.icon_medium
- text: VLCIcons.faster
+ iconText: VLCIcons.faster
onClicked: player.faster()
property bool acceptFocus: true
}
@@ -512,7 +512,7 @@ Item{
Utils.IconToolButton{
id: slowerBtn
size: VLCStyle.icon_medium
- text: VLCIcons.slower
+ iconText: VLCIcons.slower
onClicked: player.slower()
property bool acceptFocus: true
}
@@ -523,7 +523,7 @@ Item{
Utils.IconToolButton{
id: openMediaBtn
size: VLCStyle.icon_medium
- text: VLCIcons.eject
+ iconText: VLCIcons.eject
onClicked: dialogProvider.openDialog()
property bool acceptFocus: true
}
@@ -545,7 +545,7 @@ Item{
Utils.IconToolButton{
id: stepfwdBtn
size: VLCStyle.icon_medium
- text: VLCIcons.skip_for
+ iconText: VLCIcons.skip_for
onClicked: player.jumpFwd()
property bool acceptFocus: true
}
@@ -556,7 +556,7 @@ Item{
Utils.IconToolButton{
id: stepBackBtn
size: VLCStyle.icon_medium
- text: VLCIcons.skip_back
+ iconText: VLCIcons.skip_back
onClicked: player.jumpBwd()
property bool acceptFocus: true
}
@@ -567,7 +567,7 @@ Item{
Utils.IconToolButton{
id: quitBtn
size: VLCStyle.icon_medium
- text: VLCIcons.clear
+ iconText: VLCIcons.clear
onClicked: rootWindow.close()
property bool acceptFocus: true
}
diff --git a/modules/gui/qt/qml/player/TeletextWidget.qml b/modules/gui/qt/qml/player/TeletextWidget.qml
index aa18baf80b..62f6efaa55 100644
--- a/modules/gui/qt/qml/player/TeletextWidget.qml
+++ b/modules/gui/qt/qml/player/TeletextWidget.qml
@@ -49,7 +49,7 @@ FocusScope{
Utils.IconToolButton{
id: teleActivateBtn
paintOnly: widgetfscope.paintOnly
- text: VLCIcons.tv
+ iconText: VLCIcons.tv
size: VLCStyle.icon_normal
onClicked: player.teletextEnabled = !player.teletextEnabled
color: widgetfscope.color
@@ -62,7 +62,7 @@ FocusScope{
Utils.IconToolButton{
id: teleTransparencyBtn
paintOnly: widgetfscope.paintOnly
- text: VLCIcons.tvtelx
+ iconText: VLCIcons.tvtelx
size: VLCStyle.icon_normal
opacity: 0.5
enabled: player.teletextEnabled
@@ -88,7 +88,7 @@ FocusScope{
paintOnly: widgetfscope.paintOnly
enabled: player.teletextEnabled
size: VLCStyle.icon_normal
- text: VLCIcons.record
+ iconText: VLCIcons.record
onClicked: player.teletextPage = PlayerController.TELE_INDEX
color: "grey"
colorDisabled: "grey"
@@ -99,7 +99,7 @@ FocusScope{
paintOnly: widgetfscope.paintOnly
enabled: player.teletextEnabled
size: VLCStyle.icon_normal
- text: VLCIcons.record
+ iconText: VLCIcons.record
onClicked: player.teletextPage = PlayerController.TELE_RED
color: "red"
colorDisabled: "grey"
@@ -110,7 +110,7 @@ FocusScope{
paintOnly: widgetfscope.paintOnly
enabled: player.teletextEnabled
size: VLCStyle.icon_normal
- text: VLCIcons.record
+ iconText: VLCIcons.record
onClicked: player.teletextPage = PlayerController.TELE_GREEN
color: "green"
colorDisabled: "grey"
@@ -121,7 +121,7 @@ FocusScope{
paintOnly: widgetfscope.paintOnly
enabled: player.teletextEnabled
size: VLCStyle.icon_normal
- text: VLCIcons.record
+ iconText: VLCIcons.record
onClicked: player.teletextPage = PlayerController.TELE_YELLOW
color: "yellow"
colorDisabled: "grey"
@@ -132,7 +132,7 @@ FocusScope{
paintOnly: widgetfscope.paintOnly
enabled: player.teletextEnabled
size: VLCStyle.icon_normal
- text: VLCIcons.record
+ iconText: VLCIcons.record
onClicked: player.teletextPage = PlayerController.TELE_BLUE
color: "blue"
colorDisabled: "grey"
diff --git a/modules/gui/qt/qml/player/TopBar.qml b/modules/gui/qt/qml/player/TopBar.qml
index 3c5264b70c..7606b4c65d 100644
--- a/modules/gui/qt/qml/player/TopBar.qml
+++ b/modules/gui/qt/qml/player/TopBar.qml
@@ -68,7 +68,7 @@ Utils.NavigableFocusScope{
id: backBtn
objectName: "IconToolButton"
size: VLCStyle.icon_normal
- text: VLCIcons.exit
+ iconText: VLCIcons.exit
color: VLCStyle.colors.playerFg
onClicked: {
if (player.playingState === PlayerController.PLAYING_STATE_PAUSED) {
@@ -88,7 +88,7 @@ Utils.NavigableFocusScope{
id: playlistBtn
objectName: PlayerControlBarModel.PLAYLIST_BUTTON
size: VLCStyle.icon_normal
- text: VLCIcons.playlist
+ iconText: VLCIcons.playlist
color: VLCStyle.colors.playerFg
onClicked: togglePlaylistVisiblity()
property bool acceptFocus: true
diff --git a/modules/gui/qt/qml/player/VolumeWidget.qml b/modules/gui/qt/qml/player/VolumeWidget.qml
index d9174150f5..f1fcb0d2f6 100644
--- a/modules/gui/qt/qml/player/VolumeWidget.qml
+++ b/modules/gui/qt/qml/player/VolumeWidget.qml
@@ -44,7 +44,7 @@ FocusScope{
id: volumeBtn
paintOnly: widgetfscope.paintOnly
size: VLCStyle.icon_normal
- text:
+ iconText:
if( player.muted )
VLCIcons.volume_muted
else if ( player.volume < .33 )
diff --git a/modules/gui/qt/qml/utils/IconToolButton.qml b/modules/gui/qt/qml/utils/IconToolButton.qml
index 8174409649..ed319196b5 100644
--- a/modules/gui/qt/qml/utils/IconToolButton.qml
+++ b/modules/gui/qt/qml/utils/IconToolButton.qml
@@ -30,6 +30,7 @@ ToolButton {
padding: 0
+ property string iconText: ""
property color color: VLCStyle.colors.buttonText
property color colorDisabled: VLCStyle.colors.lightText
property color colorOverlay: "transparent"
@@ -48,7 +49,7 @@ ToolButton {
Label {
id: text
- text: control.text
+ text: control.iconText
color: control.enabled ? control.color : control.colorDisabled
anchors.centerIn: parent
diff --git a/modules/gui/qt/qml/utils/ListItem.qml b/modules/gui/qt/qml/utils/ListItem.qml
index 72363d6771..a43ab62c87 100644
--- a/modules/gui/qt/qml/utils/ListItem.qml
+++ b/modules/gui/qt/qml/utils/ListItem.qml
@@ -48,7 +48,7 @@ NavigableFocusScope {
id: actionAdd
IconToolButton {
size: VLCStyle.icon_normal
- text: VLCIcons.add
+ iconText: VLCIcons.add
focus: true
@@ -69,7 +69,7 @@ NavigableFocusScope {
id: add_and_play_icon
size: VLCStyle.icon_normal
//visible: mouse.containsMouse || root.activeFocus
- text: VLCIcons.play
+ iconText: VLCIcons.play
focus: true
@@ -195,7 +195,7 @@ NavigableFocusScope {
IconToolButton {
id: contextButton
size: VLCStyle.icon_normal
- text: VLCIcons.ellipsis
+ iconText: VLCIcons.ellipsis
visible: root.showContextButton
focus: actionButtons.length == toolButtons.focusIndex
diff --git a/modules/gui/qt/qml/utils/SearchBox.qml b/modules/gui/qt/qml/utils/SearchBox.qml
index 9a14637208..82115ebdbb 100644
--- a/modules/gui/qt/qml/utils/SearchBox.qml
+++ b/modules/gui/qt/qml/utils/SearchBox.qml
@@ -97,7 +97,7 @@ Utils.NavigableFocusScope {
id: icon
size: VLCStyle.icon_normal
- text: VLCIcons.topbar_filter
+ iconText: VLCIcons.topbar_filter
focus: true
diff --git a/modules/gui/qt/qml/utils/SortControl.qml b/modules/gui/qt/qml/utils/SortControl.qml
index 93b61b88d0..af151d57b3 100644
--- a/modules/gui/qt/qml/utils/SortControl.qml
+++ b/modules/gui/qt/qml/utils/SortControl.qml
@@ -52,7 +52,7 @@ Utils.NavigableFocusScope {
id: button
size: VLCStyle.icon_normal
- text: VLCIcons.topbar_sort
+ iconText: VLCIcons.topbar_sort
focus: true
More information about the vlc-commits
mailing list