mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +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() {
|
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);
|
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(wizard, SIGNAL(accepted()), SLOT(NewSmartPlaylistFinished()));
|
connect(wizard, SIGNAL(accepted()), SLOT(NewSmartPlaylistFinished()));
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ void LibraryView::NewSmartPlaylist() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LibraryView::EditSmartPlaylist() {
|
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);
|
wizard->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(wizard, SIGNAL(accepted()), SLOT(EditSmartPlaylistFinished()));
|
connect(wizard, SIGNAL(accepted()), SLOT(EditSmartPlaylistFinished()));
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
QueryWizardPlugin::QueryWizardPlugin(LibraryBackend* library, QObject* parent)
|
QueryWizardPlugin::QueryWizardPlugin(Application* app, LibraryBackend* library, QObject* parent)
|
||||||
: WizardPlugin(library, parent),
|
: WizardPlugin(app, library, parent),
|
||||||
search_page_(NULL),
|
search_page_(NULL),
|
||||||
previous_scrollarea_max_(0)
|
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());
|
QVBoxLayout* terms_page_layout = static_cast<QVBoxLayout*>(search_page_->layout());
|
||||||
terms_page_layout->addStretch();
|
terms_page_layout->addStretch();
|
||||||
search_page_->preview_ = new SearchPreview(search_page_);
|
search_page_->preview_ = new SearchPreview(search_page_);
|
||||||
|
search_page_->preview_->set_application(app_);
|
||||||
search_page_->preview_->set_library(library_);
|
search_page_->preview_->set_library(library_);
|
||||||
terms_page_layout->addWidget(search_page_->preview_);
|
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);
|
sort_ui_->limit_none->setChecked(true);
|
||||||
|
|
||||||
// Set up the preview widget that's already at the bottom of the sort page
|
// 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_);
|
sort_ui_->preview->set_library(library_);
|
||||||
connect(sort_ui_->field, SIGNAL(toggled(bool)), SLOT(UpdateSortPreview()));
|
connect(sort_ui_->field, SIGNAL(toggled(bool)), SLOT(UpdateSortPreview()));
|
||||||
connect(sort_ui_->field_value, SIGNAL(currentIndexChanged(int)), SLOT(UpdateSortPreview()));
|
connect(sort_ui_->field_value, SIGNAL(currentIndexChanged(int)), SLOT(UpdateSortPreview()));
|
||||||
|
@ -39,7 +39,7 @@ class QueryWizardPlugin : public WizardPlugin {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QueryWizardPlugin(LibraryBackend* library, QObject* parent);
|
QueryWizardPlugin(Application* app, LibraryBackend* library, QObject* parent);
|
||||||
~QueryWizardPlugin();
|
~QueryWizardPlugin();
|
||||||
|
|
||||||
QString type() const { return "Query"; }
|
QString type() const { return "Query"; }
|
||||||
|
@ -49,6 +49,10 @@ SearchPreview::~SearchPreview() {
|
|||||||
delete ui_;
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchPreview::set_application(Application* app) {
|
||||||
|
ui_->tree->SetApplication(app);
|
||||||
|
}
|
||||||
|
|
||||||
void SearchPreview::set_library(LibraryBackend* backend) {
|
void SearchPreview::set_library(LibraryBackend* backend) {
|
||||||
backend_ = backend;
|
backend_ = backend;
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class Application;
|
||||||
class LibraryBackend;
|
class LibraryBackend;
|
||||||
class Playlist;
|
class Playlist;
|
||||||
class Ui_SmartPlaylistSearchPreview;
|
class Ui_SmartPlaylistSearchPreview;
|
||||||
@ -36,6 +37,7 @@ public:
|
|||||||
SearchPreview(QWidget *parent = 0);
|
SearchPreview(QWidget *parent = 0);
|
||||||
~SearchPreview();
|
~SearchPreview();
|
||||||
|
|
||||||
|
void set_application(Application* app);
|
||||||
void set_library(LibraryBackend* backend);
|
void set_library(LibraryBackend* backend);
|
||||||
|
|
||||||
void Update(const Search& search);
|
void Update(const Search& search);
|
||||||
|
@ -55,8 +55,9 @@ public:
|
|||||||
Ui_SmartPlaylistWizardFinishPage* ui_;
|
Ui_SmartPlaylistWizardFinishPage* ui_;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wizard::Wizard(LibraryBackend* library, QWidget* parent)
|
Wizard::Wizard(Application* app, LibraryBackend* library, QWidget* parent)
|
||||||
: QWizard(parent),
|
: QWizard(parent),
|
||||||
|
app_(app),
|
||||||
library_(library),
|
library_(library),
|
||||||
type_page_(new TypePage(this)),
|
type_page_(new TypePage(this)),
|
||||||
finish_page_(new FinishPage(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)));
|
connect(type_mapper_, SIGNAL(mapped(int)), SLOT(TypeChanged(int)));
|
||||||
|
|
||||||
new QVBoxLayout(type_page_);
|
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
|
// Skip the type page - remove this when we have more than one type
|
||||||
setStartId(2);
|
setStartId(2);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
|
|
||||||
|
class Application;
|
||||||
class LibraryBackend;
|
class LibraryBackend;
|
||||||
class Ui_SmartPlaylistWizardFinishPage;
|
class Ui_SmartPlaylistWizardFinishPage;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class Wizard : public QWizard {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Wizard(LibraryBackend* library, QWidget* parent);
|
Wizard(Application* app, LibraryBackend* library, QWidget* parent);
|
||||||
~Wizard();
|
~Wizard();
|
||||||
|
|
||||||
void SetGenerator(GeneratorPtr gen);
|
void SetGenerator(GeneratorPtr gen);
|
||||||
@ -54,6 +55,7 @@ private slots:
|
|||||||
void TypeChanged(int index);
|
void TypeChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Application* app_;
|
||||||
LibraryBackend* library_;
|
LibraryBackend* library_;
|
||||||
TypePage* type_page_;
|
TypePage* type_page_;
|
||||||
FinishPage* finish_page_;
|
FinishPage* finish_page_;
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
namespace smart_playlists {
|
namespace smart_playlists {
|
||||||
|
|
||||||
WizardPlugin::WizardPlugin(LibraryBackend* library, QObject* parent)
|
WizardPlugin::WizardPlugin(Application* app, LibraryBackend* library, QObject* parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
|
app_(app),
|
||||||
library_(library),
|
library_(library),
|
||||||
start_page_(-1)
|
start_page_(-1)
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "generator_fwd.h"
|
#include "generator_fwd.h"
|
||||||
|
|
||||||
|
class Application;
|
||||||
class LibraryBackend;
|
class LibraryBackend;
|
||||||
|
|
||||||
class QWizard;
|
class QWizard;
|
||||||
@ -32,7 +33,7 @@ class WizardPlugin : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WizardPlugin(LibraryBackend* library, QObject* parent);
|
WizardPlugin(Application* app, LibraryBackend* library, QObject* parent);
|
||||||
|
|
||||||
virtual QString type() const = 0;
|
virtual QString type() const = 0;
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
@ -48,6 +49,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int CreatePages(QWizard* wizard, int finish_page_id) = 0;
|
virtual int CreatePages(QWizard* wizard, int finish_page_id) = 0;
|
||||||
|
|
||||||
|
Application* app_;
|
||||||
LibraryBackend* library_;
|
LibraryBackend* library_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user