consolidate the code paths in flushUpdatedConstraintsEvent, document it a bit better, and call layout()->updateGeometry() less often; sadly it's still needed otherwise the panel containment doesn't come up properly =/ hopefully Qt 4.5 will alleviate that issue

svn path=/trunk/KDE/kdelibs/; revision=897317
This commit is contained in:
Aaron J. Seigo 2008-12-15 18:29:45 +00:00
parent 85161ce13f
commit fab0de787f

View File

@ -882,7 +882,8 @@ void Applet::flushPendingConstraintsEvents()
}
}
if (c & Plasma::SizeConstraint && d->messageOverlay) {
if (c & Plasma::SizeConstraint) {
if (d->messageOverlay) {
d->messageOverlay->setGeometry(QRectF(QPointF(0, 0), geometry().size()));
QGraphicsItem *button = 0;
@ -899,13 +900,18 @@ void Applet::flushPendingConstraintsEvents()
}
}
if (c & Plasma::SizeConstraint && d->busyWidget && d->busyWidget->isVisible()) {
if (d->busyWidget && d->busyWidget->isVisible()) {
int busySize = qMin(size().width(), size().height())/3;
QRect busyRect(0, 0, busySize, busySize);
busyRect.moveCenter(boundingRect().center().toPoint());
d->busyWidget->setGeometry(busyRect);
}
if (d->started && layout()) {
layout()->updateGeometry();
}
}
if (c & Plasma::FormFactorConstraint) {
FormFactor f = formFactor();
if (!isContainment() && f != Vertical && f != Horizontal) {
@ -926,9 +932,9 @@ void Applet::flushPendingConstraintsEvents()
}
}
if (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) {
if (aspectRatioMode() == Plasma::Square) {
// enforce square size in panels
if ((c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) &&
aspectRatioMode() == Plasma::Square) {
if (formFactor() == Horizontal) {
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
} else if (formFactor() == Vertical) {
@ -936,11 +942,8 @@ void Applet::flushPendingConstraintsEvents()
}
updateGeometry();
}
} else if (aspectRatioMode() == Plasma::ConstrainedSquare) {
// enforce a constrained square size in panels
if ((c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) &&
aspectRatioMode() == Plasma::ConstrainedSquare) {
if (formFactor() == Horizontal) {
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding));
} else if (formFactor() == Vertical) {
@ -949,7 +952,9 @@ void Applet::flushPendingConstraintsEvents()
updateGeometry();
}
}
// now take care of constraints in special subclasses: Contaiment and PopupApplet
Containment* containment = qobject_cast<Plasma::Containment*>(this);
if (isContainment() && containment) {
containment->d->containmentConstraintsEvent(c);
@ -960,12 +965,9 @@ void Applet::flushPendingConstraintsEvents()
popup->d->popupConstraintsEvent(c);
}
// pass the constraint on to the actual subclass
constraintsEvent(c);
if (layout()) {
layout()->updateGeometry();
}
if (c & StartupCompletedConstraint) {
// start up is done, we can now go do a mod timer
if (d->modificationsTimerId > 0) {