comparison 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
comparison
equal deleted inserted replaced
1:7a2637c3eb83 2:97d2c8869c39
1 /* Copyright (C) 2014 by Intevation GmbH
2 *
3 * This file is Free Software under the GNU GPL (v>=2)
4 * and comes with ABSOLUTELY NO WARRANTY!
5 * See LICENSE.txt for details.
6 */
7 #include "pngplayer.h"
8 #include <QVBoxLayout>
9 #include <QPixmap>
10 #include <QLabel>
11
12 PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) {
13 setupGUI();
14 return;
15 }
16
17 void PNGPlayer::setupGUI() {
18 QVBoxLayout *baseLayout = new QVBoxLayout;
19 mPNGLabel = new QLabel;
20 baseLayout->addWidget(mPNGLabel);
21 connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance()));
22 setLayout(baseLayout);
23 mAdvanceTimer.setInterval(2000);
24 mAdvanceTimer.start();
25 }
26
27 void PNGPlayer::showPicture(const QString& fileName, const QString& info) {
28 QPixmap pic(mBaseDir.filePath(fileName));
29 /* If this is too slow we could use a pixmap cache here and do
30 * some intelligent preloading */
31 if (pic.isNull()) {
32 emit error(tr("Failed to load picture: '%1'").arg(fileName));
33 return;
34 }
35 mPNGLabel->setPixmap(pic);
36 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)