Changed my mind about automatically passing QFutures.

This commit is contained in:
John Maguire 2015-11-27 12:03:47 +00:00
parent ec98a68c3d
commit 2d61fe6c87
3 changed files with 8 additions and 14 deletions

View File

@ -197,16 +197,6 @@ _detail::ClosureBase* NewClosure(QFuture<T> future, QObject* receiver,
QFutureWatcher<T>* watcher = new QFutureWatcher<T>;
watcher->setFuture(future);
QObject::connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater()));
return NewClosure(watcher, SIGNAL(finished()), receiver, slot, future,
args...);
}
template <typename... Args>
_detail::ClosureBase* NewClosure(QFuture<void> future, QObject* receiver,
const char* slot, const Args&... args) {
QFutureWatcher<void>* watcher = new QFutureWatcher<void>;
watcher->setFuture(future);
QObject::connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater()));
return NewClosure(watcher, SIGNAL(finished()), receiver, slot, args...);
}

View File

@ -455,8 +455,9 @@ bool GstEngine::Play(quint64 offset_nanosec) {
QFuture<GstStateChangeReturn> future =
current_pipeline_->SetState(GST_STATE_PLAYING);
NewClosure(future, this, SLOT(PlayDone(QFuture<GstStateChangeReturn>, quint64, int)), offset_nanosec,
current_pipeline_->id());
NewClosure(future, this,
SLOT(PlayDone(QFuture<GstStateChangeReturn>, quint64, int)),
future, offset_nanosec, current_pipeline_->id());
if (is_fading_out_to_pause_) {
current_pipeline_->SetState(GST_STATE_PAUSED);
@ -848,7 +849,9 @@ int GstEngine::AddBackgroundStream(shared_ptr<GstEnginePipeline> pipeline) {
background_streams_[stream_id] = pipeline;
QFuture<GstStateChangeReturn> future = pipeline->SetState(GST_STATE_PLAYING);
NewClosure(future, this, SLOT(BackgroundStreamPlayDone(QFuture<GstStateChangeReturn>, int)), stream_id);
NewClosure(future, this,
SLOT(BackgroundStreamPlayDone(QFuture<GstStateChangeReturn>, int)),
future, stream_id);
return stream_id;
}

View File

@ -82,7 +82,8 @@ void BlockingSearchProvider::SearchAsync(int id, const QString& query) {
QFuture<ResultList> future =
QtConcurrent::run(this, &BlockingSearchProvider::Search, id, query);
NewClosure(future, this,
SLOT(BlockingSearchFinished(QFuture<ResultList>, int)), id);
SLOT(BlockingSearchFinished(QFuture<ResultList>, int)), future,
id);
}
void BlockingSearchProvider::BlockingSearchFinished(QFuture<ResultList> future,