From 557623cc4f22295e5e89462dfdff20d78b3b9cdc Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 4 Sep 2020 09:45:26 +0200 Subject: Rename QLibraryInfo::location() to path() As per ### Qt6 comment. Also rename the LibraryLocation enum to LibraryPath. Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128 Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 21 ++++++++++++++------- src/corelib/global/qlibraryinfo.h | 12 +++++++++--- src/corelib/io/qloggingregistry.cpp | 2 +- src/corelib/io/qsettings.cpp | 4 ++-- src/corelib/kernel/qcoreapplication.cpp | 2 +- 5 files changed, 27 insertions(+), 14 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1380b08372..f2601babfc 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -356,7 +356,7 @@ QVersionNumber QLibraryInfo::version() noexcept #endif // QT_BUILD_QMAKE /* - * To add a new entry in QLibrary::LibraryLocation, add it to the enum above the bootstrapped values and: + * To add a new entry in QLibrary::LibraryPath, add it to the enum above the bootstrapped values and: * - add its relative path in the qtConfEntries[] array below * (the key is what appears in a qt.conf file) * - add a property name in qmake/property.cpp propList[] array @@ -636,12 +636,19 @@ static QString getPrefix( } #endif // QT_BUILD_QMAKE_BOOTSTRAP +/*! \fn QString QLibraryInfo::path(LibraryPath loc) + \obsolete Use path() instead. + + Returns the path specified by \a loc. + \sa path() +*/ + /*! - Returns the location specified by \a loc. + Returns the path specified by \a p. */ -QString -QLibraryInfo::location(LibraryLocation loc) +QString QLibraryInfo::path(LibraryPath p) { + const LibraryPath loc = p; #ifdef QT_BUILD_QMAKE // ends inside rawLocation ! QString ret = rawLocation(loc, FinalPaths); @@ -653,7 +660,7 @@ QLibraryInfo::location(LibraryLocation loc) } QString -QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) +QLibraryInfo::rawLocation(LibraryPath loc, PathGroup group) { #endif // QT_BUILD_QMAKE, started inside location ! QString ret; @@ -803,7 +810,7 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) baseDir = prefixFromAppDirHelper(); } else { // we make any other path absolute to the prefix directory - baseDir = location(PrefixPath); + baseDir = path(PrefixPath); } #endif // QT_BUILD_QMAKE ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret); @@ -842,7 +849,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName) } /*! - \enum QLibraryInfo::LibraryLocation + \enum QLibraryInfo::LibraryPath \keyword library location diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 4a14a9728a..3ceb20336b 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -59,7 +59,7 @@ public: static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION; #endif - enum LibraryLocation + enum LibraryPath { PrefixPath = 0, DocumentationPath, @@ -90,10 +90,16 @@ public: #endif SettingsPath = 100 }; - static QString location(LibraryLocation); // ### Qt 6: consider renaming it to path() + static QString path(LibraryPath p); +#if QT_DEPRECATED_SINCE(6, 0) + using LibraryLocation = LibraryPath; + QT_DEPRECATED_VERSION_X_6_0("Use path()") + static QString location(LibraryLocation location) + { return path(location); } +#endif #ifdef QT_BUILD_QMAKE enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths }; - static QString rawLocation(LibraryLocation, PathGroup); + static QString rawLocation(LibraryPath, PathGroup); static void reload(); static void sysrootify(QString *path); #endif diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 91d3e5a73c..e1e35a07ed 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -324,7 +324,7 @@ void QLoggingRegistry::initializeRules() #if !defined(QT_BOOTSTRAPPED) // get rules from Qt data configuration path const QString qtConfigPath - = QDir(QLibraryInfo::location(QLibraryInfo::DataPath)).absoluteFilePath(configFileName); + = QDir(QLibraryInfo::path(QLibraryInfo::DataPath)).absoluteFilePath(configFileName); qr = loadRulesFromFile(qtConfigPath); #endif diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 0a62ffb2be..42a0f38be3 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -992,11 +992,11 @@ static std::unique_lock initDefaultPaths(std::unique_lockisEmpty()) { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index c89197e219..dd52242c6f 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2706,7 +2706,7 @@ QStringList QCoreApplication::libraryPathsLocked() } #endif // Q_OS_DARWIN - QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); + QString installPathPlugins = QLibraryInfo::path(QLibraryInfo::PluginsPath); if (QFile::exists(installPathPlugins)) { // Make sure we convert from backslashes to slashes. installPathPlugins = QDir(installPathPlugins).canonicalPath(); -- cgit v1.2.3