mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 03:27:40 +01:00
Fix a crash in the smart playlist preview when the moodbar column is enabled
This commit is contained in:
parent
7501d664bf
commit
ba2f4ddedc
@ -531,7 +531,7 @@ void LibraryView::FilterReturnPressed() {
|
||||
}
|
||||
|
||||
void LibraryView::NewSmartPlaylist() {
|
||||
Wizard* wizard = new Wizard(app_->library_backend(), this);
|
||||
Wizard* wizard = new Wizard(app_, app_->library_backend(), this);
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(wizard, SIGNAL(accepted()), SLOT(NewSmartPlaylistFinished()));
|
||||
|
||||
@ -539,7 +539,7 @@ void LibraryView::NewSmartPlaylist() {
|
||||
}
|
||||
|
||||
void LibraryView::EditSmartPlaylist() {
|
||||
Wizard* wizard = new Wizard(app_->library_backend(), this);
|
||||
Wizard* wizard = new Wizard(app_, app_->library_backend(), this);
|
||||
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(wizard, SIGNAL(accepted()), SLOT(EditSmartPlaylistFinished()));
|
||||
|
||||
|
@ -71,8 +71,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
QueryWizardPlugin::QueryWizardPlugin(LibraryBackend* library, QObject* parent)
|
||||
: WizardPlugin(library, parent),
|
||||
QueryWizardPlugin::QueryWizardPlugin(Application* app, LibraryBackend* library, QObject* parent)
|
||||
: WizardPlugin(app, library, parent),
|
||||
search_page_(NULL),
|
||||
previous_scrollarea_max_(0)
|
||||
{
|
||||
@ -118,6 +118,7 @@ int QueryWizardPlugin::CreatePages(QWizard* wizard, int finish_page_id) {
|
||||
QVBoxLayout* terms_page_layout = static_cast<QVBoxLayout*>(search_page_->layout());
|
||||
terms_page_layout->addStretch();
|
||||
search_page_->preview_ = new SearchPreview(search_page_);
|
||||
search_page_->preview_->set_application(app_);
|
||||
search_page_->preview_->set_library(library_);
|
||||
terms_page_layout->addWidget(search_page_->preview_);
|
||||
|
||||
@ -136,6 +137,7 @@ int QueryWizardPlugin::CreatePages(QWizard* wizard, int finish_page_id) {
|
||||
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_library(library_);
|
||||
connect(sort_ui_->field, SIGNAL(toggled(bool)), SLOT(UpdateSortPreview()));
|
||||
connect(sort_ui_->field_value, SIGNAL(currentIndexChanged(int)), SLOT(UpdateSortPreview()));
|
||||
|
@ -39,7 +39,7 @@ class QueryWizardPlugin : public WizardPlugin {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QueryWizardPlugin(LibraryBackend* library, QObject* parent);
|
||||
QueryWizardPlugin(Application* app, LibraryBackend* library, QObject* parent);
|
||||
~QueryWizardPlugin();
|
||||
|
||||
QString type() const { return "Query"; }
|
||||
|
@ -49,6 +49,10 @@ SearchPreview::~SearchPreview() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void SearchPreview::set_application(Application* app) {
|
||||
ui_->tree->SetApplication(app);
|
||||
}
|
||||
|
||||
void SearchPreview::set_library(LibraryBackend* backend) {
|
||||
backend_ = backend;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class Application;
|
||||
class LibraryBackend;
|
||||
class Playlist;
|
||||
class Ui_SmartPlaylistSearchPreview;
|
||||
@ -36,6 +37,7 @@ public:
|
||||
SearchPreview(QWidget *parent = 0);
|
||||
~SearchPreview();
|
||||
|
||||
void set_application(Application* app);
|
||||
void set_library(LibraryBackend* backend);
|
||||
|
||||
void Update(const Search& search);
|
||||
|
@ -55,8 +55,9 @@ public:
|
||||
Ui_SmartPlaylistWizardFinishPage* ui_;
|
||||
};
|
||||
|
||||
Wizard::Wizard(LibraryBackend* library, QWidget* parent)
|
||||
Wizard::Wizard(Application* app, LibraryBackend* library, QWidget* parent)
|
||||
: QWizard(parent),
|
||||
app_(app),
|
||||
library_(library),
|
||||
type_page_(new TypePage(this)),
|
||||
finish_page_(new FinishPage(this)),
|
||||
@ -83,7 +84,7 @@ Wizard::Wizard(LibraryBackend* library, QWidget* parent)
|
||||
connect(type_mapper_, SIGNAL(mapped(int)), SLOT(TypeChanged(int)));
|
||||
|
||||
new QVBoxLayout(type_page_);
|
||||
AddPlugin(new QueryWizardPlugin(library_, this));
|
||||
AddPlugin(new QueryWizardPlugin(app_, library_, this));
|
||||
|
||||
// Skip the type page - remove this when we have more than one type
|
||||
setStartId(2);
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <QWizard>
|
||||
|
||||
class Application;
|
||||
class LibraryBackend;
|
||||
class Ui_SmartPlaylistWizardFinishPage;
|
||||
|
||||
@ -35,7 +36,7 @@ class Wizard : public QWizard {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Wizard(LibraryBackend* library, QWidget* parent);
|
||||
Wizard(Application* app, LibraryBackend* library, QWidget* parent);
|
||||
~Wizard();
|
||||
|
||||
void SetGenerator(GeneratorPtr gen);
|
||||
@ -54,6 +55,7 @@ private slots:
|
||||
void TypeChanged(int index);
|
||||
|
||||
private:
|
||||
Application* app_;
|
||||
LibraryBackend* library_;
|
||||
TypePage* type_page_;
|
||||
FinishPage* finish_page_;
|
||||
|
@ -19,8 +19,9 @@
|
||||
|
||||
namespace smart_playlists {
|
||||
|
||||
WizardPlugin::WizardPlugin(LibraryBackend* library, QObject* parent)
|
||||
WizardPlugin::WizardPlugin(Application* app, LibraryBackend* library, QObject* parent)
|
||||
: QObject(parent),
|
||||
app_(app),
|
||||
library_(library),
|
||||
start_page_(-1)
|
||||
{
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "generator_fwd.h"
|
||||
|
||||
class Application;
|
||||
class LibraryBackend;
|
||||
|
||||
class QWizard;
|
||||
@ -32,7 +33,7 @@ class WizardPlugin : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WizardPlugin(LibraryBackend* library, QObject* parent);
|
||||
WizardPlugin(Application* app, LibraryBackend* library, QObject* parent);
|
||||
|
||||
virtual QString type() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
@ -48,6 +49,7 @@ public:
|
||||
protected:
|
||||
virtual int CreatePages(QWizard* wizard, int finish_page_id) = 0;
|
||||
|
||||
Application* app_;
|
||||
LibraryBackend* library_;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user