Warning, /plasma-bigscreen/peertube-voice-application/ui/+mediacenter/TopBarTabButton.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Copyright 2018 by Aditya Mehra <aix.m@outlook.com>
0003  *  Copyright 2020 Marco Martin <mart@kde.org>
0004  *
0005  *  This program is free software: you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation, either version 3 of the License, or
0008  *  (at your option) any later version.
0009 
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014 
0015  *  You should have received a copy of the GNU General Public License
0016  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 import QtQuick 2.9
0020 import QtQuick.Layouts 1.4
0021 import QtQuick.Controls 2.3 as Controls
0022 import org.kde.kirigami 2.8 as Kirigami
0023 import org.kde.plasma.core 2.0 as PlasmaCore
0024 
0025 Controls.Button {
0026     id: control
0027     Layout.fillHeight: true
0028     Layout.fillWidth: true
0029     property var imageSource
0030     property bool minMode: false
0031     
0032     background: Rectangle {
0033         Kirigami.Theme.colorSet: Kirigami.Theme.Button
0034         color: control.activeFocus ? Kirigami.Theme.highlightColor : "transparent"
0035 
0036         Kirigami.Separator {
0037             anchors {
0038                 left: parent.left
0039                 right: parent.right
0040                 bottom: parent.bottom
0041             }
0042             color: Kirigami.Theme.highlightColor
0043             height: Kirigami.Units.smallSpacing
0044             visible: control.checked
0045         }
0046     }
0047     
0048     contentItem: Loader {
0049         sourceComponent: minMode ? imageContent : textContent
0050     }
0051     
0052     Component {
0053         id: textContent
0054         Kirigami.Heading {
0055             id: contentHome
0056             horizontalAlignment: Text.AlignHCenter
0057             verticalAlignment: Text.AlignVCenter
0058             maximumLineCount: 1
0059             text: control.text
0060             level: 2
0061         }
0062     }
0063     
0064     Component {
0065         id: imageContent
0066         Image {
0067             id: contentHome
0068             anchors.centerIn: parent
0069             source: control.imageSource
0070             fillMode: Image.PreserveAspectFit
0071         }
0072     }
0073     
0074     Keys.onReturnPressed: {
0075         control.clicked()
0076     }
0077 }