diff --git a/dialog.cpp b/dialog.cpp index 87ef66923..59903b157 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -68,8 +68,7 @@ public: graphicsWidget(0), resizeCorners(Dialog::NoCorner), resizeStartCorner(Dialog::NoCorner), - moveTimer(0), - hideAnimId(0) + moveTimer(0) { } @@ -80,8 +79,6 @@ public: void themeChanged(); void adjustView(); void updateResizeCorners(); - void progressHide(qreal amount); - void progressShow(qreal amount); Plasma::Dialog *q; @@ -96,8 +93,6 @@ public: QMap resizeAreas; Dialog::ResizeCorner resizeStartCorner; QTimer *moveTimer; - Direction hideDirection; - int hideAnimId; }; void DialogPrivate::themeChanged() @@ -261,38 +256,9 @@ Dialog::~Dialog() void Dialog::paintEvent(QPaintEvent *e) { - QRect target = e->rect(); - QRect source = target; - - if (d->hideAnimId) { - target = rect(); - source = target; - switch (d->hideDirection) { - case Plasma::Up: - case Plasma::Down: { - int bottomMargin = height() - d->view->geometry().bottom(); - target.setBottom(d->view->viewport()->geometry().bottom() - bottomMargin); - source.setTop(-d->view->viewport()->y() + bottomMargin); - } - break; - - case Plasma::Right: { - target.setLeft(d->view->viewport()->x()); - source.setRight(target.width() - 1); - } - break; - - case Plasma::Left: { - target.setWidth(d->view->viewport()->geometry().right() - 1); - source.setLeft(width() - target.width()); - } - break; - } - } - QPainter p(this); p.setCompositionMode(QPainter::CompositionMode_Source); - d->background->paintFrame(&p, target, source); + d->background->paintFrame(&p, e->rect(), e->rect()); } void Dialog::mouseMoveEvent(QMouseEvent *event) @@ -574,7 +540,6 @@ void Dialog::animatedHide(Plasma::Direction direction) } Location location = Desktop; - switch (direction) { case Down: location = BottomEdge; @@ -593,7 +558,6 @@ void Dialog::animatedHide(Plasma::Direction direction) } Plasma::WindowEffects::slideWindow(this, location); - hide(); } @@ -606,7 +570,6 @@ void Dialog::animatedShow(Plasma::Direction direction) //copied to not add new api Location location = Desktop; - switch (direction) { case Up: location = BottomEdge; @@ -624,82 +587,11 @@ void Dialog::animatedShow(Plasma::Direction direction) break; } - Plasma::WindowEffects::slideWindow(this, location); + if (KWindowSystem::compositingActive()) { + Plasma::WindowEffects::slideWindow(this, location); + } show(); - -} - -void DialogPrivate::progressShow(qreal amount) -{ - //kDebug() << amount; - if (qFuzzyCompare(amount, qreal(1.0))) { - view->viewport()->move(0, 0); - hideAnimId = 0; - q->update(); - q->show(); - return; - } - - int xtrans = 0; - int ytrans = 0; - - switch (hideDirection) { - case Plasma::Up: - ytrans = (1.0 - amount) * view->height(); - break; - - case Plasma::Down: - ytrans = (amount * view->height()) - view->height(); - break; - - case Plasma::Right: - xtrans = (amount * view->width()) - view->width(); - break; - - case Plasma::Left: - xtrans = (1.0 - amount) * view->width(); - break; - } - - view->viewport()->move(xtrans, ytrans); - q->update(); - q->show(); -} - -void DialogPrivate::progressHide(qreal amount) -{ - //kDebug() << amount; - if (qFuzzyCompare(amount, qreal(1.0))) { - q->hide(); - view->viewport()->move(0, 0); - hideAnimId = 0; - return; - } - - int xtrans = 0; - int ytrans = 0; - - switch (hideDirection) { - case Plasma::Up: - ytrans = -(amount * view->height()); - break; - - case Plasma::Down: - ytrans = amount * view->height(); - break; - - case Plasma::Right: - xtrans = amount * view->width(); - break; - - case Plasma::Left: - xtrans = -(amount * view->width()); - break; - } - - view->viewport()->move(xtrans, ytrans); - q->update(); } bool Dialog::inControlArea(const QPoint &point) diff --git a/dialog.h b/dialog.h index e21981539..cfabcc05b 100644 --- a/dialog.h +++ b/dialog.h @@ -90,12 +90,14 @@ class PLASMA_EXPORT Dialog : public QWidget /** * Causes an animated hide; requires compositing to work, otherwise * the dialog will simply hide. + * @since 4.3 */ void animatedHide(Plasma::Direction direction); /** * Causes an animated hide; requires compositing to work, otherwise * the dialog will simply hide. + * @since 4.3 */ void animatedShow(Plasma::Direction direction); @@ -142,8 +144,6 @@ class PLASMA_EXPORT Dialog : public QWidget * React to theme changes */ Q_PRIVATE_SLOT(d, void themeChanged()) - Q_PRIVATE_SLOT(d, void progressHide(qreal)) - Q_PRIVATE_SLOT(d, void progressShow(qreal)) }; } // Plasma namespace