forked from qt-creator/qt-creator
Tasking::Async: Rename Async into AsyncTask
Rename Utils::AsyncTask into Utils::Async. Rename AsyncTaskBase into AsyncTask. Task-number: QTCREATORBUG-29102 Change-Id: I3aa24d84138c19922d4f61b1c9cf15bc8989f60e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -114,12 +114,12 @@ DiffFilesController::DiffFilesController(IDocument *document)
|
||||
const auto setupTree = [this, storage](TaskTree &taskTree) {
|
||||
QList<std::optional<FileData>> *outputList = storage.activeStorage();
|
||||
|
||||
const auto setupDiff = [this](AsyncTask<FileData> &async, const ReloadInput &reloadInput) {
|
||||
const auto setupDiff = [this](Async<FileData> &async, const ReloadInput &reloadInput) {
|
||||
async.setConcurrentCallData(
|
||||
DiffFile(ignoreWhitespace(), contextLineCount()), reloadInput);
|
||||
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
|
||||
};
|
||||
const auto onDiffDone = [outputList](const AsyncTask<FileData> &async, int i) {
|
||||
const auto onDiffDone = [outputList](const Async<FileData> &async, int i) {
|
||||
if (async.isResultAvailable())
|
||||
(*outputList)[i] = async.result();
|
||||
};
|
||||
@@ -130,7 +130,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
|
||||
using namespace std::placeholders;
|
||||
QList<TaskItem> tasks {parallel, optional};
|
||||
for (int i = 0; i < inputList.size(); ++i) {
|
||||
tasks.append(Async<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
||||
tasks.append(AsyncTask<FileData>(std::bind(setupDiff, _1, inputList.at(i)),
|
||||
std::bind(onDiffDone, _1, i)));
|
||||
}
|
||||
taskTree.setupRoot(tasks);
|
||||
|
||||
@@ -869,11 +869,11 @@ void SideBySideDiffEditorWidget::restoreState()
|
||||
|
||||
void SideBySideDiffEditorWidget::showDiff()
|
||||
{
|
||||
m_asyncTask.reset(new AsyncTask<SideBySideShowResults>());
|
||||
m_asyncTask.reset(new Async<SideBySideShowResults>());
|
||||
m_asyncTask->setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
|
||||
m_controller.setBusyShowing(true);
|
||||
|
||||
connect(m_asyncTask.get(), &AsyncTaskBase::done, this, [this] {
|
||||
connect(m_asyncTask.get(), &AsyncBase::done, this, [this] {
|
||||
if (m_asyncTask->isCanceled() || !m_asyncTask->isResultAvailable()) {
|
||||
for (SideDiffEditorWidget *editor : m_editor)
|
||||
editor->clearAll(Tr::tr("Retrieving data failed."));
|
||||
|
||||
@@ -18,7 +18,7 @@ class TextEditorWidget;
|
||||
|
||||
namespace Utils {
|
||||
template <typename R>
|
||||
class AsyncTask;
|
||||
class Async;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -141,7 +141,7 @@ private:
|
||||
|
||||
bool m_horizontalSync = false;
|
||||
|
||||
std::unique_ptr<Utils::AsyncTask<SideBySideShowResults>> m_asyncTask;
|
||||
std::unique_ptr<Utils::Async<SideBySideShowResults>> m_asyncTask;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -452,10 +452,10 @@ void UnifiedDiffEditorWidget::showDiff()
|
||||
return;
|
||||
}
|
||||
|
||||
m_asyncTask.reset(new AsyncTask<UnifiedShowResult>());
|
||||
m_asyncTask.reset(new Async<UnifiedShowResult>());
|
||||
m_asyncTask->setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
|
||||
m_controller.setBusyShowing(true);
|
||||
connect(m_asyncTask.get(), &AsyncTaskBase::done, this, [this] {
|
||||
connect(m_asyncTask.get(), &AsyncBase::done, this, [this] {
|
||||
if (m_asyncTask->isCanceled() || !m_asyncTask->isResultAvailable()) {
|
||||
setPlainText(Tr::tr("Retrieving data failed."));
|
||||
} else {
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace TextEditor { class FontSettings; }
|
||||
|
||||
namespace Utils {
|
||||
template <typename R>
|
||||
class AsyncTask;
|
||||
class Async;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
DiffEditorWidgetController m_controller;
|
||||
QByteArray m_state;
|
||||
|
||||
std::unique_ptr<Utils::AsyncTask<UnifiedShowResult>> m_asyncTask;
|
||||
std::unique_ptr<Utils::Async<UnifiedShowResult>> m_asyncTask;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user