mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 17:54:45 +00:00
taskpanel: Try to ensure dimension bindings are always set
This commit is contained in:
parent
b3884be926
commit
635f86e02f
2 changed files with 43 additions and 27 deletions
|
|
@ -38,6 +38,7 @@ PlasmaCore.ColorScope {
|
||||||
// 3 - VisibilityMode.WindowsGoBelow
|
// 3 - VisibilityMode.WindowsGoBelow
|
||||||
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? 0 : 3
|
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? 0 : 3
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding {
|
Binding {
|
||||||
target: plasmoid.Window.window // assumed to be plasma-workspace "PanelView" component
|
target: plasmoid.Window.window // assumed to be plasma-workspace "PanelView" component
|
||||||
property: "thickness"
|
property: "thickness"
|
||||||
|
|
@ -47,6 +48,46 @@ PlasmaCore.ColorScope {
|
||||||
value: MobileShell.MobileShellSettings.navigationPanelEnabled ? PlasmaCore.Units.gridUnit * 2 : 8
|
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
|
//BEGIN API implementation
|
||||||
|
|
||||||
Binding {
|
Binding {
|
||||||
|
|
@ -75,13 +116,9 @@ PlasmaCore.ColorScope {
|
||||||
//END API implementation
|
//END API implementation
|
||||||
|
|
||||||
Window.onWindowChanged: {
|
Window.onWindowChanged: {
|
||||||
if (!Window.window)
|
if (!Window.window) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// set offset from top panel
|
|
||||||
Window.window.offset = Qt.binding(() => {
|
|
||||||
return (root.state === "landscape") ? MobileShell.TopPanelControls.panelHeight : 0
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// bottom navigation panel component
|
// bottom navigation panel component
|
||||||
|
|
@ -106,24 +143,4 @@ PlasmaCore.ColorScope {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: MobileShell.MobileShellSettings.navigationPanelEnabled ? navigationPanel : navigationGesture
|
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_OBJECT
|
||||||
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
Q_PROPERTY(QWindow *panel READ panel WRITE setPanel NOTIFY panelChanged)
|
||||||
Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskPanel(QObject *parent, const QVariantList &args);
|
TaskPanel(QObject *parent, const QVariantList &args);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue