From eff2fe40a940aad52e2cc2dee3f1ebb7ce256ba0 Mon Sep 17 00:00:00 2001 From: Benjamin Arnaud Date: Mon, 28 Mar 2022 17:27:17 +0200 Subject: [PATCH] qml/controlbarcontrols: Create RendererButton --- modules/gui/qt/Makefile.am | 1 + modules/gui/qt/player/control_list_model.hpp | 1 + .../qml/controlbarcontrols/RendererButton.qml | 45 +++++++++++++++++++ modules/gui/qt/vlc.qrc | 1 + 4 files changed, 48 insertions(+) create mode 100644 modules/gui/qt/player/qml/controlbarcontrols/RendererButton.qml diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am index 1e71adc49d..dc6988ad3b 100644 --- a/modules/gui/qt/Makefile.am +++ b/modules/gui/qt/Makefile.am @@ -845,6 +845,7 @@ libqt_plugin_la_QML = \ gui/qt/player/qml/controlbarcontrols/PreviousButton.qml \ gui/qt/player/qml/controlbarcontrols/QuitButton.qml \ gui/qt/player/qml/controlbarcontrols/RandomButton.qml \ + gui/qt/player/qml/controlbarcontrols/RendererButton.qml \ gui/qt/player/qml/controlbarcontrols/RecordButton.qml \ gui/qt/player/qml/controlbarcontrols/ReverseButton.qml \ gui/qt/player/qml/controlbarcontrols/SkipBackButton.qml \ diff --git a/modules/gui/qt/player/control_list_model.hpp b/modules/gui/qt/player/control_list_model.hpp index 8567154999..7b26724e93 100644 --- a/modules/gui/qt/player/control_list_model.hpp +++ b/modules/gui/qt/player/control_list_model.hpp @@ -74,6 +74,7 @@ public: DVD_MENUS_BUTTON, REVERSE_BUTTON, BOOKMARK_BUTTON, + RENDERER_BUTTON, SPECIAL_MAX, WIDGET_SPACER = 0x40, diff --git a/modules/gui/qt/player/qml/controlbarcontrols/RendererButton.qml b/modules/gui/qt/player/qml/controlbarcontrols/RendererButton.qml new file mode 100644 index 0000000000..956e36cf85 --- /dev/null +++ b/modules/gui/qt/player/qml/controlbarcontrols/RendererButton.qml @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (C) 2021 VLC authors and VideoLAN + * + * Authors: Benjamin Arnaud + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * ( at your option ) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +import QtQuick 2.11 + +import org.videolan.vlc 0.1 + +import "qrc:///widgets/" as Widgets +import "qrc:///style/" + +Widgets.IconControlButton { + size: VLCStyle.icon_medium + + iconText: VLCIcons.renderer + text: I18n.qtr("Renderer") + + // NOTE: We want to pop the menu after the button. + onClicked: menu.popup(this.mapToGlobal(width, 0)) + + QmlRendererMenu { + id: menu + + ctx: MainCtx + + onAboutToShow: playerControlLayout.requestLockUnlockAutoHide(true, menu) + onAboutToHide: playerControlLayout.requestLockUnlockAutoHide(false, menu) + } +} diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc index e8bd1b10b7..1fefb47483 100644 --- a/modules/gui/qt/vlc.qrc +++ b/modules/gui/qt/vlc.qrc @@ -382,6 +382,7 @@ player/qml/controlbarcontrols/PreviousButton.qml player/qml/controlbarcontrols/QuitButton.qml player/qml/controlbarcontrols/RandomButton.qml + player/qml/controlbarcontrols/RendererButton.qml player/qml/controlbarcontrols/RecordButton.qml player/qml/controlbarcontrols/ReverseButton.qml player/qml/controlbarcontrols/SkipBackButton.qml