[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma
From:       Andre Duffeck <andre () duffeck ! de>
Date:       2008-05-08 11:45:50
Message-ID: 1210247150.070396.27062.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 805377 by duffeck:

port Plasma::Flash


 M  +2 -0      CMakeLists.txt  
 M  +11 -15    widgets/flash.cpp  
 M  +4 -7      widgets/flash.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/CMakeLists.txt #805376:805377
@@ -61,6 +61,7 @@
     widgets/webcontent.cpp
     widgets/meter.cpp
     widgets/signalplotter.cpp
+    widgets/flash.cpp
 )
 
 kde4_add_ui_files (
@@ -139,6 +140,7 @@
     widgets/webcontent.h
     widgets/meter.h
     widgets/signalplotter.h
+    widgets/flash.h
     DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/widgets)
 
 #For future
--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/flash.cpp #805376:805377
@@ -51,7 +51,7 @@
         int defaultDuration;
         FlashType type;
 
-        Plasma::Phase::AnimId animId;
+        int animId;
         QPixmap renderedPixmap;
 
         QTextOption textOption;
@@ -62,7 +62,7 @@
 
 
 Flash::Flash(QGraphicsItem *parent)
-    : Plasma::Widget(parent),
+    : QGraphicsWidget(parent),
       d(new Private)
 {
     d->defaultDuration = 3000;
@@ -70,8 +70,9 @@
     d->color = Qt::black;
     d->animId = 0;
     d->state = Private::Invisible;
-    resize(QSizeF(40, 100));
 
+    setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
+
     setCacheMode(NoCache);
 }
 
@@ -80,11 +81,6 @@
     delete d;
 }
 
-QRectF Flash::boundingRect() const
-{
-    return QRectF(0, 0, size().width(), size().height());
-}
-
 void Flash::setDuration( int duration )
 {
     d->defaultDuration = duration;
@@ -129,8 +125,8 @@
 {
     d->state = Private::Visible;
     d->renderedPixmap = renderPixmap();
-    d->animId = Plasma::Phase::self()->animateElement(this, \
                Plasma::Phase::ElementAppear);
-    Plasma::Phase::self()->setAnimationPixmap( d->animId, d->renderedPixmap );
+    d->animId = Plasma::Animator::self()->animateElement(this, \
Plasma::Animator::AppearAnimation); +    Plasma::Animator::self()->setInitialPixmap( \
d->animId, d->renderedPixmap );  if( d->duration > 0 )
         QTimer::singleShot( d->duration, this, SLOT(fadeOut()) );
 }
@@ -141,8 +137,8 @@
         return;    // Flash was already killed - do not animate again
 
     d->state = Private::Invisible;
-    d->animId = Plasma::Phase::self()->animateElement(this, \
                Plasma::Phase::ElementDisappear);
-    Plasma::Phase::self()->setAnimationPixmap( d->animId, d->renderedPixmap );
+    d->animId = Plasma::Animator::self()->animateElement(this, \
Plasma::Animator::DisappearAnimation); +    \
Plasma::Animator::self()->setInitialPixmap( d->animId, d->renderedPixmap );  }
 
 QPixmap Flash::renderPixmap()
@@ -175,13 +171,13 @@
     }
     return pm;
 }
-void Flash::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, \
QWidget *widget) +void Flash::paint(QPainter *painter, const QStyleOptionGraphicsItem \
*option, QWidget *widget)  {
     Q_UNUSED(option)
     Q_UNUSED(widget)
 
-    if( d->animId && !Plasma::Phase::self()->animationResult(d->animId).isNull() ) {
-        painter->drawPixmap( 0, 0, Plasma::Phase::self()->animationResult(d->animId) \
); +    if( d->animId && !Plasma::Animator::self()->currentPixmap(d->animId).isNull() \
) { +        painter->drawPixmap( 0, 0, \
Plasma::Animator::self()->currentPixmap(d->animId) );  } else if( d->state == \
Private::Visible ) {  painter->drawPixmap( 0, 0, d->renderedPixmap );
     }
--- trunk/KDE/kdebase/workspace/libs/plasma/widgets/flash.h #805376:805377
@@ -21,12 +21,10 @@
 #ifndef FLASH_H_
 #define FLASH_H_
 
-#include <QtCore/QObject>
-#include <QtGui/QGraphicsItem>
+#include <QtGui/QGraphicsWidget>
 #include <QtGui/QTextOption>
 
 #include <plasma/plasma_export.h>
-#include <plasma/widgets/widget.h>
 
 namespace Plasma
 {
@@ -34,15 +32,14 @@
 /**
  * Class that allows to flash text or icons inside plasma
  */
-class PLASMA_EXPORT Flash : public Plasma::Widget
+class PLASMA_EXPORT Flash : public QGraphicsWidget
 {
     Q_OBJECT
     public:
-        Flash(QGraphicsItem *parent = 0);
+        explicit Flash(QGraphicsItem *parent = 0);
         virtual ~Flash();
 
-        void paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *option, \
                QWidget *widget = 0);
-        QRectF boundingRect() const;
+        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, \
QWidget *widget = 0);  
         void setFont( const QFont & );
         void setColor( const QColor & );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic