QmlPreview: Pimpl plugin

This is closer in structure and timing to what others do.

Properties are left in the plugin itself in case someone uses them.

Change-Id: Ic43aea1da7e3bc56e9678144f37f5ad40ce1b20f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-08-13 10:57:37 +02:00
parent 20e7c1443e
commit 847108d4f4
2 changed files with 127 additions and 88 deletions

View File

@@ -61,6 +61,8 @@ class QmlPreviewPlugin : public ExtensionSystem::IPlugin
Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
public:
~QmlPreviewPlugin() override;
bool initialize(const QStringList &arguments, QString *errorString) override;
void extensionsInitialized() override;
ShutdownFlag aboutToShutdown() override;
@@ -101,28 +103,7 @@ signals:
void localeChanged(const QString &locale);
private:
void previewCurrentFile();
void onEditorChanged(Core::IEditor *editor);
void onEditorAboutToClose(Core::IEditor *editor);
void setDirty();
void addPreview(ProjectExplorer::RunControl *preview);
void removePreview(ProjectExplorer::RunControl *preview);
void attachToEditor();
void checkEditor();
void checkFile(const QString &fileName);
void triggerPreview(const QString &changedFile, const QByteArray &contents);
QThread m_parseThread;
QString m_previewedFile;
QmlPreviewFileLoader m_fileLoader = nullptr;
Core::IEditor *m_lastEditor = nullptr;
QmlPreviewRunControlList m_runningPreviews;
bool m_dirty = false;
QmlPreview::QmlPreviewFileClassifier m_fileClassifer = nullptr;
float m_zoomFactor = -1.0;
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
QString m_locale;
std::unique_ptr<ProjectExplorer::RunWorkerFactory> m_runWorkerFactory;
class QmlPreviewPluginPrivate *d = nullptr;
};
} // namespace Internal