Commit 46e65dcc authored by Nicolas Fella's avatar Nicolas Fella

Replace units context property with Kirigami.Units

Tl;Dr units bad, Kirigami.Units and PlasmaCore.Units good
parent cdf9fba8
......@@ -21,11 +21,12 @@
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents // for ListItem
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.core 2.0 as PlasmaCore
PlasmaComponents.ListItem {
property alias text: label.text
height: units.gridUnit * 1.5
height: PlasmaCore.Units.gridUnit * 1.5
sectionDelegate: true
PlasmaComponents3.Label {
......
......@@ -54,7 +54,7 @@ PlasmaComponents.ListItem {
RowLayout {
id: controlsRow
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
anchors.left: parent.left
anchors.right: parent.right
......@@ -115,10 +115,10 @@ PlasmaComponents.ListItem {
id: defaultButton
// Maximum width of the button need to match the text. Empty area must not change the default device.
Layout.maximumWidth: controlsRow.width - Layout.leftMargin - Layout.rightMargin
- (contextMenuButton.visible ? contextMenuButton.implicitWidth + units.smallSpacing * 2 : 0)
- (contextMenuButton.visible ? contextMenuButton.implicitWidth + PlasmaCore.Units.smallSpacing * 2 : 0)
Layout.leftMargin: LayoutMirroring.enabled ? 0 : Math.round((muteButton.width - defaultButton.indicator.width) / 2)
Layout.rightMargin: LayoutMirroring.enabled ? Math.round((muteButton.width - defaultButton.indicator.width) / 2) : 0
spacing: units.smallSpacing + Math.round((muteButton.width - defaultButton.indicator.width) / 2)
spacing: PlasmaCore.Units.smallSpacing + Math.round((muteButton.width - defaultButton.indicator.width) / 2)
checked: PulseObject.default ? PulseObject.default : false
visible: (type == "sink" && sinkView.model.count > 1) || (type == "source" && sourceView.model.count > 1)
onClicked: PulseObject.default = true;
......
......@@ -26,7 +26,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents3
PlasmaComponents3.ToolButton {
id: smallToolButton
readonly property int size: Math.ceil(units.iconSizes.small + units.smallSpacing * 2)
readonly property int size: Math.ceil(PlasmaCore.Units.iconSizes.small + PlasmaCore.Units.smallSpacing * 2)
implicitWidth: size
implicitHeight: size
}
......@@ -45,10 +45,10 @@ Item {
// DEFAULT_SINK_NAME in module-always-sink.c
readonly property string dummyOutputName: "auto_null"
Layout.minimumHeight: units.gridUnit * 8
Layout.minimumWidth: units.gridUnit * 14
Layout.preferredHeight: units.gridUnit * 21
Layout.preferredWidth: units.gridUnit * 24
Layout.minimumHeight: PlasmaCore.Units.gridUnit * 8
Layout.minimumWidth: PlasmaCore.Units.gridUnit * 14
Layout.preferredHeight: PlasmaCore.Units.gridUnit * 21
Layout.preferredWidth: PlasmaCore.Units.gridUnit * 24
Plasmoid.switchHeight: Layout.minimumHeight
Plasmoid.switchWidth: Layout.minimumWidth
......@@ -433,7 +433,7 @@ Item {
//this removes bottom padding to allow tabbar to touch the edge
bottomPadding: -bottomInset
RowLayout {
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
anchors.fill: parent
PlasmaComponents.TabBar {
......@@ -501,11 +501,11 @@ Item {
PlasmaCore.SvgItem {
elementId: "horizontal-line"
Layout.preferredWidth: scrollView.viewport.width - units.smallSpacing * 4
Layout.preferredWidth: scrollView.viewport.width - PlasmaCore.Units.smallSpacing * 4
Layout.preferredHeight: naturalSize.height
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
Layout.topMargin: units.smallSpacing
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaCore.Units.smallSpacing * 2
Layout.topMargin: PlasmaCore.Units.smallSpacing
svg: lineSvg
visible: sinkInputView.model.count > 0 && sourceOutputView.model.count > 0
}
......@@ -557,10 +557,10 @@ Item {
PlasmaCore.SvgItem {
id: devicesLine
elementId: "horizontal-line"
Layout.preferredWidth: scrollView.viewport.width - units.smallSpacing * 4
Layout.leftMargin: units.smallSpacing * 2
Layout.preferredWidth: scrollView.viewport.width - PlasmaCore.Units.smallSpacing * 4
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: Layout.leftMargin
Layout.topMargin: units.smallSpacing
Layout.topMargin: PlasmaCore.Units.smallSpacing
svg: lineSvg
visible: sinkView.model.count > 0 && sourceView.model.count > 0 && (sinkView.model.count > 1 || sourceView.model.count > 1)
}
......@@ -617,9 +617,9 @@ Item {
PlasmaComponents3.CheckBox {
id: raiseMaximumVolumeCheckbox
// Align center, with the devices mute icon. Calculating the size based on SmallToolButton.qml. '4' is margin in ListItem.
Layout.leftMargin: LayoutMirroring.enabled ? 0 : Math.round((Math.ceil(units.iconSizes.small + units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + 4
Layout.rightMargin: !LayoutMirroring.enabled ? 0 : Math.round((Math.ceil(units.iconSizes.small + units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + 4
spacing: Math.round((Math.ceil(units.iconSizes.small + units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + units.smallSpacing
Layout.leftMargin: LayoutMirroring.enabled ? 0 : Math.round((Math.ceil(PlasmaCore.Units.iconSizes.small + PlasmaCore.Units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + 4
Layout.rightMargin: !LayoutMirroring.enabled ? 0 : Math.round((Math.ceil(PlasmaCore.Units.iconSizes.small + PlasmaCore.Units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + 4
spacing: Math.round((Math.ceil(PlasmaCore.Units.iconSizes.small + PlasmaCore.Units.smallSpacing * 2) - raiseMaximumVolumeCheckbox.indicator.width) / 2) + PlasmaCore.Units.smallSpacing
checked: plasmoid.configuration.raiseMaximumVolume
onToggled: {
plasmoid.configuration.raiseMaximumVolume = checked
......
......@@ -25,6 +25,7 @@ import QtQuick.Controls 2.2
import org.kde.plasma.private.volume 0.1
import org.kde.kcoreaddons 1.0 as KCoreAddons
import org.kde.kcm 1.3 as KCM
import org.kde.kirigami 2.5 as Kirigami
KCM.SimpleKCM {
......@@ -43,9 +44,9 @@ KCM.SimpleKCM {
id: view
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
Layout.margins: units.gridUnit / 2
Layout.margins: Kirigami.Units.gridUnit / 2
interactive: false
spacing: units.smallSpacing * 2
spacing: Kirigami.Units.smallSpacing * 2
model: CardModel {}
delegate: CardListItem {}
}
......@@ -62,9 +63,9 @@ KCM.SimpleKCM {
CheckBox {
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
Layout.leftMargin: units.gridUnit / 2
Layout.rightMargin: units.gridUnit / 2
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.leftMargin: Kirigami.Units.gridUnit / 2
Layout.rightMargin: Kirigami.Units.gridUnit / 2
text: i18nd("kcm_pulseaudio", "Add virtual output device for simultaneous output on all local sound cards")
checked: moduleManager.combineSinks
onCheckedChanged: moduleManager.combineSinks = checked;
......@@ -74,8 +75,8 @@ KCM.SimpleKCM {
CheckBox {
Layout.fillWidth: true
Layout.leftMargin: units.gridUnit / 2
Layout.rightMargin: units.gridUnit / 2
Layout.leftMargin: Kirigami.Units.gridUnit / 2
Layout.rightMargin: Kirigami.Units.gridUnit / 2
text: i18nd("kcm_pulseaudio", "Automatically switch all running streams when a new output becomes available")
checked: moduleManager.switchOnConnect
onCheckedChanged: moduleManager.switchOnConnect = checked;
......@@ -97,7 +98,7 @@ KCM.SimpleKCM {
}
RowLayout {
Layout.margins: units.gridUnit / 2
Layout.margins: Kirigami.Units.gridUnit / 2
visible: sinks.count > 1
Label {
......
......@@ -22,14 +22,16 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import org.kde.kirigami 2.5 as Kirigami
ColumnLayout {
property alias text: heading.text
property alias disabledText: disabledLabel.text
Item {
Layout.fillWidth: true
Layout.preferredHeight: units.gridUnit * 1.5
Layout.topMargin: units.smallSpacing
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
Layout.topMargin: Kirigami.Units.smallSpacing
Label {
id: heading
......
......@@ -21,6 +21,8 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
import org.kde.kirigami 2.5 as Kirigami
Rectangle {
property ListView view
......@@ -28,7 +30,7 @@ Rectangle {
visible: (view.count != 0) && (view.count != (index + 1))
color: systemPalette.mid
height: Math.ceil(units.gridUnit / 20)
height: Math.ceil(Kirigami.Units.gridUnit / 20)
SystemPalette {
id: systemPalette
......
......@@ -37,7 +37,7 @@ ColumnLayout {
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing * 2
spacing: Kirigami.Units.smallSpacing * 2
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
......@@ -68,8 +68,8 @@ ColumnLayout {
DeviceComboBox {
id: deviceComboBox
Layout.leftMargin: units.smallSpacing
Layout.rightMargin: units.smallSpacing
Layout.leftMargin: Kirigami.Units.smallSpacing
Layout.rightMargin: Kirigami.Units.smallSpacing
Layout.preferredWidth: delegate.width / 3
visible: !isEventStream && count > 1
}
......
......@@ -26,7 +26,6 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
import org.kde.kcm 1.3
import org.kde.plasma.core 2.0 as PlasmaCore /* for units.gridUnit */
import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.private.volume 0.1
......@@ -143,7 +142,7 @@ ScrollViewKCM {
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
interactive: false
spacing: units.largeSpacing
spacing: Kirigami.Units.largeSpacing
model: PulseObjectFilterModel {
filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ]
sourceModel: StreamRestoreModel {}
......@@ -159,7 +158,7 @@ ScrollViewKCM {
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
interactive: false
spacing: units.largeSpacing
spacing: Kirigami.Units.largeSpacing
model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SinkInputModel {}
......@@ -182,7 +181,7 @@ ScrollViewKCM {
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
interactive: false
spacing: units.largeSpacing
spacing: Kirigami.Units.largeSpacing
model: PulseObjectFilterModel {
filters: [ { role: "VirtualStream", value: false } ]
sourceModel: SourceOutputModel {}
......
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