mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 17:54:45 +00:00
quicksettings: almost graphics fixes
This commit is contained in:
parent
0f7dc0cf05
commit
166460f4c2
1 changed files with 23 additions and 24 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
sourceComponent: PageIndicator {
|
||||||
|
count: swipeView.count
|
||||||
|
currentIndex: swipeView.currentIndex
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
implicitWidth: 8
|
implicitWidth: 8
|
||||||
implicitHeight: 8
|
implicitHeight: 8
|
||||||
|
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
color: PlasmaCore.Theme.buttonFocusColor
|
color: PlasmaCore.Theme.disabledTextColor
|
||||||
|
|
||||||
opacity: index === indicator.currentIndex ? 0.95 : 0.45
|
opacity: index === currentIndex ? 0.95 : 0.45
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
OpacityAnimator {
|
|
||||||
duration: MobileShell.MobileShellSettings.animationsEnabled ? 100 : 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue