mirror of https://github.com/qt/qtbase.git
remove library version matching from qt.conf
this feature was introduced in feb 2005 by Sam with this comment: > I have implemented a versioning into the keys and do environment > expansion there as well, these aren't immediately usefull but Marius > and I agreed that distributors will probably want such features at > times. The versioning fallbacks will be usefull to us over time no > doubt. imo the versioning is a contestant for the most useless feature ever: - (linux) distributors couldn't care less - they simply configure qtcore correctly. additionally, the packaging policies state that no config files should live in the binary dir at all, so no qt.conf for them. - ISVs don't care, because they ship their software with a particular qt version anyway. - SDK distributors don't care, because it doesn't solve any real problem for them: a) they will isolate the (qmake) versions and b) a distinction based on version number (as opposed to build configuration) is utterly useless in the first place. i left in the variable expansion, as it could at least theoretically be useful for creating relocatable packages. debatable - the file it easy enough to modify at installation time. Change-Id: Ida8a50b16d55d8d8613d1a98a51df56753f6a6e3 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
efde205586
commit
568e714fdf
|
@ -348,71 +348,8 @@ QLibraryInfo::location(LibraryLocation loc)
|
||||||
QSettings *config = QLibraryInfoPrivate::configuration();
|
QSettings *config = QLibraryInfoPrivate::configuration();
|
||||||
config->beginGroup(QLatin1String("Paths"));
|
config->beginGroup(QLatin1String("Paths"));
|
||||||
|
|
||||||
QString subKey;
|
ret = config->value(key, defaultValue).toString();
|
||||||
{
|
|
||||||
/*
|
|
||||||
find the child group whose version number is closest
|
|
||||||
to the library version. for example and we have the
|
|
||||||
following groups:
|
|
||||||
|
|
||||||
Paths
|
|
||||||
Paths/4.0
|
|
||||||
Paths/4.1.2
|
|
||||||
Paths/4.2.5
|
|
||||||
Paths/5
|
|
||||||
|
|
||||||
if QT_VERSION is 4.0.1, then we use 'Paths/4.0'
|
|
||||||
if QT_VERSION is 4.1.5, then we use 'Paths/4.1.2'
|
|
||||||
if QT_VERSION is 4.6.3, then we use 'Paths/4.2.5'
|
|
||||||
if QT_VERSION is 6.0.2, then we use 'Paths/5'
|
|
||||||
|
|
||||||
note: any of the trailing version numbers may be
|
|
||||||
omitted (in which case, they default to zero),
|
|
||||||
i.e. 4 == 4.0.0, 4.1 == 4.1.0, and so on
|
|
||||||
*/
|
|
||||||
enum {
|
|
||||||
QT_MAJOR = ((QT_VERSION >> 16) & 0xFF),
|
|
||||||
QT_MINOR = ((QT_VERSION >> 8) & 0xFF),
|
|
||||||
QT_PATCH = (QT_VERSION & 0xFF)
|
|
||||||
};
|
|
||||||
int maj = 0, min = 0, pat = 0;
|
|
||||||
QStringList children = config->childGroups();
|
|
||||||
for(int child = 0; child < children.size(); ++child) {
|
|
||||||
QString cver = children.at(child);
|
|
||||||
QStringList cver_list = cver.split(QLatin1Char('.'));
|
|
||||||
if(cver_list.size() > 0 && cver_list.size() < 4) {
|
|
||||||
bool ok;
|
|
||||||
int cmaj = -1, cmin = -1, cpat = -1;
|
|
||||||
cmaj = cver_list[0].toInt(&ok);
|
|
||||||
if(!ok || cmaj < 0)
|
|
||||||
continue;
|
|
||||||
if(cver_list.size() >= 2) {
|
|
||||||
cmin = cver_list[1].toInt(&ok);
|
|
||||||
if(!ok)
|
|
||||||
continue;
|
|
||||||
if(cmin < 0)
|
|
||||||
cmin = -1;
|
|
||||||
}
|
|
||||||
if(cver_list.size() >= 3) {
|
|
||||||
cpat = cver_list[2].toInt(&ok);
|
|
||||||
if(!ok)
|
|
||||||
continue;
|
|
||||||
if(cpat < 0)
|
|
||||||
cpat = -1;
|
|
||||||
}
|
|
||||||
if((cmaj >= maj && cmaj <= QT_MAJOR) &&
|
|
||||||
(cmin == -1 || (cmin >= min && cmin <= QT_MINOR)) &&
|
|
||||||
(cpat == -1 || (cpat >= pat && cpat <= QT_PATCH)) &&
|
|
||||||
config->contains(cver + QLatin1Char('/') + key)) {
|
|
||||||
subKey = cver + QLatin1Char('/');
|
|
||||||
maj = cmaj;
|
|
||||||
min = cmin;
|
|
||||||
pat = cpat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = config->value(subKey + key, defaultValue).toString();
|
|
||||||
// expand environment variables in the form $(ENVVAR)
|
// expand environment variables in the form $(ENVVAR)
|
||||||
int rep;
|
int rep;
|
||||||
QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
|
QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
|
||||||
|
|
Loading…
Reference in New Issue