qmlpreview: prepare plugin to have an external client

- export the plugin andd add client creator API to be able to implement
  external debugtranslationclients
- use the private/qqmldebugtranslationprotocol_p.h from Qt5::QmlDebugPrivate
- have a basic client implementation which cares about changing language
- remove out of date elide warning implementation
- remove old ui
- remove the menu entry

The old client implementation is incompatible with the will be introduced
service and there was never an officially released compatible service.
Therefore we can remove the old client implementation without causing
any harm.

Change-Id: I26b5e8a99ba30ae6377443b3fffb05901b1cac28
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2021-03-25 02:45:40 +01:00
parent d8737ffff4
commit 0108a85c82
18 changed files with 64 additions and 1014 deletions

View File

@@ -25,6 +25,9 @@
#pragma once
#include "qmlpreview_global.h"
#include "qmldebugtranslationclient.h"
#include <projectexplorer/runcontrol.h>
#include <extensionsystem/iplugin.h>
#include <qmljs/qmljsdialect.h>
@@ -34,16 +37,17 @@
namespace Core { class IEditor; }
namespace QmlDebug { class QmlDebugConnection; }
namespace QmlPreview {
typedef bool (*QmlPreviewFileClassifier) (const QString &);
typedef QByteArray (*QmlPreviewFileLoader)(const QString &, bool *);
typedef void (*QmlPreviewFpsHandler)(quint16[8]);
typedef QList<ProjectExplorer::RunControl *> QmlPreviewRunControlList;
typedef std::function<std::unique_ptr<QmlDebugTranslationClient>(QmlDebug::QmlDebugConnection *)> QmlDebugTranslationClientCreator;
namespace Internal {
class QmlPreviewPlugin : public ExtensionSystem::IPlugin
class QMLPREVIEW_EXPORT QmlPreviewPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlPreview.json")
@@ -59,7 +63,6 @@ class QmlPreviewPlugin : public ExtensionSystem::IPlugin
WRITE setFpsHandler NOTIFY fpsHandlerChanged)
Q_PROPERTY(float zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
Q_PROPERTY(QString localeIsoCode READ localeIsoCode WRITE setLocaleIsoCode NOTIFY localeIsoCodeChanged)
Q_PROPERTY(bool elideWarning READ elideWarning WRITE changeElideWarning NOTIFY elideWarningChanged)
public:
~QmlPreviewPlugin() override;
@@ -87,8 +90,7 @@ public:
QString localeIsoCode() const;
void setLocaleIsoCode(const QString &localeIsoCode);
bool elideWarning() const;
void changeElideWarning(bool elideWarning);
void setQmlDebugTranslationClientCreator(QmlDebugTranslationClientCreator creator);
signals:
void checkDocument(const QString &name, const QByteArray &contents,
@@ -104,13 +106,11 @@ signals:
void zoomFactorChanged(float zoomFactor);
void localeIsoCodeChanged(const QString &localeIsoCode);
void elideWarningChanged(bool elideWarning);
private:
class QmlPreviewPluginPrivate *d = nullptr;
};
} // namespace Internal
} // namespace QmlPreview
Q_DECLARE_METATYPE(QmlPreview::QmlPreviewFileLoader)