Commit b472fc82 authored by Dario Freddi's avatar Dario Freddi
Browse files

Progress ok


Signed-off-by: default avatarDario Freddi <drf@kde.org>
parent 4357b5d8
......@@ -34,6 +34,17 @@ void OperationPrivate::concurrentValidate()
validateLoop.data()->deleteLater();
}
void OperationPrivate::concurrentRun()
{
Q_Q(Operation);
runLoop = new QEventLoop;
q->run();
if (status == Operation::StatusRunning) {
runLoop.data()->exec();
}
runLoop.data()->deleteLater();
}
void OperationPrivate::setStatus(Operation::Status newstatus)
{
if (status != newstatus) {
......@@ -231,6 +242,9 @@ void Operation::setFinished(bool result)
} else {
d->status = StatusError;
}
if (!d->runLoop.isNull()) {
d->runLoop.data()->quit();
}
}
void Operation::setValidationFinished(bool result)
......
......@@ -50,11 +50,12 @@ public:
Operation::List children;
QWeakPointer<QEventLoop> validateLoop;
QHash<QObject*, QMetaMethod> finishedCallbacks;
QWeakPointer<QEventLoop> runLoop;
OperationRunner *runner;
void concurrentValidate();
void concurrentRun();
void setStatus(Operation::Status status);
};
......
......@@ -158,6 +158,11 @@ void OperationRunner::run()
d->runThread = new RunnerThread(d->operations);
connect(d->runThread.data(), SIGNAL(errorsOccurred(ErrorList)),
this, SLOT(__k__errorsOccurred(ErrorList)));
connect(d->runThread.data(), SIGNAL(runFinished(bool)),
this, SIGNAL(finished(bool)));
d->runThread.data()->start();
}
......
......@@ -35,13 +35,8 @@ RunnerThread::~RunnerThread()
bool RunnerThread::runSingle(Operation* op)
{
QEventLoop e;
const QMetaObject *mo = e.metaObject();
OperationPrivate *opPr = RunnerThread::operationPrivateProxy(op);
opPr->finishedCallbacks.insert(&e, mo->method(mo->indexOfMethod(QMetaObject::normalizedSignature("quit()"))));
op->run();
e.exec();
opPr->finishedCallbacks.remove(&e);
opPr->concurrentRun();
// How did it go?
if (op->status() == Operation::StatusPerformed) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment