[vlc-commits] qml: factorize generic tab button
Pierre Lamot
git at videolan.org
Mon Oct 14 11:59:10 CEST 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Sep 19 15:41:24 2019 +0200| [5432ad099c07e19700f37eaab09bdfd102ee4929] | committer: Jean-Baptiste Kempf
qml: factorize generic tab button
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5432ad099c07e19700f37eaab09bdfd102ee4929
---
modules/gui/qt/Makefile.am | 1 +
modules/gui/qt/qml/utils/TabButtonExt.qml | 95 +++++++++++++++++++++++++++++++
modules/gui/qt/vlc.qrc | 1 +
3 files changed, 97 insertions(+)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 2a3281b32d..833be84540 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -597,6 +597,7 @@ libqt_plugin_la_QML = \
gui/qt/qml/utils/SpinBoxExt.qml \
gui/qt/qml/utils/StackViewExt.qml \
gui/qt/qml/utils/ScanProgressBar.qml \
+ gui/qt/qml/utils/TabButtonExt.qml \
gui/qt/qml/utils/LabelSeparator.qml \
gui/qt/qml/utils/RoundButton.qml \
gui/qt/qml/utils/RoundImage.qml \
diff --git a/modules/gui/qt/qml/utils/TabButtonExt.qml b/modules/gui/qt/qml/utils/TabButtonExt.qml
new file mode 100644
index 0000000000..2cb8711760
--- /dev/null
+++ b/modules/gui/qt/qml/utils/TabButtonExt.qml
@@ -0,0 +1,95 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * 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 QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+
+import "qrc:///style/"
+
+TabButton {
+ id: control
+ text: model.displayText
+
+ padding: 0
+ width: contentItem.implicitWidth
+
+ property string iconTxt: ""
+ property string bgColor: "transparent"
+ property bool selected: false
+
+ font.pixelSize: VLCStyle.fontSize_normal
+
+ background: Rectangle {
+ height: parent.height
+ width: parent.contentItem.width
+ color: control.bgColor
+ }
+
+ contentItem: Item {
+ implicitWidth: tabRow.width
+ implicitHeight: tabRow.height
+
+ Rectangle {
+ anchors.fill: tabRow
+ visible: control.activeFocus || control.hovered
+ color: VLCStyle.colors.accent
+ }
+
+ Row {
+ id: tabRow
+ padding: VLCStyle.margin_xxsmall
+ spacing: VLCStyle.margin_xxsmall
+
+ Label {
+ id: icon
+ anchors.verticalCenter: parent.verticalCenter
+ color: VLCStyle.colors.buttonText
+
+ font.pixelSize: VLCStyle.icon_topbar
+ font.family: VLCIcons.fontFamily
+ horizontalAlignment: Text.AlignHCenter
+ rightPadding: VLCStyle.margin_xsmall
+
+ visible: control.iconTxt !== ""
+ text: control.iconTxt
+ }
+
+ Label {
+ text: control.text
+ font: control.font
+ color: VLCStyle.colors.text
+ padding: VLCStyle.margin_xxsmall
+
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ Rectangle {
+ anchors {
+ left: tabRow.left
+ right: tabRow.right
+ bottom: tabRow.bottom
+ }
+ height: 2
+ visible: control.selected
+ color: "transparent"
+ border.color: VLCStyle.colors.accent
+ }
+ }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 7d3aa4c301..0021b6f912 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -205,6 +205,7 @@
<file alias="RoundImage.qml">qml/utils/RoundImage.qml</file>
<file alias="VideoQualityLabel.qml">qml/utils/VideoQualityLabel.qml</file>
<file alias="VideoProgressBar.qml">qml/utils/VideoProgressBar.qml</file>
+ <file alias="TabButtonExt.qml">qml/utils/TabButtonExt.qml</file>
</qresource>
<qresource prefix="/mediacenter">
<file alias="MCMusicDisplay.qml">qml/mediacenter/MCMusicDisplay.qml</file>
More information about the vlc-commits
mailing list