mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
Revert "kdeplasma-addons: adjust to plasma animations support removal"
This reverts commit 3851bc2700
.
This commit is contained in:
parent
dacf91e59a
commit
4cbba576f7
23 changed files with 191 additions and 14 deletions
|
@ -34,12 +34,14 @@
|
||||||
#include <KLineEdit>
|
#include <KLineEdit>
|
||||||
#include <KTextBrowser>
|
#include <KTextBrowser>
|
||||||
|
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/IconWidget>
|
#include <Plasma/IconWidget>
|
||||||
#include <Plasma/LineEdit>
|
#include <Plasma/LineEdit>
|
||||||
#include <Plasma/TextBrowser>
|
#include <Plasma/TextBrowser>
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
#include <Plasma/ToolTipContent>
|
#include <Plasma/ToolTipContent>
|
||||||
#include <Plasma/ToolTipManager>
|
#include <Plasma/ToolTipManager>
|
||||||
|
#include <plasma/animations/animation.h>
|
||||||
|
|
||||||
#define AUTO_DEFINE_TIMEOUT 500
|
#define AUTO_DEFINE_TIMEOUT 500
|
||||||
|
|
||||||
|
@ -164,6 +166,13 @@ QGraphicsWidget *DictApplet::graphicsWidget()
|
||||||
m_graphicsWidget->setLayout(m_layout);
|
m_graphicsWidget->setLayout(m_layout);
|
||||||
m_graphicsWidget->setPreferredSize(500, 200);
|
m_graphicsWidget->setPreferredSize(500, 200);
|
||||||
|
|
||||||
|
Animation *zoomAnim =
|
||||||
|
Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||||
|
zoomAnim->setTargetWidget(m_wordEdit);
|
||||||
|
zoomAnim->setProperty("zoom", 1.0);
|
||||||
|
zoomAnim->setProperty("duration", 350);
|
||||||
|
zoomAnim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
|
||||||
return m_graphicsWidget;
|
return m_graphicsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
|
||||||
|
#include <Plasma/Animation>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
|
||||||
Fifteen::Fifteen(QGraphicsItem* parent, int size)
|
Fifteen::Fifteen(QGraphicsItem* parent, int size)
|
||||||
: QGraphicsWidget(parent),
|
: QGraphicsWidget(parent),
|
||||||
m_size(0), // this will immediately get overwritten by setSize(size) below, but needs an initial value
|
m_size(0), // this will immediately get overwritten by setSize(size) below, but needs an initial value
|
||||||
|
@ -365,12 +368,36 @@ void Fifteen::movePiece(Piece *piece, int newX, int newY)
|
||||||
int width = contentsRect().width() / m_size;
|
int width = contentsRect().width() / m_size;
|
||||||
int height = contentsRect().height() / m_size;
|
int height = contentsRect().height() / m_size;
|
||||||
QPointF pos = QPointF(newX * width, newY * height);
|
QPointF pos = QPointF(newX * width, newY * height);
|
||||||
|
|
||||||
|
// stop and delete any existing animation
|
||||||
|
Plasma::Animation *animation = m_animations.value(piece).data();
|
||||||
|
if (animation) {
|
||||||
|
if (animation->state() == QAbstractAnimation::Running) {
|
||||||
|
animation->stop();
|
||||||
|
}
|
||||||
|
delete animation;
|
||||||
|
animation = NULL;
|
||||||
|
}
|
||||||
|
animation = Plasma::Animator::create(Plasma::Animator::SlideAnimation, this);
|
||||||
|
animation->setTargetWidget(piece);
|
||||||
|
animation->setProperty("easingCurve", QEasingCurve::InOutQuad);
|
||||||
|
animation->setProperty("movementDirection", Plasma::Animation::MoveAny);
|
||||||
|
animation->setProperty("distancePointF", pos - piece->pos());
|
||||||
|
m_animations[piece] = animation;
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fifteen::toggleBlank(bool show)
|
void Fifteen::toggleBlank(bool show)
|
||||||
{
|
{
|
||||||
if (show && !m_blank->isVisible()) {
|
if (show) {
|
||||||
m_blank->show();
|
if (!m_blank->isVisible()) {
|
||||||
|
Plasma::Animation *animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation, this);
|
||||||
|
animation->setProperty("startOpacity", 0.0);
|
||||||
|
animation->setProperty("targetOpacity", 1.0);
|
||||||
|
animation->setTargetWidget(m_blank);
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
m_blank->show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_blank->hide();
|
m_blank->hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <plasma/applet.h>
|
#include <plasma/applet.h>
|
||||||
|
#include <plasma/animator.h>
|
||||||
|
|
||||||
class ConfigDialog;
|
class ConfigDialog;
|
||||||
class QGraphicsSceneDragDropEvent;
|
class QGraphicsSceneDragDropEvent;
|
||||||
|
|
|
@ -42,6 +42,9 @@ class QTextLayout;
|
||||||
class QString;
|
class QString;
|
||||||
class QAction;
|
class QAction;
|
||||||
|
|
||||||
|
// Plasma
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
|
||||||
class Tasks;
|
class Tasks;
|
||||||
class TaskGroupItem;
|
class TaskGroupItem;
|
||||||
class LayoutWidget;
|
class LayoutWidget;
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
// Plasma
|
// Plasma
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
#include <Plasma/PaintUtils>
|
#include <Plasma/PaintUtils>
|
||||||
|
|
||||||
KimpanelLabelGraphics::KimpanelLabelGraphics(RenderType type, QGraphicsItem *parent)
|
KimpanelLabelGraphics::KimpanelLabelGraphics(RenderType type, QGraphicsItem *parent)
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include <KStandardAction>
|
#include <KStandardAction>
|
||||||
#include <KAction>
|
#include <KAction>
|
||||||
|
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
#include <Plasma/PushButton>
|
#include <Plasma/PushButton>
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
|
||||||
|
@ -668,6 +670,18 @@ void Notes::createTextFormatingWidgets()
|
||||||
|
|
||||||
m_buttonAnimGroup = new QParallelAnimationGroup(this);
|
m_buttonAnimGroup = new QParallelAnimationGroup(this);
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++){
|
||||||
|
m_buttonAnim[i] = Plasma::Animator::create(Plasma::Animator::FadeAnimation, this);
|
||||||
|
m_buttonAnimGroup->addAnimation(m_buttonAnim[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buttonAnim[0]->setTargetWidget(m_buttonBold);
|
||||||
|
m_buttonAnim[1]->setTargetWidget(m_buttonItalic);
|
||||||
|
m_buttonAnim[2]->setTargetWidget(m_buttonUnderline);
|
||||||
|
m_buttonAnim[3]->setTargetWidget(m_buttonStrikeThrough);
|
||||||
|
m_buttonAnim[4]->setTargetWidget(m_buttonCenter);
|
||||||
|
m_buttonAnim[5]->setTargetWidget(m_buttonFill);
|
||||||
|
|
||||||
showOptions(false);
|
showOptions(false);
|
||||||
connect(m_buttonOption->nativeWidget(), SIGNAL(toggled(bool)), this, SLOT(showOptions(bool)));
|
connect(m_buttonOption->nativeWidget(), SIGNAL(toggled(bool)), this, SLOT(showOptions(bool)));
|
||||||
|
|
||||||
|
@ -678,6 +692,14 @@ void Notes::showOptions(bool show)
|
||||||
{
|
{
|
||||||
m_buttonOption->nativeWidget()->setDown(show);
|
m_buttonOption->nativeWidget()->setDown(show);
|
||||||
|
|
||||||
|
qreal targetOpacity = show ? 1 : 0;
|
||||||
|
qreal startOpacity = 1 - targetOpacity;
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++){
|
||||||
|
m_buttonAnim[i]->setProperty("startOpacity", startOpacity);
|
||||||
|
m_buttonAnim[i]->setProperty("targetOpacity", targetOpacity);
|
||||||
|
}
|
||||||
|
|
||||||
m_buttonAnimGroup->start();
|
m_buttonAnimGroup->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class Notes : public Plasma::PopupApplet
|
||||||
TopWidget *m_topWidget;
|
TopWidget *m_topWidget;
|
||||||
|
|
||||||
QParallelAnimationGroup *m_buttonAnimGroup;
|
QParallelAnimationGroup *m_buttonAnimGroup;
|
||||||
|
Plasma::Animation *m_buttonAnim[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
|
|
||||||
// Plasma
|
// Plasma
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/FrameSvg>
|
#include <Plasma/FrameSvg>
|
||||||
#include <Plasma/ScrollBar>
|
#include <Plasma/ScrollBar>
|
||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
// Plasma Includes
|
// Plasma Includes
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
#include <Plasma/Service>
|
#include <Plasma/Service>
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/TreeView>
|
#include <Plasma/TreeView>
|
||||||
#include <Plasma/TabBar>
|
#include <Plasma/TabBar>
|
||||||
#include <Plasma/Label>
|
#include <Plasma/Label>
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
#include <Plasma/IconWidget>
|
#include <Plasma/IconWidget>
|
||||||
#include <Plasma/Service>
|
#include <Plasma/Service>
|
||||||
|
|
||||||
|
@ -212,7 +214,28 @@ void TaskEditor::startAnimation(QSizeF endSize, bool show) {
|
||||||
fullSize = endSize;
|
fullSize = endSize;
|
||||||
resize(fullSize);
|
resize(fullSize);
|
||||||
|
|
||||||
animationFinished();
|
Plasma::Animation *animation = m_fadeAnimation.data();
|
||||||
|
if (!animation) {
|
||||||
|
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
|
||||||
|
animation->setTargetWidget(this);
|
||||||
|
animation->setProperty("startValue", 0.0);
|
||||||
|
animation->setProperty("endValue", 1.0);
|
||||||
|
animation->setProperty("duration", 100);
|
||||||
|
m_fadeAnimation = animation;
|
||||||
|
connect(animation, SIGNAL(finished()), this, SLOT(animationFinished()));
|
||||||
|
} else if (animation->state() == QAbstractAnimation::Running) {
|
||||||
|
animation->pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
animation->setProperty("easingCurve", QEasingCurve::InQuad);
|
||||||
|
animation->setProperty("direction", QAbstractAnimation::Forward);
|
||||||
|
animation->start(QAbstractAnimation::KeepWhenStopped);
|
||||||
|
} else {
|
||||||
|
animation->setProperty("easingCurve", QEasingCurve::OutQuad);
|
||||||
|
animation->setProperty("direction", QAbstractAnimation::Backward);
|
||||||
|
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskEditor::animationFinished() {
|
void TaskEditor::animationFinished() {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
#include <QAbstractAnimation>
|
#include <QAbstractAnimation>
|
||||||
#include <plasma/plasma_export.h>
|
#include <plasma/plasma_export.h>
|
||||||
|
#include <plasma/animator.h>
|
||||||
#include <plasma/dataengine.h>
|
#include <plasma/dataengine.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
#include <Plasma/FrameSvg>
|
#include <Plasma/FrameSvg>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
|
|
||||||
#include "groupingcontainment.h"
|
#include "groupingcontainment.h"
|
||||||
#include "freehandle.h"
|
#include "freehandle.h"
|
||||||
|
@ -84,6 +86,14 @@ void AbstractGroupPrivate::destroyGroup()
|
||||||
delete q;
|
delete q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractGroupPrivate::startDestroyAnimation()
|
||||||
|
{
|
||||||
|
Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||||
|
q->connect(zoomAnim, SIGNAL(finished()), q, SLOT(destroyGroup()));
|
||||||
|
zoomAnim->setTargetWidget(q);
|
||||||
|
zoomAnim->start();
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractGroupPrivate::appletDestroyed(Plasma::Applet *applet)
|
void AbstractGroupPrivate::appletDestroyed(Plasma::Applet *applet)
|
||||||
{
|
{
|
||||||
if (applets.contains(applet)) {
|
if (applets.contains(applet)) {
|
||||||
|
@ -97,7 +107,7 @@ void AbstractGroupPrivate::appletDestroyed(Plasma::Applet *applet)
|
||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
|
|
||||||
if (destroying && (q->children().count() == 0)) {
|
if (destroying && (q->children().count() == 0)) {
|
||||||
destroyGroup();
|
startDestroyAnimation();
|
||||||
destroying = false;
|
destroying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +129,7 @@ void AbstractGroupPrivate::subGroupDestroyed(AbstractGroup *subGroup)
|
||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
|
|
||||||
if (destroying && (q->children().count() == 0)) {
|
if (destroying && (q->children().count() == 0)) {
|
||||||
destroyGroup();
|
startDestroyAnimation();
|
||||||
destroying = false;
|
destroying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,7 +480,7 @@ void AbstractGroup::destroy()
|
||||||
d->destroying = true;
|
d->destroying = true;
|
||||||
|
|
||||||
if (children().count() == 0) {
|
if (children().count() == 0) {
|
||||||
d->destroyGroup();
|
d->startDestroyAnimation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
|
|
||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KPushButton>
|
#include <KPushButton>
|
||||||
|
|
||||||
|
#include <Plasma/Animation>
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
#include <Plasma/Corona>
|
#include <Plasma/Corona>
|
||||||
#include <Plasma/ItemBackground>
|
#include <Plasma/ItemBackground>
|
||||||
|
@ -63,6 +65,10 @@ GroupIconList::GroupIconList(Plasma::Location loc, QGraphicsItem *parent)
|
||||||
m_arrowsSvg->setContainsMultipleImages(true);
|
m_arrowsSvg->setContainsMultipleImages(true);
|
||||||
m_arrowsSvg->resize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
m_arrowsSvg->resize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
||||||
|
|
||||||
|
m_slide = Plasma::Animator::create(Plasma::Animator::SlideAnimation);
|
||||||
|
m_slide->setEasingCurve(QEasingCurve::Linear);
|
||||||
|
connect(m_slide, SIGNAL(finished()), this, SLOT(scrollStepFinished()));
|
||||||
|
|
||||||
//init arrows
|
//init arrows
|
||||||
m_upLeftArrow = new Plasma::ToolButton(this);
|
m_upLeftArrow = new Plasma::ToolButton(this);
|
||||||
m_upLeftArrow->setPreferredSize(IconSize(KIconLoader::Panel), IconSize(KIconLoader::Panel));
|
m_upLeftArrow->setPreferredSize(IconSize(KIconLoader::Panel), IconSize(KIconLoader::Panel));
|
||||||
|
@ -81,6 +87,8 @@ GroupIconList::GroupIconList(Plasma::Location loc, QGraphicsItem *parent)
|
||||||
m_listWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
m_listWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
m_listLayout = new QGraphicsLinearLayout(m_listWidget);
|
m_listLayout = new QGraphicsLinearLayout(m_listWidget);
|
||||||
|
|
||||||
|
m_slide->setTargetWidget(m_listWidget);
|
||||||
|
|
||||||
m_listWidget->installEventFilter(this);
|
m_listWidget->installEventFilter(this);
|
||||||
m_scrollWidget->installEventFilter(this);
|
m_scrollWidget->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -108,6 +116,7 @@ GroupIconList::GroupIconList(Plasma::Location loc, QGraphicsItem *parent)
|
||||||
|
|
||||||
GroupIconList::~GroupIconList()
|
GroupIconList::~GroupIconList()
|
||||||
{
|
{
|
||||||
|
delete m_slide;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GroupIconList::eventFilter(QObject *obj, QEvent *event)
|
bool GroupIconList::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
@ -303,7 +312,16 @@ void GroupIconList::scrollTo(int index)
|
||||||
|
|
||||||
m_firstItemIndex = index;
|
m_firstItemIndex = index;
|
||||||
|
|
||||||
scrollStepFinished();
|
m_slide->stop();
|
||||||
|
|
||||||
|
if (m_orientation == Qt::Horizontal) {
|
||||||
|
m_slide->setProperty("movementDirection", Plasma::Animation::MoveLeft);
|
||||||
|
} else {
|
||||||
|
m_slide->setProperty("movementDirection", Plasma::Animation::MoveUp);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_slide->setProperty("distance", move);
|
||||||
|
m_slide->start();
|
||||||
|
|
||||||
manageArrows();
|
manageArrows();
|
||||||
}
|
}
|
||||||
|
@ -325,8 +343,11 @@ void GroupIconList::scrollStepFinished()
|
||||||
m_scrollingDueToWheel = false;
|
m_scrollingDueToWheel = false;
|
||||||
|
|
||||||
//keep scrolling if the button is held down
|
//keep scrolling if the button is held down
|
||||||
if (m_upLeftArrow->isEnabled() && m_upLeftArrow->isDown()) {
|
bool movingLeftUp = m_slide->property("distance").value<qreal>() < 0;
|
||||||
scrollUpLeft();
|
if (movingLeftUp) {
|
||||||
|
if (m_upLeftArrow->isEnabled() && m_upLeftArrow->isDown()) {
|
||||||
|
scrollUpLeft();
|
||||||
|
}
|
||||||
} else if (m_downRightArrow->isEnabled() && m_downRightArrow->isDown()) {
|
} else if (m_downRightArrow->isEnabled() && m_downRightArrow->isDown()) {
|
||||||
scrollDownRight();
|
scrollDownRight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include <netwm.h>
|
#include <netwm.h>
|
||||||
|
|
||||||
#include <Plasma/Corona>
|
#include <Plasma/Corona>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
#include <Plasma/WindowEffects>
|
#include <Plasma/WindowEffects>
|
||||||
|
|
||||||
#include "abstractgroup.h"
|
#include "abstractgroup.h"
|
||||||
|
@ -408,7 +410,14 @@ void GroupingContainmentPrivate::onWidgetMoved(QGraphicsWidget *widget)
|
||||||
QRectF newGeom(widget->geometry());
|
QRectF newGeom(widget->geometry());
|
||||||
|
|
||||||
if (geom != newGeom) {
|
if (geom != newGeom) {
|
||||||
widgetMovedAnimationComplete();
|
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::GeometryAnimation);
|
||||||
|
if (anim) {
|
||||||
|
q->connect(anim, SIGNAL(finished()), q, SLOT(widgetMovedAnimationComplete()));
|
||||||
|
anim->setTargetWidget(widget);
|
||||||
|
anim->setProperty("startGeometry", geom);
|
||||||
|
anim->setProperty("targetGeometry", newGeom);
|
||||||
|
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
blockSceneEventFilter = false;
|
blockSceneEventFilter = false;
|
||||||
}
|
}
|
||||||
|
@ -614,6 +623,12 @@ void GroupingContainment::addGroup(AbstractGroup *group, const QPointF &pos)
|
||||||
|
|
||||||
if (!d->loading && !pos.isNull()) {
|
if (!d->loading && !pos.isNull()) {
|
||||||
d->manageGroup(group, pos);
|
d->manageGroup(group, pos);
|
||||||
|
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::AppearAnimation);
|
||||||
|
if (anim) {
|
||||||
|
anim->setTargetWidget(group);
|
||||||
|
anim->setDirection(QAbstractAnimation::Backward);
|
||||||
|
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group->installEventFilter(this);
|
group->installEventFilter(this);
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
#include <Plasma/PaintUtils>
|
#include <Plasma/PaintUtils>
|
||||||
#include <Plasma/ToolButton>
|
#include <Plasma/ToolButton>
|
||||||
|
#include <Plasma/Animator>
|
||||||
|
#include <Plasma/Animation>
|
||||||
|
|
||||||
#include "spacer.h"
|
#include "spacer.h"
|
||||||
#include "gridmanager.h"
|
#include "gridmanager.h"
|
||||||
|
@ -592,7 +594,15 @@ bool GridGroup::eventFilter(QObject *obj, QEvent *event)
|
||||||
QPointF p(child->mapFromScene(static_cast<QGraphicsSceneMouseEvent *>(event)->scenePos()));
|
QPointF p(child->mapFromScene(static_cast<QGraphicsSceneMouseEvent *>(event)->scenePos()));
|
||||||
checkCorner(p, child);
|
checkCorner(p, child);
|
||||||
|
|
||||||
child->installEventFilter(this);
|
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::GeometryAnimation);
|
||||||
|
if (anim) {
|
||||||
|
child->removeEventFilter(this);
|
||||||
|
anim->setTargetWidget(child);
|
||||||
|
anim->setProperty("startGeometry", geom);
|
||||||
|
anim->setProperty("targetGeometry", child->geometry());
|
||||||
|
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
connect(anim, SIGNAL(finished()), this, SLOT(resizeDone()));
|
||||||
|
}
|
||||||
|
|
||||||
m_showGrid = false;
|
m_showGrid = false;
|
||||||
update();
|
update();
|
||||||
|
@ -608,6 +618,12 @@ bool GridGroup::eventFilter(QObject *obj, QEvent *event)
|
||||||
return AbstractGroup::eventFilter(obj, event);
|
return AbstractGroup::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GridGroup::resizeDone()
|
||||||
|
{
|
||||||
|
Plasma::Animation *anim = static_cast<Plasma::Animation *>(sender());
|
||||||
|
anim->targetWidget()->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
void GridGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void GridGroup::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
AbstractGroup::paint(painter, option, widget);
|
AbstractGroup::paint(painter, option, widget);
|
||||||
|
|
|
@ -55,6 +55,7 @@ class GridGroup : public AbstractGroup
|
||||||
void removeRowOrColumn();
|
void removeRowOrColumn();
|
||||||
void appletRemoved(Plasma::Applet *applet);
|
void appletRemoved(Plasma::Applet *applet);
|
||||||
void subGroupRemoved(AbstractGroup *group);
|
void subGroupRemoved(AbstractGroup *group);
|
||||||
|
void resizeDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateChild(QGraphicsWidget *child);
|
void updateChild(QGraphicsWidget *child);
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
|
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
#include <Plasma/PaintUtils>
|
#include <Plasma/PaintUtils>
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/ToolButton>
|
#include <Plasma/ToolButton>
|
||||||
|
#include <Plasma/Animation>
|
||||||
|
|
||||||
static const int SIZE = 30;
|
static const int SIZE = 30;
|
||||||
|
|
||||||
|
@ -65,6 +67,12 @@ GridManager::GridManager(QGraphicsItem *parent)
|
||||||
//FIXME: QGraphicsLayout is bugged and it won't lay out the items until a resize is called.
|
//FIXME: QGraphicsLayout is bugged and it won't lay out the items until a resize is called.
|
||||||
resize(50, 50);
|
resize(50, 50);
|
||||||
|
|
||||||
|
m_fadeAnim = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
|
||||||
|
m_fadeAnim->setTargetWidget(this);
|
||||||
|
m_fadeAnim->setProperty("startOpacity", 0);
|
||||||
|
m_fadeAnim->setProperty("targetOpacity", 1);
|
||||||
|
connect(m_fadeAnim, SIGNAL(finished()), this, SLOT(animationFinished()));
|
||||||
|
|
||||||
connect(m_newRowCol, SIGNAL(clicked()), this, SIGNAL(newClicked()));
|
connect(m_newRowCol, SIGNAL(clicked()), this, SIGNAL(newClicked()));
|
||||||
connect(m_delRowCol, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));
|
connect(m_delRowCol, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));
|
||||||
connect(m_newRowCol2, SIGNAL(clicked()), this, SIGNAL(newClicked()));
|
connect(m_newRowCol2, SIGNAL(clicked()), this, SIGNAL(newClicked()));
|
||||||
|
@ -112,7 +120,8 @@ void GridManager::setLocation(Plasma::Location location)
|
||||||
|
|
||||||
if (isVisible()) {
|
if (isVisible()) {
|
||||||
m_replace = true;
|
m_replace = true;
|
||||||
animationFinished();
|
m_fadeAnim->setDirection(QAbstractAnimation::Backward);
|
||||||
|
m_fadeAnim->start();
|
||||||
} else {
|
} else {
|
||||||
place();
|
place();
|
||||||
}
|
}
|
||||||
|
@ -169,21 +178,28 @@ void GridManager::place()
|
||||||
void GridManager::showAnimated()
|
void GridManager::showAnimated()
|
||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
animationFinished();
|
|
||||||
|
m_fadeAnim->setDirection(QAbstractAnimation::Forward);
|
||||||
|
m_fadeAnim->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridManager::hideAnimated()
|
void GridManager::hideAnimated()
|
||||||
{
|
{
|
||||||
m_location = Plasma::Floating;
|
m_location = Plasma::Floating;
|
||||||
m_replace = false;
|
m_replace = false;
|
||||||
animationFinished();
|
m_fadeAnim->setDirection(QAbstractAnimation::Backward);
|
||||||
|
m_fadeAnim->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridManager::animationFinished()
|
void GridManager::animationFinished()
|
||||||
{
|
{
|
||||||
|
if (m_fadeAnim->direction() == QAbstractAnimation::Backward) {
|
||||||
|
hide();
|
||||||
|
|
||||||
if (m_replace) {
|
if (m_replace) {
|
||||||
place();
|
place();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridManager::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
void GridManager::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||||
|
|
|
@ -28,6 +28,7 @@ class QGraphicsLinearLayout;
|
||||||
|
|
||||||
namespace Plasma {
|
namespace Plasma {
|
||||||
class ToolButton;
|
class ToolButton;
|
||||||
|
class Animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GridManager : public QGraphicsWidget
|
class GridManager : public QGraphicsWidget
|
||||||
|
@ -62,6 +63,7 @@ class GridManager : public QGraphicsWidget
|
||||||
Plasma::ToolButton *m_newRowCol2;
|
Plasma::ToolButton *m_newRowCol2;
|
||||||
Plasma::ToolButton *m_delRowCol;
|
Plasma::ToolButton *m_delRowCol;
|
||||||
Plasma::ToolButton *m_delRowCol2;
|
Plasma::ToolButton *m_delRowCol2;
|
||||||
|
Plasma::Animation *m_fadeAnim;
|
||||||
bool m_replace;
|
bool m_replace;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtGui/QGraphicsObject>
|
#include <QtGui/QGraphicsObject>
|
||||||
|
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/Svg>
|
#include <Plasma/Svg>
|
||||||
|
|
||||||
class QGraphicsView;
|
class QGraphicsView;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "ScrollBar.h"
|
#include "ScrollBar.h"
|
||||||
#include "Widget.h"
|
#include "Widget.h"
|
||||||
|
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <QGraphicsSceneWheelEvent>
|
#include <QGraphicsSceneWheelEvent>
|
||||||
|
|
||||||
#include <lancelot/layouts/FullBorderLayout.h>
|
#include <lancelot/layouts/FullBorderLayout.h>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
|
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include "backgroundlistmodel.h"
|
#include "backgroundlistmodel.h"
|
||||||
#include "backgrounddelegate.h"
|
#include "backgrounddelegate.h"
|
||||||
//#include "ksmserver_interface.h"
|
//#include "ksmserver_interface.h"
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KPushButton>
|
#include <KPushButton>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
|
#include <Plasma/Animator>
|
||||||
#include <Plasma/Theme>
|
#include <Plasma/Theme>
|
||||||
|
|
||||||
// Libplasmaweather includes
|
// Libplasmaweather includes
|
||||||
|
|
Loading…
Add table
Reference in a new issue