From 5b78e0da1d64b6096829f54b29f14ec5643b5ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Fri, 15 May 2015 16:00:32 +0200 Subject: Async: rename Async namespace to KAsync --- async/src/async.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'async/src/async.cpp') diff --git a/async/src/async.cpp b/async/src/async.cpp index 0e86a84..c57c9ad 100644 --- a/async/src/async.cpp +++ b/async/src/async.cpp @@ -22,7 +22,7 @@ #include #include -using namespace Async; +using namespace KAsync; Private::Execution::Execution(const Private::ExecutorBasePtr &executor) : executor(executor) @@ -104,11 +104,11 @@ static void asyncWhile(const std::function)> &bod }); } -Job Async::dowhile(Condition condition, ThenTask body) +Job KAsync::dowhile(Condition condition, ThenTask body) { - return Async::start([body, condition](Async::Future &future) { + return KAsync::start([body, condition](KAsync::Future &future) { asyncWhile([condition, body](std::function whileCallback) { - Async::start(body).then([whileCallback, condition]() { + KAsync::start(body).then([whileCallback, condition]() { whileCallback(!condition()); }).exec(); }, @@ -118,11 +118,11 @@ Job Async::dowhile(Condition condition, ThenTask body) }); } -Job Async::dowhile(ThenTask body) +Job KAsync::dowhile(ThenTask body) { - return Async::start([body](Async::Future &future) { + return KAsync::start([body](KAsync::Future &future) { asyncWhile([body](std::function whileCallback) { - Async::start(body).then([whileCallback](bool result) { + KAsync::start(body).then([whileCallback](bool result) { whileCallback(!result); //FIXME this return value is only required because .then doesn't work return true; @@ -134,10 +134,10 @@ Job Async::dowhile(ThenTask body) }); } -Job Async::wait(int delay) +Job KAsync::wait(int delay) { auto timer = QSharedPointer::create(); - return Async::start([timer, delay](Async::Future &future) { + return KAsync::start([timer, delay](KAsync::Future &future) { timer->setSingleShot(true); QObject::connect(timer.data(), &QTimer::timeout, [&future]() { future.setFinished(); -- cgit v1.2.3