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);
|
||||
connect(ui_->field, SIGNAL(currentIndexChanged(int)), SLOT(FieldChanged(int)));
|
||||
connect(ui_->remove, SIGNAL(clicked()), SIGNAL(RemoveClicked()));
|
||||
|
||||
// Populate the combo boxes
|
||||
for (int i=0 ; i<SmartPlaylistSearchTerm::FieldCount ; ++i) {
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
|
||||
signals:
|
||||
void Clicked();
|
||||
void RemoveClicked();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent*);
|
||||
|
@ -35,13 +35,29 @@ SmartPlaylistWizard::SmartPlaylistWizard(LibraryBackend* library, QWidget* paren
|
||||
AddSearchTerm();
|
||||
}
|
||||
|
||||
SmartPlaylistWizard::~SmartPlaylistWizard() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void SmartPlaylistWizard::AddSearchTerm() {
|
||||
SmartPlaylistSearchTermWidget* widget =
|
||||
new SmartPlaylistSearchTermWidget(library_, this);
|
||||
connect(widget, SIGNAL(RemoveClicked()), SLOT(RemoveSearchTerm()));
|
||||
|
||||
search_term_layout_->insertWidget(search_terms_.count(), widget);
|
||||
search_terms_ << widget;
|
||||
}
|
||||
|
||||
SmartPlaylistWizard::~SmartPlaylistWizard() {
|
||||
delete ui_;
|
||||
void SmartPlaylistWizard::RemoveSearchTerm() {
|
||||
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:
|
||||
void AddSearchTerm();
|
||||
void RemoveSearchTerm();
|
||||
|
||||
private:
|
||||
Ui_SmartPlaylistWizard* ui_;
|
||||
|
Loading…
Reference in New Issue
Block a user