mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
mobileshell: Add constants singleton to reduce dependency on mobileshellstate
This commit is contained in:
parent
95d1ec87b1
commit
2d1610aaa2
11 changed files with 22 additions and 19 deletions
|
|
@ -46,6 +46,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
||||||
// /components
|
// /components
|
||||||
qmlRegisterSingletonType(resolvePath("components/AppLaunch.qml"), uri, 1, 0, "AppLaunch");
|
qmlRegisterSingletonType(resolvePath("components/AppLaunch.qml"), uri, 1, 0, "AppLaunch");
|
||||||
qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
|
qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
|
||||||
|
qmlRegisterSingletonType(resolvePath("components/Constants.qml"), uri, 1, 0, "Constants");
|
||||||
qmlRegisterType(resolvePath("components/ExtendedAbstractButton.qml"), uri, 1, 0, "ExtendedAbstractButton");
|
qmlRegisterType(resolvePath("components/ExtendedAbstractButton.qml"), uri, 1, 0, "ExtendedAbstractButton");
|
||||||
qmlRegisterType(resolvePath("components/Flickable.qml"), uri, 1, 0, "Flickable");
|
qmlRegisterType(resolvePath("components/Flickable.qml"), uri, 1, 0, "Flickable");
|
||||||
qmlRegisterType(resolvePath("components/GridView.qml"), uri, 1, 0, "GridView");
|
qmlRegisterType(resolvePath("components/GridView.qml"), uri, 1, 0, "GridView");
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
||||||
|
|
||||||
import "../../components" as Components
|
import "../../components" as Components
|
||||||
import "../../components/util.js" as Util
|
import "../../components/util.js" as Util
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import Qt5Compat.GraphicalEffects
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.12 as Kirigami
|
||||||
|
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
|
||||||
|
|
||||||
import "../../statusbar" as StatusBar
|
import "../../statusbar" as StatusBar
|
||||||
import "../../components" as Components
|
import "../../components" as Components
|
||||||
|
|
@ -80,7 +79,7 @@ Components.BaseItem {
|
||||||
StatusBar.StatusBar {
|
StatusBar.StatusBar {
|
||||||
id: statusBar
|
id: statusBar
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: MobileShellState.TopPanelControls.panelHeight + PlasmaCore.Units.gridUnit * 0.8
|
Layout.preferredHeight: Components.Constants.topPanelHeight + PlasmaCore.Units.gridUnit * 0.8
|
||||||
|
|
||||||
colorGroup: PlasmaCore.Theme.NormalColorGroup
|
colorGroup: PlasmaCore.Theme.NormalColorGroup
|
||||||
backgroundColor: "transparent"
|
backgroundColor: "transparent"
|
||||||
|
|
|
||||||
12
components/mobileshell/qml/components/Constants.qml
Normal file
12
components/mobileshell/qml/components/Constants.qml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
import org.kde.plasma.core as PlasmaCore
|
||||||
|
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
readonly property real topPanelHeight: PlasmaCore.Units.gridUnit + PlasmaCore.Units.smallSpacing
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,6 @@ import QtQuick.Layouts
|
||||||
|
|
||||||
import org.kde.plasma.components 3.0 as PlasmaComponents
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
||||||
import org.kde.plasma.private.nanoshell as NanoShell
|
import org.kde.plasma.private.nanoshell as NanoShell
|
||||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
|
|
@ -59,7 +58,7 @@ NanoShell.FullScreenOverlay {
|
||||||
|
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
x: 0
|
x: 0
|
||||||
y: (containerItem.coordinates.y <= overlay.height/2 ? relatedTo.height : -containerItem.height) - MobileShellState.TopPanelControls.panelHeight
|
y: (containerItem.coordinates.y <= overlay.height/2 ? relatedTo.height : -containerItem.height) - Constants.topPanelHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaComponents.Menu {
|
PlasmaComponents.Menu {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
||||||
|
|
||||||
import "indicators" as Indicators
|
import "indicators" as Indicators
|
||||||
import "../dataproviders" as DataProviders
|
import "../dataproviders" as DataProviders
|
||||||
|
import "../components" as Components
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -122,9 +123,9 @@ Item {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: row
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumHeight: MobileShellState.TopPanelControls.panelHeight - control.topPadding - control.bottomPadding
|
Layout.maximumHeight: Components.Constants.topPanelHeight - control.topPadding - control.bottomPadding
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
// clock
|
// clock
|
||||||
ClockText {
|
ClockText {
|
||||||
visible: root.showTime
|
visible: root.showTime
|
||||||
|
|
@ -175,7 +176,7 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
}
|
}
|
||||||
Indicators.BluetoothIndicator {
|
Indicators.BluetoothIndicator {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +185,7 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
}
|
}
|
||||||
Indicators.VolumeIndicator {
|
Indicators.VolumeIndicator {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ import org.kde.plasma.private.nanoshell 2.0 as NanoShell
|
||||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
import org.kde.plasma.private.mobileshell.state 1.0 as MobileShellState
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
|
||||||
|
|
||||||
import "../dataproviders" as DataProviders
|
import "../dataproviders" as DataProviders
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
<file>qml/components/AppLaunch.qml</file>
|
<file>qml/components/AppLaunch.qml</file>
|
||||||
<file>qml/components/BaseItem.qml</file>
|
<file>qml/components/BaseItem.qml</file>
|
||||||
|
<file>qml/components/Constants.qml</file>
|
||||||
<file>qml/components/ExtendedAbstractButton.qml</file>
|
<file>qml/components/ExtendedAbstractButton.qml</file>
|
||||||
<file>qml/components/Flickable.qml</file>
|
<file>qml/components/Flickable.qml</file>
|
||||||
<file>qml/components/GridView.qml</file>
|
<file>qml/components/GridView.qml</file>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ QtObject {
|
||||||
signal closeActionDrawer()
|
signal closeActionDrawer()
|
||||||
signal openActionDrawer()
|
signal openActionDrawer()
|
||||||
property bool inSwipe: false
|
property bool inSwipe: false
|
||||||
property real panelHeight: PlasmaCore.Units.gridUnit + PlasmaCore.Units.smallSpacing // set and updated in panel containment
|
|
||||||
property bool actionDrawerVisible: false
|
property bool actionDrawerVisible: false
|
||||||
property var notificationsWidget: null // updated in panel containment
|
property var notificationsWidget: null // updated in panel containment
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,6 @@ Item {
|
||||||
|
|
||||||
//BEGIN API implementation
|
//BEGIN API implementation
|
||||||
|
|
||||||
Binding {
|
|
||||||
target: MobileShellState.TopPanelControls
|
|
||||||
property: "panelHeight"
|
|
||||||
value: root.height
|
|
||||||
}
|
|
||||||
Binding {
|
Binding {
|
||||||
target: MobileShellState.TopPanelControls
|
target: MobileShellState.TopPanelControls
|
||||||
property: "inSwipe"
|
property: "inSwipe"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import org.kde.kquickcontrolsaddons 2.0
|
||||||
|
|
||||||
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.shellsettingsplugin as ShellSettings
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
||||||
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
||||||
|
|
||||||
PlasmaCore.ColorScope {
|
PlasmaCore.ColorScope {
|
||||||
|
|
@ -47,7 +46,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
readonly property real intendedWindowThickness: navigationPanelHeight
|
readonly property real intendedWindowThickness: navigationPanelHeight
|
||||||
readonly property real intendedWindowLength: isInLandscapeNavPanelMode ? Screen.height : Screen.width
|
readonly property real intendedWindowLength: isInLandscapeNavPanelMode ? Screen.height : Screen.width
|
||||||
readonly property real intendedWindowOffset: isInLandscapeNavPanelMode ? MobileShellState.TopPanelControls.panelHeight : 0; // offset for top panel
|
readonly property real intendedWindowOffset: isInLandscapeNavPanelMode ? Components.Constants.topPanelHeight : 0; // offset for top panel
|
||||||
readonly property int intendedWindowLocation: isInLandscapeNavPanelMode ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
|
readonly property int intendedWindowLocation: isInLandscapeNavPanelMode ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
|
||||||
|
|
||||||
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
|
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue