1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 04:19:55 +01:00

Load and save the visualisation delay setting properly. Fixes issue 3968.

This commit is contained in:
David Sansome 2013-12-02 21:15:08 +11:00
parent 22d3bffd9e
commit d678788af7
3 changed files with 7 additions and 0 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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)));