diff options
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h | 60 |
1 files changed, 15 insertions, 45 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h index 9a40b6360c..1705e89b5d 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlpreviewfileengine.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QML preview debug service. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QQMLPREVIEWFILEENGINE_H #define QQMLPREVIEWFILEENGINE_H @@ -53,10 +17,13 @@ #include "qqmlpreviewfileloader.h" +#include <QtCore/qpointer.h> #include <private/qabstractfileengine_p.h> #include <private/qfsfileengine_p.h> #include <QtCore/qbuffer.h> +#include <memory> + QT_BEGIN_NAMESPACE class QQmlPreviewFileEngine : public QAbstractFileEngine @@ -67,7 +34,7 @@ public: void setFileName(const QString &file) override; - bool open(QIODevice::OpenMode flags) override ; + bool open(QIODevice::OpenMode flags, std::optional<QFile::Permissions> permissions) override; bool close() override; qint64 size() const override; qint64 pos() const override; @@ -78,8 +45,9 @@ public: QString fileName(QAbstractFileEngine::FileName file) const override; uint ownerId(FileOwner) const override; - Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; - Iterator *endEntryList() override; + IteratorUniquePtr beginEntryList(const QString &path, QDir::Filters filters, + const QStringList &filterNames) override; + IteratorUniquePtr endEntryList() override; // Forwarding to fallback if exists bool flush() override; @@ -90,7 +58,8 @@ public: bool rename(const QString &newName) override; bool renameOverwrite(const QString &newName) override; bool link(const QString &newName) override; - bool mkdir(const QString &dirName, bool createParentDirectories) const override; + bool mkdir(const QString &dirName, bool createParentDirectories, + std::optional<QFile::Permissions> permissions = std::nullopt) const override; bool rmdir(const QString &dirName, bool recurseParentDirectories) const override; bool setSize(qint64 size) override; bool caseSensitive() const override; @@ -99,7 +68,7 @@ public: bool setPermissions(uint perms) override; QByteArray id() const override; QString owner(FileOwner) const override; - QDateTime fileTime(FileTime time) const override; + QDateTime fileTime(QFile::FileTime time) const override; int handle() const override; qint64 readLine(char *data, qint64 maxlen) override; qint64 write(const char *data, qint64 len) override; @@ -115,15 +84,16 @@ private: mutable QBuffer m_contents; mutable QStringList m_entries; - mutable QScopedPointer<QAbstractFileEngine> m_fallback; + mutable std::unique_ptr<QAbstractFileEngine> m_fallback; mutable QQmlPreviewFileLoader::Result m_result = QQmlPreviewFileLoader::Unknown; }; class QQmlPreviewFileEngineHandler : public QAbstractFileEngineHandler { + Q_DISABLE_COPY_MOVE(QQmlPreviewFileEngineHandler) public: QQmlPreviewFileEngineHandler(QQmlPreviewFileLoader *loader); - QAbstractFileEngine *create(const QString &fileName) const override; + std::unique_ptr<QAbstractFileEngine> create(const QString &fileName) const override; private: QPointer<QQmlPreviewFileLoader> m_loader; |