comparison src/pngplayer.cpp @ 44:73e6b6b12412

(issue 1,2) Make the column used for the Timestamp value configurable If the column contains a number it is interpreted as seconds since epoch. Otherwise its a verbatim copy of the column string.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 19:45:26 +0200
parents ee696abaab99
children 43af5fccf61e
comparison
equal deleted inserted replaced
43:ee696abaab99 44:73e6b6b12412
109 connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance())); 109 connect(&mAdvanceTimer, SIGNAL(timeout()), this, SIGNAL(advance()));
110 setLayout(baseLayout); 110 setLayout(baseLayout);
111 } 111 }
112 112
113 void PNGPlayer::showPicture(const QString& fileName, int current, int max, 113 void PNGPlayer::showPicture(const QString& fileName, int current, int max,
114 const QDateTime& timestamp, int number) { 114 const QString& timestamp, int number) {
115 QPixmap pic(mBaseDir.filePath(fileName)); 115 QPixmap pic(mBaseDir.filePath(fileName));
116 /* If this is too slow we could use a pixmap cache here and do 116 /* If this is too slow we could use a pixmap cache here and do
117 * some intelligent preloading */ 117 * some intelligent preloading */
118 if (pic.isNull()) { 118 if (pic.isNull()) {
119 qWarning() << "Failed to load picture: " << fileName; 119 qWarning() << "Failed to load picture: " << fileName;
124 mPNGLabel->setPixmap(pic); 124 mPNGLabel->setPixmap(pic);
125 } 125 }
126 updatePositions(current, max, timestamp, number); 126 updatePositions(current, max, timestamp, number);
127 } 127 }
128 128
129 void PNGPlayer::updatePositions(int current, int max, const QDateTime& timestamp, 129 void PNGPlayer::updatePositions(int current, int max, const QString& timestamp,
130 int number) { 130 int number) {
131 mMax = max; 131 mMax = max;
132 mSlider->blockSignals(true); /* We only want user generated changes */ 132 mSlider->blockSignals(true); /* We only want user generated changes */
133 mSlider->setValue(current); 133 mSlider->setValue(current);
134 mSlider->blockSignals(false); 134 mSlider->blockSignals(false);
135 mSlider->setMaximum(max); 135 mSlider->setMaximum(max);
136 mPositionLabel->setText("<b>" + tr("Screenshot Nr.:") + " </b>" + 136 mPositionLabel->setText("<b>" + tr("Screenshot Nr.:") + " </b>" +
137 QString("%1 (%2)").arg(current + 1).arg(max + 1) + 137 QString("%1 (%2)").arg(current + 1).arg(max + 1) +
138 "<b> " + tr("Index Nr.:") + " </b>" + QString::number(number) + " / <b>" + 138 "/ <b>" + tr("Index Nr.:") + " </b>" + QString::number(number) + " / <b>" +
139 tr("Timestamp:") + " </b>" + (timestamp.isValid() ? 139 tr("Timestamp:") + " </b>" + timestamp);
140 timestamp.toString(LONG_DATE_FORMAT) : tr("Unknown")));
141 140
142 if (mMax == current && mAdvanceTimer.isActive()) { 141 if (mMax == current && mAdvanceTimer.isActive()) {
143 togglePlay(); 142 togglePlay();
144 } 143 }
145 } 144 }
201 QSettings settings; 200 QSettings settings;
202 settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0); 201 settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0);
203 } 202 }
204 203
205 void PNGPlayer::togglePicFullscreen() { 204 void PNGPlayer::togglePicFullscreen() {
206 qDebug() << "togglePicFullscreen"; 205 QSettings settings;
206 bool enabled = settings.value(DETACHABLE_IMAGE_KEY, DETACHABLE_IMAGE_DEFAULT).toBool();
207 settings.setValue(DETACHABLE_IMAGE_KEY, enabled);
208
209 if (!enabled) {
210 return;
211 }
212
207 QVBoxLayout *baseLayout = qobject_cast<QVBoxLayout*>(layout()); 213 QVBoxLayout *baseLayout = qobject_cast<QVBoxLayout*>(layout());
208 if (!baseLayout) { 214 if (!baseLayout) {
209 qWarning() << "Wrong layout!"; 215 qWarning() << "Wrong layout!";
210 return; 216 return;
211 } 217 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)