quicksettings: almost graphics fixes

This commit is contained in:
Yari Polla 2022-05-07 23:19:56 +02:00 committed by Devin Lin
parent 0f7dc0cf05
commit 166460f4c2

View file

@ -40,11 +40,13 @@ Item {
property real minimizedViewProgress: 0 property real minimizedViewProgress: 0
property real fullViewProgress: 1 property real fullViewProgress: 1
readonly property int settingsPerPage: Math.max(6, Math.floor(width/columnWidth) * 2)
readonly property real quickSettingsHeight: 2 * rowHeight
readonly property MobileShell.QuickSettingsModel quickSettingsModel: MobileShell.QuickSettingsModel {} readonly property MobileShell.QuickSettingsModel quickSettingsModel: MobileShell.QuickSettingsModel {}
readonly property int rowCount: Math.floor((Window.height * 60/100) / rowHeight)
readonly property int columnCount: Math.floor(width/columnWidth)
readonly property int pageSize: rowCount * columnCount
readonly property int quickSettingsCount: quickSettingsModel.count
function resetSwipeView() { function resetSwipeView() {
swipeView.currentIndex = 0; swipeView.currentIndex = 0;
@ -77,10 +79,10 @@ Item {
id: swipeView id: swipeView
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: quickSettingsHeight Layout.minimumHeight: Math.min(quickSettingsCount / columnCount * rowHeight, rowCount * rowHeight)
Repeater { Repeater {
model: Math.ceil(quickSettingsModel.count / settingsPerPage) model: Math.ceil(quickSettingsCount / pageSize)
delegate: Flow { delegate: Flow {
id: flow id: flow
spacing: 0 spacing: 0
@ -90,8 +92,8 @@ Item {
Repeater { Repeater {
model: MobileShell.PaginateModel { model: MobileShell.PaginateModel {
sourceModel: quickSettingsModel sourceModel: quickSettingsModel
pageSize: settingsPerPage pageSize: root.pageSize
firstItem: settingsPerPage * flow.index firstItem: pageSize * flow.index
} }
delegate: Components.BaseItem { delegate: Components.BaseItem {
@ -120,27 +122,24 @@ Item {
} }
} }
} }
PageIndicator { Loader {
id: indicator id: indicatorLoader
active: swipeView.count > 1
count: swipeView.count
currentIndex: swipeView.currentIndex
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
delegate: Rectangle { sourceComponent: PageIndicator {
implicitWidth: 8 count: swipeView.count
implicitHeight: 8 currentIndex: swipeView.currentIndex
radius: width / 2 delegate: Rectangle {
color: PlasmaCore.Theme.buttonFocusColor implicitWidth: 8
implicitHeight: 8
opacity: index === indicator.currentIndex ? 0.95 : 0.45 radius: width / 2
color: PlasmaCore.Theme.disabledTextColor
Behavior on opacity { opacity: index === currentIndex ? 0.95 : 0.45
OpacityAnimator {
duration: MobileShell.MobileShellSettings.animationsEnabled ? 100 : 0
}
} }
} }
} }