comparison 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
comparison
equal deleted inserted replaced
36:92bb9687d716 37:0c05958d254c
105 connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance())); 105 connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance()));
106 setLayout(baseLayout); 106 setLayout(baseLayout);
107 } 107 }
108 108
109 void PNGPlayer::showPicture(const QString& fileName, int current, int max, 109 void PNGPlayer::showPicture(const QString& fileName, int current, int max,
110 const QDateTime& timestamp) { 110 const QDateTime& timestamp, int number) {
111 QPixmap pic(mBaseDir.filePath(fileName)); 111 QPixmap pic(mBaseDir.filePath(fileName));
112 /* If this is too slow we could use a pixmap cache here and do 112 /* If this is too slow we could use a pixmap cache here and do
113 * some intelligent preloading */ 113 * some intelligent preloading */
114 if (pic.isNull()) { 114 if (pic.isNull()) {
115 qWarning() << "Failed to load picture: " << fileName; 115 qWarning() << "Failed to load picture: " << fileName;
116 // emit error(tr("Failed to load picture: '%1'").arg(fileName)); 116 // emit error(tr("Failed to load picture: '%1'").arg(fileName));
117 return; 117 QIcon errIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical);
118 mPNGLabel->setPixmap(errIcon.pixmap(QSize(128, 128)));
119 } else {
120 mPNGLabel->setPixmap(pic);
118 } 121 }
119 mPNGLabel->setPixmap(pic); 122 updatePositions(current, max, timestamp, number);
120 updatePositions(current, max, timestamp);
121 } 123 }
122 124
123 void PNGPlayer::updatePositions(int current, int max, const QDateTime& timestamp) { 125 void PNGPlayer::updatePositions(int current, int max, const QDateTime& timestamp,
126 int number) {
124 mMax = max; 127 mMax = max;
125 mSlider->blockSignals(true); /* We only want user generated changes */ 128 mSlider->blockSignals(true); /* We only want user generated changes */
126 mSlider->setValue(current); 129 mSlider->setValue(current);
127 mSlider->blockSignals(false); 130 mSlider->blockSignals(false);
128 mSlider->setMaximum(max); 131 mSlider->setMaximum(max);
129 mPositionLabel->setText("<b>" + tr("Screenshot Nr.:") + " </b>" + 132 mPositionLabel->setText("<b>" + tr("Screenshot Nr.:") + " </b>" +
130 QString("%1 (%2)").arg(current + 1).arg(max + 1) + " / <b>" + 133 QString("%1 (%2)").arg(current + 1).arg(max + 1) +
134 "<b> " + tr("Index Nr.:") + " </b>" + QString::number(number) + " / <b>" +
131 tr("Timestamp:") + " </b>" + (timestamp.isValid() ? 135 tr("Timestamp:") + " </b>" + (timestamp.isValid() ?
132 timestamp.toString(LONG_DATE_FORMAT) : tr("Unknown"))); 136 timestamp.toString(LONG_DATE_FORMAT) : tr("Unknown")));
133 137
134 if (mMax == current && mAdvanceTimer.isActive()) { 138 if (mMax == current && mAdvanceTimer.isActive()) {
135 togglePlay(); 139 togglePlay();
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)