vlc | branch: master | Fatih Uzunoglu <[email protected]> | Fri Jan 8 00:36:58 2021 +0300| [9869bd5551d9589a7a50714b8aa7a1fd7fe18a3e] | committer: Pierre Lamot
qml: refactor PlaylistToolbar Signed-off-by: Pierre Lamot <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9869bd5551d9589a7a50714b8aa7a1fd7fe18a3e --- modules/gui/qt/playlist/qml/PlaylistToolbar.qml | 181 ++++++++++++------------ 1 file changed, 94 insertions(+), 87 deletions(-) diff --git a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml index 9d7ca00c20..3522bc8120 100644 --- a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml +++ b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml @@ -25,112 +25,119 @@ import "qrc:///widgets/" as Widgets import "qrc:///util/KeyHelper.js" as KeyHelper import "qrc:///style/" -Widgets.NavigableFocusScope { - id: playlistToolbar - property int leftPadding: 0 - property int rightPadding: 0 +RowLayout { + id: rowLayout + height: VLCStyle.heightBar_normal + spacing: VLCStyle.margin_normal - property VLCColors colors: VLCStyle.colors + Item { + Layout.fillWidth: true + implicitHeight: childrenRect.height - Rectangle { - anchors.fill: parent - color: colors.banner + Widgets.IconToolButton { + id: loop - RowLayout { - anchors { - fill: parent - leftMargin: playlistToolbar.leftPadding - rightMargin: playlistToolbar.rightPadding - } + anchors.centerIn: parent - spacing: VLCStyle.margin_normal - - Widgets.IconToolButton { - id: loop - Layout.alignment: Qt.AlignHCenter - //Layout.minimumWidth: VLCStyle.icon_normal * 2 - size: VLCStyle.icon_normal - iconText: (mainPlaylistController.repeatMode === PlaylistControllerModel.PLAYBACK_REPEAT_CURRENT) - ? VLCIcons.repeat_one - : VLCIcons.repeat_all - checked: mainPlaylistController.repeatMode !== PlaylistControllerModel.PLAYBACK_REPEAT_NONE - onClicked: mainPlaylistController.toggleRepeatMode() - focusPolicy: Qt.NoFocus - - color: colors.buttonText - colorDisabled: colors.textInactive - } + size: VLCStyle.icon_normal + iconText: (mainPlaylistController.repeatMode === PlaylistControllerModel.PLAYBACK_REPEAT_CURRENT) + ? VLCIcons.repeat_one + : VLCIcons.repeat_all + checked: mainPlaylistController.repeatMode !== PlaylistControllerModel.PLAYBACK_REPEAT_NONE + onClicked: mainPlaylistController.toggleRepeatMode() + focusPolicy: Qt.NoFocus - Widgets.IconToolButton { - id: shuffle - Layout.alignment: Qt.AlignHCenter - //Layout.minimumWidth: VLCStyle.icon_normal * 2 - enabled: !mainPlaylistController.empty - size: VLCStyle.icon_normal - iconText: VLCIcons.shuffle_on - onClicked: mainPlaylistController.shuffle() - focusPolicy: Qt.NoFocus - - color: colors.buttonText - colorDisabled: colors.textInactive - } + color: colors.buttonText + colorDisabled: colors.textInactive + } + } - Widgets.SortControl { - id: sort - Layout.alignment: Qt.AlignHCenter - //Layout.minimumWidth: VLCStyle.icon_normal * 2 - enabled: !mainPlaylistController.empty - popupAlignment: Qt.AlignRight | Qt.AlignTop - focusPolicy: Qt.NoFocus + Item { + Layout.fillWidth: true + implicitHeight: childrenRect.height - model: mainPlaylistController.sortKeyTitleList - textRole: "title" - criteriaRole: "key" + Widgets.IconToolButton { + id: shuffle - onSortSelected: { - mainPlaylistController.sortKey = type - } + anchors.centerIn: parent - onSortOrderSelected: { - if (type === Qt.AscendingOrder) - mainPlaylistController.sortOrder = PlaylistControllerModel.SORT_ORDER_ASC - else if (type === Qt.DescendingOrder) - mainPlaylistController.sortOrder = PlaylistControllerModel.SORT_ORDER_DESC + enabled: mainPlaylistController.count > 1 + size: VLCStyle.icon_normal + iconText: VLCIcons.shuffle_on + onClicked: mainPlaylistController.shuffle() + focusPolicy: Qt.NoFocus - mainPlaylistController.sort() - } + color: colors.buttonText + colorDisabled: colors.textInactive + } + } - colors: playlistToolbar.colors + Item { + Layout.fillWidth: true + implicitHeight: childrenRect.height - sortOrder: { - if (mainPlaylistController.sortOrder === PlaylistControllerModel.SORT_ORDER_ASC) { - Qt.AscendingOrder - } - else if (mainPlaylistController.sortOrder === PlaylistControllerModel.SORT_ORDER_DESC) { - Qt.DescendingOrder - } - } + Widgets.SortControl { + id: sort + + anchors.centerIn: parent + + enabled: mainPlaylistController.count > 1 + popupAlignment: Qt.AlignRight | Qt.AlignTop + + focusPolicy: Qt.NoFocus + + model: mainPlaylistController.sortKeyTitleList + textRole: "title" + criteriaRole: "key" - sortKey: mainPlaylistController.sortKey + onSortSelected: { + mainPlaylistController.sortKey = type } - Widgets.IconToolButton { - id: clear - Layout.alignment: Qt.AlignHCenter - //Layout.minimumWidth: VLCStyle.icon_normal * 2 - size: VLCStyle.icon_normal - enabled: !mainPlaylistController.empty - iconText: VLCIcons.playlist_clear - onClicked: mainPlaylistController.clear() - focusPolicy: Qt.NoFocus - - color: colors.buttonText - colorDisabled: colors.textInactive + onSortOrderSelected: { + if (type === Qt.AscendingOrder) + mainPlaylistController.sortOrder = PlaylistControllerModel.SORT_ORDER_ASC + else if (type === Qt.DescendingOrder) + mainPlaylistController.sortOrder = PlaylistControllerModel.SORT_ORDER_DESC + + mainPlaylistController.sort() + } + + colors: root.colors + + sortOrder: { + if (mainPlaylistController.sortOrder === PlaylistControllerModel.SORT_ORDER_ASC) { + Qt.AscendingOrder + } + else if (mainPlaylistController.sortOrder === PlaylistControllerModel.SORT_ORDER_DESC) { + Qt.DescendingOrder + } } + + sortKey: mainPlaylistController.sortKey } } -} + Item { + Layout.fillWidth: true + implicitHeight: childrenRect.height + + Widgets.IconToolButton { + id: clear + + anchors.centerIn: parent + + size: VLCStyle.icon_normal + enabled: !mainPlaylistController.empty + iconText: VLCIcons.playlist_clear + onClicked: mainPlaylistController.clear() + focusPolicy: Qt.NoFocus + + color: colors.buttonText + colorDisabled: colors.textInactive + } + } +} _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
