diff src/pngplayer.h @ 3:248d5d1cdb38

Add functionalty to control buttons and make picture resizable
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 23 Mar 2015 19:10:01 +0100
parents 97d2c8869c39
children 107e435cb569
line wrap: on
line diff
--- a/src/pngplayer.h	Mon Mar 23 16:34:42 2015 +0100
+++ b/src/pngplayer.h	Mon Mar 23 19:10:01 2015 +0100
@@ -9,8 +9,12 @@
 #include <QWidget>
 #include <QDir>
 #include <QTimer>
+#include <QDateTime>
 
+class QSlider;
 class QLabel;
+class QPushButton;
+class ImageLabel;
 
 class PNGPlayer: public QWidget
 {
@@ -22,16 +26,42 @@
 protected:
     void setupGUI();
 
+protected slots:
+    /**@brief the view slider was changed manually */
+    void sliderChanged();
+    /**@brief the view slider was pressed */
+    void sliderPressed();
+    /**@brief the view slider was released */
+    void sliderReleased();
+
+    /**@brief jump to the first frame */
+    void firstClicked();
+
+    /**@brief jump to the last frame */
+    void lastClicked();
+
 public slots:
     /**@brief show a PNG in the viewer.
      *
      * @param fileName: The picture file to show.
-     * @param info: Additional meta data to show with the image.
+     * @param current: The row index of the currently shown image.
+     * @param max: The row count.
+     * @param timestamp: The timestamp of the image.
      */
-    void showPicture(const QString& fileName, const QString& info);
+    void showPicture(const QString& fileName, int current, int max,
+        const QDateTime& timestamp);
 
+    /**@brief set the base dir to which filenames will be relative. */
     void setBaseDir(const QString& dirName) { mBaseDir.setPath(dirName); }
 
+    /**@brief update positional information / slider current / max info. */
+    void updatePositions(int current, int max, const QDateTime& timestamp);
+
+    /**@brief set the replay speed */
+    void setSpeed(int mSecsPerPicture);
+
+    /**@brief start or pause the replay */
+    void togglePlay();
 Q_SIGNALS:
     /** @brief Emited if something went wrong. e.g. file not readable */
     void error(const QString& msg);
@@ -39,10 +69,23 @@
     /** @brief Emited if the player wants to advance to the next picture */
     void advance();
 
+    /** @brief Emited if the player wants to go back to the last picture */
+    void back();
+
+    /** @brief Emited it the player wants to advance to a specific frame. */
+    void jumpToFrame(int frame);
+
 protected:
-    QLabel * mPNGLabel;
+    ImageLabel *mPNGLabel;
+    QLabel *mPositionLabel,
+           *mCurSpeedLabel;
+    int mCurSpeed;
+    int mMax;
     QDir mBaseDir;
     QTimer mAdvanceTimer;
+    QSlider *mSlider,
+            *mSpeedSlider;
+    QPushButton *mPlayBtn;
 };
 
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)