forked from qt-creator/qt-creator
DiffEditorPlugin: Expose plugin's future synchronizer
Change-Id: I208a0e6b9c9776486972177f845e76d33121a2a3 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -580,13 +580,12 @@ bool DiffEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
return true;
|
||||
}
|
||||
|
||||
void DiffEditorPlugin::addFuture(const QFuture<void> &future)
|
||||
FutureSynchronizer *DiffEditorPlugin::futureSynchronizer()
|
||||
{
|
||||
QTC_ASSERT(s_instance, return);
|
||||
s_instance->d->m_futureSynchronizer.addFuture(future);
|
||||
QTC_ASSERT(s_instance, return nullptr);
|
||||
return &s_instance->d->m_futureSynchronizer;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace DiffEditor
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <coreplugin/diffservice.h>
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
namespace Utils { class FutureSynchronizer; }
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
template <typename T>
|
||||
class QFuture;
|
||||
@@ -39,9 +41,7 @@ public:
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
|
||||
template <typename T>
|
||||
static void addFuture(const QFuture<T> &future) { addFuture(QFuture<void>(future)); }
|
||||
static void addFuture(const QFuture<void> &future);
|
||||
static Utils::FutureSynchronizer *futureSynchronizer();
|
||||
|
||||
private:
|
||||
class DiffEditorPluginPrivate *d = nullptr;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <texteditor/textdocumentlayout.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <utils/futuresynchronizer.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/tooltip/tooltip.h>
|
||||
|
||||
@@ -784,7 +785,7 @@ SideBySideDiffEditorWidget::~SideBySideDiffEditorWidget()
|
||||
{
|
||||
if (m_watcher) {
|
||||
m_watcher->cancel();
|
||||
DiffEditorPlugin::addFuture(m_watcher->future());
|
||||
DiffEditorPlugin::futureSynchronizer()->addFuture(m_watcher->future());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +817,7 @@ void SideBySideDiffEditorWidget::clear(const QString &message)
|
||||
editor->clearAll(message);
|
||||
if (m_watcher) {
|
||||
m_watcher->cancel();
|
||||
DiffEditorPlugin::addFuture(m_watcher->future());
|
||||
DiffEditorPlugin::futureSynchronizer()->addFuture(m_watcher->future());
|
||||
m_watcher.reset();
|
||||
m_controller.setBusyShowing(false);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <texteditor/textdocumentlayout.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <utils/futuresynchronizer.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/runextensions.h>
|
||||
#include <utils/tooltip/tooltip.h>
|
||||
@@ -57,7 +58,7 @@ UnifiedDiffEditorWidget::~UnifiedDiffEditorWidget()
|
||||
{
|
||||
if (m_watcher) {
|
||||
m_watcher->cancel();
|
||||
DiffEditorPlugin::addFuture(m_watcher->future());
|
||||
DiffEditorPlugin::futureSynchronizer()->addFuture(m_watcher->future());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +205,7 @@ void UnifiedDiffEditorWidget::clear(const QString &message)
|
||||
setSelections({});
|
||||
if (m_watcher) {
|
||||
m_watcher->cancel();
|
||||
DiffEditorPlugin::addFuture(m_watcher->future());
|
||||
DiffEditorPlugin::futureSynchronizer()->addFuture(m_watcher->future());
|
||||
m_watcher.reset();
|
||||
m_controller.setBusyShowing(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user