From d678788af792b5acaa219e13a5ee53d646108c56 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 2 Dec 2013 21:15:08 +1100 Subject: [PATCH] Load and save the visualisation delay setting properly. Fixes issue 3968. --- src/visualisations/projectmvisualisation.cpp | 5 +++++ src/visualisations/projectmvisualisation.h | 1 + src/visualisations/visualisationselector.cpp | 1 + 3 files changed, 7 insertions(+) diff --git a/src/visualisations/projectmvisualisation.cpp b/src/visualisations/projectmvisualisation.cpp index 536c5ccbe..f7505e3a7 100644 --- a/src/visualisations/projectmvisualisation.cpp +++ b/src/visualisations/projectmvisualisation.cpp @@ -159,6 +159,8 @@ void ProjectMVisualisation::SetDuration(int seconds) { if (projectm_) projectm_->changePresetDuration(duration_); + + Save(); } void ProjectMVisualisation::ConsumeBuffer(GstBuffer* buffer, int) { @@ -200,7 +202,9 @@ void ProjectMVisualisation::Load() { QSettings s; s.beginGroup(VisualisationContainer::kSettingsGroup); mode_ = Mode(s.value("mode", 0).toInt()); + duration_ = s.value("duration", duration_).toInt(); + projectm_->changePresetDuration(duration_); projectm_->clearPlaylist(); switch (mode_) { case Random: @@ -233,6 +237,7 @@ void ProjectMVisualisation::Save() { s.beginGroup(VisualisationContainer::kSettingsGroup); s.setValue("preset_paths", paths); s.setValue("mode", mode_); + s.setValue("duration", duration_); } void ProjectMVisualisation::SetMode(Mode mode) { diff --git a/src/visualisations/projectmvisualisation.h b/src/visualisations/projectmvisualisation.h index 16e8ec590..2d9352cf3 100644 --- a/src/visualisations/projectmvisualisation.h +++ b/src/visualisations/projectmvisualisation.h @@ -47,6 +47,7 @@ public: ProjectMPresetModel* preset_model() const { return preset_model_; } Mode mode() const { return mode_; } + int duration() const { return duration_; } // BufferConsumer void ConsumeBuffer(GstBuffer *buffer, int); diff --git a/src/visualisations/visualisationselector.cpp b/src/visualisations/visualisationselector.cpp index 7a06ccba0..c8ddc87d8 100644 --- a/src/visualisations/visualisationselector.cpp +++ b/src/visualisations/visualisationselector.cpp @@ -54,6 +54,7 @@ VisualisationSelector::~VisualisationSelector() { void VisualisationSelector::showEvent(QShowEvent *) { if (!ui_->list->model()) { + ui_->delay->setValue(vis_->duration()); ui_->list->setModel(vis_->preset_model()); connect(ui_->list->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), vis_->preset_model(), SLOT(SetImmediatePreset(QModelIndex)));