Don't emit signals in another object from panel

Emitting objects in another object is weird.

ShellCorona::availableScreenRect knows what properties of panelview we
use, so tracking of property changes should be in ShellCorona.

Also simplify ShellCoronaCode, if the rect changes the region has also
implicitly changed. We can handle that in one connect.

REVIEW: 126576
wilder-5.14
David Edmundson 10 years ago
parent e23a1814b0
commit c62452c467
  1. 8
      shell/panelview.cpp
  2. 14
      shell/shellcorona.cpp

@ -93,10 +93,6 @@ PanelView::PanelView(ShellCorona *corona, QScreen *targetScreen, QWindow *parent
&m_positionPaneltimer, SLOT(start()));
connect(this, SIGNAL(containmentChanged()),
this, SLOT(containmentChanged()));
connect(this, &ContainmentView::locationChanged, [this] () {
emit m_corona->availableScreenRectChanged();
emit m_corona->availableScreenRegionChanged();
});
if (!m_corona->kPackage().isValid()) {
qWarning() << "Invalid home screen package";
@ -221,8 +217,6 @@ void PanelView::setThickness(int value)
config().writeEntry("thickness", value);
m_corona->requestApplicationConfigSync();
positionPanel();
emit m_corona->availableScreenRectChanged();
emit m_corona->availableScreenRegionChanged();
}
int PanelView::length() const
@ -345,8 +339,6 @@ void PanelView::setVisibilityMode(PanelView::VisibilityMode mode)
updateStruts();
emit visibilityModeChanged();
emit corona()->availableScreenRectChanged();
emit corona()->availableScreenRegionChanged();
restoreAutoHide();
}

@ -108,6 +108,8 @@ ShellCorona::ShellCorona(QObject *parent)
executeSetupPlasmoidScript(c, c);
});
connect(this, &Plasma::Corona::availableScreenRectChanged, this, &Plasma::Corona::availableScreenRegionChanged);
m_appConfigSyncTimer.setSingleShot(true);
m_appConfigSyncTimer.setInterval(s_configSyncDelay);
connect(&m_appConfigSyncTimer, &QTimer::timeout, this, &ShellCorona::syncAppConfig);
@ -778,7 +780,6 @@ void ShellCorona::removeView(int idx)
if (panelsAltered) {
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
}
}
@ -918,7 +919,6 @@ void ShellCorona::addOutput(const KScreen::OutputPtr &output)
}
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
CHECK_SCREEN_INVARIANTS
}
@ -1014,10 +1014,9 @@ void ShellCorona::createWaitingPanels()
Q_ASSERT(qBound(0, requestedScreen, m_views.count() - 1) == requestedScreen);
QScreen *screen = m_views[requestedScreen]->screen();
PanelView* panel = new PanelView(this, screen);
connect(panel, &QWindow::visibleChanged, [this]() {
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
});
connect(panel, &QWindow::visibleChanged, this, &Plasma::Corona::availableScreenRectChanged);
connect(panel, &PanelView::locationChanged, this, &Plasma::Corona::availableScreenRectChanged);
connect(panel, &PanelView::visibilityModeChanged, this, &Plasma::Corona::availableScreenRectChanged);
m_panelViews[cont] = panel;
panel->setContainment(cont);
@ -1028,14 +1027,12 @@ void ShellCorona::createWaitingPanels()
}
m_waitingPanels = stillWaitingPanels;
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
}
void ShellCorona::containmentDeleted(QObject *cont)
{
m_panelViews.remove(static_cast<Plasma::Containment*>(cont));
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
}
void ShellCorona::handleContainmentAdded(Plasma::Containment *c)
@ -1354,7 +1351,6 @@ Plasma::Containment *ShellCorona::setContainmentTypeForScreen(int screen, const
QTimer::singleShot(2500, oldContainment, &Plasma::Applet::destroy);
emit availableScreenRectChanged();
emit availableScreenRegionChanged();
return newContainment;
}

Loading…
Cancel
Save