[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/slideInSlideOut
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2008-09-30 23:33:39
Message-ID: 1222817619.299050.9893.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 866472 by aseigo:
various fixes, improvements, clarifications, etc.
M +26 -19 SlideInSlideOut.cpp
M +6 -4 SlideInSlideOut.h
--- trunk/playground/base/plasma/applets/slideInSlideOut/SlideInSlideOut.cpp \
#866471:866472 @@ -31,19 +31,13 @@
using namespace Plasma;
SlideInSlideOut::SlideInSlideOut(QObject *parent, const QVariantList &args)
- : Plasma::Applet(parent, args)
+ : Plasma::Applet(parent, args),
+ m_out(true)
{
- setHasConfigurationInterface(false);
-
- KConfigGroup cg = config();
- m_pixelSize = cg.readEntry("size", 100);
m_theme = new Plasma::Svg(this);
m_theme->setImagePath("widgets/connection-established");
- m_theme->resize(m_pixelSize, m_pixelSize);
- t=new QTimer(this);
- connect(t, SIGNAL(timeout()), this, SLOT(moveMyself()));
- t->start(1000);
- up_down=true;
+ t = new QTimer(this);
+ connect(t, SIGNAL(timeout()), this, SLOT(moveMyself()));
resize(100,100);
}
@@ -51,6 +45,18 @@
{
}
+void SlideInSlideOut::init()
+{
+ t->start(1000);
+}
+
+void SlideInSlideOut::constraintsEvent(Plasma::Constraints constraints)
+{
+ if (constraints & Plasma::SizeConstraint) {
+ m_theme->resize(contentsRect().size());
+ }
+}
+
void SlideInSlideOut::paintInterface(QPainter *p, const QStyleOptionGraphicsItem \
*option, const QRect &contentsRect) {
Q_UNUSED(contentsRect);
@@ -62,16 +68,17 @@
void SlideInSlideOut::moveMyself()
{
- if(!up_down)
- {
- Animator::self()->moveItem(this, \
Animator::SlideInMovement,QPoint(contentsRect().x(),contentsRect().x()+20));
- up_down=true;
+ if (m_out) {
+ Animator::self()->moveItem(this, Animator::SlideInMovement,
+ QPoint(boundingRect().x(), \
-boundingRect().height())); + } else {
+ Animator::self()->moveItem(this, Animator::SlideOutMovement,
+ QPoint(boundingRect().x(), 0));
}
- else
- {
- Animator::self()->moveItem(this, \
Animator::SlideOutMovement,QPoint(contentsRect().x(),contentsRect().x()-20));
- up_down=false;
- }
+
+ m_out = !m_out;
t->start(1000);
}
+
#include "SlideInSlideOut.moc"
+
--- trunk/playground/base/plasma/applets/slideInSlideOut/SlideInSlideOut.h \
#866471:866472 @@ -42,18 +42,20 @@
SlideInSlideOut(QObject *parent, const QVariantList &args);
~SlideInSlideOut();
+ void init();
+ void constraintsEvent(Plasma::Constraints constraints);
void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem \
*option, const QRect &contentsRect);
-
- protected slots:
+
+ private slots:
void moveMyself();
- private :
+ private:
QRectF m_bounds;
int m_pixelSize;
QString m_timezone;
Plasma::Svg* m_theme;
- bool up_down;
+ bool m_out;
int x;
int y;
QTimer *t;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic