From 919796da14653d1b452760eb4f9b9d7a6e1b27fd Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 6 Mar 2009 18:21:59 +0000 Subject: [PATCH] 0 opacity with the busywidget busywidget always on the icon rather in the popup svn path=/trunk/KDE/kdelibs/; revision=936025 --- applet.cpp | 26 ++++++++++++-------------- private/applet_p.h | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/applet.cpp b/applet.cpp index 1e1b24812..6440dcf36 100644 --- a/applet.cpp +++ b/applet.cpp @@ -497,7 +497,7 @@ void AppletPrivate::cleanUpAndDelete() q->deleteLater(); } -void AppletPrivate::createMessageOverlay() +void AppletPrivate::createMessageOverlay(bool usePopup) { if (messageOverlay) { qDeleteAll(messageOverlay->children()); @@ -507,21 +507,21 @@ void AppletPrivate::createMessageOverlay() PopupApplet *popup = qobject_cast(q); if (!messageOverlay) { - if (popup && popup->widget()) { + if (usePopup && popup && popup->widget()) { messageOverlayProxy = new QGraphicsProxyWidget(q); messageOverlayProxy->setWidget(popup->widget()); messageOverlay = new AppletOverlayWidget(messageOverlayProxy); - } else if (popup && popup->graphicsWidget()) { + } else if (usePopup && popup && popup->graphicsWidget()) { messageOverlay = new AppletOverlayWidget(popup->graphicsWidget()); } else { messageOverlay = new AppletOverlayWidget(q); } } - if (popup && popup->widget()) { + if (usePopup && popup && popup->widget()) { // popupapplet with widget() messageOverlay->setGeometry(popup->widget()->contentsRect()); - } else if (popup && popup->graphicsWidget()) { + } else if (usePopup && popup && popup->graphicsWidget()) { // popupapplet with graphicsWidget() messageOverlay->setGeometry(popup->graphicsWidget()->boundingRect()); } else { @@ -683,8 +683,8 @@ Extender *Applet::extender() const void Applet::setBusy(bool busy) { if (busy) { - d->createMessageOverlay(); - d->messageOverlay->opacity = 0.4; + d->createMessageOverlay(false); + d->messageOverlay->opacity = 0; QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(d->messageOverlay); d->busyWidget = new Plasma::BusyWidget(d->messageOverlay); @@ -1077,13 +1077,6 @@ void Applet::flushPendingConstraintsEvents() }*/ } - 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(); } @@ -2349,6 +2342,11 @@ void AppletOverlayWidget::paint(QPainter *painter, { Q_UNUSED(option) Q_UNUSED(widget) + + if (qFuzzyCompare(1, 1+opacity)) { + return; + } + QColor wash = Plasma::Theme::defaultTheme()->color(Theme::BackgroundColor); wash.setAlphaF(opacity); diff --git a/private/applet_p.h b/private/applet_p.h index 3338a8c94..7c71d7c10 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -82,7 +82,7 @@ public: void updateRect(const QRectF &rect); void setFocus(); void cleanUpAndDelete(); - void createMessageOverlay(); + void createMessageOverlay(bool usePopup = true); void destroyMessageOverlay(); void addGlobalShortcutsPage(KConfigDialog *dialog); void clearShortcutEditorPtr();