Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlpreviewfileengine.h
Go to the documentation of this file.
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// Qt-Security score:significant
4
5#ifndef QQMLPREVIEWFILEENGINE_H
6#define QQMLPREVIEWFILEENGINE_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
20
21#include <QtCore/qpointer.h>
22#include <private/qabstractfileengine_p.h>
23#include <private/qfsfileengine_p.h>
24#include <QtCore/qbuffer.h>
25
26#include <memory>
27
29
30class QQmlPreviewFileEngine : public QAbstractFileEngine
31{
32public:
33 QQmlPreviewFileEngine(const QString &file, const QString &absolute,
34 QQmlPreviewFileLoader *loader);
35
36 void setFileName(const QString &file) override;
37
38 bool open(QIODevice::OpenMode flags, std::optional<QFile::Permissions> permissions) override;
39 bool close() override;
40 qint64 size() const override;
41 qint64 pos() const override;
42 bool seek(qint64) override;
43 qint64 read(char *data, qint64 maxlen) override;
44
45 FileFlags fileFlags(FileFlags type) const override;
46 QString fileName(QAbstractFileEngine::FileName file) const override;
47 uint ownerId(FileOwner) const override;
48
49 IteratorUniquePtr beginEntryList(const QString &path, QDirListing::IteratorFlags filters,
50 const QStringList &filterNames) override;
51 IteratorUniquePtr endEntryList() override;
52
53 // Forwarding to fallback if exists
54 bool flush() override;
55 bool syncToDisk() override;
56 bool isSequential() const override;
57 bool remove() override;
58 bool copy(const QString &newName) override;
59 bool rename(const QString &newName) override;
60 bool renameOverwrite(const QString &newName) override;
61 bool link(const QString &newName) override;
62 bool mkdir(const QString &dirName, bool createParentDirectories,
63 std::optional<QFile::Permissions> permissions = std::nullopt) const override;
64 bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
65 bool setSize(qint64 size) override;
66 bool caseSensitive() const override;
67 bool isRelativePath() const override;
68 bool setPermissions(uint perms) override;
69 QByteArray id() const override;
70 QString owner(FileOwner) const override;
71 QDateTime fileTime(QFile::FileTime time) const override;
72 int handle() const override;
73 qint64 readLine(char *data, qint64 maxlen) override;
74 qint64 write(const char *data, qint64 len) override;
75 bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) override;
76 bool supportsExtension(Extension extension) const override;
77
78private:
79 void load() const;
80
81 QString m_name;
82 QString m_absolute;
83 QPointer<QQmlPreviewFileLoader> m_loader;
84
85 mutable QBuffer m_contents;
86 mutable QStringList m_entries;
87 mutable std::unique_ptr<QAbstractFileEngine> m_fallback;
88 mutable QQmlPreviewFileLoader::Result m_result = QQmlPreviewFileLoader::Unknown;
89};
90
92{
94public:
96 std::unique_ptr<QAbstractFileEngine> create(const QString &fileName) const override;
97
98private:
99 QPointer<QQmlPreviewFileLoader> m_loader;
100};
101
102
103
104QT_END_NAMESPACE
105
106#endif // QQMLPREVIEWFILEENGINE_H
void messageReceived(const QByteArray &message) override
void foundTranslationBinding(const TranslationBindingInformation &translationBindingInformation) override
void engineAboutToBeAdded(QJSEngine *engine) override
void state(const QString &stateName)
void engineAboutToBeRemoved(QJSEngine *engine) override
QMultiMap< QObject *, TranslationBindingInformation > objectTranslationBindingMultiMap
QList< QPointer< QQuickItem > > translatableTextOccurrences
std::unique_ptr< QAbstractFileEngine > create(const QString &fileName) const override
If this file handler can handle fileName, this method creates a file engine and returns it wrapped in...
void dropCU(const QUrl &url)
void zoom(qreal newFactor)
QQuickItem * currentRootItem()
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void fps(const FpsInfo &info)
void removeEngine(QQmlEngine *engine)
void addEngine(QQmlEngine *engine)
void loadUrl(const QUrl &url)
bool operator==(const QQmlPreviewPosition::ScreenData &other) const
void loadWindowPositionSettings(const QUrl &url)
void takePosition(QWindow *window, InitializeState state=PositionInitialized)
void initLastSavedWindowPosition(QWindow *window)
void forwardRequest(const QString &file)
void drop(const QUrl &url)
void engineAboutToBeRemoved(QJSEngine *engine) override
QQmlPreviewServiceImpl(QObject *parent=nullptr)
void file(const QString &file, const QByteArray &contents)
void directory(const QString &file, const QStringList &entries)
void engineAboutToBeAdded(QJSEngine *engine) override
void forwardFps(const QQmlPreviewHandler::FpsInfo &frames)
void zoom(qreal factor)
static const QString s_key
void load(const QUrl &url)
void stateChanged(State state) override
void forwardError(const QString &error)
void messageReceived(const QByteArray &message) override
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static QString translationIdString(const QQmlTranslation::QsTrData &data)