view src/pngplayer.h @ 33:58f1b3c330af

(issue9) Show maximized by default If the Window geometry is not saved show maximized otherwise restore the Window state / geometry.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 15:41:42 +0200
parents 64a51a42c01f
children 0c05958d254c
line wrap: on
line source
#ifndef PNGPLAYER_H
#define PNGPLAYER_H
/* Copyright (C) 2015 by ETH Zürich
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=2)
 * and comes with ABSOLUTELY NO WARRANTY!
 * See LICENSE.txt for details.
 */
#include <QWidget>
#include <QDir>
#include <QTimer>
#include <QDateTime>

class QSlider;
class QLabel;
class QPushButton;
class ImageLabel;

class PNGPlayer: public QWidget
{
    Q_OBJECT

public:
    PNGPlayer (QWidget * parent = 0, Qt::WindowFlags f = 0);

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 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, 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();

    /**@brief the speed bar was changed */
    void speedChanged();

Q_SIGNALS:
    /** @brief Emited if something went wrong. e.g. file not readable */
    void error(const QString& msg);

    /** @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:
    ImageLabel *mPNGLabel;
    QLabel *mPositionLabel,
           *mCurSpeedLabel;
    int mCurSpeed;
    int mMax;
    QDir mBaseDir;
    QTimer mAdvanceTimer;
    QSlider *mSlider,
            *mSpeedSlider;
    QPushButton *mPlayBtn;
};



#endif // PNGPLAYER_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)