X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flib%2Ftask.cpp;h=ed79e56c68621a31dbefa9638fb64f88efe54cc0;hb=f4de41c810319d3ecc8bb5084de06a953037b7b7;hp=e72a7415de285767ee93369051fb384113b8d2a1;hpb=c8e829c219c65ff8e93b6c7b66212ff0876441c5;p=builder.git diff --git a/source/lib/task.cpp b/source/lib/task.cpp index e72a741..ed79e56 100644 --- a/source/lib/task.cpp +++ b/source/lib/task.cpp @@ -1,14 +1,16 @@ #include #include #include +#include +#include "filetarget.h" #include "task.h" using namespace std; using namespace Msp; -void Task::add_file(const FS::Path &f) +void Task::add_target(const FileTarget &t) { - files.push_back(f); + targets.push_back(&t); } void Task::set_unlink(bool u) @@ -18,8 +20,11 @@ void Task::set_unlink(bool u) void Task::prepare() { - for(const FS::Path &f: files) + start_time = Time::now(); + + for(const FileTarget *t: targets) { + const FS::Path &f = t->get_path(); if(FS::exists(f)) { // If the file exists, the directory it's in must exist too @@ -33,3 +38,10 @@ void Task::prepare() } } } + +void Task::finished(bool success) +{ + if(!duration && start_time) + duration = Time::now()-start_time; + signal_finished.emit(success); +}