diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 4304a2773..dd7bc06e4 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -575,7 +575,7 @@ void Playlist::set_current_row(int i) { using smart_playlists::Generator; // Add more dynamic playlist items - const int count = current_item_index_.row() + Generator::kDynamicFuture - items_.count(); + const int count = current_item_index_.row() + dynamic_playlist_->GetDynamicFuture() - items_.count(); if (count > 0) { GeneratorInserter* inserter = new GeneratorInserter(task_manager_, library_, this); connect(inserter, SIGNAL(Error(QString)), SIGNAL(LoadTracksError(QString))); @@ -585,7 +585,7 @@ void Playlist::set_current_row(int i) { } // Remove the first item - if (current_item_index_.row() > Generator::kDynamicHistory) { + if (current_item_index_.row() > dynamic_playlist_->GetDynamicHistory()) { RemoveItemsWithoutUndo(0, 1); } } diff --git a/src/smartplaylists/generator.cpp b/src/smartplaylists/generator.cpp index ebbc6bc58..711975f0e 100644 --- a/src/smartplaylists/generator.cpp +++ b/src/smartplaylists/generator.cpp @@ -25,8 +25,8 @@ namespace smart_playlists { const int Generator::kDefaultLimit = 20; -const int Generator::kDynamicHistory = 5; -const int Generator::kDynamicFuture = 15; +const int Generator::kDefaultDynamicHistory = 5; +const int Generator::kDefaultDynamicFuture = 15; Generator::Generator() : QObject(NULL), diff --git a/src/smartplaylists/generator.h b/src/smartplaylists/generator.h index d6caf274e..7046e87ec 100644 --- a/src/smartplaylists/generator.h +++ b/src/smartplaylists/generator.h @@ -34,8 +34,8 @@ public: Generator(); static const int kDefaultLimit; - static const int kDynamicHistory; - static const int kDynamicFuture; + static const int kDefaultDynamicHistory; + static const int kDefaultDynamicFuture; // Creates a new Generator of the given type static boost::shared_ptr Create(const QString& type); @@ -61,13 +61,15 @@ public: // If the generator can be used as a dynamic playlist then GenerateMore // should return the next tracks in the sequence. The subclass should - // remember the last kDynamicHistory + kDynamicFuture tracks and ensure that + // remember the last GetDynamicHistory() + GetDynamicFuture() tracks and ensure that // the tracks returned from this method are not in that set. virtual bool is_dynamic() const { return false; } virtual void set_dynamic(bool dynamic) {} // Called from non-UI thread. virtual PlaylistItemList GenerateMore(int count) { return PlaylistItemList(); } + virtual int GetDynamicHistory () { return kDefaultDynamicHistory; } + virtual int GetDynamicFuture () { return kDefaultDynamicFuture; } signals: void Error(const QString& message); diff --git a/src/smartplaylists/querygenerator.cpp b/src/smartplaylists/querygenerator.cpp index 7b4fab461..4088dbf32 100644 --- a/src/smartplaylists/querygenerator.cpp +++ b/src/smartplaylists/querygenerator.cpp @@ -68,8 +68,6 @@ PlaylistItemList QueryGenerator::GenerateMore(int count) { search_copy.id_not_in_ = previous_ids_; if (count) { search_copy.limit_ = count; - } else if (dynamic_) { - search_copy.limit_ = kDynamicFuture; } if (search_copy.sort_type_ != Search::Sort_Random) { @@ -84,7 +82,7 @@ PlaylistItemList QueryGenerator::GenerateMore(int count) { backend_->songs_table(), song)); previous_ids_ << song.id(); - if (previous_ids_.count() > kDynamicFuture + kDynamicHistory) + if (previous_ids_.count() > GetDynamicFuture() + GetDynamicHistory()) previous_ids_.removeFirst(); } return items; diff --git a/src/smartplaylists/querygenerator.h b/src/smartplaylists/querygenerator.h index fd2ee9e00..5c9922cf9 100644 --- a/src/smartplaylists/querygenerator.h +++ b/src/smartplaylists/querygenerator.h @@ -40,6 +40,7 @@ public: void set_dynamic(bool dynamic) { dynamic_ = dynamic; } Search search() const { return search_; } + int GetDynamicFuture () { return search_.limit_; } private: Search search_; diff --git a/src/smartplaylists/wizardfinishpage.ui b/src/smartplaylists/wizardfinishpage.ui index 971d9e9e8..beeb11472 100644 --- a/src/smartplaylists/wizardfinishpage.ui +++ b/src/smartplaylists/wizardfinishpage.ui @@ -40,7 +40,7 @@ - In dynamic mode new tracks will be chosen and added to the playlist every time a song finishes. Enabling dynamic mode will ignore any size limit you set on the playlist. + In dynamic mode new tracks will be chosen and added to the playlist every time a song finishes. true diff --git a/src/translations/nl.po b/src/translations/nl.po index c7b4b5921..27e785a47 100644 --- a/src/translations/nl.po +++ b/src/translations/nl.po @@ -11,10 +11,10 @@ msgstr "" "PO-Revision-Date: 2011-04-12 21:14+0000\n" "Last-Translator: Cugel \n" "Language-Team: Dutch \n" -"Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: nl\n" "X-Launchpad-Export-Date: 2011-04-13 05:02+0000\n" "X-Generator: Launchpad (build 12735)\n" @@ -85,15 +85,15 @@ msgstr "%1 nummers" msgid "%1: Wiimotedev module" msgstr "%1: Wiimotedev module" -#, c-format, qt-plural-format +#, c-format msgid "%n failed" msgstr "%n mislukt" -#, c-format, qt-plural-format +#, c-format msgid "%n finished" msgstr "%n voltooid" -#, c-format, qt-plural-format +#, c-format msgid "%n remaining" msgstr "%n te gaan" @@ -1378,13 +1378,10 @@ msgstr "Beeldformaat (*.png *.jpg *.jpeg *.bmp *.xpm *.pbm *.ppm *.xbm)" msgid "" "In dynamic mode new tracks will be chosen and added to the playlist every " -"time a song finishes. Enabling dynamic mode will ignore any size limit you " -"set on the playlist." +"time a song finishes." msgstr "" "In 'dynamische modus' worden nieuwe nummers gekozen en aan de afspeellijst " -"toegevoegd op het moment dat een nummer eindigt. Het activeren van deze " -"modus negeert eventuele limieten die voor het aantal nummers in de " -"afspeellijst zijn ingesteld." +"toegevoegd op het moment dat een nummer eindigt." msgid "Inbox" msgstr "" @@ -3129,7 +3126,7 @@ msgstr "Z-A" msgid "Zero" msgstr "Nul" -#, c-format, qt-plural-format +#, c-format msgid "add %n songs" msgstr "%n nummers toevoegen" @@ -3218,7 +3215,7 @@ msgstr "opties" msgid "press enter" msgstr "" -#, c-format, qt-plural-format +#, c-format msgid "remove %n songs" msgstr "%n nummers verwijderen"