From 60cc89d5953727dc65a4815a253c22d14ac5d204 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 16 Jan 2018 21:05:09 +0200 Subject: [PATCH] MultipleLayouts:restore isSwitching signal --this creates a nice animation when switching layouts for orphaned Activities at a Multiple Layouts state --- app/layoutmanager.cpp | 21 +++++++++++++++++-- app/layoutmanager.h | 3 ++- .../package/contents/ui/VisibilityManager.qml | 12 ++++++----- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/layoutmanager.cpp b/app/layoutmanager.cpp index b40eea0c5..284696907 100644 --- a/app/layoutmanager.cpp +++ b/app/layoutmanager.cpp @@ -448,7 +448,7 @@ void LayoutManager::confirmDynamicSwitch() if (m_shouldSwitchToLayout == tempShouldSwitch && m_shouldSwitchToLayout != currentLayoutName()) { qDebug() << "dynamic switch to layout :: " << m_shouldSwitchToLayout; - emit currentLayoutIsChanging(); + emit currentLayoutIsSwitching(currentLayoutName()); if (m_corona->universalSettings()->showInfoWindow()) { showInfoWindow(i18n("Switching to layout %0 ...").arg(m_shouldSwitchToLayout), 4000); @@ -595,7 +595,24 @@ bool LayoutManager::switchToLayout(QString layoutName) if (!lPath.isEmpty()) { if (memoryUsage() == Dock::SingleLayout) { - emit currentLayoutIsChanging(); + emit currentLayoutIsSwitching(currentLayoutName()); + } else if (memoryUsage() == Dock::MultipleLayouts && layoutName != Layout::MultipleLayoutsName) { + Layout toLayout(this, lPath); + + QStringList toActivities = toLayout.activities(); + + Layout *activeForOrphans{nullptr}; + + foreach (auto fromLayout, m_activeLayouts) { + if (fromLayout->isOriginalLayout() && fromLayout->activities().isEmpty()) { + activeForOrphans = fromLayout; + break; + } + } + + if (toActivities.isEmpty() && activeForOrphans) { + emit currentLayoutIsSwitching(activeForOrphans->name()); + } } //! this code must be called asynchronously because it is called diff --git a/app/layoutmanager.h b/app/layoutmanager.h index 2f80745bd..b98b56e25 100644 --- a/app/layoutmanager.h +++ b/app/layoutmanager.h @@ -118,12 +118,13 @@ signals: void addWidgetsActionChanged(); void currentLayoutChanged(); void currentLayoutNameChanged(); - void currentLayoutIsChanging(); void launchersSignalsChanged(); void layoutsChanged(); void memoryUsageChanged(); void menuLayoutsChanged(); + void currentLayoutIsSwitching(QString layoutName); + private slots: void currentActivityChanged(const QString &id); void showInfoWindowChanged(); diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml index dc1dad74c..57a3bf46c 100644 --- a/containment/package/contents/ui/VisibilityManager.qml +++ b/containment/package/contents/ui/VisibilityManager.qml @@ -156,11 +156,13 @@ Item{ Connections{ target: universalLayoutManager - onCurrentLayoutIsChanging: { - manager.inTempHiding = true; - manager.inForceHiding = true; - root.clearZoom(); - manager.slotMustBeHide(); + onCurrentLayoutIsSwitching: { + if (root.dockManagedLayout && root.dockManagedLayout.name === layoutName) { + manager.inTempHiding = true; + manager.inForceHiding = true; + root.clearZoom(); + manager.slotMustBeHide(); + } } }