Commit 635f86e0 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

taskpanel: Try to ensure dimension bindings are always set

parent b3884be9
Pipeline #161062 passed with stages
in 1 minute and 2 seconds
......@@ -38,6 +38,7 @@ PlasmaCore.ColorScope {
// 3 - VisibilityMode.WindowsGoBelow
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? 0 : 3
}
Binding {
target: plasmoid.Window.window // assumed to be plasma-workspace "PanelView" component
property: "thickness"
......@@ -47,6 +48,46 @@ PlasmaCore.ColorScope {
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Units.gridUnit * 2 : 8
}
Binding {
target: plasmoid.Window.window
property: "location"
value: {
if (MobileShell.Shell.orientation === MobileShell.Shell.Portrait) {
return PlasmaCore.Types.BottomEdge;
} else if (MobileShell.Shell.orientation === MobileShell.Shell.Landscape) {
return MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
}
}
}
// HACK: really really really make sure the dimensions are set properly
function setBindings() {
plasmoid.Window.window.offset = Qt.binding(() => {
return (MobileShell.Shell.orientation === MobileShell.Shell.Landscape) ? MobileShell.TopPanelControls.panelHeight : 0;
});
plasmoid.Window.window.thickness = Qt.binding(() => {
return MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Units.gridUnit * 2 : 8
});
plasmoid.Window.window.length = Qt.binding(() => {
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
});
plasmoid.Window.window.maximumLength = Qt.binding(() => {
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
});
plasmoid.Window.window.minimumLength = Qt.binding(() => {
return MobileShell.Shell.orientation === MobileShell.Shell.Portrait ? Screen.width : Screen.height;
});
}
Connections {
target: plasmoid.Window.window
function onThicknessChanged() {
root.setBindings();
}
}
Component.onCompleted: setBindings();
//BEGIN API implementation
Binding {
......@@ -75,13 +116,9 @@ PlasmaCore.ColorScope {
//END API implementation
Window.onWindowChanged: {
if (!Window.window)
if (!Window.window) {
return;
// set offset from top panel
Window.window.offset = Qt.binding(() => {
return (root.state === "landscape") ? MobileShell.TopPanelControls.panelHeight : 0
});
}
}
// bottom navigation panel component
......@@ -106,24 +143,4 @@ PlasmaCore.ColorScope {
anchors.fill: parent
sourceComponent: MobileShell.MobileShellSettings.navigationPanelEnabled ? navigationPanel : navigationGesture
}
// landscape vs. portrait orientation of panel
states: [
State {
name: "landscape"
when: MobileShell.Shell.orientation === MobileShell.Shell.Landscape
PropertyChanges {
target: plasmoid.nativeInterface
// only show on right edge if gestures are not enabled
location: MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
}
}, State {
name: "portrait"
when: MobileShell.Shell.orientation === MobileShell.Shell.Portrait
PropertyChanges {
target: plasmoid.nativeInterface
location: PlasmaCore.Types.BottomEdge
}
}
]
}
......@@ -29,7 +29,6 @@ class TaskPanel : public Plasma::Containment
{
Q_OBJECT
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
public:
TaskPanel(QObject *parent, const QVariantList &args);
......
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