annotate 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
rev   line source
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 #ifndef PNGPLAYER_H
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 #define PNGPLAYER_H
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 /* Copyright (C) 2014 by Intevation GmbH
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 *
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 * This file is Free Software under the GNU GPL (v>=2)
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 * and comes with ABSOLUTELY NO WARRANTY!
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 * See LICENSE.txt for details.
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 */
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 #include <QWidget>
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 #include <QDir>
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 #include <QTimer>
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
12 #include <QDateTime>
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
14 class QSlider;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 class QLabel;
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
16 class QPushButton;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
17 class ImageLabel;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 class PNGPlayer: public QWidget
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 {
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 Q_OBJECT
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 public:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 PNGPlayer (QWidget * parent = 0, Qt::WindowFlags f = 0);
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 protected:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 void setupGUI();
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
29 protected slots:
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
30 /**@brief the view slider was changed manually */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
31 void sliderChanged();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
32 /**@brief the view slider was pressed */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
33 void sliderPressed();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
34 /**@brief the view slider was released */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
35 void sliderReleased();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
36
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
37 /**@brief jump to the first frame */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
38 void firstClicked();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
39
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
40 /**@brief jump to the last frame */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
41 void lastClicked();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
42
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 public slots:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 /**@brief show a PNG in the viewer.
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 *
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 * @param fileName: The picture file to show.
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
47 * @param current: The row index of the currently shown image.
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
48 * @param max: The row count.
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
49 * @param timestamp: The timestamp of the image.
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 */
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
51 void showPicture(const QString& fileName, int current, int max,
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
52 const QDateTime& timestamp);
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
54 /**@brief set the base dir to which filenames will be relative. */
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55 void setBaseDir(const QString& dirName) { mBaseDir.setPath(dirName); }
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
56
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
57 /**@brief update positional information / slider current / max info. */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
58 void updatePositions(int current, int max, const QDateTime& timestamp);
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
59
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
60 /**@brief set the replay speed */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
61 void setSpeed(int mSecsPerPicture);
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
62
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
63 /**@brief start or pause the replay */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
64 void togglePlay();
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65 Q_SIGNALS:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 /** @brief Emited if something went wrong. e.g. file not readable */
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 void error(const QString& msg);
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69 /** @brief Emited if the player wants to advance to the next picture */
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
70 void advance();
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
71
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
72 /** @brief Emited if the player wants to go back to the last picture */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
73 void back();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
74
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
75 /** @brief Emited it the player wants to advance to a specific frame. */
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
76 void jumpToFrame(int frame);
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
77
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
78 protected:
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
79 ImageLabel *mPNGLabel;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
80 QLabel *mPositionLabel,
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
81 *mCurSpeedLabel;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
82 int mCurSpeed;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
83 int mMax;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
84 QDir mBaseDir;
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
85 QTimer mAdvanceTimer;
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
86 QSlider *mSlider,
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
87 *mSpeedSlider;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
88 QPushButton *mPlayBtn;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
89 };
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
90
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
91
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
92
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
93 #endif // PNGPLAYER_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)