Mercurial > retraceit
comparison 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 |
comparison
equal
deleted
inserted
replaced
2:97d2c8869c39 | 3:248d5d1cdb38 |
---|---|
7 * See LICENSE.txt for details. | 7 * See LICENSE.txt for details. |
8 */ | 8 */ |
9 #include <QWidget> | 9 #include <QWidget> |
10 #include <QDir> | 10 #include <QDir> |
11 #include <QTimer> | 11 #include <QTimer> |
12 #include <QDateTime> | |
12 | 13 |
14 class QSlider; | |
13 class QLabel; | 15 class QLabel; |
16 class QPushButton; | |
17 class ImageLabel; | |
14 | 18 |
15 class PNGPlayer: public QWidget | 19 class PNGPlayer: public QWidget |
16 { | 20 { |
17 Q_OBJECT | 21 Q_OBJECT |
18 | 22 |
20 PNGPlayer (QWidget * parent = 0, Qt::WindowFlags f = 0); | 24 PNGPlayer (QWidget * parent = 0, Qt::WindowFlags f = 0); |
21 | 25 |
22 protected: | 26 protected: |
23 void setupGUI(); | 27 void setupGUI(); |
24 | 28 |
29 protected slots: | |
30 /**@brief the view slider was changed manually */ | |
31 void sliderChanged(); | |
32 /**@brief the view slider was pressed */ | |
33 void sliderPressed(); | |
34 /**@brief the view slider was released */ | |
35 void sliderReleased(); | |
36 | |
37 /**@brief jump to the first frame */ | |
38 void firstClicked(); | |
39 | |
40 /**@brief jump to the last frame */ | |
41 void lastClicked(); | |
42 | |
25 public slots: | 43 public slots: |
26 /**@brief show a PNG in the viewer. | 44 /**@brief show a PNG in the viewer. |
27 * | 45 * |
28 * @param fileName: The picture file to show. | 46 * @param fileName: The picture file to show. |
29 * @param info: Additional meta data to show with the image. | 47 * @param current: The row index of the currently shown image. |
48 * @param max: The row count. | |
49 * @param timestamp: The timestamp of the image. | |
30 */ | 50 */ |
31 void showPicture(const QString& fileName, const QString& info); | 51 void showPicture(const QString& fileName, int current, int max, |
52 const QDateTime& timestamp); | |
32 | 53 |
54 /**@brief set the base dir to which filenames will be relative. */ | |
33 void setBaseDir(const QString& dirName) { mBaseDir.setPath(dirName); } | 55 void setBaseDir(const QString& dirName) { mBaseDir.setPath(dirName); } |
34 | 56 |
57 /**@brief update positional information / slider current / max info. */ | |
58 void updatePositions(int current, int max, const QDateTime& timestamp); | |
59 | |
60 /**@brief set the replay speed */ | |
61 void setSpeed(int mSecsPerPicture); | |
62 | |
63 /**@brief start or pause the replay */ | |
64 void togglePlay(); | |
35 Q_SIGNALS: | 65 Q_SIGNALS: |
36 /** @brief Emited if something went wrong. e.g. file not readable */ | 66 /** @brief Emited if something went wrong. e.g. file not readable */ |
37 void error(const QString& msg); | 67 void error(const QString& msg); |
38 | 68 |
39 /** @brief Emited if the player wants to advance to the next picture */ | 69 /** @brief Emited if the player wants to advance to the next picture */ |
40 void advance(); | 70 void advance(); |
41 | 71 |
72 /** @brief Emited if the player wants to go back to the last picture */ | |
73 void back(); | |
74 | |
75 /** @brief Emited it the player wants to advance to a specific frame. */ | |
76 void jumpToFrame(int frame); | |
77 | |
42 protected: | 78 protected: |
43 QLabel * mPNGLabel; | 79 ImageLabel *mPNGLabel; |
80 QLabel *mPositionLabel, | |
81 *mCurSpeedLabel; | |
82 int mCurSpeed; | |
83 int mMax; | |
44 QDir mBaseDir; | 84 QDir mBaseDir; |
45 QTimer mAdvanceTimer; | 85 QTimer mAdvanceTimer; |
86 QSlider *mSlider, | |
87 *mSpeedSlider; | |
88 QPushButton *mPlayBtn; | |
46 }; | 89 }; |
47 | 90 |
48 | 91 |
49 | 92 |
50 #endif // PNGPLAYER_H | 93 #endif // PNGPLAYER_H |