diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c61bfe49..6a56a33c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -366,7 +366,6 @@ endif(PHONON_FOUND)
install(FILES
animations/animation.h
- animations/pendulumcurve.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/animations COMPONENT Devel)
diff --git a/animations/pendulumcurve.cpp b/animations/pendulumcurve.cpp
index 27a95f3e7..8a328843c 100644
--- a/animations/pendulumcurve.cpp
+++ b/animations/pendulumcurve.cpp
@@ -15,7 +15,7 @@
* License along with this library. If not, see .
*/
-#include "pendulumcurve.h"
+#include "pendulumcurve_p.h"
/**
* This static method is used to create a custom easing curve type.
diff --git a/animations/pendulumcurve.h b/animations/pendulumcurve_p.h
similarity index 83%
rename from animations/pendulumcurve.h
rename to animations/pendulumcurve_p.h
index 3d64e9bd7..b46d6912a 100644
--- a/animations/pendulumcurve.h
+++ b/animations/pendulumcurve_p.h
@@ -15,13 +15,11 @@
* License along with this library. If not, see .
*/
-#ifndef PLASMA_ANIMATIONS_PENDULUMCURVE_H
-#define PLASMA_ANIMATIONS_PENDULUMCURVE_H
+#ifndef PLASMA_ANIMATIONS_PENDULUMCURVE_P_H
+#define PLASMA_ANIMATIONS_PENDULUMCURVE_P_H
#include
-#include
-
namespace Plasma
{
@@ -32,7 +30,7 @@ namespace Plasma
* This easing curve provides values which are split in 4 parts:
* from 0 to 1, from 1 to 0, from 0 to -1, and from -1 to 0, in a linear way.
*/
-class PLASMA_EXPORT PendulumCurve : public QEasingCurve
+class PendulumCurve : public QEasingCurve
{
public:
/**
@@ -43,4 +41,4 @@ public:
} // namespace Plasma
-#endif // PLASMA_ANIMATIONS_PENDULUMCURVE_H
+#endif // PLASMA_ANIMATIONS_PENDULUMCURVE_P_H
diff --git a/animator.cpp b/animator.cpp
index 344bdebe7..19f0d1635 100644
--- a/animator.cpp
+++ b/animator.cpp
@@ -32,6 +32,8 @@
#include "animations/pixmaptransition_p.h"
#include "animations/water_p.h"
+#include "animations/pendulumcurve_p.h"
+
namespace Plasma
{
@@ -87,6 +89,39 @@ Plasma::Animation* Animator::create(Animator::Animation type, QObject *parent)
return result;
}
+QEasingCurve Animator::easingCurve(Animator::CurveShape type)
+{
+ QEasingCurve result;
+
+ switch (type) {
+ case EaseInCurve:
+ result.setType(QEasingCurve::InQuad);
+ break;
+
+ case EaseOutCurve:
+ result.setType(QEasingCurve::OutQuad);
+ break;
+
+ case EaseInOutCurve:
+ result.setType(QEasingCurve::InOutQuad);
+ break;
+
+ case LinearCurve:
+ result.setType(QEasingCurve::Linear);
+ break;
+
+ case PendularCurve:
+ result = PendulumCurve();
+ break;
+
+ default:
+ kDebug() << "Unsupported easing curve type.";
+ break;
+ }
+
+ return result;
+}
+
} // namespace Plasma
#include
diff --git a/animator.h b/animator.h
index 7aaa4b158..5fd5f539c 100644
--- a/animator.h
+++ b/animator.h
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
@@ -74,7 +75,8 @@ public:
EaseInCurve = 0,
EaseOutCurve,
EaseInOutCurve,
- LinearCurve
+ LinearCurve,
+ PendularCurve
};
enum Movement {
@@ -95,6 +97,11 @@ public:
**/
static Plasma::Animation *create(Animator::Animation type, QObject *parent = 0);
+ /**
+ * Factory to build new custom easing curves.
+ */
+ static QEasingCurve easingCurve(Animator::CurveShape type);
+
/**
* Starts a standard animation on a QGraphicsItem.
*