Purge QResource of some deprecated API
Removed isCompressed(), deprecated since 5.15, and (since 5.13) addSearchPath() and searchPath(). Change-Id: I4b6fb8077c02bbe322334e474eaf0a2a7caf0004 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
7ce27430a7
commit
5a682b04ce
@ -623,29 +623,6 @@ bool QResource::isValid() const
|
|||||||
\sa isDir()
|
\sa isDir()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns \c true if the resource represents a file and the data backing it
|
|
||||||
is in a compressed format, false otherwise. If the data is compressed,
|
|
||||||
check compressionAlgorithm() to verify what algorithm to use to decompress
|
|
||||||
the data.
|
|
||||||
|
|
||||||
\note This function is deprecated and can be replaced with
|
|
||||||
\code
|
|
||||||
compressionAlgorithm() != NoCompression
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
\sa data(), compressionAlgorithm(), isFile()
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool QResource::isCompressed() const
|
|
||||||
{
|
|
||||||
return compressionAlgorithm() != NoCompression;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 5.13
|
\since 5.13
|
||||||
|
|
||||||
@ -797,50 +774,6 @@ QStringList QResource::children() const
|
|||||||
return d->children;
|
return d->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Use QDir::addSearchPath() with a prefix instead.
|
|
||||||
|
|
||||||
Adds \a path to the search paths searched in to find resources that are
|
|
||||||
not specified with an absolute path. The \a path must be an absolute
|
|
||||||
path (start with \c{/}).
|
|
||||||
|
|
||||||
The default search path is to search only in the root (\c{:/}). The last
|
|
||||||
path added will be consulted first upon next QResource creation.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
QResource::addSearchPath(const QString &path)
|
|
||||||
{
|
|
||||||
if (!path.startsWith(QLatin1Char('/'))) {
|
|
||||||
qWarning("QResource::addResourceSearchPath: Search paths must be absolute (start with /) [%ls]",
|
|
||||||
qUtf16Printable(path));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto locker = qt_scoped_lock(resourceMutex());
|
|
||||||
resourceSearchPaths()->prepend(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Use QDir::searchPaths() instead.
|
|
||||||
|
|
||||||
Returns the current search path list. This list is consulted when
|
|
||||||
creating a relative resource.
|
|
||||||
|
|
||||||
\sa QDir::addSearchPath(), QDir::setSearchPaths()
|
|
||||||
*/
|
|
||||||
|
|
||||||
QStringList
|
|
||||||
QResource::searchPaths()
|
|
||||||
{
|
|
||||||
const auto locker = qt_scoped_lock(resourceMutex());
|
|
||||||
return *resourceSearchPaths();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline uint QResourceRoot::hash(int node) const
|
inline uint QResourceRoot::hash(int node) const
|
||||||
{
|
{
|
||||||
if(!node) //root
|
if(!node) //root
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Copyright (C) 2019 Intel Corporation.
|
** Copyright (C) 2019 Intel Corporation.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
@ -80,17 +80,6 @@ public:
|
|||||||
QByteArray uncompressedData() const;
|
QByteArray uncompressedData() const;
|
||||||
QDateTime lastModified() const;
|
QDateTime lastModified() const;
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
|
||||||
QT_DEPRECATED_X("Use QDir::addSearchPath() instead")
|
|
||||||
static void addSearchPath(const QString &path);
|
|
||||||
QT_DEPRECATED_X("Use QDir::searchPaths() instead")
|
|
||||||
static QStringList searchPaths();
|
|
||||||
#endif
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 15)
|
|
||||||
QT_DEPRECATED_VERSION_X_5_15("Use QResource::compressionAlgorithm() instead")
|
|
||||||
bool isCompressed() const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
|
static bool registerResource(const QString &rccFilename, const QString &resourceRoot=QString());
|
||||||
static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());
|
static bool unregisterResource(const QString &rccFilename, const QString &resourceRoot=QString());
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
** Copyright (C) 2020 The Qt Company Ltd.
|
||||||
** Copyright (C) 2019 Intel Corporation.
|
** Copyright (C) 2019 Intel Corporation.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
@ -57,10 +57,6 @@ private slots:
|
|||||||
void checkStructure();
|
void checkStructure();
|
||||||
void searchPath_data();
|
void searchPath_data();
|
||||||
void searchPath();
|
void searchPath();
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
|
||||||
void searchPath_deprecated_data();
|
|
||||||
void searchPath_deprecated();
|
|
||||||
#endif
|
|
||||||
void doubleSlashInRoot();
|
void doubleSlashInRoot();
|
||||||
void setLocale();
|
void setLocale();
|
||||||
void lastModified();
|
void lastModified();
|
||||||
@ -540,48 +536,6 @@ void tst_QResourceEngine::searchPath()
|
|||||||
qf.close();
|
qf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 13)
|
|
||||||
|
|
||||||
void tst_QResourceEngine::searchPath_deprecated_data()
|
|
||||||
{
|
|
||||||
QTest::addColumn<QString>("searchPath");
|
|
||||||
QTest::addColumn<QString>("file");
|
|
||||||
QTest::addColumn<QByteArray>("expected");
|
|
||||||
|
|
||||||
QTest::newRow("no_search_path") << QString()
|
|
||||||
<< ":search_file.txt"
|
|
||||||
<< QByteArray("root\n");
|
|
||||||
QTest::newRow("path1") << "/searchpath1"
|
|
||||||
<< ":search_file.txt"
|
|
||||||
<< QByteArray("path1\n");
|
|
||||||
QTest::newRow("no_search_path2") << QString()
|
|
||||||
<< ":/search_file.txt"
|
|
||||||
<< QByteArray("root\n");
|
|
||||||
QTest::newRow("path2") << "/searchpath2"
|
|
||||||
<< ":search_file.txt"
|
|
||||||
<< QByteArray("path2\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void tst_QResourceEngine::searchPath_deprecated()
|
|
||||||
{
|
|
||||||
QFETCH(QString, searchPath);
|
|
||||||
QFETCH(QString, file);
|
|
||||||
QFETCH(QByteArray, expected);
|
|
||||||
|
|
||||||
if(!searchPath.isEmpty())
|
|
||||||
QDir::addResourceSearchPath(searchPath);
|
|
||||||
QFile qf(file);
|
|
||||||
QVERIFY(qf.open(QFile::ReadOnly));
|
|
||||||
QByteArray actual = qf.readAll();
|
|
||||||
|
|
||||||
actual.replace('\r', "");
|
|
||||||
|
|
||||||
QCOMPARE(actual, expected);
|
|
||||||
qf.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void tst_QResourceEngine::checkUnregisterResource_data()
|
void tst_QResourceEngine::checkUnregisterResource_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("rcc_file");
|
QTest::addColumn<QString>("rcc_file");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user