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

Port away from using units as context properties

This commit ports away from units.* to PlasmaCore.Units.*
parent 8ea04438
...@@ -49,25 +49,25 @@ Item { ...@@ -49,25 +49,25 @@ Item {
var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth)); var scaledHeight = Math.floor(parent.width * (buttonIcon.implicitHeight / buttonIcon.implicitWidth));
root.Layout.minimumHeight = scaledHeight; root.Layout.minimumHeight = scaledHeight;
root.Layout.maximumHeight = scaledHeight; root.Layout.maximumHeight = scaledHeight;
root.Layout.minimumWidth = units.iconSizes.small; root.Layout.minimumWidth = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1; root.Layout.maximumWidth = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
} else { } else {
var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight)); var scaledWidth = Math.floor(parent.height * (buttonIcon.implicitWidth / buttonIcon.implicitHeight));
root.Layout.minimumWidth = scaledWidth; root.Layout.minimumWidth = scaledWidth;
root.Layout.maximumWidth = scaledWidth; root.Layout.maximumWidth = scaledWidth;
root.Layout.minimumHeight = units.iconSizes.small; root.Layout.minimumHeight = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1; root.Layout.maximumHeight = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
} }
} else { } else {
root.Layout.minimumWidth = units.iconSizes.small; root.Layout.minimumWidth = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumWidth = inPanel ? units.iconSizeHints.panel : -1; root.Layout.maximumWidth = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
root.Layout.minimumHeight = units.iconSizes.small; root.Layout.minimumHeight = PlasmaCore.Units.iconSizes.small;
root.Layout.maximumHeight = inPanel ? units.iconSizeHints.panel : -1; root.Layout.maximumHeight = inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1;
} }
} }
Connections { Connections {
target: units.iconSizeHints target: PlasmaCore.Units.iconSizeHints
onPanelChanged: root.updateSizeHints() onPanelChanged: root.updateSizeHints()
} }
......
...@@ -58,8 +58,8 @@ Kirigami.FormLayout { ...@@ -58,8 +58,8 @@ Kirigami.FormLayout {
Kirigami.FormData.label: i18n("Icon:") Kirigami.FormData.label: i18n("Icon:")
implicitWidth: previewFrame.width + units.smallSpacing * 2 implicitWidth: previewFrame.width + PlasmaCore.Units.smallSpacing * 2
implicitHeight: previewFrame.height + units.smallSpacing * 2 implicitHeight: previewFrame.height + PlasmaCore.Units.smallSpacing * 2
// Just to provide some visual feedback when dragging; // Just to provide some visual feedback when dragging;
// cannot have checked without checkable enabled // cannot have checked without checkable enabled
...@@ -116,12 +116,12 @@ Kirigami.FormLayout { ...@@ -116,12 +116,12 @@ Kirigami.FormLayout {
anchors.centerIn: parent anchors.centerIn: parent
imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal
? "widgets/panel-background" : "widgets/background" ? "widgets/panel-background" : "widgets/background"
width: units.iconSizes.large + fixedMargins.left + fixedMargins.right width: PlasmaCore.Units.iconSizes.large + fixedMargins.left + fixedMargins.right
height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom height: PlasmaCore.Units.iconSizes.large + fixedMargins.top + fixedMargins.bottom
PlasmaCore.IconItem { PlasmaCore.IconItem {
anchors.centerIn: parent anchors.centerIn: parent
width: units.iconSizes.large width: PlasmaCore.Units.iconSizes.large
height: width height: width
source: configGeneral.cfg_useCustomButtonImage ? configGeneral.cfg_customButtonImage : configGeneral.cfg_icon source: configGeneral.cfg_useCustomButtonImage ? configGeneral.cfg_customButtonImage : configGeneral.cfg_icon
} }
......
...@@ -22,6 +22,7 @@ import QtGraphicalEffects 1.0 ...@@ -22,6 +22,7 @@ import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.1 as PlasmaCore import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents 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.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0 import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwindowsystem 1.0 import org.kde.kwindowsystem 1.0
...@@ -41,11 +42,11 @@ import "code/tools.js" as Tools ...@@ -41,11 +42,11 @@ import "code/tools.js" as Tools
Kicker.DashboardWindow { Kicker.DashboardWindow {
id: root 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 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, + (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom,
highlightItemSvg.margins.left + highlightItemSvg.margins.right)) highlightItemSvg.margins.left + highlightItemSvg.margins.right))
property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize)) property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize))
...@@ -319,11 +320,11 @@ Kicker.DashboardWindow { ...@@ -319,11 +320,11 @@ Kicker.DashboardWindow {
anchors { anchors {
left: searchHeading.right left: searchHeading.right
leftMargin: units.largeSpacing leftMargin: PlasmaCore.Units.largeSpacing
verticalCenter: searchHeading.verticalCenter verticalCenter: searchHeading.verticalCenter
} }
width: units.iconSizes.large width: PlasmaCore.Units.iconSizes.large
height: width height: width
visible: (searchField.text != "") visible: (searchField.text != "")
...@@ -361,15 +362,15 @@ Kicker.DashboardWindow { ...@@ -361,15 +362,15 @@ Kicker.DashboardWindow {
anchors { anchors {
top: parent.top top: parent.top
topMargin: units.gridUnit * (smallScreen ? 8 : 10) topMargin: PlasmaCore.Units.gridUnit * (smallScreen ? 8 : 10)
bottom: parent.bottom bottom: parent.bottom
bottomMargin: (units.gridUnit * 2) bottomMargin: (PlasmaCore.Units.gridUnit * 2)
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
width: (root.columns * root.cellSize) + (2 * spacing) width: (root.columns * root.cellSize) + (2 * spacing)
spacing: units.gridUnit * 2 spacing: PlasmaCore.Units.gridUnit * 2
Item { Item {
id: favoritesColumn id: favoritesColumn
...@@ -379,7 +380,7 @@ Kicker.DashboardWindow { ...@@ -379,7 +380,7 @@ Kicker.DashboardWindow {
bottom: parent.bottom bottom: parent.bottom
} }
width: (columns * root.cellSize) + units.gridUnit width: (columns * root.cellSize) + PlasmaCore.Units.gridUnit
property int columns: 3 property int columns: 3
...@@ -392,7 +393,7 @@ Kicker.DashboardWindow { ...@@ -392,7 +393,7 @@ Kicker.DashboardWindow {
top: parent.top top: parent.top
} }
x: units.smallSpacing x: PlasmaCore.Units.smallSpacing
width: parent.width - x width: parent.width - x
elide: Text.ElideRight elide: Text.ElideRight
...@@ -406,7 +407,7 @@ Kicker.DashboardWindow { ...@@ -406,7 +407,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3) 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 { PlasmaCore.SvgItem {
...@@ -418,7 +419,7 @@ Kicker.DashboardWindow { ...@@ -418,7 +419,7 @@ Kicker.DashboardWindow {
top: favoritesColumnLabel.bottom top: favoritesColumnLabel.bottom
} }
width: parent.width - units.gridUnit width: parent.width - PlasmaCore.Units.gridUnit
height: lineSvg.horLineHeight height: lineSvg.horLineHeight
svg: lineSvg svg: lineSvg
...@@ -426,7 +427,7 @@ Kicker.DashboardWindow { ...@@ -426,7 +427,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3) 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 { ItemGridView {
...@@ -436,11 +437,11 @@ Kicker.DashboardWindow { ...@@ -436,11 +437,11 @@ Kicker.DashboardWindow {
anchors { anchors {
top: favoritesColumnLabelUnderline.bottom top: favoritesColumnLabelUnderline.bottom
topMargin: units.largeSpacing topMargin: PlasmaCore.Units.largeSpacing
} }
property int rows: (Math.floor((parent.height - favoritesColumnLabel.height property int rows: (Math.floor((parent.height - favoritesColumnLabel.height
- favoritesColumnLabelUnderline.height - units.largeSpacing) / root.cellSize) - favoritesColumnLabelUnderline.height - PlasmaCore.Units.largeSpacing) / root.cellSize)
- systemFavoritesGrid.rows) - systemFavoritesGrid.rows)
width: parent.width width: parent.width
...@@ -457,7 +458,7 @@ Kicker.DashboardWindow { ...@@ -457,7 +458,7 @@ Kicker.DashboardWindow {
opacity: (enabled ? 1.0 : 0.3) 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: { onCurrentIndexChanged: {
preloadAllAppsTimer.defer(); preloadAllAppsTimer.defer();
...@@ -561,7 +562,7 @@ Kicker.DashboardWindow { ...@@ -561,7 +562,7 @@ Kicker.DashboardWindow {
anchors.top: parent.top 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 height: Math.floor(parent.height / root.cellSize) * root.cellSize + mainGridContainer.headerHeight
property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns property int columns: root.columns - favoritesColumn.columns - filterListColumn.columns
...@@ -581,7 +582,7 @@ Kicker.DashboardWindow { ...@@ -581,7 +582,7 @@ Kicker.DashboardWindow {
enabled: (opacity == 1.0) ? 1 : 0 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: { opacity: {
if (tabBar.activeTab == 0 && root.searching) { if (tabBar.activeTab == 0 && root.searching) {
...@@ -608,7 +609,7 @@ Kicker.DashboardWindow { ...@@ -608,7 +609,7 @@ Kicker.DashboardWindow {
top: parent.top top: parent.top
} }
x: units.smallSpacing x: PlasmaCore.Units.smallSpacing
width: parent.width - x width: parent.width - x
elide: Text.ElideRight elide: Text.ElideRight
...@@ -631,7 +632,7 @@ Kicker.DashboardWindow { ...@@ -631,7 +632,7 @@ Kicker.DashboardWindow {
top: mainColumnLabel.bottom top: mainColumnLabel.bottom
} }
width: parent.width - units.gridUnit width: parent.width - PlasmaCore.Units.gridUnit
height: lineSvg.horLineHeight height: lineSvg.horLineHeight
svg: lineSvg svg: lineSvg
...@@ -643,7 +644,7 @@ Kicker.DashboardWindow { ...@@ -643,7 +644,7 @@ Kicker.DashboardWindow {
anchors { anchors {
top: mainColumnLabelUnderline.bottom top: mainColumnLabelUnderline.bottom
topMargin: units.largeSpacing topMargin: PlasmaCore.Units.largeSpacing
} }
width: parent.width width: parent.width
...@@ -651,7 +652,7 @@ Kicker.DashboardWindow { ...@@ -651,7 +652,7 @@ Kicker.DashboardWindow {
cellWidth: (tabBar.activeTab == 0 ? root.cellSize : root.cellSize * 2) cellWidth: (tabBar.activeTab == 0 ? root.cellSize : root.cellSize * 2)
cellHeight: cellWidth 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 model: funnelModel
...@@ -800,7 +801,7 @@ Kicker.DashboardWindow { ...@@ -800,7 +801,7 @@ Kicker.DashboardWindow {
anchors { anchors {
top: parent.top top: parent.top
topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + units.largeSpacing topMargin: mainColumnLabelUnderline.y + mainColumnLabelUnderline.height + PlasmaCore.Units.largeSpacing
bottom: parent.bottom bottom: parent.bottom
} }
...@@ -811,9 +812,9 @@ Kicker.DashboardWindow { ...@@ -811,9 +812,9 @@ Kicker.DashboardWindow {
PlasmaExtras.ScrollArea { PlasmaExtras.ScrollArea {
id: filterListScrollArea 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 width: parent.width
height: mainGrid.height height: mainGrid.height
...@@ -824,7 +825,7 @@ Kicker.DashboardWindow { ...@@ -824,7 +825,7 @@ Kicker.DashboardWindow {
opacity: root.visible ? (root.searching ? 0.30 : 1.0) : 0.3 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 verticalScrollBarPolicy: (opacity == 1.0) ? Qt.ScrollBarAsNeeded : Qt.ScrollBarAlwaysOff
...@@ -990,7 +991,7 @@ Kicker.DashboardWindow { ...@@ -990,7 +991,7 @@ Kicker.DashboardWindow {
width: (highlightItemSvg.margins.left width: (highlightItemSvg.margins.left
+ filterList.currentItem.textWidth + filterList.currentItem.textWidth
+ highlightItemSvg.margins.right + highlightItemSvg.margins.right
+ units.smallSpacing) + PlasmaCore.Units.smallSpacing)
visible: filterList.currentItem visible: filterList.currentItem
} }
...@@ -1013,7 +1014,7 @@ Kicker.DashboardWindow { ...@@ -1013,7 +1014,7 @@ Kicker.DashboardWindow {
} }
filterListColumn.columns = Math.ceil(width / root.cellSize); filterListColumn.columns = Math.ceil(width / root.cellSize);
filterListScrollArea.width = width + hItemMargins + (units.gridUnit * 2); filterListScrollArea.width = width + hItemMargins + (PlasmaCore.Units.gridUnit * 2);
} }
function applyFilter() { function applyFilter() {
......
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
import QtQuick 2.4 import QtQuick 2.4
import org.kde.plasma.plasmoid 2.0 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 import org.kde.plasma.extras 2.0 as PlasmaExtras
Item { Item {
id: tab id: tab
width: label.contentWidth + (units.largeSpacing * 2) width: label.contentWidth + (PlasmaCore.Units.largeSpacing * 2)
height: label.contentHeight + (units.smallSpacing * 2) height: label.contentHeight + (PlasmaCore.Units.smallSpacing * 2)
property int index: 0 property int index: 0
property bool active: false property bool active: false
...@@ -40,18 +41,18 @@ Item { ...@@ -40,18 +41,18 @@ Item {
color: tab.parent.focus ? theme.highlightColor : "black" color: tab.parent.focus ? theme.highlightColor : "black"
opacity: tab.active ? 0.4 : 0.15 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 { PlasmaExtras.Heading {
id: label id: label
x: units.largeSpacing x: PlasmaCore.Units.largeSpacing
elide: Text.ElideNone elide: Text.ElideNone
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
opacity: tab.active ? 1.0 : 0.6 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" color: tab.parent.focus ? theme.highlightedTextColor : "white"
......
...@@ -86,7 +86,7 @@ Item { ...@@ -86,7 +86,7 @@ Item {
anchors { anchors {
top: icon.bottom top: icon.bottom
topMargin: units.smallSpacing topMargin: PlasmaCore.Units.smallSpacing
left: parent.left left: parent.left
leftMargin: highlightItemSvg.margins.left leftMargin: highlightItemSvg.margins.left
right: parent.right right: parent.right
......
...@@ -198,7 +198,7 @@ FocusScope { ...@@ -198,7 +198,7 @@ FocusScope {
property bool usesPlasmaTheme: false property bool usesPlasmaTheme: false
property int iconSize: units.iconSizes.huge property int iconSize: PlasmaCore.Units.iconSizes.huge
property bool animating: false property bool animating: false
property int animationDuration: itemGrid.dropEnabled ? resetAnimationDurationTimer.interval : 0 property int animationDuration: itemGrid.dropEnabled ? resetAnimationDurationTimer.interval : 0
...@@ -273,7 +273,7 @@ FocusScope { ...@@ -273,7 +273,7 @@ FocusScope {
bottomMargin: parent.margins.bottom bottomMargin: parent.margins.bottom
} }
width: units.iconSizes.smallMedium width: PlasmaCore.Units.iconSizes.smallMedium
height: width height: width
source: "list-add" source: "list-add"
......
...@@ -188,7 +188,7 @@ Item { ...@@ -188,7 +188,7 @@ Item {
height: parent.height 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) readonly property real actualSpacing: ((icon.visible ? 1 : 0) * spacing) + ((arrow.visible ? 1 : 0) * spacing)
LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft) LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft)
...@@ -198,7 +198,7 @@ Item { ...@@ -198,7 +198,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: visible ? units.iconSizes.small : 0 width: visible ? PlasmaCore.Units.iconSizes.small : 0
height: width height: width