1 | // Copyright (C) 2018 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | |
5 | #ifndef QQMLPREVIEWCLIENT_P_H |
6 | #define QQMLPREVIEWCLIENT_P_H |
7 | |
8 | // |
9 | // W A R N I N G |
10 | // ------------- |
11 | // |
12 | // This file is not part of the Qt API. It exists purely as an |
13 | // implementation detail. This header file may change from version to |
14 | // version without notice, or even be removed. |
15 | // |
16 | // We mean it. |
17 | // |
18 | |
19 | #include <private/qqmldebugclient_p.h> |
20 | #include <private/qqmldebugconnection_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQmlPreviewClientPrivate; |
25 | class QQmlPreviewClient : public QQmlDebugClient |
26 | { |
27 | Q_OBJECT |
28 | Q_DECLARE_PRIVATE(QQmlPreviewClient) |
29 | public: |
30 | enum Command { |
31 | File, |
32 | Load, |
33 | Request, |
34 | Error, |
35 | Rerun, |
36 | Directory, |
37 | ClearCache, |
38 | Zoom, |
39 | Fps |
40 | }; |
41 | |
42 | struct FpsInfo { |
43 | quint16 numSyncs = 0; |
44 | quint16 minSync = std::numeric_limits<quint16>::max(); |
45 | quint16 maxSync = 0; |
46 | quint16 totalSync = 0; |
47 | |
48 | quint16 numRenders = 0; |
49 | quint16 minRender = std::numeric_limits<quint16>::max(); |
50 | quint16 maxRender = 0; |
51 | quint16 totalRender = 0; |
52 | }; |
53 | |
54 | QQmlPreviewClient(QQmlDebugConnection *parent); |
55 | void messageReceived(const QByteArray &message) override; |
56 | |
57 | void sendDirectory(const QString &path, const QStringList &entries); |
58 | void sendFile(const QString &path, const QByteArray &contents); |
59 | void sendError(const QString &path); |
60 | |
61 | void triggerLoad(const QUrl &url); |
62 | void triggerRerun(); |
63 | void triggerZoom(float factor); |
64 | |
65 | Q_SIGNALS: |
66 | void request(const QString &path); |
67 | void error(const QString &message); |
68 | void fps(const FpsInfo &info); |
69 | }; |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // QQMLPREVIEWCLIENT_P_H |
74 | |