Get rid of OutputProxy in ShellCommand

Before we have used the OutputProxyFactory, which
was called in the non-gui thread. The factory, when run,
created the connection between the thread and outside
world (e.g. VersionControl output window). Instead of
setting the factory we provide a set of virtual functions
called directly from non-gui threads. We also provide overrides
for them in VcsCommand class. Their implementation
safely redirects the calls directly to the VcsOutputWindow
through the QMetaObject::invokeMethod() with auto connection
as a default.

Task-number: QTCREATORBUG-25744
Change-Id: I09f2da278003b71095e953a51499a5513cb8f03f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-06-01 13:45:20 +02:00
parent 269f15df6b
commit 6e85ff9f4b
4 changed files with 68 additions and 59 deletions

View File

@@ -31,6 +31,8 @@
namespace VcsBase {
class VcsOutputWindow;
class VCSBASE_EXPORT VcsCommand : public Core::ShellCommand
{
Q_OBJECT
@@ -49,12 +51,20 @@ public:
const Utils::CommandLine &command,
const QString &workDirectory = {}) override;
protected:
void append(const QString &text) override;
void appendSilently(const QString &text) override;
void appendError(const QString &text) override;
void appendCommand(const QString &workingDirectory, const Utils::CommandLine &command) override;
void appendMessage(const QString &text) override;
private:
void emitRepositoryChanged(const QString &workingDirectory);
void coreAboutToClose() override;
bool m_preventRepositoryChanged;
VcsOutputWindow *m_outputWindow = nullptr;
};
} // namespace VcsBase