DiffEditor: Pimpl plugin

The standard pattern, and allows to drop the QObject parent on
the editor factory which gets into the way of de-QObject-ifing
the IEditorFactory hierarchy.

Change-Id: I5c6a50f8075a99592ed4459b417ca8ba7471ae96
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-02-05 15:50:46 +01:00
parent 3f17fa4a12
commit ca89d1b8a6
4 changed files with 61 additions and 48 deletions

View File

@@ -30,10 +30,6 @@
#include <coreplugin/diffservice.h>
#include <extensionsystem/iplugin.h>
QT_FORWARD_DECLARE_CLASS(QAction)
namespace Core { class IEditor; }
namespace DiffEditor {
namespace Internal {
@@ -41,31 +37,27 @@ class DiffEditorServiceImpl : public QObject, public Core::DiffService
{
Q_OBJECT
Q_INTERFACES(Core::DiffService)
public:
explicit DiffEditorServiceImpl(QObject *parent = nullptr);
DiffEditorServiceImpl();
void diffFiles(const QString &leftFileName, const QString &rightFileName) override;
void diffModifiedFiles(const QStringList &fileNames) override;
};
class DiffEditorPlugin : public ExtensionSystem::IPlugin
class DiffEditorPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "DiffEditor.json")
public:
bool initialize(const QStringList &arguments, QString *errorMessage = nullptr) override;
void extensionsInitialized() override;
~DiffEditorPlugin() final;
bool initialize(const QStringList &arguments, QString *errorMessage) final;
void extensionsInitialized() final {};
private:
void updateDiffCurrentFileAction();
void updateDiffOpenFilesAction();
void diffCurrentFile();
void diffOpenFiles();
void diffExternalFiles();
QAction *m_diffCurrentFileAction = nullptr;
QAction *m_diffOpenFilesAction = nullptr;
class DiffEditorPluginPrivate *d = nullptr;
#ifdef WITH_TESTS
private slots: