summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-07-07 19:29:23 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-01-16 03:11:51 +0100
commitbbded12df3a7465dc72872e69b7b34b815e7e81c (patch)
tree7a97d6ad4946a2a0f3508f3b72bade87a6ab6fd8 /src/corelib/io
parent23f663cad6a68a7af8e8adde4f25b3cae5f14b0e (diff)
Update QFileSelector to use QSysInfo better
This reduces a bit of string duplication by relying on the constants defined in qglobal.cpp and detection via uname(2), in addition to adding the Linux distribution name as a selector. Change-Id: I64a46a0fc552c399db787125b1b32aae5c50056f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfileselector.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index 95fa970b2d..b95e628b0f 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -145,7 +145,9 @@ QFileSelectorPrivate::QFileSelectorPrivate()
Selectors normally available are
\list
\li platform, any of the following strings which match the platform the application is running
- on: android, blackberry, ios, osx, darwin, mac, linux, wince, unix, windows.
+ on (list not exhaustive): android, blackberry, ios, osx, darwin, mac, linux, wince, unix,
+ windows. On Linux, if it can be determined, the name of the distribution too, like debian,
+ fedora or opensuse.
\li locale, same as QLocale::system().name().
\endlist
@@ -351,10 +353,10 @@ QStringList QFileSelectorPrivate::platformSelectors()
// similar, but not identical to QSysInfo::osType
QStringList ret;
#if defined(Q_OS_WIN)
+ // can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case
ret << QStringLiteral("windows");
-# if defined(Q_OS_WINCE)
- ret << QStringLiteral("wince");
-# elif defined(Q_OS_WINRT)
+ ret << QSysInfo::kernelType(); // "wince" and "winnt"
+# if defined(Q_OS_WINRT)
ret << QStringLiteral("winrt");
# if defined(Q_OS_WINPHONE)
ret << QStringLiteral("winphone");
@@ -362,25 +364,16 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
#elif defined(Q_OS_UNIX)
ret << QStringLiteral("unix");
-# if defined(Q_OS_ANDROID)
- ret << QStringLiteral("android");
-# elif defined(Q_OS_BLACKBERRY)
- ret << QStringLiteral("blackberry");
-# elif defined(Q_OS_QNX)
- ret << QStringLiteral("qnx");
-# elif defined(Q_OS_LINUX)
- ret << QStringLiteral("linux");
-# elif defined(Q_OS_DARWIN)
- ret << QStringLiteral("darwin");
- ret << QStringLiteral("mac"); // compatibility synonym
-# if defined(Q_OS_IOS)
- ret << QStringLiteral("ios");
-# elif defined(Q_OS_OSX)
- ret << QStringLiteral("osx");
-# endif
-# else
+# if !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY)
+ // we don't want "linux" for Android or "qnx" for Blackberry here
ret << QSysInfo::kernelType();
+# ifdef Q_OS_MAC
+ ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
+# endif
# endif
+ QString productName = QSysInfo::productType();
+ if (productName != QLatin1String("unknown"))
+ ret << productName; // "opensuse", "fedora", "osx", "ios", "blackberry", "android"
#endif
return ret;
}