experiment in delaying the panel creation

This commit is contained in:
Marco Martin 2013-08-08 22:18:45 +02:00
parent f979e1bbcb
commit 336055edc5
5 changed files with 36 additions and 4 deletions

View File

@ -732,7 +732,7 @@ void AppletInterface::itemChange(ItemChange change, const ItemChangeData &value)
{
if (change == QQuickItem::ItemSceneChange) {
//we have a window: create the
if (value.window && !m_qmlObject->rootObject() && !m_creationTimer->isActive()) {
if (value.window && !m_qmlObject->rootObject() /*&& !m_creationTimer->isActive()*/) {
init();
/*Experiment on even more delayed, doesn't seem to be good

View File

@ -213,6 +213,7 @@ private:
Plasma::Types::BackgroundHints m_backgroundHints;
bool m_busy : 1;
bool m_expanded : 1;
friend class ContainmentInterface;
};
#endif

View File

@ -67,6 +67,17 @@ void ContainmentInterface::init()
connect(containment()->corona(), &Plasma::Corona::availableScreenRegionChanged,
this, &ContainmentInterface::availableScreenRegionChanged);
}
//HACK, why appletAddedForward doesn't get called?
foreach (Plasma::Applet *applet, containment()->applets()) {
appletAddedForward(applet);
}
foreach (QObject *appletObj, m_appletInterfaces) {
AppletInterface *applet = qobject_cast<AppletInterface *>(appletObj);
if (!applet->qmlObject()) {
applet->init();
}
}
}
QList <QObject *> ContainmentInterface::applets()

View File

@ -50,6 +50,11 @@ DesktopCorona::DesktopCorona(QObject *parent)
connect(m_appConfigSyncTimer, &QTimer::timeout,
this, &DesktopCorona::syncAppConfig);
m_waitingPanelsTimer = new QTimer(this);
m_waitingPanelsTimer->setSingleShot(true);
connect(m_waitingPanelsTimer, &QTimer::timeout,
this, &DesktopCorona::createWaitingPanels);
connect(m_desktopWidget, SIGNAL(resized(int)),
this, SLOT(screenResized(int)));
@ -252,6 +257,16 @@ void DesktopCorona::checkViews()
}
}
void DesktopCorona::createWaitingPanels()
{
foreach (Plasma::Containment *cont, m_waitingPanels) {
m_panelViews[cont] = new PanelView(this);
m_panelViews[cont]->setContainment(cont);
m_panelViews[cont]->show();
}
m_waitingPanels.clear();
}
void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Containment *containment)
{
qDebug() << "Was screen" << wasScreen << "Is screen" << isScreen <<"Containment" << containment << containment->title();
@ -260,9 +275,8 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
containment->formFactor() == Plasma::Types::Vertical) {
if (isScreen >= 0) {
m_panelViews[containment] = new PanelView(this);
m_panelViews[containment]->setContainment(containment);
m_panelViews[containment]->show();
m_waitingPanels << containment;
m_waitingPanelsTimer->start(250);
} else {
if (m_panelViews.contains(containment)) {
m_panelViews[containment]->setContainment(0);
@ -274,6 +288,9 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
//Desktop view
} else {
if (m_waitingPanelsTimer->isActive()) {
m_waitingPanelsTimer->start(250);
}
if (isScreen < 0 || m_views.count() < isScreen + 1) {
qWarning() << "Invalid screen";
return;

View File

@ -99,14 +99,17 @@ private Q_SLOTS:
void handleContainmentAdded(Plasma::Containment *c);
void showWidgetExplorer();
void syncAppConfig();
void createWaitingPanels();
private:
QDesktopWidget *m_desktopWidget;
QList <View *> m_views;
WidgetExplorerView *m_widgetExplorerView;
QList<Plasma::Containment *> m_waitingPanels;
QHash<Plasma::Containment *, PanelView *> m_panelViews;
KConfigGroup m_desktopDefaultsConfig;
QTimer *m_appConfigSyncTimer;
QTimer *m_waitingPanelsTimer;
};
#endif