Commit 833641f2 authored by Aditya Mehra's avatar Aditya Mehra
Browse files

port audio kcm to expanded tiles

parent 457b01bd
......@@ -14,10 +14,6 @@ import "views" as Views
FocusScope {
id: mainFlick
anchors {
fill: parent
margins: Kirigami.Units.smallSpacing * 2
}
SourceModel {
id: paSourceModel
......@@ -32,6 +28,8 @@ FocusScope {
width: parent.width - settingsView.width
property Item currentSection
y: currentSection ? -currentSection.y : 0
anchors.left: parent.left
anchors.leftMargin: Kirigami.Units.largeSpacing
Behavior on y {
NumberAnimation {
duration: Kirigami.Units.longDuration * 2
......@@ -111,19 +109,19 @@ FocusScope {
Kirigami.Separator {
id: viewSept
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: settingsView.left
anchors.top: settingsView.top
anchors.bottom: settingsView.bottom
width: 1
}
ListView {
id: settingsView
//model: sinkView.activeFocus ? sinkView.model : sourceView.model
anchors.top: parent.top
anchors.topMargin: -Kirigami.Units.smallSpacing * 2
anchors.topMargin: -Kirigami.Units.largeSpacing
anchors.right: parent.right
anchors.rightMargin: -Kirigami.Units.smallSpacing * 2
height: parent.height
anchors.rightMargin: -Kirigami.Units.largeSpacing
height: parent.height + Kirigami.Units.largeSpacing
width: parent.width / 3.5
layoutDirection: Qt.LeftToRight
orientation: ListView.Horizontal
......@@ -141,16 +139,5 @@ FocusScope {
isPlayback: settingsView.checkPlayBack
type: settingsView.typeDevice
}
onActiveFocusChanged: {
console.log(activeFocus)
}
move: Transition {
SmoothedAnimation {
property: "x"
duration: 0
}
}
}
}
......@@ -116,7 +116,7 @@ Rectangle {
Kirigami.Separator {
id: headrSept
anchors.top: headerAreaSettingsItem.bottom
anchors.topMargin: Kirigami.Units.largeSpacing
anchors.topMargin: Kirigami.Units.largeSpacing * 2
width: parent.width
height: 1
}
......
......@@ -45,7 +45,7 @@ BigScreen.AbstractDelegate {
property var pObject: PulseObject
property int focusMarginWidth: listView.currentIndex == index && delegate.activeFocus ? contentLayout.width : contentLayout.width - Kirigami.Units.gridUnit
implicitWidth: isCurrent ? listView.cellWidth * 2 : listView.cellWidth
implicitWidth: listView.cellWidth * 2
implicitHeight: listView.height + Kirigami.Units.largeSpacing
Behavior on implicitWidth {
......@@ -70,57 +70,49 @@ BigScreen.AbstractDelegate {
PlasmaCore.IconItem {
id: deviceAudioSvgIcon
width: listView.cellWidth - delegate.leftPadding - (delegate.isCurrent ? 0 : delegate.rightPadding)
height: isCurrent ? width : width - Kirigami.Units.largeSpacing * 4
width: Kirigami.Units.iconSizes.huge
height: width
y: contentItemLayout.height/2 - deviceAudioSvgIcon.height/2
source: Icon.name(Volume, Muted, isPlayback ? "audio-volume" : "microphone-sensitivity")
Behavior on width {
NumberAnimation {
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
}
ColumnLayout {
width: isCurrent ? listView.cellWidth - delegate.leftPadding : listView.cellWidth - delegate.leftPadding - delegate.rightPadding
anchors.right: parent.right
y: delegate.isCurrent ? contentItemLayout.height / 2 - height / 2 : contentItemLayout.height - (deviceNameLabel.height + deviceDefaultRepresentationLayout.height)
id: textLayout
Kirigami.Heading {
anchors {
left: deviceAudioSvgIcon.right
right: contentItemLayout.right
top: deviceAudioSvgIcon.top
bottom: deviceAudioSvgIcon.bottom
leftMargin: Kirigami.Units.smallSpacing
}
PlasmaComponents.Label {
id: deviceNameLabel
Layout.fillWidth: true
visible: text.length > 0
level: 2
elide: Text.ElideRight
wrapMode: Text.Wrap
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
maximumLineCount: delegate.isCurrent ? 3 : 2
maximumLineCount: 2
textFormat: Text.PlainText
color: Kirigami.Theme.textColor
text: delegate.isCurrent ? !currentPort ? Description : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description) : !currentPort ? Description.split("(")[0] : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description).split("(")[0]
}
RowLayout {
Item {
id: deviceDefaultRepresentationLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
PlasmaCore.IconItem {
id: deviceDefaultIcon
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.preferredWidth: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
Layout.preferredHeight: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
anchors.centerIn: parent
width: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
height: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
source: Qt.resolvedUrl("../images/green-tick.svg")
opacity: PulseObject.default ? 1 : 0
}
// Kirigami.Heading {
// id: deviceDefaultLabel
// Layout.rightMargin: Kirigami.Units.smallSpacing
// level: 2
// text: "Default"
// visible: PulseObject.default ? 1 : 0
// }
}
}
}
......
/*
* Copyright 2019 Aditya Mehra <aix.m@outlook.com>
* Copyright 2019 Marco Martin <mart@kde.org>
*
* 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 2.010-1301, USA.
*/
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.3
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents2
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.kirigami 2.11 as Kirigami
import org.kde.mycroft.bigscreen 1.0 as BigScreen
import QtGraphicalEffects 1.0
import org.kde.plasma.private.volume 0.1
import "../code/icon.js" as Icon
BigScreen.AbstractDelegate {
id: delegate
property bool isPlayback: type.substring(0, 4) == "sink"
property bool onlyOne: false
readonly property var currentPort: Ports[ActivePortIndex]
property string type
property bool isDefaultDevice: deviceDefaultIcon.visible
signal setDefault
property var hasVolume: HasVolume
property bool volumeWritable: VolumeWritable
property var muted: Muted
property var vol: Volume
property var pObject: PulseObject
property int focusMarginWidth: listView.currentIndex == index && delegate.activeFocus ? contentLayout.width : contentLayout.width - Kirigami.Units.gridUnit
implicitWidth: isCurrent ? listView.cellWidth * 2 : listView.cellWidth
implicitHeight: listView.height + Kirigami.Units.largeSpacing
Behavior on implicitWidth {
NumberAnimation {
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Keys.onReturnPressed: {
listView.currentIndex = index
settingsView.currentItem.forceActiveFocus()
}
onClicked: {
listView.currentIndex = index
settingsView.forceActiveFocus()
}
contentItem: Item {
id: contentItemLayout
PlasmaCore.IconItem {
id: deviceAudioSvgIcon
width: listView.cellWidth - delegate.leftPadding - (delegate.isCurrent ? 0 : delegate.rightPadding)
height: isCurrent ? width : width - Kirigami.Units.largeSpacing * 4
source: Icon.name(Volume, Muted, isPlayback ? "audio-volume" : "microphone-sensitivity")
Behavior on width {
NumberAnimation {
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
}
ColumnLayout {
width: isCurrent ? listView.cellWidth - delegate.leftPadding : listView.cellWidth - delegate.leftPadding - delegate.rightPadding
anchors.right: parent.right
y: delegate.isCurrent ? contentItemLayout.height / 2 - height / 2 : contentItemLayout.height - (deviceNameLabel.height + deviceDefaultRepresentationLayout.height)
Kirigami.Heading {
id: deviceNameLabel
Layout.fillWidth: true
visible: text.length > 0
level: 2
elide: Text.ElideRight
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
maximumLineCount: delegate.isCurrent ? 3 : 2
textFormat: Text.PlainText
color: Kirigami.Theme.textColor
text: delegate.isCurrent ? !currentPort ? Description : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description) : !currentPort ? Description.split("(")[0] : i18ndc("kcm_pulseaudio", "label of device items", "%1 (%2)", currentPort.description, Description).split("(")[0]
}
RowLayout {
id: deviceDefaultRepresentationLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
PlasmaCore.IconItem {
id: deviceDefaultIcon
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.preferredWidth: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
Layout.preferredHeight: listView.currentIndex == index && delegate.activeFocus ? Kirigami.Units.iconSizes.medium : Kirigami.Units.iconSizes.smallMedium
source: Qt.resolvedUrl("../images/green-tick.svg")
opacity: PulseObject.default ? 1 : 0
}
// Kirigami.Heading {
// id: deviceDefaultLabel
// Layout.rightMargin: Kirigami.Units.smallSpacing
// level: 2
// text: "Default"
// visible: PulseObject.default ? 1 : 0
// }
}
}
}
}
......@@ -78,6 +78,7 @@ KCM.SimpleKCM {
contentItem: DeviceChooserPage {
id: deviceChooserView
width: parent.width
height: parent.height - footerArea.height
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment