diff options
author | Rafael Roquetto <rafael.roquetto.qnx@kdab.com> | 2012-10-16 19:01:51 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-30 16:34:21 (GMT) |
commit | 343f559bc7dd345ff8b03ddc8695bfe124310f6b (patch) | |
tree | d47d194b85303982fe44c9a3007ab5c00b341a6f /tools | |
parent | 09264c709ea68e585c1f8c479095ebf8420e6e11 (diff) | |
download | Qt-343f559bc7dd345ff8b03ddc8695bfe124310f6b.zip Qt-343f559bc7dd345ff8b03ddc8695bfe124310f6b.tar.gz Qt-343f559bc7dd345ff8b03ddc8695bfe124310f6b.tar.bz2 |
Support other platform names on configure.exe
Added three new methods, which are meant to be used internally to
configureapp.cpp:
- int platform(): returns an integer representing a platform
- QString platformName(): returns the platform name string to be used when
displaying the license agreement.
- QString qpaPlatformName(): returns the value to be defined as
QT_QPA_DEFAULT_PLATFORM_NAME.
Currently supported names are Windows, Windows CE, QNX, Blackberry, and
Symbian*.
Default platform name is "Windows".
* Symbian is not present on the original Qt5 patch. Symbian
is not supported on Qt5.
cherry-picked from qt5 b87c5cff24229b1bcc77ac68699f2f03acabc9e7
Change-Id: I6a97e00d59cce36804c857aa57c5754a2f6277db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/configure/configureapp.cpp | 72 | ||||
-rw-r--r-- | tools/configure/configureapp.h | 5 |
2 files changed, 68 insertions, 9 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 21131b6..80dacb3 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -62,6 +62,14 @@ QT_BEGIN_NAMESPACE +enum Platforms { + WINDOWS, + WINDOWS_CE, + QNX, + BLACKBERRY, + SYMBIAN +}; + std::ostream &operator<<(std::ostream &s, const QString &val) { s << val.toLocal8Bit().data(); return s; @@ -3543,6 +3551,9 @@ void Configure::generateConfigfiles() if (dictionary[ "QT_SXE" ] == "no") tmpStream<<"#define QT_NO_SXE"<<endl; + if (dictionary[ "QPA" ] == "yes") + tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\""<<endl; + tmpStream.flush(); tmpFile.flush(); @@ -4335,15 +4346,7 @@ bool Configure::showLicense(QString orgLicenseFile) void Configure::readLicense() { - if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") && - (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince"))) - dictionary["PLATFORM NAME"] = "Qt for Windows CE"; - else if (dictionary.value("XQMAKESPEC").startsWith("symbian")) - dictionary["PLATFORM NAME"] = "Qt for Symbian"; - else if (dictionary["QPA"] == "yes") - dictionary["PLATFORM NAME"] = "Qt for QPA"; - else - dictionary["PLATFORM NAME"] = "Qt for Windows"; + dictionary["PLATFORM NAME"] = platformName(); dictionary["LICENSE FILE"] = sourcePath; bool openSource = false; @@ -4472,6 +4475,57 @@ bool Configure::isOk() return (dictionary[ "DONE" ] != "error"); } +QString Configure::platformName() const +{ + switch (platform()) { + default: + case WINDOWS: + return QLatin1String("Qt for Windows"); + case WINDOWS_CE: + return QLatin1String("Qt for Windows CE"); + case QNX: + return QLatin1String("Qt for QNX"); + case BLACKBERRY: + return QLatin1String("Qt for Blackberry"); + case SYMBIAN: + return QLatin1String("Qt for Symbian"); + } +} + +QString Configure::qpaPlatformName() const +{ + switch (platform()) { + default: + case WINDOWS: + case WINDOWS_CE: + return QLatin1String("windows"); + case QNX: + return QLatin1String("qnx"); + case BLACKBERRY: + return QLatin1String("blackberry"); + } +} + +int Configure::platform() const +{ + const QString qMakeSpec = dictionary.value("QMAKESPEC"); + const QString xQMakeSpec = dictionary.value("XQMAKESPEC"); + + if ((qMakeSpec.startsWith("wince") || xQMakeSpec.startsWith("wince"))) + return WINDOWS_CE; + + if (xQMakeSpec.contains("qnx")) + return QNX; + + if (xQMakeSpec.contains("blackberry")) + return BLACKBERRY; + + if (xQMakeSpec.startsWith("symbian")) + return SYMBIAN; + + return WINDOWS; +} + bool Configure::filesDiffer(const QString &fn1, const QString &fn2) { diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index d3f4ca1..0ad020d 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -101,6 +101,11 @@ public: ProjectType projectType( const QString& proFileName ); bool isDone(); bool isOk(); + + int platform() const; + QString platformName() const; + QString qpaPlatformName() const; + private: // Our variable dictionaries QMap<QString,QString> dictionary; |