1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-16 07:24:23 +03:00

MultipleLayouts:restore isSwitching signal

--this creates a nice animation when switching
layouts for orphaned Activities at a Multiple
Layouts state
This commit is contained in:
Michail Vourlakos 2018-01-16 21:05:09 +02:00
parent 1275da22d7
commit 60cc89d595
3 changed files with 28 additions and 8 deletions

View File

@ -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 <b>%0</b> ...").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

View File

@ -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();

View File

@ -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();
}
}
}