diff src/pngplayer.cpp @ 37:0c05958d254c

(issue 13, 6) Add constant index number column to data and view
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 17:17:13 +0200
parents 92bb9687d716
children 26e1521b9afd
line wrap: on
line diff
--- a/src/pngplayer.cpp	Wed May 06 16:10:01 2015 +0200
+++ b/src/pngplayer.cpp	Wed May 06 17:17:13 2015 +0200
@@ -107,27 +107,31 @@
 }
 
 void PNGPlayer::showPicture(const QString& fileName, int current, int max,
-        const QDateTime& timestamp) {
+        const QDateTime& timestamp, int number) {
     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()) {
         qWarning() << "Failed to load picture: " << fileName;
 //        emit error(tr("Failed to load picture: '%1'").arg(fileName));
-        return;
+        QIcon errIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical);
+        mPNGLabel->setPixmap(errIcon.pixmap(QSize(128, 128)));
+    } else {
+        mPNGLabel->setPixmap(pic);
     }
-    mPNGLabel->setPixmap(pic);
-    updatePositions(current, max, timestamp);
+    updatePositions(current, max, timestamp, number);
 }
 
-void PNGPlayer::updatePositions(int current, int max, const QDateTime& timestamp) {
+void PNGPlayer::updatePositions(int current, int max, const QDateTime& timestamp,
+        int number) {
     mMax = max;
     mSlider->blockSignals(true); /* We only want user generated changes */
     mSlider->setValue(current);
     mSlider->blockSignals(false);
     mSlider->setMaximum(max);
     mPositionLabel->setText("<b>" + tr("Screenshot Nr.:") + " </b>" +
-            QString("%1 (%2)").arg(current + 1).arg(max + 1) + " / <b>" +
+            QString("%1 (%2)").arg(current + 1).arg(max + 1) +
+            "<b> " + tr("Index Nr.:") + " </b>" + QString::number(number) + " / <b>" +
         tr("Timestamp:") + " </b>" + (timestamp.isValid() ?
             timestamp.toString(LONG_DATE_FORMAT) : tr("Unknown")));
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)