andre@2: /* Copyright (C) 2014 by Intevation GmbH andre@2: * andre@2: * This file is Free Software under the GNU GPL (v>=2) andre@2: * and comes with ABSOLUTELY NO WARRANTY! andre@2: * See LICENSE.txt for details. andre@2: */ andre@2: #include "pngplayer.h" andre@2: #include andre@2: #include andre@2: #include andre@2: andre@2: PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { andre@2: setupGUI(); andre@2: return; andre@2: } andre@2: andre@2: void PNGPlayer::setupGUI() { andre@2: QVBoxLayout *baseLayout = new QVBoxLayout; andre@2: mPNGLabel = new QLabel; andre@2: baseLayout->addWidget(mPNGLabel); andre@2: connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance())); andre@2: setLayout(baseLayout); andre@2: mAdvanceTimer.setInterval(2000); andre@2: mAdvanceTimer.start(); andre@2: } andre@2: andre@2: void PNGPlayer::showPicture(const QString& fileName, const QString& info) { andre@2: QPixmap pic(mBaseDir.filePath(fileName)); andre@2: /* If this is too slow we could use a pixmap cache here and do andre@2: * some intelligent preloading */ andre@2: if (pic.isNull()) { andre@2: emit error(tr("Failed to load picture: '%1'").arg(fileName)); andre@2: return; andre@2: } andre@2: mPNGLabel->setPixmap(pic); andre@2: }