mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-14 02:14:21 +01:00
Make the remove button work in smart playlist search terms
This commit is contained in:
parent
6c5ce58eda
commit
9b5b4ef4c6
@ -68,6 +68,7 @@ SmartPlaylistSearchTermWidget::SmartPlaylistSearchTermWidget(LibraryBackend* lib
|
|||||||
{
|
{
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
connect(ui_->field, SIGNAL(currentIndexChanged(int)), SLOT(FieldChanged(int)));
|
connect(ui_->field, SIGNAL(currentIndexChanged(int)), SLOT(FieldChanged(int)));
|
||||||
|
connect(ui_->remove, SIGNAL(clicked()), SIGNAL(RemoveClicked()));
|
||||||
|
|
||||||
// Populate the combo boxes
|
// Populate the combo boxes
|
||||||
for (int i=0 ; i<SmartPlaylistSearchTerm::FieldCount ; ++i) {
|
for (int i=0 ; i<SmartPlaylistSearchTerm::FieldCount ; ++i) {
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Clicked();
|
void Clicked();
|
||||||
|
void RemoveClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent*);
|
void showEvent(QShowEvent*);
|
||||||
|
@ -35,13 +35,29 @@ SmartPlaylistWizard::SmartPlaylistWizard(LibraryBackend* library, QWidget* paren
|
|||||||
AddSearchTerm();
|
AddSearchTerm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmartPlaylistWizard::~SmartPlaylistWizard() {
|
||||||
|
delete ui_;
|
||||||
|
}
|
||||||
|
|
||||||
void SmartPlaylistWizard::AddSearchTerm() {
|
void SmartPlaylistWizard::AddSearchTerm() {
|
||||||
SmartPlaylistSearchTermWidget* widget =
|
SmartPlaylistSearchTermWidget* widget =
|
||||||
new SmartPlaylistSearchTermWidget(library_, this);
|
new SmartPlaylistSearchTermWidget(library_, this);
|
||||||
|
connect(widget, SIGNAL(RemoveClicked()), SLOT(RemoveSearchTerm()));
|
||||||
|
|
||||||
search_term_layout_->insertWidget(search_terms_.count(), widget);
|
search_term_layout_->insertWidget(search_terms_.count(), widget);
|
||||||
search_terms_ << widget;
|
search_terms_ << widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmartPlaylistWizard::~SmartPlaylistWizard() {
|
void SmartPlaylistWizard::RemoveSearchTerm() {
|
||||||
delete ui_;
|
SmartPlaylistSearchTermWidget* widget =
|
||||||
|
qobject_cast<SmartPlaylistSearchTermWidget*>(sender());
|
||||||
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const int index = search_terms_.indexOf(widget);
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete search_terms_.takeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void AddSearchTerm();
|
void AddSearchTerm();
|
||||||
|
void RemoveSearchTerm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_SmartPlaylistWizard* ui_;
|
Ui_SmartPlaylistWizard* ui_;
|
||||||
|
Loading…
Reference in New Issue
Block a user