Refactoring

This commit is contained in:
Jonas Kvinge
2024-10-22 18:12:33 +02:00
parent dfcf715291
commit 8da2b9cd94
623 changed files with 9071 additions and 5126 deletions

View File

@@ -30,8 +30,8 @@
#include <QVBoxLayout>
#include <QScrollBar>
#include "core/scoped_ptr.h"
#include "core/shared_ptr.h"
#include "includes/scoped_ptr.h"
#include "includes/shared_ptr.h"
#include "playlistquerygenerator.h"
#include "smartplaylistquerywizardplugin.h"
#include "smartplaylistquerywizardpluginsearchpage.h"
@@ -43,8 +43,22 @@
using std::make_unique;
using std::make_shared;
SmartPlaylistQueryWizardPlugin::SmartPlaylistQueryWizardPlugin(Application *app, SharedPtr<CollectionBackend> collection_backend, QObject *parent)
: SmartPlaylistWizardPlugin(app, collection_backend, parent),
SmartPlaylistQueryWizardPlugin::SmartPlaylistQueryWizardPlugin(const SharedPtr<Player> player,
const SharedPtr<PlaylistManager> playlist_manager,
const SharedPtr<CollectionBackend> collection_backend,
#ifdef HAVE_MOODBAR
const SharedPtr<MoodbarLoader> moodbar_loader,
#endif
const SharedPtr<CurrentAlbumCoverLoader> current_albumcover_loader,
QObject *parent)
: SmartPlaylistWizardPlugin(collection_backend, parent),
player_(player),
playlist_manager_(playlist_manager),
collection_backend_(collection_backend),
#ifdef HAVE_MOODBAR
moodbar_loader_(moodbar_loader),
#endif
current_albumcover_loader_(current_albumcover_loader),
search_page_(nullptr),
previous_scrollarea_max_(0) {}
@@ -86,8 +100,13 @@ int SmartPlaylistQueryWizardPlugin::CreatePages(QWizard *wizard, int finish_page
QVBoxLayout *terms_page_layout = static_cast<QVBoxLayout*>(search_page_->layout());
terms_page_layout->addStretch();
search_page_->preview_ = new SmartPlaylistSearchPreview(search_page_);
search_page_->preview_->set_application(app_);
search_page_->preview_->set_collection(collection_backend_);
search_page_->preview_->Init(player_,
playlist_manager_,
collection_backend_,
#ifdef HAVE_MOODBAR
moodbar_loader_,
#endif
current_albumcover_loader_);
terms_page_layout->addWidget(search_page_->preview_);
// Add sort field texts
@@ -105,8 +124,14 @@ int SmartPlaylistQueryWizardPlugin::CreatePages(QWizard *wizard, int finish_page
sort_ui_->limit_none->setChecked(true);
// Set up the preview widget that's already at the bottom of the sort page
sort_ui_->preview->set_application(app_);
sort_ui_->preview->set_collection(collection_backend_);
sort_ui_->preview->Init(player_,
playlist_manager_,
collection_backend_,
#ifdef HAVE_MOODBAR
moodbar_loader_,
#endif
current_albumcover_loader_);
QObject::connect(sort_ui_->field, &QRadioButton::toggled, this, &SmartPlaylistQueryWizardPlugin::UpdateSortPreview);
QObject::connect(sort_ui_->field_value, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SmartPlaylistQueryWizardPlugin::UpdateSortPreview);
QObject::connect(sort_ui_->limit_limit, &QRadioButton::toggled, this, &SmartPlaylistQueryWizardPlugin::UpdateSortPreview);