diff options
Diffstat (limited to 'src/plugins/texteditor/codeassist/asyncprocessor.h')
-rw-r--r-- | src/plugins/texteditor/codeassist/asyncprocessor.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/plugins/texteditor/codeassist/asyncprocessor.h b/src/plugins/texteditor/codeassist/asyncprocessor.h new file mode 100644 index 0000000000..6890a721a0 --- /dev/null +++ b/src/plugins/texteditor/codeassist/asyncprocessor.h @@ -0,0 +1,32 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 + +#pragma once + +#include "iassistprocessor.h" + +#include <QFutureWatcher> + +namespace TextEditor { + +class TEXTEDITOR_EXPORT AsyncProcessor : public TextEditor::IAssistProcessor +{ +public: + AsyncProcessor(); + + IAssistProposal *perform(AssistInterface *interface) final; + bool running() override; + void cancel() override; + + virtual IAssistProposal *performAsync(AssistInterface *interface) = 0; + virtual IAssistProposal *immediateProposal(AssistInterface *interface); + +protected: + bool isCanceled() const; + +private: + AssistInterface *m_interface = nullptr; + QFutureWatcher<IAssistProposal *> m_watcher; +}; + +} // namespace TextEditor |