Commit 3564a1e0 authored by Jan Blackquill's avatar Jan Blackquill 🌈

Port away from using units as context properties

This commit ports away from units.* to PlasmaCore.Units.*
parent 8ea04438
......@@ -49,25 +49,25 @@ Item {
var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth));
root.Layout.minimumHeight = scaledHeight;
root.Layout.maximumHeight = scaledHeight;
root.Layout.minimumWidth = units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1;
root.Layout.minimumWidth = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
} else {
var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight));
root.Layout.minimumWidth = scaledWidth;
root.Layout.maximumWidth = scaledWidth;
root.Layout.minimumHeight = units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1;
root.Layout.minimumHeight = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
}
} else {
root.Layout.minimumWidth = units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1;
root.Layout.minimumHeight = units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1;
root.Layout.minimumWidth = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
root.Layout.minimumHeight = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
}
}
Connections {
target: units.iconSizeHints
target: PlasmaCore.Units.iconSizeHints
onPanelChanged: root.updateSizeHints()
}
......
......@@ -58,8 +58,8 @@ Kirigami.FormLayout {
Kirigami.FormData.label: i18n("Icon:")
implicitWidth: previewFrame.width + units.smallSpacing * 2
implicitHeight: previewFrame.height + units.smallSpacing * 2
implicitWidth: previewFrame.width + PlasmaCore.Units.smallSpacing * 2
implicitHeight: previewFrame.height + PlasmaCore.Units.smallSpacing * 2
// Just to provide some visual feedback when dragging;
// cannot have checked without checkable enabled
......@@ -116,12 +116,12 @@ Kirigami.FormLayout {
anchors.centerIn: parent
imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal
? "widgets/panel-background" : "widgets/background"
width: units.iconSizes.large + fixedMargins.left + fixedMargins.right
height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom
width: PlasmaCore.Units.iconSizes.large + fixedMargins.left + fixedMargins.right
height: PlasmaCore.Units.iconSizes.large + fixedMargins.top + fixedMargins.bottom
PlasmaCore.IconItem {
anchors.centerIn: parent
width: units.iconSizes.large
width: PlasmaCore.Units.iconSizes.large
height: width
source: configGeneral.cfg_useCustomButtonImage ? configGeneral.cfg_customButtonImage : configGeneral.cfg_icon
}
......
......@@ -22,6 +22,7 @@ import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwindowsystem 1.0
......@@ -41,11 +42,11 @@ import "code/tools.js" as Tools
Kicker.DashboardWindow {
id: root
property bool smallScreen: ((Math.floor(width / units.iconSizes.huge) <= 22) || (Math.floor(height / units.iconSizes.huge) <= 14))
property bool smallScreen: ((Math.floor(width / PlasmaCore.Units.iconSizes.huge) <= 22) || (Math.floor(height / PlasmaCore.Units.iconSizes.huge) <= 14))
property int iconSize: smallScreen ? units.iconSizes.large : units.iconSizes.huge
property int iconSize: smallScreen ? PlasmaCore.Units.iconSizes.large : PlasmaCore.Units.iconSizes.huge
property int cellSize: iconSize + theme.mSize(theme.defaultFont).height
+ (2 * units.smallSpacing)
+ (2 * PlasmaCore.Units.smallSpacing)
+ (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
highlightItemSvg.margins.left + highlightItemSvg.margins.right))
property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize))
......@@ -319,11 +320,11 @@ Kicker.DashboardWindow {
anchors {
left: searchHeading.right
leftMargin: units.largeSpacing
leftMargin: PlasmaCore.Units.largeSpacing
verticalCenter: searchHeading.verticalCenter
}
width: units.iconSizes.large
width: PlasmaCore.Units.iconSizes.large
height: width
visible: (searchField.text != "")
......@@ -361,15 +362,15 @@ Kicker.DashboardWindow {
anchors {
top: parent.top
topMargin: units.gridUnit * (smallScreen ? 8 : 10)
topMargin: PlasmaCore.Units.gridUnit * (smallScreen ? 8 : 10)
bottom: parent.bottom
bottomMargin: (units.gridUnit * 2)
bottomMargin: (PlasmaCore.Units.gridUnit * 2)
horizontalCenter: parent.horizontalCenter
}
width: (root.columns * root.cellSize) + (2 * spacing)
spacing: units.gridUnit * 2
spacing: PlasmaCore.Units.gridUnit * 2
Item {
id: favoritesColumn
......@@ -379,7 +380,7 @@ Kicker.DashboardWindow {
bottom: parent.bottom
}
width: (columns * root.cellSize) + units.gridUnit
width: (columns * root.cellSize) + PlasmaCore.Units.gridUnit
property int columns: 3
......@@ -392,7 +393,7 @@ Kicker.DashboardWindow {
top: parent.top
}
x: units.smallSpacing
x: PlasmaCore.Units.smallSpacing
width: parent.width - x
elide: Text.ElideRight
......@@ -406,7 +407,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3)
Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.longDuration; velocity: 0.01 } }
}
PlasmaCore.SvgItem {
......@@ -418,7 +419,7 @@ Kicker.DashboardWindow {
top: favoritesColumnLabel.bottom
}
width: parent.width - units.gridUnit
width: parent.width - PlasmaCore.Units.gridUnit
height: lineSvg.horLineHeight
svg: lineSvg
......@@ -426,7 +427,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3)
Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.longDuration; velocity: 0.01 } }
}
ItemGridView {
......@@ -436,11 +437,11 @@ Kicker.DashboardWindow {
anchors {
top: favoritesColumnLabelUnderline.bottom
topMargin: units.largeSpacing
topMargin: PlasmaCore.Units.largeSpacing
}
property int rows: (Math.floor((parent.height - favoritesColumnLabel.height
- favoritesColumnLabelUnderline.height - units.largeSpacing) / root.cellSize)
- favoritesColumnLabelUnderline.height - PlasmaCore.Units.largeSpacing) / root.cellSize)
- systemFavoritesGrid.rows)
width: parent.width
......@@ -457,7 +458,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3)
Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.longDuration; velocity: 0.01 } }
onCurrentIndexChanged: {
preloadAllAppsTimer.defer();
......@@ -561,7 +562,7 @@ Kicker.DashboardWindow {
anchors.top: parent.top
width: (columns * root.cellSize) + units.gridUnit
width: (columns * root.cellSize) + PlasmaCore.Units.gridUnit
height: Math.floor(parent.height / root.cellSize) * root.cellSize + mainGridContainer.headerHeight
property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns
......@@ -581,7 +582,7 @@ Kicker.DashboardWindow {
enabled: (opacity == 1.0) ? 1 : 0
property int headerHeight: mainColumnLabel.height + mainColumnLabelUnderline.height + units.largeSpacing
property int headerHeight: mainColumnLabel.height + mainColumnLabelUnderline.height + PlasmaCore.Units.largeSpacing
opacity: {
if (tabBar.activeTab == 0 && root.searching) {
......@@ -608,7 +609,7 @@ Kicker.DashboardWindow {
top: parent.top
}
x: units.smallSpacing
x: PlasmaCore.Units.smallSpacing
width: parent.width - x
elide: Text.ElideRight
......@@ -631,7 +632,7 @@ Kicker.DashboardWindow {
top: mainColumnLabel.bottom
}
width: parent.width - units.gridUnit
width: parent.width - PlasmaCore.Units.gridUnit
height: lineSvg.horLineHeight
svg: lineSvg
......@@ -643,7 +644,7 @@ Kicker.DashboardWindow {
anchors {
top: mainColumnLabelUnderline.bottom
topMargin: units.largeSpacing
topMargin: PlasmaCore.Units.largeSpacing
}
width: parent.width
......@@ -651,7 +652,7 @@ Kicker.DashboardWindow {
cellWidth: (tabBar.activeTab == 0 ? root.cellSize : root.cellSize * 2)
cellHeight: cellWidth
iconSize: (tabBar.activeTab == 0 ? root.iconSize : cellWidth - (units.largeSpacing * 2))
iconSize: (tabBar.activeTab == 0 ? root.iconSize : cellWidth - (PlasmaCore.Units.largeSpacing * 2))
model: funnelModel
......@@ -800,7 +801,7 @@ Kicker.DashboardWindow {
anchors {
top: parent.top
topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + units.largeSpacing
topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + PlasmaCore.Units.largeSpacing
bottom: parent.bottom
}
......@@ -811,9 +812,9 @@ Kicker.DashboardWindow {
PlasmaExtras.ScrollArea {
id: filterListScrollArea
x: root.visible ? 0 : units.gridUnit
x: root.visible ? 0 : PlasmaCore.Units.gridUnit
Behavior on x { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } }
Behavior on x { SmoothedAnimation { duration: PlasmaCore.Units.longDuration; velocity: 0.01 } }
width: parent.width
height: mainGrid.height
......@@ -824,7 +825,7 @@ Kicker.DashboardWindow {
opacity: root.visible ? (root.searching ? 0.30 : 1.0) : 0.3
Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.longDuration; velocity: 0.01 } }
verticalScrollBarPolicy: (opacity == 1.0) ? Qt.ScrollBarAsNeeded : Qt.ScrollBarAlwaysOff
......@@ -990,7 +991,7 @@ Kicker.DashboardWindow {
width: (highlightItemSvg.margins.left
+ filterList.currentItem.textWidth
+ highlightItemSvg.margins.right
+ units.smallSpacing)
+ PlasmaCore.Units.smallSpacing)
visible: filterList.currentItem
}
......@@ -1013,7 +1014,7 @@ Kicker.DashboardWindow {
}
filterListColumn.columns = Math.ceil(width / root.cellSize);
filterListScrollArea.width = width + hItemMargins + (units.gridUnit * 2);
filterListScrollArea.width = width + hItemMargins + (PlasmaCore.Units.gridUnit * 2);
}
function applyFilter() {
......
......@@ -20,13 +20,14 @@
import QtQuick 2.4
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
id: tab
width: label.contentWidth + (units.largeSpacing * 2)
height: label.contentHeight + (units.smallSpacing * 2)
width: label.contentWidth + (PlasmaCore.Units.largeSpacing * 2)
height: label.contentHeight + (PlasmaCore.Units.smallSpacing * 2)
property int index: 0
property bool active: false
......@@ -40,18 +41,18 @@ Item {
color: tab.parent.focus ? theme.highlightColor : "black"
opacity: tab.active ? 0.4 : 0.15
Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.shortDuration; velocity: 0.01 } }
}
PlasmaExtras.Heading {
id: label
x: units.largeSpacing
x: PlasmaCore.Units.largeSpacing
elide: Text.ElideNone
wrapMode: Text.NoWrap
opacity: tab.active ? 1.0 : 0.6
Behavior on opacity { SmoothedAnimation { duration: units.shortDuration; velocity: 0.01 } }
Behavior on opacity { SmoothedAnimation { duration: PlasmaCore.Units.shortDuration; velocity: 0.01 } }
color: tab.parent.focus ? theme.highlightedTextColor : "white"
......
......@@ -86,7 +86,7 @@ Item {
anchors {
top: icon.bottom
topMargin: units.smallSpacing
topMargin: PlasmaCore.Units.smallSpacing
left: parent.left
leftMargin: highlightItemSvg.margins.left
right: parent.right
......
......@@ -198,7 +198,7 @@ FocusScope {
property bool usesPlasmaTheme: false
property int iconSize: units.iconSizes.huge
property int iconSize: PlasmaCore.Units.iconSizes.huge
property bool animating: false
property int animationDuration: itemGrid.dropEnabled ? resetAnimationDurationTimer.interval : 0
......@@ -273,7 +273,7 @@ FocusScope {
bottomMargin: parent.margins.bottom
}
width: units.iconSizes.smallMedium
width: PlasmaCore.Units.iconSizes.smallMedium
height: width
source: "list-add"
......
......@@ -188,7 +188,7 @@ Item {
height: parent.height
spacing: units.smallSpacing * 2
spacing: PlasmaCore.Units.smallSpacing * 2
readonly property real actualSpacing: ((icon.visible ? 1 : 0) * spacing) + ((arrow.visible ? 1 : 0) * spacing)
LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft)
......@@ -198,7 +198,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
width: visible ? units.iconSizes.small : 0
width: visible ? PlasmaCore.Units.iconSizes.small : 0
height: width
visible: iconsEnabled
......@@ -232,7 +232,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
width: visible ? units.iconSizes.small : 0
width: visible ? PlasmaCore.Units.iconSizes.small : 0
height: width
visible: item.hasChildren
......
......@@ -37,7 +37,7 @@ Kicker.SubMenu {
location: PlasmaCore.Types.Floating
offset: units.smallSpacing
offset: PlasmaCore.Units.smallSpacing
onWindowDeactivated: {
if (!aboutToBeDestroyed) {
......
......@@ -27,7 +27,7 @@ import org.kde.kquickcontrolsaddons 2.0
FocusScope {
id: itemList
property real minimumWidth: units.gridUnit * 14
property real minimumWidth: PlasmaCore.Units.gridUnit * 14
property real maximumWidth: minimumWidth * 2
width: minimumWidth
......@@ -41,10 +41,10 @@ FocusScope {
property QtObject dialog: null
property QtObject childDialog: null
property bool iconsEnabled: false
property int itemHeight: Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, units.iconSizes.small)
property int itemHeight: Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, PlasmaCore.Units.iconSizes.small)
+ Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2
property int separatorHeight: lineSvg.horLineHeight + (2 * units.smallSpacing)
property int separatorHeight: lineSvg.horLineHeight + (2 * PlasmaCore.Units.smallSpacing)
property alias currentIndex: listView.currentIndex
property alias currentItem: listView.currentItem
......
......@@ -87,17 +87,17 @@ PlasmaExtras.ScrollArea {
Column {
id: itemColumn
width: itemMultiGrid.width - units.gridUnit
width: itemMultiGrid.width - PlasmaCore.Units.gridUnit
Repeater {
id: repeater
delegate: Item {
width: itemColumn.width - units.gridUnit
width: itemColumn.width - PlasmaCore.Units.gridUnit
height: headerHeight + gridView.height + (index == repeater.count - 1 ? 0 : footerHeight)
property int headerHeight: (gridViewLabel.height
+ gridViewLabelUnderline.height + units.largeSpacing)
+ gridViewLabelUnderline.height + PlasmaCore.Units.largeSpacing)
property int footerHeight: (Math.ceil(headerHeight / cellSize) * cellSize) - headerHeight
property Item itemGrid: gridView
......@@ -107,7 +107,7 @@ PlasmaExtras.ScrollArea {
anchors.top: parent.top
x: units.smallSpacing
x: PlasmaCore.Units.smallSpacing
width: parent.width - x
height: dummyHeading.height
......@@ -127,7 +127,7 @@ PlasmaExtras.ScrollArea {
anchors.top: gridViewLabel.bottom
width: parent.width - units.gridUnit
width: parent.width - PlasmaCore.Units.gridUnit
height: lineSvg.horLineHeight
svg: lineSvg
......@@ -146,7 +146,7 @@ PlasmaExtras.ScrollArea {
anchors {
top: gridViewLabelUnderline.bottom
topMargin: units.largeSpacing
topMargin: PlasmaCore.Units.largeSpacing
}
width: parent.width
......
......@@ -33,9 +33,9 @@ FocusScope {
Layout.minimumHeight: Math.max(((rootModel.count - rootModel.separatorCount) * rootList.itemHeight)
+ (rootModel.separatorCount * rootList.separatorHeight)
+ searchField.height + (2 * units.smallSpacing), sideBar.margins.top + sideBar.margins.bottom
+ searchField.height + (2 * PlasmaCore.Units.smallSpacing), sideBar.margins.top + sideBar.margins.bottom
+ favoriteApps.contentHeight + favoriteSystemActions.contentHeight + sidebarSeparator.height
+ (4 * units.smallSpacing))
+ (4 * PlasmaCore.Units.smallSpacing))
Layout.maximumHeight: Layout.minimumHeight
signal appendSearchText(string text)
......@@ -54,7 +54,7 @@ FocusScope {
height: parent.height
spacing: units.smallSpacing
spacing: PlasmaCore.Units.smallSpacing
LayoutMirroring.enabled: ((plasmoid.location === PlasmaCore.Types.RightEdge)
|| (Qt.application.layoutDirection == Qt.RightToLeft && plasmoid.location !== PlasmaCore.Types.LeftEdge))
......@@ -66,7 +66,7 @@ FocusScope {
width: (globalFavorites && systemFavorites
&& (globalFavorites.count + systemFavorites.count)
? units.iconSizes.medium + margins.left + margins.right : 0)
? PlasmaCore.Units.iconSizes.medium + margins.left + margins.right : 0)
height: parent.height
imagePath: "widgets/frame"
......@@ -79,7 +79,7 @@ FocusScope {
anchors.topMargin: sideBar.margins.top
height: (sideBar.height - sideBar.margins.top - sideBar.margins.bottom
- favoriteSystemActions.height - sidebarSeparator.height - (4 * units.smallSpacing))
- favoriteSystemActions.height - sidebarSeparator.height - (4 * PlasmaCore.Units.smallSpacing))
model: globalFavorites
......@@ -103,7 +103,7 @@ FocusScope {
Binding {
target: globalFavorites
property: "iconSize"
value: units.iconSizes.medium
value: PlasmaCore.Units.iconSizes.medium
}
}
......@@ -111,10 +111,10 @@ FocusScope {
id: sidebarSeparator
anchors.bottom: favoriteSystemActions.top
anchors.bottomMargin: (2 * units.smallSpacing)
anchors.bottomMargin: (2 * PlasmaCore.Units.smallSpacing)
anchors.horizontalCenter: parent.horizontalCenter
width: units.iconSizes.medium
width: PlasmaCore.Units.iconSizes.medium
height: lineSvg.horLineHeight
visible: (favoriteApps.model && favoriteApps.model.count
......@@ -136,7 +136,7 @@ FocusScope {
PropertyChanges {
target: sidebarSeparator
anchors.topMargin: (2 * units.smallSpacing)
anchors.topMargin: (2 * PlasmaCore.Units.smallSpacing)
anchors.bottomMargin: undefined
}
}]
......@@ -306,12 +306,12 @@ FocusScope {
anchors.bottom: mainRow.bottom
anchors.left: parent.left
anchors.leftMargin: sideBar.width + (sideBar.width ? mainRow.spacing : 0) + units.smallSpacing
anchors.leftMargin: sideBar.width + (sideBar.width ? mainRow.spacing : 0) + PlasmaCore.Units.smallSpacing
readonly property real defaultWidth: units.gridUnit * 14
readonly property real defaultWidth: PlasmaCore.Units.gridUnit * 14
width: (runnerColumnsRepeater.count != 0 ? runnerColumnsRepeater.itemAt(0).width
: (rootList.visible ? rootList.width : defaultWidth))
- units.smallSpacing
- PlasmaCore.Units.smallSpacing
focus: true
......@@ -349,7 +349,7 @@ FocusScope {
PropertyChanges {
target: searchField
anchors.leftMargin: sideBar.width + mainRow.spacing + units.smallSpacing
anchors.leftMargin: sideBar.width + mainRow.spacing + PlasmaCore.Units.smallSpacing
anchors.rightMargin: undefined
}
},
......@@ -369,7 +369,7 @@ FocusScope {
PropertyChanges {
target: searchField
anchors.leftMargin: undefined
anchors.rightMargin: sideBar.width + mainRow.spacing + units.smallSpacing