better delay of panel creation

it also avoids recursive checkLoadingDesktopsComplete that caused a crash
This commit is contained in:
Marco Martin 2013-10-22 14:55:46 +02:00
parent b9382aefb2
commit 82ef02217d
2 changed files with 21 additions and 5 deletions

View File

@ -34,6 +34,7 @@
#include <kactivities/controller.h>
#include <kactivities/consumer.h>
#include "activity.h"
#include "desktopview.h"
#include "panelview.h"
@ -54,6 +55,11 @@ public:
// constant controlling how long between requesting a configuration sync
// and one happening should occur. currently 10 seconds
appConfigSyncTimer.setInterval(10000);
waitingPanelsTimer = new QTimer(q);
waitingPanelsTimer->setSingleShot(true);
waitingPanelsTimer->setInterval(250);
connect(waitingPanelsTimer, &QTimer::timeout, q, &ShellCorona::createWaitingPanels);
}
ShellCorona *q;
@ -69,6 +75,7 @@ public:
QList<Plasma::Containment *> waitingPanels;
QSet<Plasma::Containment *> loadingDesktops;
QHash<QString, Activity*> activities;
QTimer *waitingPanelsTimer;
QTimer appConfigSyncTimer;
};
@ -389,14 +396,21 @@ void ShellCorona::checkLoadingDesktopsComplete()
}
if (d->loadingDesktops.isEmpty()) {
foreach (Plasma::Containment *cont, d->waitingPanels) {
d->panelViews[cont] = new PanelView(this);
d->panelViews[cont]->setContainment(cont);
}
d->waitingPanels.clear();
d->waitingPanelsTimer->start();
} else {
d->waitingPanelsTimer->stop();
}
}
void ShellCorona::createWaitingPanels()
{
foreach (Plasma::Containment *cont, d->waitingPanels) {
d->panelViews[cont] = new PanelView(this);
d->panelViews[cont]->setContainment(cont);
}
d->waitingPanels.clear();
}
void ShellCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Containment *containment)
{
qDebug() << "Was screen" << wasScreen << "Is screen" << isScreen <<"Containment" << containment << containment->title();
@ -413,6 +427,7 @@ void ShellCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Contain
d->panelViews[containment]->setContainment(0);
d->panelViews[containment]->deleteLater();
d->panelViews.remove(containment);
d->waitingPanels.removeAll(containment);
}
}
checkLoadingDesktopsComplete();

View File

@ -125,6 +125,7 @@ protected Q_SLOTS:
private Q_SLOTS:
void checkLoadingDesktopsComplete();
void createWaitingPanels();
void handleContainmentAdded(Plasma::Containment *c);
void showWidgetExplorer();
void toggleActivityManager();