Mercurial > retraceit
comparison src/pngplayer.cpp @ 34:40a683d1a318
(issue15) Change picture speed setting to seconds and default to 1s
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 06 May 2015 16:07:35 +0200 |
parents | 64a51a42c01f |
children | 92bb9687d716 |
comparison
equal
deleted
inserted
replaced
33:58f1b3c330af | 34:40a683d1a318 |
---|---|
21 #include <QDebug> | 21 #include <QDebug> |
22 | 22 |
23 PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { | 23 PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { |
24 setupGUI(); | 24 setupGUI(); |
25 QSettings settings; | 25 QSettings settings; |
26 mSpeedSlider->setValue(settings.value(REPLAY_SPEED_KEY, REPLAY_SPEED_DEFAULT).toInt()); | 26 double settingsSecs = settings.value(REPLAY_SPEED_KEY, REPLAY_SPEED_DEFAULT).toDouble(); |
27 if (settingsSecs != 0) { | |
28 mSpeedSlider->setValue(settingsSecs * 1000 / REPLAY_SPEED_STEP_MS); | |
29 } | |
27 speedChanged(); | 30 speedChanged(); |
28 } | 31 } |
29 | 32 |
30 void PNGPlayer::setupGUI() { | 33 void PNGPlayer::setupGUI() { |
31 QVBoxLayout *baseLayout = new QVBoxLayout; | 34 QVBoxLayout *baseLayout = new QVBoxLayout; |
186 setSpeed(mSpeedSlider->value() * REPLAY_SPEED_STEP_MS); | 189 setSpeed(mSpeedSlider->value() * REPLAY_SPEED_STEP_MS); |
187 } else { | 190 } else { |
188 setSpeed(REPLAY_SPEED_STEP_MS / 2); | 191 setSpeed(REPLAY_SPEED_STEP_MS / 2); |
189 } | 192 } |
190 QSettings settings; | 193 QSettings settings; |
191 settings.setValue(REPLAY_SPEED_KEY, mSpeedSlider->value()); | 194 settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0); |
192 } | 195 } |