Commit e3bbf24a authored by Nate Graham's avatar Nate Graham 💤
Browse files

Port task switchers to use standard sizes for everything else

This completes the work started in 16ff74c0 and uses standard sizes for
everything else that's currently hardcoded. The result is not as
dramatic, but it fixes all remaining minor visual glitches when using a
high DPI screen.
parent 16ff74c0
......@@ -38,7 +38,8 @@ KWin.Switcher {
mainItem: Item {
id: dialogMainItem
property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count
property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + 40
property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + units.gridUnit * 2
property bool canStretchX: false
property bool canStretchY: false
width: Math.min(Math.max(tabBox.screenGeometry.width * 0.3, optimalWidth), tabBox.screenGeometry.width * 0.9)
......
......@@ -45,7 +45,7 @@ KWin.Switcher {
height: Math.min(Math.max(tabBox.screenGeometry.height * 0.2, optimalHeight), tabBox.screenGeometry.height * 0.8)
focus: true
property int textMargin: 2
property int textMargin: units.smallSpacing
/**
* Returns the caption with adjustments for minimized items.
......@@ -127,7 +127,7 @@ KWin.Switcher {
compactListView, "calculateMaxRowWidth");
width = Math.max(textElement.width, width);
textElement.destroy();
return width + 16 + 2 * dialogMainItem.textMargin + hoverItem.margins.right + hoverItem.margins.left
return width + units.iconSizes.small + 2 * dialogMainItem.textMargin + hoverItem.margins.right + hoverItem.margins.left
}
/**
* Calculates the height of one row based on the text height and icon size.
......@@ -145,7 +145,7 @@ KWin.Switcher {
var height = textElement.height;
textElement.destroy();
// icon size or two text elements and margins and hoverItem margins
return Math.max(16, height + hoverItem.margins.top + hoverItem.margins.bottom);
return Math.max(units.iconSizes.small, height + hoverItem.margins.top + hoverItem.margins.bottom);
}
id: compactListView
// the maximum text width + icon item width (32 + 4 margin) + margins for hover item
......
......@@ -141,7 +141,7 @@ KWin.Switcher {
listView, "calculateMaxRowWidth");
width = Math.max(textElement.width, width);
textElement.destroy();
return width + 32 + hoverItem.margins.right + hoverItem.margins.left;
return width + units.iconSizes.medium + hoverItem.margins.right + hoverItem.margins.left;
}
/**
* Calculates the height of one row based on the text height and icon size.
......@@ -159,7 +159,7 @@ KWin.Switcher {
var height = textElement.height;
textElement.destroy();
// icon size or two text elements and margins and hoverItem margins
return Math.max(32, height*2 + informativeTabBox.textMargin * 3 + hoverItem.margins.top + hoverItem.margins.bottom);
return Math.max(units.iconSizes.medium, height*2 + informativeTabBox.textMargin * 3 + hoverItem.margins.top + hoverItem.margins.bottom);
}
id: listView
model: tabBox.model
......
......@@ -40,7 +40,7 @@ KWin.Switcher {
id: dialogMainItem
property int optimalWidth: 0.9*tabBox.screenGeometry.width
property int optimalHeight: 0.9*tabBox.screenGeometry.height
property int standardMargin: 2
property int standardMargin: units.smallSpacing
width: optimalWidth
height: optimalHeight
focus: true
......
......@@ -38,7 +38,7 @@ KWin.Switcher {
mainItem: Item {
id: dialogMainItem
property int optimalWidth: (icons.iconSize + icons.margins.left + icons.margins.right) * icons.count
property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + 40
property int optimalHeight: icons.iconSize + icons.margins.top + icons.margins.bottom + units.gridUnit * 2
property bool canStretchX: false
property bool canStretchY: false
width: Math.min(Math.max(tabBox.screenGeometry.width * 0.1, optimalWidth), tabBox.screenGeometry.width * 0.9)
......
......@@ -45,7 +45,7 @@ KWin.Switcher {
height: Math.min(Math.max(tabBox.screenGeometry.height * 0.2, optimalHeight), tabBox.screenGeometry.height * 0.8)
focus: true
property int textMargin: 2
property int textMargin: units.smallSpacing
// just to get the margin sizes
PlasmaCore.FrameSvgItem {
......
......@@ -172,7 +172,7 @@ KWin.Switcher {
RowLayout {
id: captionRow
spacing: 4 * units.devicePixelRatio
spacing: units.smallSpacing
QIconItem {
id: iconItem
......
......@@ -38,7 +38,7 @@ KWin.Switcher {
id: dialogMainItem
property real screenFactor: tabBox.screenGeometry.width/tabBox.screenGeometry.height
property int optimalWidth: (thumbnailListView.thumbnailWidth + hoverItem.margins.left + hoverItem.margins.right) * thumbnailListView.count
property int optimalHeight: thumbnailListView.thumbnailWidth*(1.0/screenFactor) + hoverItem.margins.top + hoverItem.margins.bottom + 40
property int optimalHeight: thumbnailListView.thumbnailWidth*(1.0/screenFactor) + hoverItem.margins.top + hoverItem.margins.bottom + units.gridUnit * 2
property bool canStretchX: false
property bool canStretchY: false
width: Math.min(Math.max(tabBox.screenGeometry.width * 0.3, optimalWidth), tabBox.screenGeometry.width * 0.9)
......@@ -60,7 +60,7 @@ KWin.Switcher {
orientation: ListView.Horizontal
property int thumbnailWidth: 300 * units.devicePixelRatio
height: thumbnailWidth * (1.0/dialogMainItem.screenFactor) + hoverItem.margins.bottom + hoverItem.margins.top
spacing: 5
spacing: units.smallSpacing
highlightMoveDuration: 0
highlightResizeDuration: 0
width: Math.min(parent.width - (anchors.leftMargin + anchors.rightMargin) - (hoverItem.margins.left + hoverItem.margins.right), thumbnailWidth * count + 5 * (count - 1))
......@@ -114,7 +114,7 @@ KWin.Switcher {
}
}
Item {
height: 40
height: units.gridUnit * 2
id: captionFrame
anchors {
top: thumbnailListView.bottom
......@@ -126,12 +126,12 @@ KWin.Switcher {
QIconItem {
id: iconItem
icon: thumbnailListView.currentItem ? thumbnailListView.currentItem.icon : ""
width: 32
height: 32
width: units.iconSizes.medium
height: units.iconSizes.medium
anchors {
verticalCenter: parent.verticalCenter
right: textItem.left
rightMargin: 4
rightMargin: units.smallSpacing
}
}
PlasmaComponents.Label {
......
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