From 89fd411dab657a558526b52ef2f18c6c7cc82ae0 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 9 Mar 2019 11:44:14 +0200 Subject: [PATCH] improve how config window size is calculated --- app/view/settings/primaryconfigview.cpp | 8 ++++++++ app/view/settings/primaryconfigview.h | 5 +++++ .../contents/configuration/LatteDockConfiguration.qml | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/view/settings/primaryconfigview.cpp b/app/view/settings/primaryconfigview.cpp index 502ce3d32..416c937f8 100644 --- a/app/view/settings/primaryconfigview.cpp +++ b/app/view/settings/primaryconfigview.cpp @@ -142,6 +142,9 @@ void PrimaryConfigView::init() updateEnabledBorders(); + int currentScrId = m_latteView->positioner()->currentScreenId(); + m_availableScreenGeometry = m_corona->availableScreenRect(currentScrId); + auto source = QUrl::fromLocalFile(m_latteView->containment()->corona()->kPackage().filePath(tempFilePath)); setSource(source); syncGeometry(); @@ -177,6 +180,11 @@ void PrimaryConfigView::deleteSecondaryWindow() } } +QRect PrimaryConfigView::availableScreenGeometry() const +{ + return m_availableScreenGeometry; +} + QRect PrimaryConfigView::geometryWhenVisible() const { return m_geometryWhenVisible; diff --git a/app/view/settings/primaryconfigview.h b/app/view/settings/primaryconfigview.h index bb9225af3..1bf8f945a 100644 --- a/app/view/settings/primaryconfigview.h +++ b/app/view/settings/primaryconfigview.h @@ -70,6 +70,8 @@ class PrimaryConfigView : public PlasmaQuick::ConfigView Q_PROPERTY(int complexity READ complexity WRITE setComplexity NOTIFY complexityChanged) + Q_PROPERTY(QRect availableScreenGeometry READ availableScreenGeometry NOTIFY availableScreenGeometryChanged) + Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged) public: @@ -92,6 +94,7 @@ public: int complexity() const; void setComplexity(int complexity); + QRect availableScreenGeometry() const; QRect geometryWhenVisible() const; Plasma::FrameSvg::EnabledBorders enabledBorders() const; @@ -105,6 +108,7 @@ public slots: Q_INVOKABLE void updateLaunchersForGroup(int groupInt); signals: + void availableScreenGeometryChanged(); void complexityChanged(); void enabledBordersChanged(); void raiseDocksTemporaryChanged(); @@ -144,6 +148,7 @@ private: Latte::Types::Visibility m_originalMode{Latte::Types::DodgeActive}; Latte::Types::SettingsComplexity m_complexity{Latte::Types::BasicSettings}; + QRect m_availableScreenGeometry; QRect m_geometryWhenVisible; QPointer m_latteView; diff --git a/shell/package/contents/configuration/LatteDockConfiguration.qml b/shell/package/contents/configuration/LatteDockConfiguration.qml index 4d844f3cb..eda10f70a 100644 --- a/shell/package/contents/configuration/LatteDockConfiguration.qml +++ b/shell/package/contents/configuration/LatteDockConfiguration.qml @@ -54,8 +54,8 @@ FocusScope { //! we use 100px. or 50px. in order to give space for othe views to be shown and to have also //! some space around the settings window property int maxHeight: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? - latteView.screenGeometry.height - latteView.editThickness - 64 : - latteView.height - 50 + viewConfig.availableScreenGeometry.height - (latteView.editThickness - latteView.normalThickness) - 16 : + viewConfig.availableScreenGeometry.height - 16 property int maxWidth: 0.6 * latteView.screenGeometry.width //! propose size based on font size