Commit c6b90fd6 authored by Jan Blackquill's avatar Jan Blackquill 🌈

Port from context properties to singletons

This ports from units.* to PlasmaCore.Units.* and theme.* to
PlasmaCore.Theme.*
parent 99475b09
......@@ -21,6 +21,7 @@ import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
......@@ -28,7 +29,7 @@ PlasmaExtras.ListItem {
id: menuItem
property bool supportsBarcodes
property int maximumNumberOfPreviews: Math.floor(width / (units.gridUnit * 4 + units.smallSpacing))
property int maximumNumberOfPreviews: Math.floor(width / (PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing))
readonly property real gradientThreshold: (label.width - toolButtonsLoader.width) / label.width
signal itemSelected(string uuid)
......@@ -38,7 +39,7 @@ PlasmaExtras.ListItem {
signal action(string uuid)
// the 1.6 comes from ToolButton's default height
height: Math.max(label.height, Math.round(units.gridUnit * 1.6)) + 2 * units.smallSpacing
height: Math.max(label.height, Math.round(PlasmaCore.Units.gridUnit * 1.6)) + 2 * PlasmaCore.Units.smallSpacing
enabled: true
......@@ -96,7 +97,7 @@ PlasmaExtras.ListItem {
visible: !menuItem.ListView.isCurrentItem
anchors {
left: parent.left
leftMargin: units.gridUnit / 2 - listMargins.left
leftMargin: PlasmaCore.Units.gridUnit / 2 - listMargins.left
right: parent.right
verticalCenter: parent.verticalCenter
}
......
......@@ -21,11 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.plasma.core 2.0 as PlasmaCore
KQuickControlsAddons.QPixmapItem {
id: previewPixmap
width: Math.min(nativeWidth, width)
height: Math.min(nativeHeight, Math.round(width * (nativeHeight/nativeWidth) + units.smallSpacing * 2))
height: Math.min(nativeHeight, Math.round(width * (nativeHeight/nativeWidth) + PlasmaCore.Units.smallSpacing * 2))
pixmap: DecorationRole
fillMode: KQuickControlsAddons.QPixmapItem.PreserveAspectFit
}
......@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // For Highlight
import org.kde.kirigami 2.12 as Kirigami
......@@ -59,7 +60,7 @@ PlasmaExtras.ScrollArea {
id: emptyHint
anchors.centerIn: parent
width: parent.width - (units.largeSpacing * 4)
width: parent.width - (PlasmaCore.Units.largeSpacing * 4)
visible: menuListView.count === 0
text: i18n("Clipboard is empty")
......
......@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
PlasmaComponents3.Label {
......@@ -27,7 +28,7 @@ PlasmaComponents3.Label {
verticalAlignment: Text.AlignVCenter
text: {
var highlightFontTag = "<font color='" + theme.highlightColor + "'>%1</font>"
var highlightFontTag = "<font color='" + PlasmaCore.Theme.highlightColor + "'>%1</font>"
var text = DisplayRole.slice(0, 100)
......
......@@ -20,21 +20,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
Item {
id: previewItem
height: units.gridUnit * 4 + units.smallSpacing * 2
height: PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing * 2
ListView {
id: previewList
model: DisplayRole.split(" ", maximumNumberOfPreviews)
property int itemWidth: units.gridUnit * 4
property int itemHeight: units.gridUnit * 4
property int itemWidth: PlasmaCore.Units.gridUnit * 4
property int itemHeight: PlasmaCore.Units.gridUnit * 4
interactive: false
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
orientation: Qt.Horizontal
width: (itemWidth + spacing) * model.length
anchors {
......@@ -77,7 +78,7 @@ Item {
id: overlay
color: theme.textColor
opacity: 0.6
height: units.gridUnit
height: PlasmaCore.Units.gridUnit
anchors {
left: parent.left
right: parent.right
......@@ -92,8 +93,8 @@ Item {
verticalCenter: overlay.verticalCenter
left: overlay.left
right: overlay.right
leftMargin: units.smallSpacing
rightMargin: units.smallSpacing
leftMargin: PlasmaCore.Units.smallSpacing
rightMargin: PlasmaCore.Units.smallSpacing
}
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
......@@ -113,7 +114,7 @@ Item {
left: previewList.right
right: parent.right
bottom: parent.bottom
margins: units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
verticalAlignment: Text.AlignBottom
......
......@@ -201,7 +201,7 @@ QtLayouts.ColumnLayout {
visible: cfg_dateFormat == "custom"
wrapMode: Text.Wrap
QtLayouts.Layout.preferredWidth: QtLayouts.Layout.maximumWidth
QtLayouts.Layout.maximumWidth: units.gridUnit * 16
QtLayouts.Layout.maximumWidth: Kirigami.Units.gridUnit * 16
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
......@@ -225,7 +225,7 @@ QtLayouts.ColumnLayout {
QtLayouts.Layout.fillWidth: true
currentIndex: 0
// ComboBox's sizing is just utterly broken
QtLayouts.Layout.minimumWidth: units.gridUnit * 10
QtLayouts.Layout.minimumWidth: Kirigami.Units.gridUnit * 10
model: fontsModel
// doesn't autodeduce from model because we manually populate it
textRole: "text"
......
......@@ -50,6 +50,6 @@ MouseArea {
target: delegate
property:"x"
to: 0
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
......@@ -21,6 +21,7 @@
import QtQuick 2.8
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
RowLayout {
......@@ -36,7 +37,7 @@ RowLayout {
property string buttonIconName
property string buttonText
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
function activate() {
replyTextField.forceActiveFocus();
......
......@@ -72,8 +72,8 @@ ColumnLayout {
ListView {
id: itemsList
property var visibilityColumnWidth: units.gridUnit
property var keySequenceColumnWidth: units.gridUnit
property var visibilityColumnWidth: PlasmaCore.Units.gridUnit
property var keySequenceColumnWidth: PlasmaCore.Units.gridUnit
clip: true
......@@ -123,7 +123,7 @@ ColumnLayout {
Layout.fillWidth: true
Kirigami.Icon {
width: units.iconSizes.small
width: PlasmaCore.Units.iconSizes.small
height: width
source: model.decoration
}
......
......@@ -30,20 +30,20 @@ import "items"
MouseArea {
id: root
Layout.minimumWidth: vertical ? units.iconSizes.small : tasksGrid.implicitWidth + (expander.visible ? expander.implicitWidth : 0) + units.smallSpacing
Layout.minimumWidth: vertical ? PlasmaCore.Units.iconSizes.small : tasksGrid.implicitWidth + (expander.visible ? expander.implicitWidth : 0) + PlasmaCore.Units.smallSpacing
Layout.minimumHeight: vertical ? tasksGrid.implicitHeight + (expander.visible ? expander.implicitHeight : 0) + units.smallSpacing : units.smallSpacing
Layout.minimumHeight: vertical ? tasksGrid.implicitHeight + (expander.visible ? expander.implicitHeight : 0) + PlasmaCore.Units.smallSpacing : PlasmaCore.Units.smallSpacing
Layout.preferredHeight: Layout.minimumHeight
LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
// The icon size to display when not using the auto-scaling setting
readonly property int smallIconSize: units.iconSizes.smallMedium
readonly property int smallIconSize: PlasmaCore.Units.iconSizes.smallMedium
// Used only by AbstractItem, but it's easiest to keep it here since it
// uses dimensions from this item to calculate the final value
readonly property int itemSize: autoSize ? units.roundToIconSize(Math.min(Math.min(width / rowsOrColumns, height / rowsOrColumns), units.iconSizes.enormous)) : smallIconSize
readonly property int itemSize: autoSize ? PlasmaCore.Units.roundToIconSize(Math.min(Math.min(width / rowsOrColumns, height / rowsOrColumns), PlasmaCore.Units.iconSizes.enormous)) : smallIconSize
// The rest are derived properties; do not modify
readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
......@@ -147,7 +147,7 @@ MouseArea {
GridView {
id: tasksGrid
readonly property int smallSizeCellLength: root.cellThickness > root.smallIconSize ? root.smallIconSize + units.smallSpacing * 2
readonly property int smallSizeCellLength: root.cellThickness > root.smallIconSize ? root.smallIconSize + PlasmaCore.Units.smallSpacing * 2
: root.smallIconSize
readonly property int autoSizeCellLength: root.cellThickness / root.rowsOrColumns
readonly property int totalLength: root.vertical ? cellHeight * Math.round(count / root.rowsOrColumns)
......@@ -182,7 +182,7 @@ MouseArea {
from: 0
to: 1
easing.type: Easing.InOutQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
......@@ -193,7 +193,7 @@ MouseArea {
property: "scale"
to: 1
easing.type: Easing.InOutQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
......@@ -201,7 +201,7 @@ MouseArea {
NumberAnimation {
properties: "x,y"
easing.type: Easing.InOutQuad
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
}
}
}
......
......@@ -20,14 +20,14 @@
import QtQuick 2.12
import org.kde.plasma.private.containmentlayoutmanager 1.0 as ContainmentLayoutManager
import org.kde.plasma.core 2.0 as PlasmaCore
ContainmentLayoutManager.ResizeHandle {
width: overlay.touchInteraction ? units.gridUnit * 2 : units.gridUnit
width: overlay.touchInteraction ? PlasmaCore.Units.gridUnit * 2 : PlasmaCore.Units.gridUnit
height: width
z: 999
Rectangle {
color: resizeBlocked ? theme.negativeTextColor : theme.backgroundColor
color: resizeBlocked ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.backgroundColor
anchors.fill: parent
radius: width
opacity: 0.6
......@@ -35,7 +35,7 @@ ContainmentLayoutManager.ResizeHandle {
scale: overlay.open ? 1 : 0
Behavior on scale {
NumberAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.InOutQuad
}
}
......
......@@ -19,6 +19,7 @@
import QtQuick 2.5
import QtQuick.Window 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
Rectangle {
id: root
......@@ -45,14 +46,14 @@ Rectangle {
id: units
text: "M"
property int gridUnit: boundingRect.height
property int largeSpacing: units.gridUnit
property int largeSpacing: PlasmaCore.Units.gridUnit
property int smallSpacing: Math.max(2, gridUnit/4)
}
Image {
id: logo
//match SDDM/lockscreen avatar positioning
property real size: units.gridUnit * 8
property real size: PlasmaCore.Units.gridUnit * 8
anchors.centerIn: parent
......@@ -68,8 +69,8 @@ Rectangle {
y: parent.height - (parent.height - logo.y) / 2 - height/2
anchors.horizontalCenter: parent.horizontalCenter
source: "images/busywidget.svgz"
sourceSize.height: units.gridUnit * 2
sourceSize.width: units.gridUnit * 2
sourceSize.height: PlasmaCore.Units.gridUnit * 2
sourceSize.width: PlasmaCore.Units.gridUnit * 2
RotationAnimator on rotation {
id: rotationAnimator
from: 0
......@@ -79,11 +80,11 @@ Rectangle {
}
}
Row {
spacing: units.smallSpacing*2
spacing: PlasmaCore.Units.smallSpacing*2
anchors {
bottom: parent.bottom
right: parent.right
margins: units.gridUnit
margins: PlasmaCore.Units.gridUnit
}
Text {
color: "#eff0f1"
......@@ -95,8 +96,8 @@ Rectangle {
}
Image {
source: "images/kde.svgz"
sourceSize.height: units.gridUnit * 2
sourceSize.width: units.gridUnit * 2
sourceSize.height: PlasmaCore.Units.gridUnit * 2
sourceSize.width: PlasmaCore.Units.gridUnit * 2
}
}
}
......
......@@ -69,7 +69,7 @@ KCM.GridDelegate {
QIconItem {
anchors.centerIn: parent
width: units.iconSizes.large
width: PlasmaCore.Units.iconSizes.large
height: width
icon: "view-preview"
visible: !walliePreview.visible
......
......@@ -20,6 +20,7 @@
import QtQuick 2.0
import QtQuick.Controls.Private 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
MouseArea {
......@@ -40,18 +41,18 @@ MouseArea {
color: "white"
anchors {
fill: parent
margins: units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
opacity: 0.8
Rectangle {
color: cfg_Color
anchors {
fill: parent
margins: units.smallSpacing * 2
margins: PlasmaCore.Units.smallSpacing * 2
}
QIconItem {
anchors.centerIn: parent
width: units.iconSizes.large
width: PlasmaCore.Units.iconSizes.large
height: width
icon: "view-preview"
visible: !walliePreview.visible
......@@ -83,7 +84,7 @@ MouseArea {
anchors {
top: parent.top
right: parent.right
margins: units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
icon.name: "list-remove"
flat: false
......@@ -100,12 +101,12 @@ MouseArea {
Rectangle {
opacity: selected ? 1.0 : 0
anchors.fill: background
border.width: units.smallSpacing * 2
border.width: PlasmaCore.Units.smallSpacing * 2
border.color: syspal.highlight
color: "transparent"
Behavior on opacity {
PropertyAnimation {
duration: units.longDuration
duration: PlasmaCore.Units.longDuration
easing.type: Easing.OutQuad
}
}
......
......@@ -19,7 +19,7 @@
import QtQuick 2.0
//We need units from it
import org.kde.plasma.core 2.0 as Plasmacore
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.wallpapers.image 2.0 as Wallpaper
import org.kde.kquickcontrolsaddons 2.0
import QtQuick.Controls 2.8 as QQC2
......@@ -51,7 +51,7 @@ Item {
model: imageWallpaper.wallpaperModel
currentIndex: -1
cellWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (units.gridUnit*12)), 3))
cellWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (PlasmaCore.Units.gridUnit*12)), 3))
cellHeight: cellWidth / (plasmoid.width / plasmoid.height)
anchors.margins: 4
......
......@@ -19,7 +19,7 @@
import QtQuick 2.0
import Qt.labs.folderlistmodel 2.1
//We need units from it
import org.kde.plasma.core 2.0 as Plasmacore
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.wallpapers.image 2.0 as Wallpaper
import org.kde.kquickcontrolsaddons 2.0
import QtQuick.Controls 2.8 as QQC2
......@@ -45,7 +45,7 @@ Rectangle {
}
currentIndex: -1
cellWidth: Math.floor(customGrid.width / Math.max(Math.floor(customGrid.width / (units.gridUnit*12)), 3))
cellWidth: Math.floor(customGrid.width / Math.max(Math.floor(customGrid.width / (PlasmaCore.Units.gridUnit*12)), 3))
cellHeight: cellWidth / (imageWallpaper.width / imageWallpaper.height)
anchors.margins: 4
......@@ -63,12 +63,12 @@ Rectangle {
color: "white"
anchors {
fill: parent
margins: units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
Image {
anchors {
fill: parent
margins: units.smallSpacing * 2
margins: PlasmaCore.Units.smallSpacing * 2
}
source: model.fileURL
}
......
......@@ -22,6 +22,7 @@ import QtQuick 2.0
import org.kde.plasma.core 2.0 as Plasmacore
import org.kde.plasma.wallpapers.image 2.0 as Wallpaper
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.mobilecomponents 0.2 as MobileComponets
Item {
......@@ -58,7 +59,7 @@ Item {
right: parent.right
}
delegateWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (units.gridUnit*12)), 3))
delegateWidth: Math.floor(wallpapersGrid.width / Math.max(Math.floor(wallpapersGrid.width / (PlasmaCore.Units.gridUnit*12)), 3))
delegateHeight: delegateWidth / 1.6
delegate: WallpaperDelegate {}
......
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