summaryrefslogtreecommitdiffstats
path: root/api/logic/net/FileSink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/net/FileSink.cpp')
-rw-r--r--api/logic/net/FileSink.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/api/logic/net/FileSink.cpp b/api/logic/net/FileSink.cpp
index 7dfc4336..83df6843 100644
--- a/api/logic/net/FileSink.cpp
+++ b/api/logic/net/FileSink.cpp
@@ -17,10 +17,10 @@ FileSink::~FileSink()
// nil
};
-JobStatus FileSink::init(QNetworkRequest& request)
+Task::Status FileSink::init(QNetworkRequest& request)
{
auto result = initCache(request);
- if(result != Job_InProgress)
+ if(result != Task::Status::InProgress)
{
return result;
}
@@ -28,27 +28,27 @@ JobStatus FileSink::init(QNetworkRequest& request)
if (!FS::ensureFilePathExists(m_filename))
{
qCritical() << "Could not create folder for " + m_filename;
- return Job_Failed;
+ return Task::Status::Failed;
}
wroteAnyData = false;
m_output_file.reset(new QSaveFile(m_filename));
if (!m_output_file->open(QIODevice::WriteOnly))
{
qCritical() << "Could not open " + m_filename + " for writing";
- return Job_Failed;
+ return Task::Status::Failed;
}
if(initAllValidators(request))
- return Job_InProgress;
- return Job_Failed;
+ return Task::Status::InProgress;
+ return Task::Status::Failed;
}
-JobStatus FileSink::initCache(QNetworkRequest &)
+Task::Status FileSink::initCache(QNetworkRequest &)
{
- return Job_InProgress;
+ return Task::Status::InProgress;
}
-JobStatus FileSink::write(QByteArray& data)
+Task::Status FileSink::write(QByteArray& data)
{
if (!writeAllValidators(data) || m_output_file->write(data) != data.size())
{
@@ -56,20 +56,20 @@ JobStatus FileSink::write(QByteArray& data)
m_output_file->cancelWriting();
m_output_file.reset();
wroteAnyData = false;
- return Job_Failed;
+ return Task::Status::Failed;
}
wroteAnyData = true;
- return Job_InProgress;
+ return Task::Status::InProgress;
}
-JobStatus FileSink::abort()
+Task::Status FileSink::abort()
{
m_output_file->cancelWriting();
failAllValidators();
- return Job_Failed;
+ return Task::Status::Failed;
}
-JobStatus FileSink::finalize(QNetworkReply& reply)
+Task::Status FileSink::finalize(QNetworkReply& reply)
{
// if we wrote any data to the save file, we try to commit the data to the real file.
if (wroteAnyData)
@@ -77,13 +77,13 @@ JobStatus FileSink::finalize(QNetworkReply& reply)
// ask validators for data consistency
// we only do this for actual downloads, not 'your data is still the same' cache hits
if(!finalizeAllValidators(reply))
- return Job_Failed;
+ return Task::Status::Failed;
// nothing went wrong...
if (!m_output_file->commit())
{
qCritical() << "Failed to commit changes to " << m_filename;
m_output_file->cancelWriting();
- return Job_Failed;
+ return Task::Status::Failed;
}
}
// then get rid of the save file
@@ -92,9 +92,9 @@ JobStatus FileSink::finalize(QNetworkReply& reply)
return finalizeCache(reply);
}
-JobStatus FileSink::finalizeCache(QNetworkReply &)
+Task::Status FileSink::finalizeCache(QNetworkReply &)
{
- return Job_Finished;
+ return Task::Status::Finished;
}
bool FileSink::hasLocalData()