1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-28 18:19:42 +01:00

Don't use caller in OrganiseDialog

This commit is contained in:
Krzysztof Sobiecki 2014-11-05 02:37:44 +01:00
parent e4141dd862
commit 5045f9b870
5 changed files with 17 additions and 9 deletions

View File

@ -192,7 +192,7 @@ void Organise::ProcessSomeFiles() {
}
else {
if(job.mark_as_listened_) {
emit FileCopied(job.metadata_.id());
emit FileCopied_(job.metadata_.id());
}
}

View File

@ -54,7 +54,7 @@ class Organise : public QObject {
signals:
void Finished(const QStringList& files_with_errors);
void FileCopied(int database_id);
void FileCopied_(int database_id);
protected:
void timerEvent(QTimerEvent* e);

View File

@ -59,7 +59,7 @@ PodcastService::PodcastService(Application* app, InternetModel* parent)
context_menu_(nullptr),
root_(nullptr),
organise_dialog_(new OrganiseDialog(app_->task_manager(),
nullptr, this)) {
nullptr)) {
icon_loader_->SetModel(model_);
proxy_->setSourceModel(model_);
proxy_->setDynamicSortFilter(true);
@ -76,6 +76,8 @@ PodcastService::PodcastService(Application* app, InternetModel* parent)
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)),
SLOT(CurrentSongChanged(Song)));
connect(organise_dialog_.get(), SIGNAL(FileCopied(int)),
this, SLOT(FileCopied(int)));
}
PodcastService::~PodcastService() {}

View File

@ -43,9 +43,8 @@ const char* OrganiseDialog::kDefaultFormat =
"%artist/%album{ (Disc %disc)}/{%track - }%title.%extension";
const char* OrganiseDialog::kSettingsGroup = "OrganiseDialog";
OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget* parent, QObject* caller)
OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget* parent)
: QDialog(parent),
caller_(caller),
ui_(new Ui_OrganiseDialog),
task_manager_(task_manager),
total_size_(0),
@ -354,13 +353,17 @@ void OrganiseDialog::accept() {
new_songs_info_, ui_->eject_after->isChecked());
connect(organise, SIGNAL(Finished(QStringList)),
SLOT(OrganiseFinished(QStringList)));
connect(organise, SIGNAL(FileCopied(int)),
caller_, SLOT(FileCopied(int)));
connect(organise, SIGNAL(FileCopied_(int)),
this, SLOT(FileCopied_(int)));
organise->Start();
QDialog::accept();
}
void OrganiseDialog::FileCopied_(int database_id) {
emit FileCopied(database_id);
}
void OrganiseDialog::OrganiseFinished(const QStringList& files_with_errors) {
if (files_with_errors.isEmpty()) return;

View File

@ -41,12 +41,11 @@ class OrganiseDialog : public QDialog {
Q_OBJECT
public:
OrganiseDialog(TaskManager* task_manager, QWidget* parent = nullptr, QObject* caller = nullptr);
OrganiseDialog(TaskManager* task_manager, QWidget* parent = nullptr);
~OrganiseDialog();
static const char* kDefaultFormat;
static const char* kSettingsGroup;
QObject* caller_;
QSize sizeHint() const;
@ -61,8 +60,12 @@ class OrganiseDialog : public QDialog {
void SetCopy(bool copy);
signals:
void FileCopied(int);
public slots:
void accept();
void FileCopied_(int);
protected:
void showEvent(QShowEvent*);