File indexing completed on 2025-01-19 04:25:15
0001 /* 0002 * Replacement fot QT Bindings that were removed from QT5 0003 * Copyright (C) 2020 Pedro de Carvalho Gomes <pedrogomes81@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 #ifndef CORERESOURCE_H 0020 #define CORERESOURCE_H 0021 0022 #include "QtBinding.h" 0023 0024 #include <QObject> 0025 #include <QResource> 0026 0027 namespace QtBindings 0028 { 0029 namespace Core 0030 { 0031 class Resource : public QObject, public QResource, public QtBindings::Base<Resource> 0032 { 0033 Q_OBJECT 0034 public: 0035 Q_INVOKABLE Resource(const QString &file=QString(), const QLocale &locale=QLocale()); 0036 Q_INVOKABLE Resource(const Resource& resource); 0037 Q_INVOKABLE static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString()); 0038 Q_INVOKABLE static bool registerResource(const uchar *rccData, const QString &resourceRoot=QString()); 0039 Q_INVOKABLE static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString()); 0040 Q_INVOKABLE static bool unregisterResource(const uchar *rccData, const QString &resourceRoot=QString()); 0041 Resource &operator=(const Resource &other); 0042 public slots: 0043 QString absoluteFilePath() const; 0044 const uchar *data() const; 0045 QString fileName() const; 0046 QResource::Compression compressionAlgorithm() const; 0047 bool isValid() const; 0048 QDateTime lastModified() const; 0049 QLocale locale() const; 0050 void setFileName(const QString &file); 0051 void setLocale(const QLocale &locale); 0052 qint64 size() const; 0053 }; 0054 } 0055 } 0056 Q_DECLARE_METATYPE(QtBindings::Core::Resource) 0057 #endif //CORERESOURCE_H