void TrackSelectionDialog::accept() { if (save_on_close_) { SetLoading(tr("Saving tracks") + "..."); // Save tags in the background QFuture<void> future = QtConcurrent::run(&TrackSelectionDialog::SaveData, data_); QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this); watcher->setFuture(future); connect(watcher, SIGNAL(finished()), SLOT(AcceptFinished())); return; } QDialog::accept(); for (const Data& data : data_) { if (data.pending_ || data.results_.isEmpty() || data.selected_result_ == -1) continue; const Song& new_metadata = data.results_[data.selected_result_]; emit SongChosen(data.original_song_, new_metadata); } }
void EditTagDialog::accept() { // Show the loading indicator if (!SetLoading(tr("Saving tracks") + "...")) return; // Save tags in the background QFuture<void> future = QtConcurrent::run(this, &EditTagDialog::SaveData, data_); QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this); watcher->setFuture(future); connect(watcher, SIGNAL(finished()), SLOT(AcceptFinished())); }
void EditTagDialog::accept() { // Show the loading indicator if (!SetLoading(tr("Saving tracks") + "...")) return; abortRequested_ = false; ui_->abortSaveButton->setEnabled(true); // Save tags in the background QFuture<void> future = QtConcurrent::run(this, &EditTagDialog::SaveData, data_); NewClosure(future, this, SLOT(AcceptFinished())); }