Added qmafw-gst-subtitles-renderer-0.0.55 for Meego Harmattan 1.2
[mafwsubrenderer] / qmafw-gst-subtitles-renderer / inc / MafwGstRendererHaltState.h
diff --git a/qmafw-gst-subtitles-renderer/inc/MafwGstRendererHaltState.h b/qmafw-gst-subtitles-renderer/inc/MafwGstRendererHaltState.h
new file mode 100644 (file)
index 0000000..d7168d1
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * This file is part of QMAFW
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). All rights
+ * reserved.
+ *
+ * Contact: Visa Smolander <visa.smolander@nokia.com>
+ *
+ * This software, including documentation, is protected by copyright controlled
+ * by Nokia Corporation. All rights are reserved. Copying, including
+ * reproducing, storing, adapting or translating, any or all of this material
+ * requires the prior written consent of Nokia Corporation. This material also
+ * contains confidential information which may not be disclosed to others
+ * without the prior written consent of Nokia.
+ *
+ */
+
+#ifndef MAFWGSTRENDERERHALTSTATE_H
+#define MAFWGSTRENDERERHALTSTATE_H
+
+#include <MafwRenderer.h>
+
+#include <QTimer>
+
+class MafwGstRendererHaltState : public QObject
+{
+    Q_OBJECT
+public:
+    static int DECAY_TIME;
+public:
+    MafwGstRendererHaltState();
+    MafwGstRendererHaltState(const QString &uri, MafwRenderer::State state, int position);
+    ~MafwGstRendererHaltState();
+
+    /**
+     * Assigns other halt state to this object, also resets the decay timer.
+     */
+    MafwGstRendererHaltState(const MafwGstRendererHaltState &other);
+
+    /**
+     * Assigns other halt state to this object, also resets the decay timer.
+     */
+    MafwGstRendererHaltState& operator =(const MafwGstRendererHaltState &other);
+
+
+    /**
+     * Set new renderer state for halt state, user pressed pause etc
+     * @param  newState, if newState is MafwRenderer::Paused the decay time is paused also
+     */
+    void setState(MafwRenderer::State newState);
+
+    /**
+     * Is the halt state valid? Not decayed and contains relevenat information
+     */
+    bool isSet() const;
+
+    /**
+     * Clears the halt state from any valid content, also stop the decay timer
+     */
+    void clear();
+
+    QString uri() const;
+    MafwRenderer::State state() const;
+    int position() const;
+
+Q_SIGNALS:
+    /**
+     * This signal is emitted when the MafwGstRendererHaltState::DECAY_TIME has passed
+     * from object creation or when valid parameters were assigned to it.
+     */
+    void decayed();
+
+private:
+    void initializeDecayTimer();
+
+private:
+    QString m_uri;
+    MafwRenderer::State m_state;
+    int m_position;
+    QTimer m_decayTimer;
+};
+
+#endif // MAFWGSTRENDERERHALTSTATE_H