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

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
  • animations
water.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Bruno Abinader <bruno.abinader@indt.org.br>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <plasma/private/effects/ripple_p.h>
19 #include "water_p.h"
20 
21 namespace Plasma
22 {
23 
24 WaterAnimation::WaterAnimation(QObject *parent)
25  : EasingAnimation(parent),
26  m_offset(1)
27 {
28 }
29 
30 qint8 WaterAnimation::offset() const
31 {
32  return m_offset;
33 }
34 
35 void WaterAnimation::setOffset(qint8 offset)
36 {
37  m_offset = offset;
38 }
39 
40 void WaterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
41 {
42  QGraphicsWidget *widget = targetWidget();
43  if (!widget) {
44  return;
45  }
46 
47  RippleEffect *effect = qobject_cast<RippleEffect*>(widget->graphicsEffect());
48  if (!effect) {
49  effect = new RippleEffect(widget);
50  widget->setGraphicsEffect(effect);
51  }
52 
53  if (oldState == Stopped && newState == Running) {
54  effect->setOffset(m_offset);
55  effect->setEnabled(true);
56  } else if (newState == Stopped) {
57  effect->setEnabled(false);
58  }
59 }
60 
61 void WaterAnimation::updateEffectiveTime(int currentTime)
62 {
63  QGraphicsWidget *widget = targetWidget();
64  if (widget && widget->graphicsEffect()) {
65  widget->graphicsEffect()->setProperty("opacity", currentTime / qreal(duration()));
66  }
67 }
68 
69 } // namespace Plasma
QObject
QGraphicsWidget
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal