mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
actiondrawer: Share quick settings model between landscape and portrait
Don't recreate the quick settings model when switching between landscape and portrait. This should improve the performance of screen rotation.
This commit is contained in:
parent
2961fa7ea7
commit
8ca80841d2
6 changed files with 27 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -28,6 +29,11 @@ Item {
|
||||||
*/
|
*/
|
||||||
property var notificationModelType: MobileShell.NotificationsModelType.NotificationsModel
|
property var notificationModelType: MobileShell.NotificationsModelType.NotificationsModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model for the quick settings.
|
||||||
|
*/
|
||||||
|
property var quickSettingsModel: QS.QuickSettingsModel {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The notification settings object to be used in the notification widget.
|
* The notification settings object to be used in the notification widget.
|
||||||
*/
|
*/
|
||||||
|
|
@ -261,6 +267,7 @@ Item {
|
||||||
actionDrawer: root
|
actionDrawer: root
|
||||||
width: root.width
|
width: root.width
|
||||||
height: root.height
|
height: root.height
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,6 +277,7 @@ Item {
|
||||||
actionDrawer: root
|
actionDrawer: root
|
||||||
width: root.width
|
width: root.width
|
||||||
height: root.height
|
height: root.height
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.plasma5support 2.0 as P5Support
|
import org.kde.plasma.plasma5support 2.0 as P5Support
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
||||||
|
|
@ -23,6 +24,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
property QS.QuickSettingsModel quickSettingsModel
|
||||||
|
|
||||||
property alias notificationsWidget: notificationWidget
|
property alias notificationsWidget: notificationWidget
|
||||||
|
|
||||||
|
|
@ -169,6 +171,7 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
actionDrawer: root.actionDrawer
|
actionDrawer: root.actionDrawer
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
fullScreenHeight: root.height
|
fullScreenHeight: root.height
|
||||||
|
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.kirigami 2.20 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
* Root element that contains all the ActionDrawer's contents, and is anchored to the screen.
|
||||||
|
|
@ -20,6 +21,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
property QS.QuickSettingsModel quickSettingsModel
|
||||||
|
|
||||||
property alias notificationsWidget: notificationWidget
|
property alias notificationsWidget: notificationWidget
|
||||||
|
|
||||||
|
|
@ -56,6 +58,7 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
actionDrawer: root.actionDrawer
|
actionDrawer: root.actionDrawer
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
|
|
||||||
// opacity and move animation (disabled when openToPinnedMode is false)
|
// opacity and move animation (disabled when openToPinnedMode is false)
|
||||||
property real offsetDist: actionDrawer.offset - minimizedQuickSettingsOffset
|
property real offsetDist: actionDrawer.offset - minimizedQuickSettingsOffset
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ Item {
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
required property int mode
|
required property int mode
|
||||||
|
|
||||||
|
property QS.QuickSettingsModel quickSettingsModel
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
Pages,
|
Pages,
|
||||||
ScrollView
|
ScrollView
|
||||||
|
|
@ -45,8 +47,6 @@ Item {
|
||||||
property real minimizedViewProgress: 0
|
property real minimizedViewProgress: 0
|
||||||
property real fullViewProgress: 1
|
property real fullViewProgress: 1
|
||||||
|
|
||||||
readonly property QS.QuickSettingsModel quickSettingsModel: QS.QuickSettingsModel {}
|
|
||||||
|
|
||||||
readonly property int columnCount: Math.floor(width/columnWidth)
|
readonly property int columnCount: Math.floor(width/columnWidth)
|
||||||
readonly property int rowCount: {
|
readonly property int rowCount: {
|
||||||
let totalRows = Math.ceil(quickSettingsCount / columnCount);
|
let totalRows = Math.ceil(quickSettingsCount / columnCount);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import org.kde.ksvg 1.0 as KSvg
|
||||||
|
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick settings drawer pulled down from the top (for portrait mode).
|
* Quick settings drawer pulled down from the top (for portrait mode).
|
||||||
|
|
@ -23,6 +24,8 @@ MobileShell.BaseItem {
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
|
||||||
|
property QS.QuickSettingsModel quickSettingsModel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of height to add to the panel (increasing the height of the quick settings area).
|
* The amount of height to add to the panel (increasing the height of the quick settings area).
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,6 +98,7 @@ MobileShell.BaseItem {
|
||||||
|
|
||||||
mode: QuickSettings.Pages
|
mode: QuickSettings.Pages
|
||||||
actionDrawer: root.actionDrawer
|
actionDrawer: root.actionDrawer
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
minimizedViewProgress: 1 - root.minimizedToFullProgress
|
minimizedViewProgress: 1 - root.minimizedToFullProgress
|
||||||
fullViewProgress: root.minimizedToFullProgress
|
fullViewProgress: root.minimizedToFullProgress
|
||||||
height: root.minimizedQuickSettingsHeight + root.addedHeight
|
height: root.minimizedQuickSettingsHeight + root.addedHeight
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import org.kde.kirigami 2.12 as Kirigami
|
||||||
import org.kde.ksvg 1.0 as KSvg
|
import org.kde.ksvg 1.0 as KSvg
|
||||||
import org.kde.plasma.private.mobileshell as MobileShell
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
import org.kde.plasma.core as PlasmaCore
|
import org.kde.plasma.core as PlasmaCore
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick settings panel for landscape view (right sidebar).
|
* Quick settings panel for landscape view (right sidebar).
|
||||||
|
|
@ -22,6 +23,11 @@ MobileShell.BaseItem {
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
|
||||||
|
property QS.QuickSettingsModel quickSettingsModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The height of the entire screen the panel opens in.
|
||||||
|
*/
|
||||||
required property real fullScreenHeight
|
required property real fullScreenHeight
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,6 +81,7 @@ MobileShell.BaseItem {
|
||||||
id: quickSettings
|
id: quickSettings
|
||||||
|
|
||||||
mode: QuickSettings.ScrollView
|
mode: QuickSettings.ScrollView
|
||||||
|
quickSettingsModel: root.quickSettingsModel
|
||||||
width: column.width
|
width: column.width
|
||||||
implicitHeight: quickSettings.fullHeight
|
implicitHeight: quickSettings.fullHeight
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue