Mercurial > retraceit
changeset 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 | 58f1b3c330af |
children | f10d4e035eec |
files | src/constants.h src/mainwindow.cpp src/pngplayer.cpp |
diffstat | 3 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/constants.h Wed May 06 15:41:42 2015 +0200 +++ b/src/constants.h Wed May 06 16:07:35 2015 +0200 @@ -56,8 +56,8 @@ /**@def the config key for the replay speed */ #define REPLAY_SPEED_KEY "Speed" -/**@def the default value for the replay speed in REPLAY_SPEED_STEP_MS steps */ -#define REPLAY_SPEED_DEFAULT 5 +/**@def the default value for the replay speed in seconds */ +#define REPLAY_SPEED_DEFAULT 1. /**@def the value for a step in the speed slider */ #define REPLAY_SPEED_STEP_MS 500
--- a/src/mainwindow.cpp Wed May 06 15:41:42 2015 +0200 +++ b/src/mainwindow.cpp Wed May 06 16:07:35 2015 +0200 @@ -40,7 +40,6 @@ MainWindow::MainWindow() : mDataView(NULL) { setStatusBar(new QStatusBar()); - //resize(1190, 500); setupGUI(); readSettings();
--- a/src/pngplayer.cpp Wed May 06 15:41:42 2015 +0200 +++ b/src/pngplayer.cpp Wed May 06 16:07:35 2015 +0200 @@ -23,7 +23,10 @@ PNGPlayer::PNGPlayer(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) { setupGUI(); QSettings settings; - mSpeedSlider->setValue(settings.value(REPLAY_SPEED_KEY, REPLAY_SPEED_DEFAULT).toInt()); + double settingsSecs = settings.value(REPLAY_SPEED_KEY, REPLAY_SPEED_DEFAULT).toDouble(); + if (settingsSecs != 0) { + mSpeedSlider->setValue(settingsSecs * 1000 / REPLAY_SPEED_STEP_MS); + } speedChanged(); } @@ -188,5 +191,5 @@ setSpeed(REPLAY_SPEED_STEP_MS / 2); } QSettings settings; - settings.setValue(REPLAY_SPEED_KEY, mSpeedSlider->value()); + settings.setValue(REPLAY_SPEED_KEY, (mSpeedSlider->value() * REPLAY_SPEED_STEP_MS) / 1000.0); }