summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorA-Team <ateam@pad.test.qt.nokia.com>2010-09-24 22:00:19 (GMT)
committerA-Team <ateam@pad.test.qt.nokia.com>2010-09-24 22:00:19 (GMT)
commit81d25b1c69dc186eaa3d3993e74ae132cc8f582a (patch)
tree7034202e9b2108c2d0ced275448e8ececf816612 /src/corelib/global
parent84d278501a19eaccf9a77cccd95ca5d17a2dcd2b (diff)
parentf28d3e2f6c09abe7629779a8b10f3caa9007c468 (diff)
downloadQt-81d25b1c69dc186eaa3d3993e74ae132cc8f582a.zip
Qt-81d25b1c69dc186eaa3d3993e74ae132cc8f582a.tar.gz
Qt-81d25b1c69dc186eaa3d3993e74ae132cc8f582a.tar.bz2
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/global.pri3
-rw-r--r--src/corelib/global/qglobal.cpp81
-rw-r--r--src/corelib/global/qglobal.h4
3 files changed, 57 insertions, 31 deletions
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 260ed59..4800716 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -24,3 +24,6 @@ linux*:!static:!linux-armcc:!linux-gcce {
prog=$$quote(if (/program interpreter: (.*)]/) { print $1; })
DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
}
+
+# Compensate for lack of platform defines in Symbian3 and Symbian4
+symbian: DEFINES += SYMBIAN_VERSION_$$upper($$replace(SYMBIAN_VERSION,\\.,_))
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 401af85..3291fe7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -86,7 +86,8 @@
# include "private/qcore_symbian_p.h"
_LIT(qt_S60Filter, "Series60v?.*.sis");
-_LIT(qt_S60SystemInstallDir, "z:\\system\\install\\");
+_LIT(qt_symbianFilter, "Symbianv*.sis");
+_LIT(qt_symbianSystemInstallDir, "z:\\system\\install\\");
#endif
QT_BEGIN_NAMESPACE
@@ -1813,12 +1814,12 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion()
#endif
#ifdef Q_OS_SYMBIAN
-static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1);
+static QSysInfo::SymbianVersion cachedSymbianVersion = QSysInfo::SymbianVersion(-1);
-QSysInfo::S60Version QSysInfo::s60Version()
+QSysInfo::SymbianVersion QSysInfo::symbianVersion()
{
- if (cachedS60Version != -1)
- return cachedS60Version;
+ if (cachedSymbianVersion != -1)
+ return cachedSymbianVersion;
// Use pure Symbian code, because if done using QDir, there will be a call back
// to this method, resulting doing this expensive operation twice before the cache kicks in.
@@ -1826,7 +1827,22 @@ QSysInfo::S60Version QSysInfo::s60Version()
RFs rfs = qt_s60GetRFs();
TFindFile fileFinder(rfs);
CDir* contents;
- TInt err = fileFinder.FindWildByDir(qt_S60Filter, qt_S60SystemInstallDir, contents);
+
+ // Check for Symbian4
+ TInt err = fileFinder.FindWildByDir(qt_symbianFilter, qt_symbianSystemInstallDir, contents);
+ if (err == KErrNone) {
+ QScopedPointer<CDir> contentsDeleter(contents);
+ err = contents->Sort(EDescending|ESortByName);
+ if (err == KErrNone && contents->Count() > 0 && (*contents)[0].iName.Length() >= 9) {
+ TInt major = (*contents)[0].iName[8] - '0';
+ if (major == 4) {
+ return cachedSymbianVersion = SV_SF_4;
+ }
+ }
+ }
+
+ // Check for S60 and Symbian3 platforms, which use older .sis naming scheme
+ err = fileFinder.FindWildByDir(qt_S60Filter, qt_symbianSystemInstallDir, contents);
if (err == KErrNone) {
QScopedPointer<CDir> contentsDeleter(contents);
err = contents->Sort(EDescending|ESortByName);
@@ -1835,19 +1851,19 @@ QSysInfo::S60Version QSysInfo::s60Version()
TInt minor = (*contents)[0].iName[11] - '0';
if (major == 3) {
if (minor == 1) {
- return cachedS60Version = SV_S60_3_1;
+ return cachedSymbianVersion = SV_9_2;
} else if (minor == 2) {
- return cachedS60Version = SV_S60_3_2;
+ return cachedSymbianVersion = SV_9_3;
}
} else if (major == 5) {
if (minor == 0) {
- return cachedS60Version = SV_S60_5_0;
+ return cachedSymbianVersion = SV_9_4;
}
else if (minor == 1) {
- return cachedS60Version = SV_S60_5_1;
+ return cachedSymbianVersion = SV_SF_2;
}
else if (minor == 2) {
- return cachedS60Version = SV_S60_5_2;
+ return cachedSymbianVersion = SV_SF_3;
}
}
}
@@ -1855,33 +1871,40 @@ QSysInfo::S60Version QSysInfo::s60Version()
# ifdef Q_CC_NOKIAX86
// Some emulator environments may not contain the version specific .sis files, so
- // simply hardcode the version on those environments.
+ // simply hardcode the version on those environments. Note that can't use
+ // SYMBIAN_VERSION_* defines for S60 3.x/5.0 platforms, as they do not define them
+ // right anyway in case .sis files are not found.
# if defined(__SERIES60_31__)
- return cachedS60Version = SV_S60_3_1;
+ return cachedSymbianVersion = SV_9_2;
# elif defined(__S60_32__)
- return cachedS60Version = SV_S60_3_2;
+ return cachedSymbianVersion = SV_9_3;
# elif defined(__S60_50__)
- return cachedS60Version = SV_S60_5_0;
+ return cachedSymbianVersion = SV_9_4;
+# elif defined(SYMBIAN_VERSION_SYMBIAN3)
+ return cachedSymbianVersion = SV_SF_3;
+# elif defined(SYMBIAN_VERSION_SYMBIAN4)
+ return cachedSymbianVersion = SV_SF_4;
# endif
# endif
//If reaching here, it was not possible to determine the version
- return cachedS60Version = SV_S60_Unknown;
+ return cachedSymbianVersion = SV_Unknown;
}
-QSysInfo::SymbianVersion QSysInfo::symbianVersion()
+
+QSysInfo::S60Version QSysInfo::s60Version()
{
- switch (s60Version()) {
- case SV_S60_3_1:
- return SV_9_2;
- case SV_S60_3_2:
- return SV_9_3;
- case SV_S60_5_0:
- return SV_9_4;
- case SV_S60_5_1:
- return SV_SF_2;
- case SV_S60_5_2:
- return SV_SF_3;
+ switch (symbianVersion()) {
+ case SV_9_2:
+ return SV_S60_3_1;
+ case SV_9_3:
+ return SV_S60_3_2;
+ case SV_9_4:
+ return SV_S60_5_0;
+ case SV_SF_2:
+ return SV_S60_5_1;
+ case SV_SF_3:
+ return SV_S60_5_2;
default:
- return SV_Unknown;
+ return SV_S60_Unknown;
}
}
#endif // ifdef Q_OS_SYMBIAN
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d04133b..6ef15d4 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1515,7 +1515,7 @@ public:
#endif
#ifdef Q_OS_SYMBIAN
enum SymbianVersion {
- SV_Unknown = 0x0000,
+ SV_Unknown = 1000000, // Assume unknown is something newer than what is supported
//These are the Symbian Ltd versions 9.2-9.4
SV_9_2 = 10,
SV_9_3 = 20,
@@ -1529,7 +1529,7 @@ public:
static SymbianVersion symbianVersion();
enum S60Version {
SV_S60_None = 0,
- SV_S60_Unknown = 1,
+ SV_S60_Unknown = SV_Unknown,
SV_S60_3_1 = SV_9_2,
SV_S60_3_2 = SV_9_3,
SV_S60_5_0 = SV_9_4,