annotate src/pngplayer.h @ 37:0c05958d254c

(issue 13, 6) Add constant index number column to data and view
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 17:17:13 +0200
parents 64a51a42c01f
children 26e1521b9afd
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
25
64a51a42c01f Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents: 5
diff changeset
3 /* Copyright (C) 2015 by ETH Zürich
64a51a42c01f Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents: 5
diff changeset
4 * Software engineering by Intevation GmbH
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 *
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 * 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
7 * and comes with ABSOLUTELY NO WARRANTY!
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 * See LICENSE.txt for details.
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 */
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 #include <QWidget>
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 #include <QDir>
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 #include <QTimer>
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
13 #include <QDateTime>
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
15 class QSlider;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16 class QLabel;
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
17 class QPushButton;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
18 class ImageLabel;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 class PNGPlayer: public QWidget
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 {
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 Q_OBJECT
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 public:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25 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
26
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 protected:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 void setupGUI();
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
30 protected slots:
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
31 /**@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
32 void sliderChanged();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
33 /**@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
34 void sliderPressed();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
35 /**@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
36 void sliderReleased();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
37
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
38 /**@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
39 void firstClicked();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
40
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
41 /**@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
42 void lastClicked();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
43
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 public slots:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 /**@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
46 *
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 * @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
48 * @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
49 * @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
50 * @param timestamp: The timestamp of the image.
37
0c05958d254c (issue 13, 6) Add constant index number column to data and view
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
51 * @param number: The index number of the picture to show.
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 */
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
53 void showPicture(const QString& fileName, int current, int max,
37
0c05958d254c (issue 13, 6) Add constant index number column to data and view
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
54 const QDateTime& timestamp, int number);
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
56 /**@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
57 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
58
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
59 /**@brief update positional information / slider current / max info. */
37
0c05958d254c (issue 13, 6) Add constant index number column to data and view
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
60 void updatePositions(int current, int max, const QDateTime& timestamp, int number);
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
61
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
62 /**@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
63 void setSpeed(int mSecsPerPicture);
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
64
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
65 /**@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
66 void togglePlay();
5
107e435cb569 Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 3
diff changeset
67
107e435cb569 Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 3
diff changeset
68 /**@brief the speed bar was changed */
107e435cb569 Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 3
diff changeset
69 void speedChanged();
107e435cb569 Enable speed slider in pngplayer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 3
diff changeset
70
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
71 Q_SIGNALS:
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
72 /** @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
73 void error(const QString& msg);
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
75 /** @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
76 void advance();
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
77
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
78 /** @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
79 void back();
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
80
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
81 /** @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
82 void jumpToFrame(int frame);
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
83
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
84 protected:
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
85 ImageLabel *mPNGLabel;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
86 QLabel *mPositionLabel,
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
87 *mCurSpeedLabel;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
88 int mCurSpeed;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
89 int mMax;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
90 QDir mBaseDir;
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
91 QTimer mAdvanceTimer;
3
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
92 QSlider *mSlider,
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
93 *mSpeedSlider;
248d5d1cdb38 Add functionalty to control buttons and make picture resizable
Andre Heinecke <andre.heinecke@intevation.de>
parents: 2
diff changeset
94 QPushButton *mPlayBtn;
2
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
95 };
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
96
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
97
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
98
97d2c8869c39 First prototype implementation of table view and player
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
99 #endif // PNGPLAYER_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)