view src/pngplayer.cpp @ 2:97d2c8869c39

First prototype implementation of table view and player
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 23 Mar 2015 16:34:42 +0100
parents
children 248d5d1cdb38
line wrap: on
line source
/* Copyright (C) 2014 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 "pngplayer.h"
#include <QVBoxLayout>
#include <QPixmap>
#include <QLabel>

PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) {
    setupGUI();
    return;
}

void PNGPlayer::setupGUI() {
    QVBoxLayout *baseLayout = new QVBoxLayout;
    mPNGLabel = new QLabel;
    baseLayout->addWidget(mPNGLabel);
    connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance()));
    setLayout(baseLayout);
    mAdvanceTimer.setInterval(2000);
    mAdvanceTimer.start();
}

void PNGPlayer::showPicture(const QString& fileName, const QString& info) {
    QPixmap pic(mBaseDir.filePath(fileName));
    /* If this is too slow we could use a pixmap cache here and do
     * some intelligent preloading */
    if (pic.isNull()) {
        emit error(tr("Failed to load picture: '%1'").arg(fileName));
        return;
    }
    mPNGLabel->setPixmap(pic);
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)