DiffEditor: Use QtConcurrent invocation for async tasks

Change-Id: I06640837ffee830e60e8dd2a566f9388f8444010
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2023-02-11 23:21:58 +01:00
parent a8214665fe
commit 5ff073df19
11 changed files with 114 additions and 170 deletions

View File

@@ -291,8 +291,8 @@ Core::IDocument::OpenResult DiffEditorDocument::open(QString *errorString, const
return OpenResult::ReadError;
}
bool ok = false;
QList<FileData> fileDataList = DiffUtils::readPatch(patch, &ok);
const std::optional<QList<FileData>> fileDataList = DiffUtils::readPatch(patch);
bool ok = fileDataList.has_value();
if (!ok) {
*errorString = Tr::tr("Could not parse patch file \"%1\". "
"The content is not of unified diff format.")
@@ -302,7 +302,7 @@ Core::IDocument::OpenResult DiffEditorDocument::open(QString *errorString, const
emit temporaryStateChanged();
setFilePath(filePath.absoluteFilePath());
setWorkingDirectory(filePath.absoluteFilePath());
setDiffFiles(fileDataList);
setDiffFiles(*fileDataList);
}
endReload(ok);
if (!ok && readResult == TextFileFormat::ReadEncodingError)