view src/pngplayer.h @ 62:a9a343271490

Statically import cocoa plugin
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 19 May 2015 16:14:34 +0200
parents 73e6b6b12412
children 098a10fc2e83
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>

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

class PNGPlayer: public QWidget
{
    Q_OBJECT

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

    /**@brief close the player 
     *
     * This function makes sure that the png label is also
     * closed when detached.
     **/
    void close();
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.
     * @param number: The index number of the picture to show.
     */
    void showPicture(const QString& fileName, int current, int max,
        const QString& timestamp, int number);

    /**@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 QString& timestamp, int number);

    /**@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();

    /**@brief detach the actual picture as fullscreen */
    void togglePicFullscreen();

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)