Skip to content

Commit

Permalink
More documentation, fewer magic numbers, fixes #14 and #15, works wit…
Browse files Browse the repository at this point in the history
…h scaling
  • Loading branch information
Fuchs committed Dec 5, 2019
1 parent 225aefc commit 371268c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
7 changes: 3 additions & 4 deletions package/contents/ui/GroupItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ PlasmaComponents.ListItem {
left: parent.left
right: parent.right
top: parent.top
topMargin: -Math.round(units.gridUnit)
}

height: Math.max(units.iconSizes.medium, groupLabel.height + groupInfoLabel.height + groupBrightnessSlider.height) + Math.round(units.gridUnit / 2)
height: Math.max(units.iconSizes.medium, groupLabel.height + groupInfoLabel.height) + groupBrightnessSlider.height + Math.round(units.gridUnit / 2)

HueColourItem {
id: colourItem
Expand All @@ -91,8 +90,7 @@ PlasmaComponents.ListItem {
type: "group"

anchors {
top: parent.top
topMargin: Math.round(units.iconSizes.medium / 2)
verticalCenter: groupItemBase.verticalCenter - Math.round(groupBrightnessSlider.height / 2)
left: parent.left
}
}
Expand Down Expand Up @@ -156,6 +154,7 @@ PlasmaComponents.ListItem {
rightMargin: Math.round(units.gridUnit)
right: groupOnOffButton.left
top: groupInfoLabel.bottom
topMargin: units.smallSpacing * 2
}

PlasmaCore.IconItem {
Expand Down
13 changes: 7 additions & 6 deletions package/contents/ui/LightItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ PlasmaComponents.ListItem {
left: parent.left
right: parent.right
top: parent.top
topMargin: -Math.round(units.gridUnit)
}

height: Math.max(units.iconSizes.medium, lightLabel.height + lightInfoLabel.height + slider.height) + Math.round(units.gridUnit / 2)
height: Math.max(units.iconSizes.medium, lightLabel.height + lightInfoLabel.height) + slider.height + Math.round(units.gridUnit / 2)

HueColourItem {
id: colourItem
Expand All @@ -98,8 +97,7 @@ PlasmaComponents.ListItem {
type: "bulb"

anchors {
top: parent.top
topMargin: Math.round(units.iconSizes.medium / 2)
verticalCenter: lightItemBase.verticalCenter - Math.round(slider.height / 2)
left: parent.left
}
}
Expand Down Expand Up @@ -147,6 +145,7 @@ PlasmaComponents.ListItem {
rightMargin: Math.round(units.gridUnit)
right: lightOnOffButton.left
top: lightInfoLabel.bottom
topMargin: units.smallSpacing * 2
}

PlasmaCore.IconItem {
Expand Down Expand Up @@ -222,7 +221,10 @@ PlasmaComponents.ListItem {
Item {
id: lightDetailsItem
visible: expanded
height: Math.max((lightWhitesItem.height + units.smallSpacing * 8 + lightTabBar.height), ((theme.smallestFont.pointSize * 14) + lightTabBar.height) )
// Explanation: there can be two items that could be the tallest in the light, depending on font size.
// For small fonts, the temperature / colour chooser will be taller, so we add it's size plus the base.
// For big font sizes, the details will be. So we add 8 lines of details plus 2 lines margin, plus the base.
height: Math.max((tempChooser.height + lightItemBase.height), ((theme.smallestFont.pointSize * 10) + lightItemBase.height) )

anchors {
top: lightItemBase.bottom
Expand All @@ -235,7 +237,6 @@ PlasmaComponents.ListItem {

anchors {
top: parent.top
topMargin: Math.round(units.gridUnit / 2)
left: parent.left
right: parent.right
}
Expand Down

0 comments on commit 371268c

Please sign in to comment.