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
4#ifndef QQMLPREVIEWFILEENGINE_H
5#define QQMLPREVIEWFILEENGINE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19
20#include <QtCore/qpointer.h>
21#include <private/qabstractfileengine_p.h>
22#include <private/qfsfileengine_p.h>
23#include <QtCore/qbuffer.h>
24
25#include <memory>
26
28
29class QQmlPreviewFileEngine : public QAbstractFileEngine
30{
31public:
32 QQmlPreviewFileEngine(const QString &file, const QString &absolute,
33 QQmlPreviewFileLoader *loader);
34
35 void setFileName(const QString &file) override;
36
37 bool open(QIODevice::OpenMode flags, std::optional<QFile::Permissions> permissions) override;
38 bool close() override;
39 qint64 size() const override;
40 qint64 pos() const override;
41 bool seek(qint64) override;
42 qint64 read(char *data, qint64 maxlen) override;
43
44 FileFlags fileFlags(FileFlags type) const override;
45 QString fileName(QAbstractFileEngine::FileName file) const override;
46 uint ownerId(FileOwner) const override;
47
48 IteratorUniquePtr beginEntryList(const QString &path, QDirListing::IteratorFlags filters,
49 const QStringList &filterNames) override;
50 IteratorUniquePtr endEntryList() override;
51
52 // Forwarding to fallback if exists
53 bool flush() override;
54 bool syncToDisk() override;
55 bool isSequential() const override;
56 bool remove() override;
57 bool copy(const QString &newName) override;
58 bool rename(const QString &newName) override;
59 bool renameOverwrite(const QString &newName) override;
60 bool link(const QString &newName) override;
61 bool mkdir(const QString &dirName, bool createParentDirectories,
62 std::optional<QFile::Permissions> permissions = std::nullopt) const override;
63 bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
64 bool setSize(qint64 size) override;
65 bool caseSensitive() const override;
66 bool isRelativePath() const override;
67 bool setPermissions(uint perms) override;
68 QByteArray id() const override;
69 QString owner(FileOwner) const override;
70 QDateTime fileTime(QFile::FileTime time) const override;
71 int handle() const override;
72 qint64 readLine(char *data, qint64 maxlen) override;
73 qint64 write(const char *data, qint64 len) override;
74 bool extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) override;
75 bool supportsExtension(Extension extension) const override;
76
77private:
78 void load() const;
79
80 QString m_name;
81 QString m_absolute;
82 QPointer<QQmlPreviewFileLoader> m_loader;
83
84 mutable QBuffer m_contents;
85 mutable QStringList m_entries;
86 mutable std::unique_ptr<QAbstractFileEngine> m_fallback;
87 mutable QQmlPreviewFileLoader::Result m_result = QQmlPreviewFileLoader::Unknown;
88};
89
91{
93public:
95 std::unique_ptr<QAbstractFileEngine> create(const QString &fileName) const override;
96
97private:
98 QPointer<QQmlPreviewFileLoader> m_loader;
99};
100
101
102
103QT_END_NAMESPACE
104
105#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
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static QString translationIdString(const QQmlTranslation::QsTrData &data)