• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Plasma

water.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 Bruno Abinader <bruno.abinader@indt.org.br>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include <plasma/private/effects/ripple_p.h>
00019 #include "water_p.h"
00020 
00021 namespace Plasma
00022 {
00023 
00024 WaterAnimation::WaterAnimation(QObject *parent)
00025     : EasingAnimation(parent),
00026       m_offset(1)
00027 {
00028 }
00029 
00030 qint8 WaterAnimation::offset() const
00031 {
00032     return m_offset;
00033 }
00034 
00035 void WaterAnimation::setOffset(qint8 offset)
00036 {
00037     m_offset = offset;
00038 }
00039 
00040 void WaterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
00041 {
00042     QGraphicsWidget *widget = targetWidget();
00043     if (!widget) {
00044         return;
00045     }
00046 
00047     RippleEffect *effect = qobject_cast<RippleEffect*>(widget->graphicsEffect());
00048     if (!effect) {
00049         effect = new RippleEffect(widget);
00050         widget->setGraphicsEffect(effect);
00051     }
00052 
00053     if (oldState == Stopped && newState == Running) {
00054         effect->setOffset(m_offset);
00055         effect->setEnabled(true);
00056     } else if (newState == Stopped) {
00057         effect->setEnabled(false);
00058     }
00059 }
00060 
00061 void WaterAnimation::updateEffectiveTime(int currentTime)
00062 {
00063     QGraphicsWidget *widget = targetWidget();
00064     if (widget && widget->graphicsEffect()) {
00065         widget->graphicsEffect()->setProperty("opacity", currentTime / qreal(duration()));
00066     }
00067 }
00068 
00069 } // namespace Plasma

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal