Commit 54da94bc authored by Nate Graham's avatar Nate Graham
Browse files

[sidebar view] Clean intro page code

The code here was a little bit hairy and super complicated for a size
calaulation that was ultimately unnecessary because the row could never
exceed its window anyway due to the minimum window size.

BUG: 432083
FIXED-IN: 5.22
parent 0a071db4
......@@ -27,14 +27,13 @@ MouseArea {
property alias icon: iconItem.source
property alias text: label.text
property string module
property int iconSize: Kirigami.Units.iconSizes.huge
Layout.minimumWidth: Kirigami.Units.iconSizes.medium
Layout.minimumHeight: column.implicitHeight
cursorShape: Qt.PointingHandCursor
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
width: childrenRect.width
height: childrenRect.height
activeFocusOnTab: true
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: systemsettings.loadModule(systemsettings.mostUsedModel.index(index, 0));
onEntered: systemsettings.requestMostUsedToolTip(index, item.mapToItem(root, 0, Kirigami.Units.largeSpacing, width, height));
......@@ -54,34 +53,27 @@ MouseArea {
root.focusPreviousRequest();
}
}
Kirigami.Separator {
anchors{
left: parent.left
right: parent.right
bottom: parent.bottom
}
visible: item.activeFocus
color: Kirigami.Theme.highlightColor
}
ColumnLayout {
id: column
width: parent.width
Kirigami.Icon {
id: iconItem
active: item.containsMouse || item.activeFocus
Layout.alignment: Qt.AlignHCenter
Layout.minimumWidth: item.iconSize
Layout.minimumHeight: Layout.minimumWidth
height: width
implicitWidth: Kirigami.Units.iconSizes.huge
implicitHeight: Kirigami.Units.iconSizes.huge
}
QQC2.Label {
id: label
Layout.fillWidth: true
Layout.maximumWidth: item.width
Layout.maximumWidth: Kirigami.Units.iconSizes.huge + (4 * Kirigami.Units.largeSpacing)
Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
}
Kirigami.Separator {
Layout.fillWidth: true
visible: item.activeFocus
color: Kirigami.Theme.highlightColor
}
}
Accessible.role: Accessible.Button
......
......@@ -44,16 +44,16 @@ Rectangle {
bottomMargin: verticalMargin
horizontalCenter: parent.horizontalCenter
}
Layout.alignment: Qt.AlignHCenter
spacing: Kirigami.Units.largeSpacing
Kirigami.Icon {
Layout.alignment: Qt.AlignHCenter
source: "preferences-system"
Layout.preferredWidth: Kirigami.Units.iconSizes.enormous
Layout.preferredHeight: Kirigami.Units.iconSizes.enormous
}
Item {
width: Kirigami.Units.largeSpacing
implicitWidth: Kirigami.Units.iconSizes.enormous
implicitHeight: Kirigami.Units.iconSizes.enormous
}
ColumnLayout {
RowLayout {
Kirigami.Icon {
......@@ -61,8 +61,8 @@ Rectangle {
source: Qt.resolvedUrl("../images/plasma-logo.svg")
color: Kirigami.Theme.textColor
isMask: true
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
implicitWidth: Kirigami.Units.iconSizes.medium
implicitHeight: Kirigami.Units.iconSizes.medium
}
Kirigami.Heading {
text: i18n("Plasma")
......@@ -70,7 +70,7 @@ Rectangle {
font.weight: Font.Bold
}
}
Kirigami.Heading {
text: i18n("System Settings")
level: 1
......@@ -93,15 +93,14 @@ Rectangle {
wrapMode: Text.NoWrap
text: i18n("Frequently Used")
}
RowLayout {
id: iconsRow
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
spacing: Kirigami.Units.largeSpacing
property int spaceForIcon: Math.max((iconsRow.parent.width - iconsRow.spacing * 4) / 5, Kirigami.Units.iconSizes.medium)
property int iconSize: iconsRow.spaceForIcon >= Kirigami.Units.iconSizes.huge
? Kirigami.Units.iconSizes.huge
: (iconsRow.spaceForIcon >= Kirigami.Units.iconSizes.large ? Kirigami.Units.iconSizes.large : Kirigami.Units.iconSizes.medium)
spacing: Kirigami.Units.largeSpacing * 3
Repeater {
id: mostUsedRepeater
......@@ -109,10 +108,6 @@ Rectangle {
delegate: IntroIcon {
icon: model.decoration
text: model.display
iconSize: iconsRow.iconSize
Layout.minimumWidth: iconsRow.spaceForIcon
Layout.maximumWidth: Layout.minimumWidth
visible: (index + 1) * iconSize + index * iconsRow.spacing < iconsRow.parent.width
}
}
}
......
Supports Markdown
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