Commit 00026cee authored by Nate Graham's avatar Nate Graham 🔩

[KCM] Port to QQC2

Summary:
This patch ports the KCM to QQC2, which has the side effect of working around https://bugreports.qt.io/browse/QTBUG-70481 and improving the presentation for people using fractional Qt scale factors.

BUG: 397954
FIXED-IN: 5.16.0

Test Plan: All functionality tested still worked. No visual changes at 1x scale. With a fractional scale factor, it now looks good: {F6612007}

Reviewers: #plasma, drosca

Reviewed By: drosca

Subscribers: apol, huftis, nicolasfella, davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15304
parent 908501f1
......@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Controls 2.2
import org.kde.plasma.private.volume 0.1
import org.kde.kcoreaddons 1.0 as KCoreAddons
......@@ -29,11 +29,17 @@ import org.kde.kcoreaddons 1.0 as KCoreAddons
ScrollView {
id: scrollView
contentWidth: contentLayout.width
contentHeight: contentLayout.height
clip: true
ColumnLayout {
id: contentLayout
Component.onCompleted: {
// Normal binding causes binding loops
width = Qt.binding(function() {
return scrollView.viewport.width;
return scrollView.width;
});
}
......
......@@ -21,19 +21,24 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Controls 2.2
import org.kde.plasma.private.volume 0.1
ScrollView {
id: scrollView
anchors.fill: parent
contentWidth: contentLayout.width
contentHeight: contentLayout.height
clip: true
ColumnLayout {
id: contentLayout
Component.onCompleted: {
// Normal binding causes binding loops
width = Qt.binding(function() {
return scrollView.viewport.width;
return scrollView.width;
});
}
......
......@@ -19,10 +19,10 @@
*/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.private.volume 0.1
ColumnLayout {
......@@ -30,12 +30,11 @@ ColumnLayout {
width: parent.width
RowLayout {
QIconItem {
id: clientIcon
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
width: height
height: nameLabel.contentHeight
icon: IconName || "audio-card"
source: IconName || "audio-card"
}
Label {
......
......@@ -20,7 +20,7 @@
*/
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Controls 2.0
ComboBox {
onModelChanged: updateIndex()
......
......@@ -19,11 +19,10 @@
*/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.private.volume 0.1
ColumnLayout {
......@@ -31,10 +30,11 @@ ColumnLayout {
width: parent.width
RowLayout {
QIconItem {
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
width: height
height: inputText.height
icon: IconName || "audio-card"
source: IconName || "audio-card"
}
Label {
......
......@@ -20,16 +20,22 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Controls 2.3
ScrollView {
id: scrollView
contentWidth: contentLayout.width
contentHeight: contentLayout.height
clip: true
ColumnLayout {
id: contentLayout
Component.onCompleted: {
// Normal binding causes binding loops
width = Qt.binding(function() {
return scrollView.viewport.width;
return scrollView.width;
});
}
......
......@@ -20,7 +20,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.3
import QtQuick.Controls 2.0
ColumnLayout {
property alias text: heading.text
......
......@@ -19,11 +19,10 @@
*/
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.private.volume 0.1
ColumnLayout {
......@@ -38,12 +37,11 @@ ColumnLayout {
Layout.fillWidth: true
spacing: units.smallSpacing * 2
QIconItem {
id: clientIcon
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: delegateColumn.height * 0.60
Layout.preferredWidth: Layout.preferredHeight
icon: IconName || "unknown"
source: IconName || "unknown"
}
ColumnLayout {
......
......@@ -20,7 +20,7 @@
import QtQuick 2.4
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.0
import org.kde.plasma.private.volume 0.1
......@@ -38,8 +38,8 @@ RowLayout {
property bool ignoreValueChange: true
Layout.fillWidth: true
minimumValue: PulseAudio.MinimalVolume
maximumValue: PulseAudio.MaximalVolume
from: PulseAudio.MinimalVolume
to: PulseAudio.MaximalVolume
visible: HasVolume
enabled: VolumeWritable
opacity: Muted ? 0.5 : 1
......
......@@ -18,8 +18,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.1
import QtQuick.Controls 1.3
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
import org.kde.kcm 1.0
import org.kde.plasma.core 2.0 as PlasmaCore /* for units.gridUnit */
......@@ -28,50 +29,50 @@ import org.kde.plasma.private.volume 0.1
Kirigami.Page {
title: kcm.name
property int wheelDelta: 0
property QtObject sinkModel: SinkModel { }
property QtObject sourceModel: SourceModel { }
ConfigModule.quickHelp: i18nd("kcm_pulseaudio", "This module allows configuring the Pulseaudio sound subsystem.")
contentItem: MouseArea {
acceptedButtons: Qt.NoButton
implicitWidth: units.gridUnit * 30
implicitHeight: units.gridUnit * 30
// TODO: replace this TabBar-plus-Frame-in-a-ColumnLayout with whatever shakes
// out of https://bugs.kde.org/show_bug.cgi?id=394296
ColumnLayout {
anchors.fill: parent
spacing: 0
onWheel: {
if (tabView.childAt(wheel.x, wheel.y).objectName != "tabbar") {
wheel.accepted = false;
return;
TabBar {
id: tabView
TabButton {
text: i18ndc("kcm_pulseaudio", "@title:tab", "Devices")
}
var delta = wheel.angleDelta.y || wheel.angleDelta.x;
wheelDelta += delta;
// Magic number 120 for common "one click"
// See: http://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop
while (wheelDelta >= 120) {
wheelDelta -= 120;
tabView.currentIndex = Math.max(0, tabView.currentIndex - 1);
TabButton {
text: i18ndc("kcm_pulseaudio", "@title:tab", "Applications")
}
while (wheelDelta <= -120) {
wheelDelta += 120;
tabView.currentIndex = Math.min(tabView.count - 1, tabView.currentIndex + 1);
TabButton {
text: i18ndc("kcm_pulseaudio", "@title:tab", "Advanced")
}
}
Frame {
Layout.fillWidth: true
Layout.fillHeight: true
TabView {
id: tabView
anchors.fill: parent
StackLayout {
anchors.fill: parent
Tab {
title: i18ndc("kcm_pulseaudio", "@title:tab", "Devices")
Devices {}
}
Tab {
title: i18ndc("kcm_pulseaudio", "@title:tab", "Applications")
Applications {}
}
Tab {
title: i18ndc("kcm_pulseaudio", "@title:tab", "Advanced")
Advanced {}
currentIndex: tabView.currentIndex
Devices {
Layout.fillWidth: true
Layout.fillHeight: true
}
Applications {
Layout.fillWidth: true
Layout.fillHeight: true
}
Advanced {
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
}
......
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