From 98f0b4668999d677d8bf91d57ac095d96e7a661c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 18 Nov 2013 10:31:42 +0200 Subject: [PATCH 01/24] Android: Use native platform menus. This is an Android only patch, a proper implementation will be pushed soon to stable branch. Task-number: QTBUG-29462 Task-number: QTBUG-33588 Change-Id: I3447c523b4533a768d7f95e4ae60541b09a7944f Reviewed-by: Christoph Schleifenbaum Reviewed-by: Marc Mutz Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/widgets/qmenu.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 3a4fd449c8e..0cbd1c720c3 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1834,6 +1834,14 @@ QSize QMenu::sizeHint() const void QMenu::popup(const QPoint &p, QAction *atAction) { Q_D(QMenu); + +#ifdef Q_OS_ANDROID + if (!d->platformMenu.isNull() && !testAttribute(Qt::WA_SetStyle)) { + d->platformMenu->showPopup(window()->windowHandle(), p, 0); + return; + } +#endif + if (d->scroll) { // reset scroll state from last popup if (d->scroll->scrollOffset) d->itemsDirty = 1; // sizeHint will be incorrect if there is previous scroll From 69a8c59b3ffe81f20cb5f1425d72cca8053a0527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:25:54 +0100 Subject: [PATCH 02/24] tst_QWindow: Set explicit window position to please qWaitForWindowActive qWaitForWindowActive waits until the timeout for the window to receive a non-0x0 position, even when it's active, just in case the WM sets the position as a response to focus-in. Change-Id: I748cce2747f406a8cdff556465175f02675fcd13 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index c4983f44628..bd5959786f8 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -843,7 +843,10 @@ void tst_QWindow::activateAndClose() { for (int i = 0; i < 10; ++i) { QWindow window; - window.show(); + // qWaitForWindowActive will block for the duration of + // of the timeout if the window is at 0,0 + window.setGeometry(QGuiApplication::primaryScreen()->availableGeometry().adjusted(1, 1, -1, -1)); + window.showNormal(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(qGuiApp->focusWindow(), &window); From eccd365ac544c0e24da86bfaf09d24130feb2e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:42:49 +0100 Subject: [PATCH 03/24] iOS: Don't enable kEAGLDrawablePropertyRetainedBacking We report our swap-behavior as QSurfaceFormat::DoubleBuffer, which means there's no point in using retained backing. This was a left-over from when we reported single-buffered swaps, which didn't work to well as clients would wrongly assume swap was not needed at all. Change-Id: Id26df2f8b282892c720d48cfe85eb9e010f1500d Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index e02f570634a..af429f9d65a 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -105,7 +105,7 @@ CAEAGLLayer *eaglLayer = static_cast(self.layer); eaglLayer.opaque = TRUE; eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, + [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; // Set up text input From dcd71a08972e9d6de73242ce8073de89a19f7c97 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 13 Nov 2013 13:23:09 +0100 Subject: [PATCH 04/24] Android: Remove usage of QObject::tr() Change-Id: I948d9fc36aa52d2d247a84b5d9b2cf949b93387d Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Paul Olav Tvete --- .../src/qandroidplatformdialoghelpers.cpp | 57 +++++++------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp index f9eb34751e0..f379402e18f 100644 --- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -63,64 +63,45 @@ void QAndroidPlatformMessageDialogHelper::exec() static QString standardButtonText(int sbutton) { - QString buttonText = 0; switch (sbutton) { case QMessageDialogOptions::Ok: - buttonText = QObject::tr("OK"); - break; + return QAndroidPlatformMessageDialogHelper::tr("OK"); case QMessageDialogOptions::Save: - buttonText = QObject::tr("Save"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Save"); case QMessageDialogOptions::Open: - buttonText = QObject::tr("Open"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Open"); case QMessageDialogOptions::Cancel: - buttonText = QObject::tr("Cancel"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Cancel"); case QMessageDialogOptions::Close: - buttonText = QObject::tr("Close"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Close"); case QMessageDialogOptions::Apply: - buttonText = QObject::tr("Apply"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Apply"); case QMessageDialogOptions::Reset: - buttonText = QObject::tr("Reset"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Reset"); case QMessageDialogOptions::Help: - buttonText = QObject::tr("Help"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Help"); case QMessageDialogOptions::Discard: - buttonText = QObject::tr("Discard"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Discard"); case QMessageDialogOptions::Yes: - buttonText = QObject::tr("Yes"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Yes"); case QMessageDialogOptions::YesToAll: - buttonText = QObject::tr("Yes to All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Yes to All"); case QMessageDialogOptions::No: - buttonText = QObject::tr("No"); - break; + return QAndroidPlatformMessageDialogHelper::tr("No"); case QMessageDialogOptions::NoToAll: - buttonText = QObject::tr("No to All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("No to All"); case QMessageDialogOptions::SaveAll: - buttonText = QObject::tr("Save All"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Save All"); case QMessageDialogOptions::Abort: - buttonText = QObject::tr("Abort"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Abort"); case QMessageDialogOptions::Retry: - buttonText = QObject::tr("Retry"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Retry"); case QMessageDialogOptions::Ignore: - buttonText = QObject::tr("Ignore"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Ignore"); case QMessageDialogOptions::RestoreDefaults: - buttonText = QObject::tr("Restore Defaults"); - break; + return QAndroidPlatformMessageDialogHelper::tr("Restore Defaults"); } // switch - return buttonText; + return QString(); } bool QAndroidPlatformMessageDialogHelper::show(Qt::WindowFlags windowFlags From 7faf1a73ef5d5e03eacee59c3254ad61cbc37428 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 18:36:15 +0100 Subject: [PATCH 05/24] initialize WHICH, AWK, PERL and MAKE a bit earlier have this option independent code out of the way before starting option processing. Change-Id: I5a08caeb25689b155c256ef82505c000112f5039 Reviewed-by: Thiago Macieira --- configure | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 116df1477bb..924a6d67ab6 100755 --- a/configure +++ b/configure @@ -53,6 +53,40 @@ relpath=`(cd "$relpath"; /bin/pwd)` # the current directory is the "build tree" or "object tree" outpath=`/bin/pwd` +# where to find which.. +unixtests="$relpath/config.tests/unix" +mactests="$relpath/config.tests/mac" +WHICH="$unixtests/which.test" + +PERL=`$WHICH perl 2>/dev/null` + +# find out which awk we want to use, prefer gawk, then nawk, then regular awk +AWK= +for e in gawk nawk awk; do + if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then + AWK=$e + break + fi +done + +# find a make command +if [ -z "$MAKE" ]; then + MAKE= + for mk in gmake make; do + if "$WHICH" $mk >/dev/null 2>&1; then + MAKE=`"$WHICH" $mk` + break + fi + done + if [ -z "$MAKE" ]; then + echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH." + echo >&2 "Cannot proceed." + exit 1 + fi + # export MAKE, we need it later in the config.tests + export MAKE +fi + #license file location LICENSE_FILE="$QT_LICENSE_FILE" [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license" @@ -2429,22 +2463,6 @@ esac # build tree initialization #------------------------------------------------------------------------------- -# where to find which.. -unixtests="$relpath/config.tests/unix" -mactests="$relpath/config.tests/mac" -WHICH="$unixtests/which.test" - -PERL=`$WHICH perl 2>/dev/null` - -# find out which awk we want to use, prefer gawk, then nawk, then regular awk -AWK= -for e in gawk nawk awk; do - if "$WHICH" $e >/dev/null 2>&1 && ( $e -f /dev/null /dev/null ) >/dev/null 2>&1; then - AWK=$e - break - fi -done - ### skip this if the user just needs help... if [ "$OPT_HELP" != "yes" ]; then @@ -2503,24 +2521,6 @@ if [ ! -d "${outpath}/lib/fonts" ]; then fi fi -# find a make command -if [ -z "$MAKE" ]; then - MAKE= - for mk in gmake make; do - if "$WHICH" $mk >/dev/null 2>&1; then - MAKE=`"$WHICH" $mk` - break - fi - done - if [ -z "$MAKE" ]; then - echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH." - echo >&2 "Cannot proceed." - exit 1 - fi - # export MAKE, we need it later in the config.tests - export MAKE -fi - fi ### help #------------------------------------------------------------------------------- From c9692fbd6e92db126ca1bf446be515666079e44d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 18:38:49 +0100 Subject: [PATCH 06/24] remove hacks to support solaris 2.[56] and aix < 5 moving dead code out of the way of further refactoring. Change-Id: If558406cdf13d61478634dd7eff644dc67b0e53d Reviewed-by: Thiago Macieira --- configure | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/configure b/configure index 924a6d67ab6..94eb0bfd6a1 100755 --- a/configure +++ b/configure @@ -2836,14 +2836,6 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then exit 2 fi -if [ "$UNAME_SYSTEM" = "SunOS" ]; then - # Solaris 2.5 and 2.6 have libposix4, which was renamed to librt for Solaris 7 and up - if echo $UNAME_RELEASE | grep "^5\.[5|6]" >/dev/null 2>&1; then - sed -e "s,-lrt,-lposix4," "$XQMAKESPEC/qmake.conf" > "$XQMAKESPEC/qmake.conf.new" - mv "$XQMAKESPEC/qmake.conf.new" "$XQMAKESPEC/qmake.conf" - fi -fi - if [ "$CFG_RTOS_ENABLED" = "no" ]; then case `basename "$XPLATFORM"` in qnx-* | vxworks-*) @@ -3943,18 +3935,6 @@ elif [ "$Edition" != "OpenSource" ]; then done fi -# this should be moved somewhere else -case "$PLATFORM" in -aix-*) - AIX_VERSION=`uname -v` - if [ "$AIX_VERSION" -lt "5" ]; then - QMakeVar add QMAKE_LIBS_X11 -lbind - fi - ;; -*) - ;; -esac - #------------------------------------------------------------------------------- # generate qconfig.cpp #------------------------------------------------------------------------------- From d1990a71323cad1f431969506d8b1c1dfc2fa0ac Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 19:42:41 +0100 Subject: [PATCH 07/24] don't automatically display help on error it's entirely pointless to flood the user with information and force him to scroll back when he most likely just made a typo. apart from that, this reduces the data dependencies, thus easing further refactoring. Change-Id: I7b24274d453de54a4f02481a66d77e27d4ab0657 Reviewed-by: Thiago Macieira --- configure | 9 ++------- tools/configure/configureapp.cpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/configure b/configure index 94eb0bfd6a1..f8e3b9e68bb 100755 --- a/configure +++ b/configure @@ -1357,7 +1357,6 @@ while [ "$#" -gt 0 ]; do esac if [ "$UNKNOWN_ARG" = "yes" ]; then echo "$1: unknown argument" - OPT_HELP=yes ERROR=yes shift continue @@ -2254,7 +2253,6 @@ while [ "$#" -gt 0 ]; do fi if [ "$ERROR" = "yes" ]; then echo "$CURRENT_OPT: unknown argument" - OPT_HELP=yes fi ;; v|verbose) @@ -2429,10 +2427,10 @@ while [ "$#" -gt 0 ]; do esac if [ "$UNKNOWN_OPT" = "yes" ]; then echo "${CURRENT_OPT}: invalid command-line switch" - OPT_HELP=yes ERROR=yes fi done +[ "x$ERROR" = "xyes" ] && exit 1 # update QT_CONFIG to show our current predefined configuration CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h @@ -2454,7 +2452,7 @@ minimal|small|medium|large|full) echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" echo >&2 " or" echo >&2 " $CFG_QCONFIG_PATH" - OPT_HELP=yes + exit 1 fi fi esac @@ -3285,9 +3283,7 @@ fi # help - interactive parts of the script _after_ this section please #------------------------------------------------------------------------------- -# next, emit a usage message if something failed. if [ "$OPT_HELP" = "yes" ]; then - [ "x$ERROR" = "xyes" ] && echo if [ "$CFG_NIS" = "no" ]; then NSY=" " NSN="*" @@ -3781,7 +3777,6 @@ EOF fi - [ "x$ERROR" = "xyes" ] && exit 1 exit 0 fi # Help diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ff7d8d93bc1..57c22a23cc2 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -384,7 +384,7 @@ void Configure::parseCmdLine() configCmdLine.clear(); reloadCmdLine(); } else { - dictionary[ "HELP" ] = "yes"; + dictionary[ "DONE" ] = "error"; } i = 0; } @@ -1304,7 +1304,7 @@ void Configure::parseCmdLine() } else { - dictionary[ "HELP" ] = "yes"; + dictionary[ "DONE" ] = "error"; cout << "Unknown option " << configCmdLine.at(i) << endl; break; } @@ -1324,7 +1324,7 @@ void Configure::parseCmdLine() if (dictionary["QMAKESPEC"].toLower() == "features" || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) { - dictionary[ "HELP" ] = "yes"; + dictionary[ "DONE" ] = "error"; if (dictionary ["QMAKESPEC_FROM"] == "commandline") { cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl; } else if (dictionary ["QMAKESPEC_FROM"] == "env") { @@ -1362,10 +1362,10 @@ void Configure::parseCmdLine() const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive); if (family.isEmpty()) { - dictionary["HELP"] = "yes"; + dictionary[ "DONE" ] = "error"; cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl; } else if (family.size() > 1) { - dictionary["HELP"] = "yes"; + dictionary[ "DONE" ] = "error"; cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl; @@ -1380,7 +1380,7 @@ void Configure::parseCmdLine() // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well if (dictionary.contains("XQMAKESPEC") && !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) { - dictionary["HELP"] = "yes"; + dictionary[ "DONE" ] = "error"; cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl; } } @@ -1432,7 +1432,8 @@ void Configure::parseCmdLine() for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it) qtConfig.removeAll(*it); - if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes")) + if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes") + && (dictionary[ "DONE" ] != "error")) saveCmdLine(); } @@ -1461,7 +1462,7 @@ void Configure::validateArgs() if (!QFileInfo::exists(cfgpath)) { cfgpath = QFileInfo(dictionary["QCONFIG"]).absoluteFilePath(); if (!QFileInfo::exists(cfgpath)) { - dictionary[ "HELP" ] = "yes"; + dictionary[ "DONE" ] = "error"; cout << "No such configuration \"" << qPrintable(dictionary["QCONFIG"]) << "\"" << endl ; return; } @@ -2825,7 +2826,6 @@ void Configure::generateOutputVars() cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl << "be defined as an environment variable, or specified as an" << endl << "argument with -platform" << endl; - dictionary[ "HELP" ] = "yes"; QStringList winPlatforms; QDir mkspecsDir(sourcePath + "/mkspecs"); From 862fbd98cd04e71e574897696cc5f3687c15974e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 18:50:00 +0100 Subject: [PATCH 08/24] move some option validations to more relevant places minimizing the amount of code executed before platform detection. Change-Id: Ib2c0d97ce5040ced8c4c41d74f428fe7d0f75664 Reviewed-by: Thiago Macieira --- configure | 82 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/configure b/configure index f8e3b9e68bb..7d642fc0179 100755 --- a/configure +++ b/configure @@ -2432,31 +2432,6 @@ while [ "$#" -gt 0 ]; do done [ "x$ERROR" = "xyes" ] && exit 1 -# update QT_CONFIG to show our current predefined configuration -CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h -case "$CFG_QCONFIG" in -minimal|small|medium|large|full) - # these are a sequence of increasing functionality - for c in minimal small medium large full; do - QT_CONFIG="$QT_CONFIG $c-config" - [ "$CFG_QCONFIG" = $c ] && break - done - [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH= - ;; -*) - # not known to be sufficient for anything - if [ ! -f "$CFG_QCONFIG_PATH" ]; then - CFG_QCONFIG_PATH=`"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` - if [ ! -f "$CFG_QCONFIG_PATH" ]; then - echo >&2 "Error: configuration file not found:" - echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" - echo >&2 " or" - echo >&2 " $CFG_QCONFIG_PATH" - exit 1 - fi - fi -esac - #------------------------------------------------------------------------------- # build tree initialization #------------------------------------------------------------------------------- @@ -2484,19 +2459,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." fi -if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then - echo - echo "WARNING: -debug-and-release is not supported outside of Mac OS X." - echo "Qt can be built in release mode with separate debug information, so" - echo "-debug-and-release is not necessary anymore" - echo -fi - -if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then - echo "Error: -no-xkbcommon is not supported on XCB platform plugin." - exit 101 -fi - if [ "$CFG_SILENT" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG silent" fi @@ -2522,7 +2484,7 @@ fi fi ### help #------------------------------------------------------------------------------- -# auto-detect all that hasn't been specified in the arguments +# platform detection #------------------------------------------------------------------------------- if [ -z "$PLATFORM" ]; then @@ -2715,6 +2677,48 @@ case "$XPLATFORM" in ;; esac +#------------------------------------------------------------------------------- +# command line and environment validation +#------------------------------------------------------------------------------- + +# update QT_CONFIG to show our current predefined configuration +CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h +case "$CFG_QCONFIG" in +minimal|small|medium|large|full) + # these are a sequence of increasing functionality + for c in minimal small medium large full; do + QT_CONFIG="$QT_CONFIG $c-config" + [ "$CFG_QCONFIG" = $c ] && break + done + [ "$CFG_QCONFIG" = full ] && CFG_QCONFIG_PATH= + ;; +*) + # not known to be sufficient for anything + if [ ! -f "$CFG_QCONFIG_PATH" ]; then + CFG_QCONFIG_PATH=`"$relpath/config.tests/unix/makeabs" "${CFG_QCONFIG}"` + if [ ! -f "$CFG_QCONFIG_PATH" ]; then + echo >&2 "Error: configuration file not found:" + echo >&2 " $relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h" + echo >&2 " or" + echo >&2 " $CFG_QCONFIG_PATH" + exit 1 + fi + fi +esac + +if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then + echo + echo "WARNING: -debug-and-release is not supported outside of Mac OS X." + echo "Qt can be built in release mode with separate debug information, so" + echo "-debug-and-release is not necessary anymore" + echo +fi + +if [ "$CFG_XCB" != "no" ] && [ "$CFG_XKBCOMMON" = "no" ]; then + echo "Error: -no-xkbcommon is not supported on XCB platform plugin." + exit 101 +fi + if [ "$XPLATFORM_ANDROID" = "yes" ]; then if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then case $PLATFORM in From 925899dcd646237a379189197e94c3c2b67b7ac5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 13 Nov 2013 14:59:30 +0100 Subject: [PATCH 09/24] do CONFIG+=silent after configure tests it's counterproductive to do it earlier: it's passed down to configure tests, which then log less info than they could. but primarily, this serves the purpose of minimizing the amount of code executed before platform detection. Change-Id: Iff19b8555de19d048ea6d9341af965871b314c54 Reviewed-by: Thiago Macieira --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 7d642fc0179..5b2ff1b9a67 100755 --- a/configure +++ b/configure @@ -2459,10 +2459,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." fi -if [ "$CFG_SILENT" = "yes" ]; then - QMAKE_CONFIG="$QMAKE_CONFIG silent" -fi - # if the source tree is different from the build tree, # symlink or copy part of the sources if [ "$OPT_SHADOW" = "yes" ]; then @@ -5846,6 +5842,10 @@ fi [ "$CFG_CXX11" = "yes" ] && QT_CONFIG="$QT_CONFIG c++11" +if [ "$CFG_SILENT" = "yes" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG silent" +fi + # disable accessibility if [ "$CFG_ACCESSIBILITY" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ACCESSIBILITY" From 558b0a24d6a7b9a12fd5e970be2a6743eae2cafc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 19:26:07 +0100 Subject: [PATCH 10/24] make help independent from options and environment the help would echo the defaults adjusted by command line overrides and environment variables for some options. this was entirely pointless. it also printed the result of the os detection, which was mostly useless. but the primary reason for doing this is reducing data dependencies, so the code can be moved up. not touching the windows configure, as it's a lot harder and currently that behavior isn't in the way of what i need to do. Change-Id: Ide62119091c8494fb3bea2b607f140268f057919 Reviewed-by: Thiago Macieira --- configure | 174 +++++++++++------------------------------------------- 1 file changed, 33 insertions(+), 141 deletions(-) diff --git a/configure b/configure index 5b2ff1b9a67..59c855927ea 100755 --- a/configure +++ b/configure @@ -3284,114 +3284,6 @@ fi #------------------------------------------------------------------------------- if [ "$OPT_HELP" = "yes" ]; then - if [ "$CFG_NIS" = "no" ]; then - NSY=" " - NSN="*" - else - NSY="*" - NSN=" " - fi - if [ "$CFG_CUPS" = "no" ]; then - CUY=" " - CUN="*" - else - CUY="*" - CUN=" " - fi - if [ "$CFG_ICONV" = "no" ]; then - CIY=" " - CIN="*" - else - CIY="*" - CIN=" " - fi - if [ "$CFG_LARGEFILE" = "no" ]; then - LFSY=" " - LFSN="*" - else - LFSY="*" - LFSN=" " - fi - if [ "$CFG_PRECOMPILE" = "auto" ] || [ "$CFG_PRECOMPILE" = "no" ]; then - PHY=" " - PHN="*" - else - PHY="*" - PHN=" " - fi - - if [ "$CFG_XCB" = "no" ]; then - XCBY=" " - XCBN="*" - else - XCBY="*" - XCBN=" " - fi - - if [ "$CFG_EGLFS" = "no" ]; then - EGLFSY=" " - EGLFSN="*" - else - EGLFSY="*" - EGLFSN=" " - fi - - if [ "$CFG_DIRECTFB" = "no" ]; then - DFBY=" " - DFBN="*" - else - DFBY="*" - DFBN=" " - fi - - if [ "$CFG_LINUXFB" = "no" ]; then - LFBY=" " - LFBN="*" - else - LFBY="*" - LFBN=" " - fi - - if [ "$CFG_KMS" = "no" ]; then - KMSY=" " - KMSN="*" - else - KMSY="*" - KMSN=" " - fi - - if [ "$CFG_XINPUT2" = "no" ]; then - X2Y=" " - X2N="*" - else - X2Y="*" - X2N=" " - fi - - if [ "$CFG_DBUS" = "no" ]; then - DBY=" " - DBN="+" - else - DBY="+" - DBN=" " - fi - - if [ "$CFG_SEPARATE_DEBUG_INFO" = "no" ]; then - SBY=" " - SBN="*" - else - SBY="*" - SBN=" " - fi - - if [ "$CFG_GLIB" = "no" ]; then - GBY=" " - GBN="+" - else - GBY="+" - GBN=" " - fi - cat < ...... This will install everything relative to - (default $QT_INSTALL_PREFIX) + (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active) -extprefix ... When -sysroot is used, install everything to , rather than into SYSROOT/PREFIX. @@ -3423,7 +3315,7 @@ Installation options: -plugindir ...... Plugins will be installed to (default ARCHDATADIR/plugins) -libexecdir ..... Program executables will be installed to - (default ARCHDATADIR/$QT_INSTALL_LIBEXECS_DIRNAME) + (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) -importdir ...... Imports for QML1 will be installed to (default ARCHDATADIR/imports) -qmldir ......... Imports for QML2 will be installed to @@ -3496,7 +3388,7 @@ Configure options: at run time. Possible values for : - [ $CFG_SQL_AVAILABLE ] + [$CFG_SQL_AVAILABLE ] -system-sqlite ..... Use sqlite from the operating system. @@ -3507,7 +3399,7 @@ Configure options: + -qml-debug ......... Build the QML debugging support. -platform target ... The operating system and compiler you are building - on ($PLATFORM). + on (default detected from host system). See the README file for a list of supported operating systems and compilers. @@ -3624,15 +3516,15 @@ Additional options: * -no-optimized-qmake ... Do not build qmake optimized. -optimized-qmake ...... Build qmake optimized. - $NSN -no-nis ............ Do not compile NIS support. - $NSY -nis ............... Compile NIS support. + -no-nis ............ Do not compile NIS support. + * -nis ............... Compile NIS support. - $CUN -no-cups ........... Do not compile CUPS support. - $CUY -cups .............. Compile CUPS support. + -no-cups ........... Do not compile CUPS support. + * -cups .............. Compile CUPS support. Requires cups/cups.h and libcups.so.2. - $CIN -no-iconv .......... Do not compile support for iconv(3). - $CIY -iconv ............. Compile support for iconv(3). + -no-iconv .......... Do not compile support for iconv(3). + * -iconv ............. Compile support for iconv(3). -no-icu ............ Do not compile support for ICU libraries. + -icu ............... Compile support for ICU libraries. @@ -3643,11 +3535,11 @@ Additional options: -no-strip .......... Do not strip binaries and libraries of unneeded symbols. * -strip ............. Strip binaries and libraries of unneeded symbols when installing. - $PHN -no-pch ............ Do not use precompiled header support. - $PHY -pch ............... Use precompiled header support. + * -no-pch ............ Do not use precompiled header support. + -pch ............... Use precompiled header support. - $DBN -no-dbus ........... Do not compile the Qt D-Bus module. - $DBY -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. + -no-dbus ........... Do not compile the Qt D-Bus module. + + -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. -reduce-relocations ..... Reduce relocations in the libraries through extra @@ -3660,23 +3552,23 @@ Additional options: -device-option ... Add device specific options for the device mkspec (experimental) - $SBN -no-separate-debug-info . Do not store debug information in a separate file. - $SBY -separate-debug-info .... Strip debug information into a separate file. + -no-separate-debug-info . Do not store debug information in a separate file. + * -separate-debug-info .... Strip debug information into a separate file. - $XCBN -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. - $XCBY -xcb ............... Compile Xcb support. + -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. + * -xcb ............... Compile Xcb support. - $EGLFSN -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. - $EGLFSY -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support). + -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. + * -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support). - $DFBN -no-directfb ....... Do not compile DirectFB support. - $DFBY -directfb .......... Compile DirectFB support. + -no-directfb ....... Do not compile DirectFB support. + * -directfb .......... Compile DirectFB support. - $LFBN -no-linuxfb ........ Do not compile Linux Framebuffer support. - $LFBY -linuxfb ........... Compile Linux Framebuffer support. + -no-linuxfb ........ Do not compile Linux Framebuffer support. + * -linuxfb ........... Compile Linux Framebuffer support. - $KMSN -no-kms ............ Do not compile KMS support. - $KMSY -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support). + -no-kms ............ Do not compile KMS support. + * -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support). -qpa ......... Sets the default QPA platform (e.g xcb, cocoa, windows). @@ -3708,15 +3600,15 @@ Additional options: -warnings-are-errors Make warnings be treated as errors (enabled if -developer-build is active) - $GBN -no-glib ........... Do not compile Glib support. - $GBY -glib .............. Compile Glib support. + -no-glib ........... Do not compile Glib support. + + -glib .............. Compile Glib support. EOF if [ "$XPLATFORM_MAEMO" = "yes" ]; then cat << EOF - $X2N -no-xinput2 ........ Do not compile XInput2 support. - $X2Y -xinput2 ........... Compile XInput2 support. + -no-xinput2 ........ Do not compile XInput2 support. + * -xinput2 ........... Compile XInput2 support. EOF @@ -3757,16 +3649,16 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then Android options: -android-sdk path .............. The Android SDK root path. - (default $CFG_DEFAULT_ANDROID_SDK_ROOT) + (default \$ANDROID_SDK_ROOT) -android-ndk path .............. The Android NDK root path. - (default $CFG_DEFAULT_ANDROID_NDK_ROOT) + (default \$ANDROID_NDK_ROOT) -android-ndk-platform .......... Sets the android platform (default $CFG_DEFAULT_ANDROID_PLATFORM) -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) - (default $CFG_DEFAULT_ANDROID_NDK_HOST) + (default \$ANDROID_NDK_HOST) -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) From 829b1d13b225e87b8a385397e2b53c7a9f8cda9e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 28 Oct 2013 14:11:50 +0100 Subject: [PATCH 11/24] Ensure Qt::WA_Mapped is set in case of obscured native windows. Task-number: QTBUG-33520 Change-Id: I51f9b4634be29fd32f4ad9cc8b5d3e10b19ea2f5 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwidget_qpa.cpp | 2 +- src/widgets/kernel/qwidgetwindow.cpp | 4 +++ .../widgets/kernel/qwidget/tst_qwidget.cpp | 4 +++ .../qwidget_window/tst_qwidget_window.cpp | 28 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index ae8a0b25b9f..18045e3b09d 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -506,9 +506,9 @@ void QWidgetPrivate::show_sys() QWindow *window = q->windowHandle(); + q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); - q->setAttribute(Qt::WA_Mapped); if (q->isWindow() && q->windowModality() != Qt::NonModal && window) { // add our window to the modal window list QGuiApplicationPrivate::showModalWindow(window); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index e977ab3d6fe..22e15e23fe2 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -713,6 +713,10 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event break; } + // Note that widgetState == m_widget->data->window_state when triggered by QWidget::setWindowState(). + if (!(widgetState & Qt::WindowMinimized)) + m_widget->setAttribute(Qt::WA_Mapped); + // Sent event if the state changed (that is, it is not triggered by // QWidget::setWindowState(), which also sends an event to the widget). if (widgetState != int(m_widget->data->window_state)) { diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 03d6c1cdbd3..7bb5fd4614c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -7192,6 +7192,10 @@ void tst_QWidget::hideOpaqueChildWhileHidden() #if !defined(Q_OS_WINCE) void tst_QWidget::updateWhileMinimized() { +#ifdef Q_OS_UNIX + if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity")) + QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason. +#endif // Q_OS_UNIX UpdateWidget widget; // Filter out activation change and focus events to avoid update() calls in QWidget. widget.updateOnActivationChangeAndFocusIn = false; diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 1bbbfd610e8..f5585c583a0 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -91,6 +91,8 @@ private slots: void tst_showWithoutActivating(); void tst_paintEventOnSecondShow(); + void obscuredNativeMapped(); + #ifndef QT_NO_DRAGANDDROP void tst_dnd(); #endif @@ -368,6 +370,32 @@ void tst_QWidget_window::tst_paintEventOnSecondShow() QTRY_VERIFY(w.paintEventReceived); } +// QTBUG-33520, a toplevel fully obscured by native children should still receive Qt::WA_Mapped +void tst_QWidget_window::obscuredNativeMapped() +{ + enum { size = 200 }; + + QWidget topLevel; + topLevel.setWindowFlags(Qt::FramelessWindowHint); + QWidget *child = new QWidget(&topLevel); + child->resize(size, size); + topLevel.resize(size, size); + topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(size /2 , size / 2)); + child->winId(); + topLevel.show(); + QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped)); +#if defined(Q_OS_MAC) + QSKIP("This test fails on Mac."); // Minimized windows are not unmapped for some reason. +#elif defined(Q_OS_UNIX) + if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity")) + QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason. +#endif // Q_OS_UNIX + topLevel.setWindowState(Qt::WindowMinimized); + QTRY_VERIFY(!topLevel.testAttribute(Qt::WA_Mapped)); + topLevel.setWindowState(Qt::WindowNoState); + QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped)); +} + #ifndef QT_NO_DRAGANDDROP /* DnD test for QWidgetWindow (handleDrag*Event() functions). From 078ad536c8180559c87183c0429d8e61ee4f72d8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 13 Nov 2013 15:15:07 +0100 Subject: [PATCH 12/24] print help right after parsing command line is the only sane thing, and now that there are no dependencies on anything else any more (in particular anything slow or side effect laden), we can actually do it. this removes some nasty OPT_HELP checks spread throughout the code, thus further reducing data dependencies. Change-Id: Ib0a00e1514e2aa25ec3b527ba9f5719e3214640b Reviewed-by: Joerg Bornemann --- configure | 775 ++++++++++++++++++++++++++---------------------------- 1 file changed, 371 insertions(+), 404 deletions(-) diff --git a/configure b/configure index 59c855927ea..17b8b517789 100755 --- a/configure +++ b/configure @@ -2433,11 +2433,378 @@ done [ "x$ERROR" = "xyes" ] && exit 1 #------------------------------------------------------------------------------- -# build tree initialization +# help - interactive parts of the script _after_ this section please #------------------------------------------------------------------------------- -### skip this if the user just needs help... -if [ "$OPT_HELP" != "yes" ]; then +if [ "$OPT_HELP" = "yes" ]; then + cat < ...... This will install everything relative to + (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active) + + -extprefix ... When -sysroot is used, install everything to , + rather than into SYSROOT/PREFIX. + + -hostprefix [dir] .. Tools and libraries needed when developing + applications are installed in [dir]. If [dir] is + not given, the current build directory will be used. + (default EXTPREFIX) + + You may use these to separate different parts of the install: + + -bindir ......... User executables will be installed to + (default PREFIX/bin) + -headerdir ...... Headers will be installed to + (default PREFIX/include) + -libdir ......... Libraries will be installed to + (default PREFIX/lib) + -archdatadir .... Arch-dependent data used by Qt will be installed to + (default PREFIX) + -plugindir ...... Plugins will be installed to + (default ARCHDATADIR/plugins) + -libexecdir ..... Program executables will be installed to + (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) + -importdir ...... Imports for QML1 will be installed to + (default ARCHDATADIR/imports) + -qmldir ......... Imports for QML2 will be installed to + (default ARCHDATADIR/qml) + -datadir ........ Arch-independent data used by Qt will be installed to + (default PREFIX) + -docdir ......... Documentation will be installed to + (default DATADIR/doc) + -translationdir . Translations of Qt programs will be installed to + (default DATADIR/translations) + -sysconfdir ..... Settings used by Qt programs will be looked for in + (default PREFIX/etc/xdg) + -examplesdir .... Examples will be installed to + (default PREFIX/examples) + -testsdir ....... Tests will be installed to + (default PREFIX/tests) + + -hostbindir .. Host executables will be installed to + (default HOSTPREFIX/bin) + -hostlibdir .. Host libraries will be installed to + (default HOSTPREFIX/lib) + -hostdatadir . Data used by qmake will be installed to + (default HOSTPREFIX) + +Configure options: + + The defaults (*) are usually acceptable. A plus (+) denotes a default value + that needs to be evaluated. If the evaluation succeeds, the feature is + included. Here is a short explanation of each option: + + * -release ........... Compile and link Qt with debugging turned off. + -debug ............. Compile and link Qt with debugging turned on. + -debug-and-release . Compile and link two versions of Qt, with and without + debugging turned on (Mac only). + + -force-debug-info .. Create symbol files for release builds. + + -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) + + -opensource ........ Compile and link the Open-Source Edition of Qt. + -commercial ........ Compile and link the Commercial Edition of Qt. + + -confirm-license ... Automatically acknowledge the license (use with + either -opensource or -commercial) + + -no-c++11 .......... Do not compile Qt with C++11 support enabled. + + -c++11 ............. Compile Qt with C++11 support enabled. + + * -shared ............ Create and use shared Qt libraries. + -static ............ Create and use static Qt libraries. + + * -process ........... Generate only a top-level Makefile. + -fully-process ..... Generate Makefiles for the entire Qt tree. + -dont-process ...... Do not generate any Makefiles. + + -no-largefile ...... Disables large file support. + + -largefile ......... Enables Qt to access files larger than 4 GB. + + -no-accessibility .. Do not compile Accessibility support. + Disabling accessibility is not recommended, as it will break QStyle + and may break other internal parts of Qt. + With this switch you create a source incompatible version of Qt, + which is unsupported. + + -accessibility ..... Compile Accessibility support. + + -no-sql- ... Disable SQL entirely. + -qt-sql- ... Enable a SQL in the Qt SQL module, by default + none are turned on. + -plugin-sql- Enable SQL as a plugin to be linked to + at run time. + + Possible values for : + [$CFG_SQL_AVAILABLE ] + + -system-sqlite ..... Use sqlite from the operating system. + + -no-javascript-jit . Do not build the JavaScriptCore JIT compiler. + + -javascript-jit .... Build the JavaScriptCore JIT compiler. + + -no-qml-debug ...... Do not build the in-process QML debugging support. + + -qml-debug ......... Build the QML debugging support. + + -platform target ... The operating system and compiler you are building + on (default detected from host system). + + See the README file for a list of supported + operating systems and compilers. + + -no-sse2 ........... Do not compile with use of SSE2 instructions. + -no-sse3 ........... Do not compile with use of SSE3 instructions. + -no-ssse3 .......... Do not compile with use of SSSE3 instructions. + -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. + -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. + -no-avx ............ Do not compile with use of AVX instructions. + -no-avx2 ........... Do not compile with use of AVX2 instructions. + -no-neon ........... Do not compile with use of NEON instructions. + -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. + -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. + + -qtnamespace Wraps all Qt library code in 'namespace {...}'. + -qtlibinfix Renames all libQt*.so to libQt*.so. + + -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. + -gcov .............. Instrument Qt with the GCov code coverage tool. + + -D ........ Add an explicit define to the preprocessor. + -I ........ Add an explicit include path. + -L ........ Add an explicit library path. + + + -pkg-config ........ Use pkg-config to detect include and library paths. By default, + configure determines whether to use pkg-config or not with + some heuristics such as checking the environment variables. + -no-pkg-config ..... Disable use of pkg-config. + -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability + detection heuristic). + + -help, -h .......... Display this information. + +Third Party Libraries: + + -qt-zlib ........... Use the zlib bundled with Qt. + + -system-zlib ....... Use zlib from the operating system. + See http://www.gzip.org/zlib + + -no-gif ............ Do not compile GIF reading support. + + -no-libpng ......... Do not compile PNG support. + -qt-libpng ......... Use the libpng bundled with Qt. + + -system-libpng ..... Use libpng from the operating system. + See http://www.libpng.org/pub/png + + -no-libjpeg ........ Do not compile JPEG support. + -qt-libjpeg ........ Use the libjpeg bundled with Qt. + + -system-libjpeg .... Use libjpeg from the operating system. + See http://www.ijg.org + + -no-freetype ....... Do not compile in Freetype2 support. + -qt-freetype ....... Use the libfreetype bundled with Qt. + + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active). + See http://www.freetype.org + + * -no-harfbuzz ....... Do not compile HarfBuzz-NG support. + -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt + to do text shaping. It can still be disabled + by setting QT_HARFBUZZ environment variable to "old". + -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system + to do text shaping. It can still be disabled + by setting QT_HARFBUZZ environment variable to "old". + + -no-openssl ........ Do not compile support for OpenSSL. + + -openssl ........... Enable run-time OpenSSL support. + -openssl-linked .... Enabled linked OpenSSL support. + + -qt-pcre ........... Use the PCRE library bundled with Qt. + + -system-pcre ....... Use the PCRE library from the operating system. + + -qt-xcb ............ Use xcb- libraries bundled with Qt. + (libxcb.so will still be used from operating system). + + -system-xcb ........ Use xcb- libraries from the operating system. + + -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt. + + -system-xkbcommon .. Use the xkbcommon library from the operating system. + + -no-xinput2 ........ Do not compile XInput2 support. + * -xinput2 ........... Compile XInput2 support. + + -no-glib ........... Do not compile Glib support. + + -glib .............. Compile Glib support. + +Additional options: + + -make ....... Add part to the list of parts to be built at make time. + (defaults to: $QT_DEFAULT_BUILD_PARTS) + -nomake ..... Exclude part from the list of parts to be built. + + -skip ..... Exclude an entire module from the build. + + -no-compile-examples ... Install only the sources of examples. + + -no-gui ............ Don't build the Qt GUI module and dependencies. + + -gui ............... Build the Qt GUI module and dependencies. + + -no-widgets ........ Don't build the Qt Widgets module and dependencies. + + -widgets ........... Build the Qt Widgets module and dependencies. + + -R ........ Add an explicit runtime library path to the Qt + libraries. + -l ........ Add an explicit library. + + -no-rpath .......... Do not use the library install path as a runtime + library path. + + -rpath ............. Link Qt libraries and executables using the library + install path as a runtime library path. Equivalent + to -R install_libpath + + -continue .......... Continue as far as possible if an error occurs. + + -verbose, -v ....... Print verbose information about each step of the + configure process. + + -silent ............ Reduce the build output so that warnings and errors + can be seen more easily. + + * -no-optimized-qmake ... Do not build qmake optimized. + -optimized-qmake ...... Build qmake optimized. + + -no-nis ............ Do not compile NIS support. + * -nis ............... Compile NIS support. + + -no-cups ........... Do not compile CUPS support. + * -cups .............. Compile CUPS support. + Requires cups/cups.h and libcups.so.2. + + -no-iconv .......... Do not compile support for iconv(3). + * -iconv ............. Compile support for iconv(3). + + -no-icu ............ Do not compile support for ICU libraries. + + -icu ............... Compile support for ICU libraries. + + -no-fontconfig ..... Do not compile FontConfig support. + + -fontconfig ........ Compile FontConfig support. + + -no-strip .......... Do not strip binaries and libraries of unneeded symbols. + * -strip ............. Strip binaries and libraries of unneeded symbols when installing. + + * -no-pch ............ Do not use precompiled header support. + -pch ............... Use precompiled header support. + + -no-dbus ........... Do not compile the Qt D-Bus module. + + -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. + -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. + + -reduce-relocations ..... Reduce relocations in the libraries through extra + linker optimizations (Qt/X11 and Qt for Embedded Linux only; + experimental; needs GNU ld >= 2.18). + + -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. + + -device ............... Cross-compile for device (experimental) + -device-option ... Add device specific options for the device mkspec + (experimental) + + -no-separate-debug-info . Do not store debug information in a separate file. + * -separate-debug-info .... Strip debug information into a separate file. + + -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. + * -xcb ............... Compile Xcb support. + + -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. + * -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support). + + -no-directfb ....... Do not compile DirectFB support. + * -directfb .......... Compile DirectFB support. + + -no-linuxfb ........ Do not compile Linux Framebuffer support. + * -linuxfb ........... Compile Linux Framebuffer support. + + -no-kms ............ Do not compile KMS support. + * -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support). + + -qpa ......... Sets the default QPA platform (e.g xcb, cocoa, windows). + + -xplatform target ... The target platform when cross-compiling. + + -sysroot ...... Sets as the target compiler's and qmake's sysroot and also sets pkg-config paths. + -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler + + -no-feature- Do not compile in . + -feature- .. Compile in . The available features + are described in src/corelib/global/qfeatures.txt + + -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the + default ($CFG_QCONFIG). + + -qreal [double|float] typedef qreal to the specified type. The default is double. + Note that changing this flag affects binary compatibility. + + -no-opengl .......... Do not support OpenGL. + -opengl ....... Enable OpenGL support + With no parameter, this will attempt to auto-detect + OpenGL ES 2, or regular desktop OpenGL. + Use es2 for to override auto-detection. + + * -no-system-proxies .. Do not use system network proxies by default. + -system-proxies ..... Use system network proxies by default. + + -no-warnings-are-errors Make warnings be treated normally + -warnings-are-errors Make warnings be treated as errors + (enabled if -developer-build is active) + +QNX/Blackberry options: + + -no-slog2 .......... Do not compile with slog2 support. + -slog2 ............. Compile with slog2 support. + +MacOS/iOS options: + + -Fstring ........... Add an explicit framework path. + -fw string ......... Add an explicit framework. + + * -framework ......... Build Qt as a series of frameworks and + link tools against those frameworks. + -no-framework ...... Do not build Qt as a series of frameworks. + + -sdk ......... Build Qt using Apple provided SDK . The argument should be + one of the available SDKs as listed by 'xcodebuild -showsdks'. + Note that the argument applies only to Qt libraries and applications built + using the target mkspec - not host tools such as qmake, moc, rcc, etc. + +Android options: + + -android-sdk path .............. The Android SDK root path. + (default \$ANDROID_SDK_ROOT) + + -android-ndk path .............. The Android NDK root path. + (default \$ANDROID_NDK_ROOT) + + -android-ndk-platform .......... Sets the android platform + (default $CFG_DEFAULT_ANDROID_PLATFORM) + + -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) + (default \$ANDROID_NDK_HOST) + + -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) + (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) + + -android-toolchain-version ..... Sets the android toolchain version + (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION) +EOF + + exit 0 +fi # Help + +#------------------------------------------------------------------------------- +# build tree initialization +#------------------------------------------------------------------------------- # is this a shadow build? if [ "$OPT_SHADOW" = "maybe" ]; then @@ -2477,8 +2844,6 @@ if [ ! -d "${outpath}/lib/fonts" ]; then fi fi -fi ### help - #------------------------------------------------------------------------------- # platform detection #------------------------------------------------------------------------------- @@ -2640,7 +3005,6 @@ if [ -z "$PLATFORM" ]; then PLATFORM=unsupported/qnx-g++ ;; *) - if [ "$OPT_HELP" != "yes" ]; then echo >&2 echo " The build script does not currently recognize all" >&2 echo " platforms supported by Qt." >&2 @@ -2648,7 +3012,6 @@ if [ -z "$PLATFORM" ]; then echo " set the system/compiler combination you use." >&2 echo >&2 exit 2 - fi esac fi @@ -2740,7 +3103,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then esac fi - if [ "$OPT_HELP" != "yes" ]; then if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then echo echo "Can not find Android NDK. Please use -android-ndk option to specify one" @@ -2771,7 +3133,6 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST" DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH" DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" - fi fi if [ -d "$PLATFORM" ]; then @@ -2898,7 +3259,7 @@ QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX` TEST_COMPILER=$QMAKE_CONF_COMPILER -if [ "$OPT_HELP" != "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ] ; then +if [ "$XPLATFORM_ANDROID" = "yes" ] ; then ANDROID_NDK_TOOLS_PREFIX= ANDROID_PLATFORM_ARCH= case $CFG_DEFAULT_ANDROID_TARGET_ARCH in @@ -3279,400 +3640,6 @@ if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG compile_examples" fi -#------------------------------------------------------------------------------- -# help - interactive parts of the script _after_ this section please -#------------------------------------------------------------------------------- - -if [ "$OPT_HELP" = "yes" ]; then - cat < ...... This will install everything relative to - (default /usr/local/Qt-${QT_VERSION}, \$PWD if -developer-build is active) - - -extprefix ... When -sysroot is used, install everything to , - rather than into SYSROOT/PREFIX. - - -hostprefix [dir] .. Tools and libraries needed when developing - applications are installed in [dir]. If [dir] is - not given, the current build directory will be used. - (default EXTPREFIX) - - You may use these to separate different parts of the install: - - -bindir ......... User executables will be installed to - (default PREFIX/bin) - -headerdir ...... Headers will be installed to - (default PREFIX/include) - -libdir ......... Libraries will be installed to - (default PREFIX/lib) - -archdatadir .... Arch-dependent data used by Qt will be installed to - (default PREFIX) - -plugindir ...... Plugins will be installed to - (default ARCHDATADIR/plugins) - -libexecdir ..... Program executables will be installed to - (default ARCHDATADIR/libexec, ARCHDATADIR/bin for MinGW) - -importdir ...... Imports for QML1 will be installed to - (default ARCHDATADIR/imports) - -qmldir ......... Imports for QML2 will be installed to - (default ARCHDATADIR/qml) - -datadir ........ Arch-independent data used by Qt will be installed to - (default PREFIX) - -docdir ......... Documentation will be installed to - (default DATADIR/doc) - -translationdir . Translations of Qt programs will be installed to - (default DATADIR/translations) - -sysconfdir ..... Settings used by Qt programs will be looked for in - (default PREFIX/etc/xdg) - -examplesdir .... Examples will be installed to - (default PREFIX/examples) - -testsdir ....... Tests will be installed to - (default PREFIX/tests) - - -hostbindir .. Host executables will be installed to - (default HOSTPREFIX/bin) - -hostlibdir .. Host libraries will be installed to - (default HOSTPREFIX/lib) - -hostdatadir . Data used by qmake will be installed to - (default HOSTPREFIX) - -Configure options: - - The defaults (*) are usually acceptable. A plus (+) denotes a default value - that needs to be evaluated. If the evaluation succeeds, the feature is - included. Here is a short explanation of each option: - - * -release ........... Compile and link Qt with debugging turned off. - -debug ............. Compile and link Qt with debugging turned on. - -debug-and-release . Compile and link two versions of Qt, with and without - debugging turned on (Mac only). - - -force-debug-info .. Create symbol files for release builds. - - -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) - - -opensource ........ Compile and link the Open-Source Edition of Qt. - -commercial ........ Compile and link the Commercial Edition of Qt. - - -confirm-license ... Automatically acknowledge the license (use with - either -opensource or -commercial) - - -no-c++11 .......... Do not compile Qt with C++11 support enabled. - + -c++11 ............. Compile Qt with C++11 support enabled. - - * -shared ............ Create and use shared Qt libraries. - -static ............ Create and use static Qt libraries. - - * -process ........... Generate only a top-level Makefile. - -fully-process ..... Generate Makefiles for the entire Qt tree. - -dont-process ...... Do not generate any Makefiles. - - -no-largefile ...... Disables large file support. - + -largefile ......... Enables Qt to access files larger than 4 GB. - - -no-accessibility .. Do not compile Accessibility support. - Disabling accessibility is not recommended, as it will break QStyle - and may break other internal parts of Qt. - With this switch you create a source incompatible version of Qt, - which is unsupported. - + -accessibility ..... Compile Accessibility support. - - -no-sql- ... Disable SQL entirely. - -qt-sql- ... Enable a SQL in the Qt SQL module, by default - none are turned on. - -plugin-sql- Enable SQL as a plugin to be linked to - at run time. - - Possible values for : - [$CFG_SQL_AVAILABLE ] - - -system-sqlite ..... Use sqlite from the operating system. - - -no-javascript-jit . Do not build the JavaScriptCore JIT compiler. - + -javascript-jit .... Build the JavaScriptCore JIT compiler. - - -no-qml-debug ...... Do not build the in-process QML debugging support. - + -qml-debug ......... Build the QML debugging support. - - -platform target ... The operating system and compiler you are building - on (default detected from host system). - - See the README file for a list of supported - operating systems and compilers. - - -no-sse2 ........... Do not compile with use of SSE2 instructions. - -no-sse3 ........... Do not compile with use of SSE3 instructions. - -no-ssse3 .......... Do not compile with use of SSSE3 instructions. - -no-sse4.1 ......... Do not compile with use of SSE4.1 instructions. - -no-sse4.2 ......... Do not compile with use of SSE4.2 instructions. - -no-avx ............ Do not compile with use of AVX instructions. - -no-avx2 ........... Do not compile with use of AVX2 instructions. - -no-neon ........... Do not compile with use of NEON instructions. - -no-mips_dsp ....... Do not compile with use of MIPS DSP instructions. - -no-mips_dspr2 ..... Do not compile with use of MIPS DSP rev2 instructions. - - -qtnamespace Wraps all Qt library code in 'namespace {...}'. - -qtlibinfix Renames all libQt*.so to libQt*.so. - - -testcocoon ........ Instrument Qt with the TestCocoon code coverage tool. - -gcov .............. Instrument Qt with the GCov code coverage tool. - - -D ........ Add an explicit define to the preprocessor. - -I ........ Add an explicit include path. - -L ........ Add an explicit library path. - - + -pkg-config ........ Use pkg-config to detect include and library paths. By default, - configure determines whether to use pkg-config or not with - some heuristics such as checking the environment variables. - -no-pkg-config ..... Disable use of pkg-config. - -force-pkg-config .. Force usage of pkg-config (skips pkg-config usability - detection heuristic). - - -help, -h .......... Display this information. - -Third Party Libraries: - - -qt-zlib ........... Use the zlib bundled with Qt. - + -system-zlib ....... Use zlib from the operating system. - See http://www.gzip.org/zlib - - -no-gif ............ Do not compile GIF reading support. - - -no-libpng ......... Do not compile PNG support. - -qt-libpng ......... Use the libpng bundled with Qt. - + -system-libpng ..... Use libpng from the operating system. - See http://www.libpng.org/pub/png - - -no-libjpeg ........ Do not compile JPEG support. - -qt-libjpeg ........ Use the libjpeg bundled with Qt. - + -system-libjpeg .... Use libjpeg from the operating system. - See http://www.ijg.org - - -no-freetype ....... Do not compile in Freetype2 support. - -qt-freetype ....... Use the libfreetype bundled with Qt. - + -system-freetype.... Use the libfreetype provided by the system (enabled if -fontconfig is active). - See http://www.freetype.org - - * -no-harfbuzz ....... Do not compile HarfBuzz-NG support. - -qt-harfbuzz ....... (experimental) Use HarfBuzz-NG bundled with Qt - to do text shaping. It can still be disabled - by setting QT_HARFBUZZ environment variable to "old". - -system-harfbuzz ... (experimental) Use HarfBuzz-NG from the operating system - to do text shaping. It can still be disabled - by setting QT_HARFBUZZ environment variable to "old". - - -no-openssl ........ Do not compile support for OpenSSL. - + -openssl ........... Enable run-time OpenSSL support. - -openssl-linked .... Enabled linked OpenSSL support. - - -qt-pcre ........... Use the PCRE library bundled with Qt. - + -system-pcre ....... Use the PCRE library from the operating system. - - -qt-xcb ............ Use xcb- libraries bundled with Qt. - (libxcb.so will still be used from operating system). - + -system-xcb ........ Use xcb- libraries from the operating system. - - -qt-xkbcommon ...... Use the xkbcommon library bundled with Qt. - + -system-xkbcommon .. Use the xkbcommon library from the operating system. - -Additional options: - - -make ....... Add part to the list of parts to be built at make time. - (defaults to: $QT_DEFAULT_BUILD_PARTS) - -nomake ..... Exclude part from the list of parts to be built. - - -skip ..... Exclude an entire module from the build. - - -no-compile-examples ... Install only the sources of examples. - - -no-gui ............ Don't build the Qt GUI module and dependencies. - + -gui ............... Build the Qt GUI module and dependencies. - - -no-widgets ........ Don't build the Qt Widgets module and dependencies. - + -widgets ........... Build the Qt Widgets module and dependencies. - - -R ........ Add an explicit runtime library path to the Qt - libraries. - -l ........ Add an explicit library. - - -no-rpath .......... Do not use the library install path as a runtime - library path. - + -rpath ............. Link Qt libraries and executables using the library - install path as a runtime library path. Equivalent - to -R install_libpath - - -continue .......... Continue as far as possible if an error occurs. - - -verbose, -v ....... Print verbose information about each step of the - configure process. - - -silent ............ Reduce the build output so that warnings and errors - can be seen more easily. - - * -no-optimized-qmake ... Do not build qmake optimized. - -optimized-qmake ...... Build qmake optimized. - - -no-nis ............ Do not compile NIS support. - * -nis ............... Compile NIS support. - - -no-cups ........... Do not compile CUPS support. - * -cups .............. Compile CUPS support. - Requires cups/cups.h and libcups.so.2. - - -no-iconv .......... Do not compile support for iconv(3). - * -iconv ............. Compile support for iconv(3). - - -no-icu ............ Do not compile support for ICU libraries. - + -icu ............... Compile support for ICU libraries. - - -no-fontconfig ..... Do not compile FontConfig support. - + -fontconfig ........ Compile FontConfig support. - - -no-strip .......... Do not strip binaries and libraries of unneeded symbols. - * -strip ............. Strip binaries and libraries of unneeded symbols when installing. - - * -no-pch ............ Do not use precompiled header support. - -pch ............... Use precompiled header support. - - -no-dbus ........... Do not compile the Qt D-Bus module. - + -dbus .............. Compile the Qt D-Bus module and dynamically load libdbus-1. - -dbus-linked ....... Compile the Qt D-Bus module and link to libdbus-1. - - -reduce-relocations ..... Reduce relocations in the libraries through extra - linker optimizations (Qt/X11 and Qt for Embedded Linux only; - experimental; needs GNU ld >= 2.18). - - -force-asserts ........ Force Q_ASSERT to be enabled even in release builds. - - -device ............... Cross-compile for device (experimental) - -device-option ... Add device specific options for the device mkspec - (experimental) - - -no-separate-debug-info . Do not store debug information in a separate file. - * -separate-debug-info .... Strip debug information into a separate file. - - -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support. - * -xcb ............... Compile Xcb support. - - -no-eglfs .......... Do not compile EGLFS (EGL Full Screen/Single Surface) support. - * -eglfs ............. Compile EGLFS support (Requires OpenGL ES 2 support). - - -no-directfb ....... Do not compile DirectFB support. - * -directfb .......... Compile DirectFB support. - - -no-linuxfb ........ Do not compile Linux Framebuffer support. - * -linuxfb ........... Compile Linux Framebuffer support. - - -no-kms ............ Do not compile KMS support. - * -kms ............... Compile KMS support (Requires EGL and OpenGL ES 2 support). - - -qpa ......... Sets the default QPA platform (e.g xcb, cocoa, windows). - - -xplatform target ... The target platform when cross-compiling. - - -sysroot ...... Sets as the target compiler's and qmake's sysroot and also sets pkg-config paths. - -no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler - - -no-feature- Do not compile in . - -feature- .. Compile in . The available features - are described in src/corelib/global/qfeatures.txt - - -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the - default ($CFG_QCONFIG). - - -qreal [double|float] typedef qreal to the specified type. The default is double. - Note that changing this flag affects binary compatibility. - - -no-opengl .......... Do not support OpenGL. - -opengl ....... Enable OpenGL support - With no parameter, this will attempt to auto-detect - OpenGL ES 2, or regular desktop OpenGL. - Use es2 for to override auto-detection. - - * -no-system-proxies .. Do not use system network proxies by default. - -system-proxies ..... Use system network proxies by default. - - -no-warnings-are-errors Make warnings be treated normally - -warnings-are-errors Make warnings be treated as errors - (enabled if -developer-build is active) - - -no-glib ........... Do not compile Glib support. - + -glib .............. Compile Glib support. -EOF - -if [ "$XPLATFORM_MAEMO" = "yes" ]; then - cat << EOF - - -no-xinput2 ........ Do not compile XInput2 support. - * -xinput2 ........... Compile XInput2 support. - -EOF - -fi - -if [ "$XPLATFORM_QNX" = "yes" ]; then - cat << EOF - - -no-slog2 .......... Do not compile with slog2 support. - -slog2 ............. Compile with slog2 support. - -EOF - -fi - -if [ "$BUILD_ON_MAC" = "yes" ]; then - cat << EOF - -Qt/Mac only: - - -Fstring ........... Add an explicit framework path. - -fw string ......... Add an explicit framework. - - * -framework ......... Build Qt as a series of frameworks and - link tools against those frameworks. - -no-framework ...... Do not build Qt as a series of frameworks. - - -sdk ......... Build Qt using Apple provided SDK . The argument should be - one of the available SDKs as listed by 'xcodebuild -showsdks'. - Note that the argument applies only to Qt libraries and applications built - using the target mkspec - not host tools such as qmake, moc, rcc, etc. - -EOF -fi - -if [ "$XPLATFORM_ANDROID" = "yes" ]; then - cat << EOF - -Android options: - -android-sdk path .............. The Android SDK root path. - (default \$ANDROID_SDK_ROOT) - - -android-ndk path .............. The Android NDK root path. - (default \$ANDROID_NDK_ROOT) - - -android-ndk-platform .......... Sets the android platform - (default $CFG_DEFAULT_ANDROID_PLATFORM) - - -android-ndk-host .............. Sets the android NDK host (linux-x86, linux-x86_64, etc.) - (default \$ANDROID_NDK_HOST) - - -android-arch .................. Sets the android architecture (armeabi, armeabi-v7a, x86, mips) - (default $CFG_DEFAULT_ANDROID_TARGET_ARCH) - - -android-toolchain-version ..... Sets the android toolchain version - (default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION) -EOF - -fi - - exit 0 -fi # Help - - # ----------------------------------------------------------------------------- # LICENSING, INTERACTIVE PART # ----------------------------------------------------------------------------- From a6b9729d1c8b0d347329fba56401023e6ccaf084 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 13 Nov 2013 15:44:48 +0100 Subject: [PATCH 13/24] don't initialize build dir earlier than necessary this way, platform detection (and later license checking) become (mostly) read-only operations. Change-Id: I4c5ffcf80feadfeee2c6e927cf0285f46fa6ea43 Reviewed-by: Thiago Macieira --- configure | 84 +++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/configure b/configure index 17b8b517789..40657c1f95f 100755 --- a/configure +++ b/configure @@ -2802,48 +2802,6 @@ EOF exit 0 fi # Help -#------------------------------------------------------------------------------- -# build tree initialization -#------------------------------------------------------------------------------- - -# is this a shadow build? -if [ "$OPT_SHADOW" = "maybe" ]; then - OPT_SHADOW=no - if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then - if [ -h "$outpath" ]; then - [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes - else - OPT_SHADOW=yes - fi - fi -fi -if [ "$OPT_SHADOW" = "yes" ]; then - if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then - echo >&2 "You cannot make a shadow build from a source tree containing a previous build." - echo >&2 "Cannot proceed." - exit 1 - fi - [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." -fi - -# if the source tree is different from the build tree, -# symlink or copy part of the sources -if [ "$OPT_SHADOW" = "yes" ]; then - echo "Preparing build tree..." - - [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin" - - mkdir -p "$outpath/mkspecs" -fi - -# symlink fonts to be able to run application from build directory -if [ ! -d "${outpath}/lib/fonts" ]; then - if [ "$PLATFORM" = "$XPLATFORM" ]; then - mkdir -p "${outpath}/lib" - ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" - fi -fi - #------------------------------------------------------------------------------- # platform detection #------------------------------------------------------------------------------- @@ -3209,6 +3167,48 @@ if [ "$CFG_RTOS_ENABLED" = "no" ]; then esac fi +#------------------------------------------------------------------------------- +# build tree initialization +#------------------------------------------------------------------------------- + +# is this a shadow build? +if [ "$OPT_SHADOW" = "maybe" ]; then + OPT_SHADOW=no + if [ "$relpath" != "$outpath" ] && [ '!' -f "$outpath/configure" ]; then + if [ -h "$outpath" ]; then + [ "$relpath" -ef "$outpath" ] || OPT_SHADOW=yes + else + OPT_SHADOW=yes + fi + fi +fi +if [ "$OPT_SHADOW" = "yes" ]; then + if [ -f "$relpath/.qmake.cache" -o -f "$relpath/src/corelib/global/qconfig.h" -o -f "$relpath/src/corelib/global/qconfig.cpp" ]; then + echo >&2 "You cannot make a shadow build from a source tree containing a previous build." + echo >&2 "Cannot proceed." + exit 1 + fi + [ "$OPT_VERBOSE" = "yes" ] && echo "Performing shadow build..." +fi + +# if the source tree is different from the build tree, +# symlink or copy part of the sources +if [ "$OPT_SHADOW" = "yes" ]; then + echo "Preparing build tree..." + + [ -d "$outpath/bin" ] || mkdir -p "$outpath/bin" + + mkdir -p "$outpath/mkspecs" +fi + +# symlink fonts to be able to run application from build directory +if [ ! -d "${outpath}/lib/fonts" ]; then + if [ "$PLATFORM" = "$XPLATFORM" ]; then + mkdir -p "${outpath}/lib" + ln -s "${relpath}/lib/fonts" "${outpath}/lib/fonts" + fi +fi + #------------------------------------------------------------------------------- # tests that don't need qmake (must be run before displaying help) #------------------------------------------------------------------------------- From f0524cedda1eaadb3f58cf8bc5a1301b9951fdf9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 21:29:38 +0100 Subject: [PATCH 14/24] consolidate all license checking in the earliest place possible ... which is right after performing the platform detection, as proper license checking needs to know the target platform. we can do that now, as we moved all more expensive or side effect laden processing to a later point. as a side effect, we also get rid of the weird early cmdline parsing. Change-Id: I0fda0a15a1ea2082603f7097e89aa422853f30fa Reviewed-by: Thiago Macieira --- configure | 891 +++++++++++++++++++++++++----------------------------- 1 file changed, 409 insertions(+), 482 deletions(-) diff --git a/configure b/configure index 40657c1f95f..7ae26726953 100755 --- a/configure +++ b/configure @@ -87,14 +87,6 @@ if [ -z "$MAKE" ]; then export MAKE fi -#license file location -LICENSE_FILE="$QT_LICENSE_FILE" -[ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license" -if [ -f "$LICENSE_FILE" ]; then - tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp" - diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp" -fi - # do this early so we don't store it in config.status CFG_TOPLEVEL= if [ x"$1" = x"-top-level" ]; then @@ -554,315 +546,6 @@ if [ -z "$QT_MAJOR_VERSION" ]; then exit 1 fi -#------------------------------------------------------------------------------- -# check the license -#------------------------------------------------------------------------------- -COMMERCIAL_USER=ask -CFG_DEV=no -CFG_RTOS_ENABLED=yes -EditionString=Commercial - -earlyArgParse() -{ - # parse the arguments, setting things to "yes" or "no" - while [ "$#" -gt 0 ]; do - CURRENT_OPT="$1" - UNKNOWN_ARG=no - case "$1" in - #Autoconf style options - --enable-*) - VAR=`echo $1 | sed "s,^--enable-\(.*\),\1,"` - VAL=yes - ;; - --disable-*) - VAR=`echo $1 | sed "s,^--disable-\(.*\),\1,"` - VAL=no - ;; - --*=*) - VAR=`echo $1 | sed "s,^--\(.*\)=.*,\1,"` - VAL=`echo $1 | sed "s,^--.*=\(.*\),\1,"` - ;; - --no-*) - VAR=`echo $1 | sed "s,^--no-\(.*\),\1,"` - VAL=no - ;; - -h|help|--help|-help) - if [ "$VAL" = "yes" ]; then - OPT_HELP="$VAL" - COMMERCIAL_USER="no" #doesn't matter we will display the help - else - UNKNOWN_OPT=yes - COMMERCIAL_USER="no" #doesn't matter we will display the help - fi - ;; - --*) - VAR=`echo $1 | sed "s,^--\(.*\),\1,"` - VAL=yes - ;; - -*) - VAR=`echo $1 | sed "s,^-\(.*\),\1,"` - VAL="unknown" - ;; - *) - UNKNOWN_ARG=yes - ;; - esac - if [ "$UNKNOWN_ARG" = "yes" ]; then - shift - continue - fi - shift - - UNKNOWN_OPT=no - case "$VAR" in - developer-build) - CFG_DEV="yes" - ;; - commercial) - COMMERCIAL_USER="yes" - ;; - opensource) - COMMERCIAL_USER="no" - ;; - *) - UNKNOWN_OPT=yes - ;; - esac - done -} - -earlyArgParse "$@" - -if [ "$COMMERCIAL_USER" = "ask" ]; then - while true; do - echo "Which edition of Qt do you want to use ?" - echo - echo "Type 'c' if you want to use the Commercial Edition." - echo "Type 'o' if you want to use the Open Source Edition." - echo - read commercial - echo - if [ "$commercial" = "c" ]; then - COMMERCIAL_USER="yes" - break - elif [ "$commercial" = "o" ]; then - COMMERCIAL_USER="no" - break - fi - done -fi - -if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then - # Commercial preview release - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - Licensee="Preview" - Edition="Preview" - QT_EDITION="QT_EDITION_DESKTOP" - LicenseType="Technology Preview" -elif [ $COMMERCIAL_USER = "yes" ]; then - # one of commercial editions - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - - # read in the license file - if [ -f "$LICENSE_FILE" ]; then - . "$LICENSE_FILE" >/dev/null 2>&1 - if [ -z "$LicenseKeyExt" ]; then - echo - echo "You are using an old license file." - echo - echo "Please install the license file supplied by Digia," - echo "or install the Qt Open Source Edition if you intend to" - echo "develop free software." - exit 1 - fi - if [ -z "$Licensee" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - else - if [ -z "$LicenseKeyExt" ]; then - echo - echo $ECHO_N "Please enter your license key: $ECHO_C" - read LicenseKeyExt - Licensee="Unknown user" - fi - fi - - # Key verification - echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \ - && LicenseValid="yes" \ - || LicenseValid="no" - if [ "$LicenseValid" != "yes" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` - PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -` - LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -` - LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` - - # determine which edition we are licensed to use - case "$LicenseTypeCode" in - F4M) - LicenseType="Commercial" - case $ProductCode in - F) - Edition="Universal" - QT_EDITION="QT_EDITION_UNIVERSAL" - ;; - B) - Edition="FullFramework" - EditionString="Full Framework" - QT_EDITION="QT_EDITION_DESKTOP" - ;; - L) - Edition="GUIFramework" - EditionString="GUI Framework" - QT_EDITION="QT_EDITION_DESKTOPLIGHT" - ;; - esac - ;; - Z4M|R4M|Q4M) - LicenseType="Evaluation" - QMakeVar add DEFINES QT_EVAL - case $ProductCode in - B) - Edition="Evaluation" - QT_EDITION="QT_EDITION_EVALUATION" - ;; - esac - ;; - esac - if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then - echo - echo "Invalid license key. Please check the license key." - exit 1 - fi - - # verify that we are licensed to use Qt on this platform - LICENSE_EXTENSION= - case "$PlatformCode" in - *L) - CFG_RTOS_ENABLED=yes - PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'` - ;; - *) - CFG_RTOS_ENABLED=no - PlatformCode=`echo "$PlatformCode" | sed 's/.$//'` - ;; - esac - ### EMBEDDED_QPA logic missing ### - case "$PlatformCode,$PLATFORM_MAC" in - X9,* | XC,* | XU,* | XW,* | XM,*) - # Qt All-OS - LICENSE_EXTENSION="-ALLOS" - ;; - 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) - # Qt for Embedded Linux - LICENSE_EXTENSION="-EMBEDDED" - ;; - 6M,* | N7,* | N9,* | NX,*) - # Embedded no-deploy - LICENSE_EXTENSION="-EMBEDDED" - ;; - FM,* | LM,yes | ZM,no) - # Desktop - LICENSE_EXTENSION="-DESKTOP" - ;; - *) - Platform=Linux/X11 - [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X' - echo - echo "You are not licensed for the $Platform platform." - echo - echo "Please use the contact form at http://qt.digia.com/contact-us" - echo "to upgrade your license to include the $Platform platform, or install" - echo "the Qt Open Source Edition if you intend to develop free software." - exit 1 - ;; - esac - - if test -r "$relpath/.LICENSE"; then - # Generic, non-final license - LICENSE_EXTENSION="" - line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE` - case "$line" in - *BETA*) - Edition=Beta - ;; - *TECHNOLOGY?PREVIEW*) - Edition=Preview - ;; - *EVALUATION*) - Edition=Evaluation - ;; - *) - echo >&2 "Invalid license files; cannot continue" - exit 1 - ;; - esac - Licensee="$Edition" - EditionString="$Edition" - QT_EDITION="QT_EDITION_DESKTOP" - fi - - case "$LicenseFeatureCode" in - B|G|L|Y) - # US - case "$LicenseType" in - Commercial) - cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE" - ;; - Evaluation) - cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE" - ;; - esac - ;; - 2|4|5|F) - # non-US - case "$LicenseType" in - Commercial) - cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE" - ;; - Evaluation) - cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE" - ;; - esac - ;; - *) - echo - echo "Invalid license key. Please check the license key." - exit 1 - ;; - esac - case "$LicenseFeatureCode" in - 4|B|F|Y) - CFG_RTOS_ENABLED=yes - ;; - 2|5|G|L) - CFG_RTOS_ENABLED=no - ;; - esac - if [ '!' -f "$outpath/LICENSE" ]; then - echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with" - echo "this software has disappeared." - echo - echo "Sorry, you are not licensed to use this software." - echo "Try re-installing." - echo - exit 1 - fi -elif [ $COMMERCIAL_USER = "no" ]; then - # Open Source edition - may only be used under the terms of the GPL or LGPL. - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes - Licensee="Open Source" - Edition="OpenSource" - EditionString="Open Source" - QT_EDITION="QT_EDITION_OPENSOURCE" -fi - #------------------------------------------------------------------------------- # initalize variables #------------------------------------------------------------------------------- @@ -1042,6 +725,9 @@ CFG_DIRECTWRITE=no CFG_WERROR=auto CFG_QREAL=double OPT_MAC_SDK= +COMMERCIAL_USER=ask +LICENSE_FILE= +CFG_DEV=no # initalize variables used for installation QT_INSTALL_PREFIX= @@ -1687,8 +1373,14 @@ while [ "$#" -gt 0 ]; do force-debug-info) CFG_FORCEDEBUGINFO="$VAL" ;; - developer-build|commercial|opensource) - # These switches have been dealt with already + developer-build) + CFG_DEV="yes" + ;; + commercial) + COMMERCIAL_USER="yes" + ;; + opensource) + COMMERCIAL_USER="no" ;; static) if [ "$VAL" = "yes" ]; then @@ -2994,6 +2686,404 @@ case "$XPLATFORM" in ;; esac +#------------------------------------------------------------------------------- +# check the license +#------------------------------------------------------------------------------- + +if [ "$COMMERCIAL_USER" = "ask" ]; then + while true; do + echo "Which edition of Qt do you want to use ?" + echo + echo "Type 'c' if you want to use the Commercial Edition." + echo "Type 'o' if you want to use the Open Source Edition." + echo + read commercial + echo + if [ "$commercial" = "c" ]; then + COMMERCIAL_USER="yes" + break + elif [ "$commercial" = "o" ]; then + COMMERCIAL_USER="no" + break + fi + done +fi + +CFG_RTOS_ENABLED=yes +EditionString=Commercial +if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then + # Commercial preview release + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + Licensee="Preview" + Edition="Preview" + QT_EDITION="QT_EDITION_DESKTOP" + LicenseType="Technology Preview" +elif [ $COMMERCIAL_USER = "yes" ]; then + # one of commercial editions + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + + # read in the license file + [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$QT_LICENSE_FILE" + [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$HOME/.qt-license" + if [ -f "$LICENSE_FILE" ]; then + tr -d '\r' <"$LICENSE_FILE" >"${LICENSE_FILE}.tmp" + diff "${LICENSE_FILE}.tmp" "${LICENSE_FILE}" >/dev/null 2>&1 || LICENSE_FILE="${LICENSE_FILE}.tmp" + . "$LICENSE_FILE" >/dev/null 2>&1 + if [ -z "$LicenseKeyExt" ]; then + echo + echo "You are using an old license file." + echo + echo "Please install the license file supplied by Digia," + echo "or install the Qt Open Source Edition if you intend to" + echo "develop free software." + exit 1 + fi + if [ -z "$Licensee" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + else + if [ -z "$LicenseKeyExt" ]; then + echo + echo $ECHO_N "Please enter your license key: $ECHO_C" + read LicenseKeyExt + Licensee="Unknown user" + fi + fi + + # Key verification + echo "$LicenseKeyExt" | grep ".....*-....*-....*-....*-.....*-.....*-...." >/dev/null 2>&1 \ + && LicenseValid="yes" \ + || LicenseValid="no" + if [ "$LicenseValid" != "yes" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + ProductCode=`echo $LicenseKeyExt | cut -f 1 -d - | cut -b 1` + PlatformCode=`echo $LicenseKeyExt | cut -f 2 -d -` + LicenseTypeCode=`echo $LicenseKeyExt | cut -f 3 -d -` + LicenseFeatureCode=`echo $LicenseKeyExt | cut -f 4 -d - | cut -b 1` + + # determine which edition we are licensed to use + case "$LicenseTypeCode" in + F4M) + LicenseType="Commercial" + case $ProductCode in + F) + Edition="Universal" + QT_EDITION="QT_EDITION_UNIVERSAL" + ;; + B) + Edition="FullFramework" + EditionString="Full Framework" + QT_EDITION="QT_EDITION_DESKTOP" + ;; + L) + Edition="GUIFramework" + EditionString="GUI Framework" + QT_EDITION="QT_EDITION_DESKTOPLIGHT" + ;; + esac + ;; + Z4M|R4M|Q4M) + LicenseType="Evaluation" + QMakeVar add DEFINES QT_EVAL + case $ProductCode in + B) + Edition="Evaluation" + QT_EDITION="QT_EDITION_EVALUATION" + ;; + esac + ;; + esac + if [ -z "$LicenseType" -o -z "$Edition" -o -z "$QT_EDITION" ]; then + echo + echo "Invalid license key. Please check the license key." + exit 1 + fi + + # verify that we are licensed to use Qt on this platform + LICENSE_EXTENSION= + case "$PlatformCode" in + *L) + CFG_RTOS_ENABLED=yes + PlatformCode=`echo "$PlatformCode" | sed 'h;y/8NPQRTZ/UCWX9M7/;x;G;s/\(.\)....\(.\)./\1\2/'` + ;; + *) + CFG_RTOS_ENABLED=no + PlatformCode=`echo "$PlatformCode" | sed 's/.$//'` + ;; + esac + ### EMBEDDED_QPA logic missing ### + case "$PlatformCode,$PLATFORM_MAC" in + X9,* | XC,* | XU,* | XW,* | XM,*) + # Qt All-OS + LICENSE_EXTENSION="-ALLOS" + ;; + 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) + # Qt for Embedded Linux + LICENSE_EXTENSION="-EMBEDDED" + ;; + 6M,* | N7,* | N9,* | NX,*) + # Embedded no-deploy + LICENSE_EXTENSION="-EMBEDDED" + ;; + FM,* | LM,yes | ZM,no) + # Desktop + LICENSE_EXTENSION="-DESKTOP" + ;; + *) + Platform=Linux/X11 + [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X' + echo + echo "You are not licensed for the $Platform platform." + echo + echo "Please use the contact form at http://qt.digia.com/contact-us" + echo "to upgrade your license to include the $Platform platform, or install" + echo "the Qt Open Source Edition if you intend to develop free software." + exit 1 + ;; + esac + + if test -r "$relpath/.LICENSE"; then + # Generic, non-final license + LICENSE_EXTENSION="" + line=`sed 'y/a-z/A-Z/;q' "$relpath"/.LICENSE` + case "$line" in + *BETA*) + Edition=Beta + ;; + *TECHNOLOGY?PREVIEW*) + Edition=Preview + ;; + *EVALUATION*) + Edition=Evaluation + ;; + *) + echo >&2 "Invalid license files; cannot continue" + exit 1 + ;; + esac + Licensee="$Edition" + EditionString="$Edition" + QT_EDITION="QT_EDITION_DESKTOP" + fi + + case "$LicenseFeatureCode" in + B|G|L|Y) + # US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}-US" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE-EVALUATION-US" "$outpath/LICENSE" + ;; + esac + ;; + 2|4|5|F) + # non-US + case "$LicenseType" in + Commercial) + cp -f "$relpath/.LICENSE${LICENSE_EXTENSION}" "$outpath/LICENSE" + ;; + Evaluation) + cp -f "$relpath/.LICENSE-EVALUATION" "$outpath/LICENSE" + ;; + esac + ;; + *) + echo + echo "Invalid license key. Please check the license key." + exit 1 + ;; + esac + case "$LicenseFeatureCode" in + 4|B|F|Y) + CFG_RTOS_ENABLED=yes + ;; + 2|5|G|L) + CFG_RTOS_ENABLED=no + ;; + esac + if [ '!' -f "$outpath/LICENSE" ]; then + echo "The LICENSE, LICENSE.GPL3 LICENSE.LGPL file shipped with" + echo "this software has disappeared." + echo + echo "Sorry, you are not licensed to use this software." + echo "Try re-installing." + echo + exit 1 + fi +elif [ $COMMERCIAL_USER = "no" ]; then + # Open Source edition - may only be used under the terms of the GPL or LGPL. + [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes + Licensee="Open Source" + Edition="OpenSource" + EditionString="Open Source" + QT_EDITION="QT_EDITION_OPENSOURCE" +fi +echo +echo "This is the Qt ${EditionString} Edition." +echo + +if [ "$CFG_RTOS_ENABLED" = "no" ]; then + case `basename "$XPLATFORM"` in + qnx-* | vxworks-*) + echo "" + echo "You are not licensed for Qt for `basename $XPLATFORM`." + echo "" + echo "Please use the contact form at http://qt.digia.com/contact-us" + echo "to upgrade your license to include this platform, or install" + echo "the Qt Open Source Edition if you intend to develop free software." + exit 1 + ;; + esac +fi + +if [ "$Edition" = "OpenSource" ]; then + while true; do + echo "You are licensed to use this software under the terms of" + echo "the Lesser GNU General Public License (LGPL) versions 2.1." + if [ -f "$relpath/LICENSE.GPL3" ]; then + echo "You are also licensed to use this software under the terms of" + echo "the GNU General Public License (GPL) versions 3." + affix="either" + else + affix="the" + fi + echo + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + if [ -f "$relpath/LICENSE.GPL3" ]; then + echo "Type '3' to view the GNU General Public License version 3." + fi + echo "Type 'L' to view the Lesser GNU General Public License version 2.1." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + elif [ "$acceptance" = "3" ]; then + more "$relpath/LICENSE.GPL3" + elif [ "$acceptance" = "L" ]; then + more "$relpath/LICENSE.LGPL" + fi + done +elif [ "$Edition" = "Preview" ]; then + TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"` + while true; do + + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $LicenseType license." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense" + echo + echo "Type '?' to read the Preview License." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ] ;then + echo "You are not licensed to use this software." + echo + exit 0 + elif [ "$acceptance" = "?" ]; then + more "$relpath/LICENSE.PREVIEW.COMMERCIAL" + fi + done +elif [ "$Edition" != "OpenSource" ]; then + if [ -n "$ExpiryDate" ]; then + ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"` + [ -z "$ExpiryDate" ] && ExpiryDate="0" + Today=`date +%Y%m%d` + if [ "$Today" -gt "$ExpiryDate" ]; then + case "$LicenseType" in + Commercial|Academic|Educational) + echo + echo "WARNING WARNING WARNING WARNING" + echo + echo " Your support and upgrade period has expired." + echo + echo " You may continue to use your last licensed release" + echo " of Qt under the terms of your existing license" + echo " agreement. But you are not entitled to technical" + echo " support, nor are you entitled to use any more recent" + echo " Qt releases." + echo + echo " Please use the contact form at http://qt.digia.com/contact-us" + echo " to renew your support and upgrades for this license." + echo + echo "WARNING WARNING WARNING WARNING" + echo + sleep 3 + ;; + Evaluation|*) + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + echo " Your Evaluation license has expired." + echo + echo " You are no longer licensed to use this software. Please" + echo " use the contact form at http://qt.digia.com/contact-us to" + echo " purchase license, or install the Qt Open Source Edition" + echo " if you intend to develop free software." + echo + echo "NOTICE NOTICE NOTICE NOTICE" + echo + exit 1 + ;; + esac + fi + fi + TheLicense=`head -n 1 "$outpath/LICENSE"` + while true; do + if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then + echo "You have already accepted the terms of the $TheLicense." + acceptance=yes + else + echo "You are licensed to use this software under the terms of" + echo "the $TheLicense." + echo + echo "Type '?' to view the $TheLicense." + echo "Type 'yes' to accept this license offer." + echo "Type 'no' to decline this license offer." + echo + echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" + read acceptance + fi + echo + if [ "$acceptance" = "yes" ]; then + break + elif [ "$acceptance" = "no" ]; then + echo "You are not licensed to use this software." + echo + exit 1 + else [ "$acceptance" = "?" ] + more "$outpath/LICENSE" + fi + done +fi + #------------------------------------------------------------------------------- # command line and environment validation #------------------------------------------------------------------------------- @@ -3153,20 +3243,6 @@ if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then exit 2 fi -if [ "$CFG_RTOS_ENABLED" = "no" ]; then - case `basename "$XPLATFORM"` in - qnx-* | vxworks-*) - echo "" - echo "You are not licensed for Qt for `basename $XPLATFORM`." - echo "" - echo "Please use the contact form at http://qt.digia.com/contact-us" - echo "to upgrade your license to include this platform, or install" - echo "the Qt Open Source Edition if you intend to develop free software." - exit 1 - ;; - esac -fi - #------------------------------------------------------------------------------- # build tree initialization #------------------------------------------------------------------------------- @@ -3640,155 +3716,6 @@ if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG compile_examples" fi -# ----------------------------------------------------------------------------- -# LICENSING, INTERACTIVE PART -# ----------------------------------------------------------------------------- - -echo -echo "This is the Qt ${EditionString} Edition." -echo - -if [ "$Edition" = "OpenSource" ]; then - while true; do - echo "You are licensed to use this software under the terms of" - echo "the Lesser GNU General Public License (LGPL) versions 2.1." - if [ -f "$relpath/LICENSE.GPL3" ]; then - echo "You are also licensed to use this software under the terms of" - echo "the GNU General Public License (GPL) versions 3." - affix="either" - else - affix="the" - fi - echo - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $LicenseType license." - acceptance=yes - else - if [ -f "$relpath/LICENSE.GPL3" ]; then - echo "Type '3' to view the GNU General Public License version 3." - fi - echo "Type 'L' to view the Lesser GNU General Public License version 2.1." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of $affix license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ] || [ "$acceptance" = "y" ]; then - break - elif [ "$acceptance" = "no" ]; then - echo "You are not licensed to use this software." - echo - exit 1 - elif [ "$acceptance" = "3" ]; then - more "$relpath/LICENSE.GPL3" - elif [ "$acceptance" = "L" ]; then - more "$relpath/LICENSE.LGPL" - fi - done -elif [ "$Edition" = "Preview" ]; then - TheLicense=`head -n 1 "$relpath/LICENSE.PREVIEW.COMMERCIAL"` - while true; do - - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $LicenseType license." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense" - echo - echo "Type '?' to read the Preview License." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of the license? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ] ;then - echo "You are not licensed to use this software." - echo - exit 0 - elif [ "$acceptance" = "?" ]; then - more "$relpath/LICENSE.PREVIEW.COMMERCIAL" - fi - done -elif [ "$Edition" != "OpenSource" ]; then - if [ -n "$ExpiryDate" ]; then - ExpiryDate=`echo $ExpiryDate | sed -e "s,-,,g" | tr -d "\n\r"` - [ -z "$ExpiryDate" ] && ExpiryDate="0" - Today=`date +%Y%m%d` - if [ "$Today" -gt "$ExpiryDate" ]; then - case "$LicenseType" in - Commercial|Academic|Educational) - echo - echo "WARNING WARNING WARNING WARNING" - echo - echo " Your support and upgrade period has expired." - echo - echo " You may continue to use your last licensed release" - echo " of Qt under the terms of your existing license" - echo " agreement. But you are not entitled to technical" - echo " support, nor are you entitled to use any more recent" - echo " Qt releases." - echo - echo " Please use the contact form at http://qt.digia.com/contact-us" - echo " to renew your support and upgrades for this license." - echo - echo "WARNING WARNING WARNING WARNING" - echo - sleep 3 - ;; - Evaluation|*) - echo - echo "NOTICE NOTICE NOTICE NOTICE" - echo - echo " Your Evaluation license has expired." - echo - echo " You are no longer licensed to use this software. Please" - echo " use the contact form at http://qt.digia.com/contact-us to" - echo " purchase license, or install the Qt Open Source Edition" - echo " if you intend to develop free software." - echo - echo "NOTICE NOTICE NOTICE NOTICE" - echo - exit 1 - ;; - esac - fi - fi - TheLicense=`head -n 1 "$outpath/LICENSE"` - while true; do - if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then - echo "You have already accepted the terms of the $TheLicense." - acceptance=yes - else - echo "You are licensed to use this software under the terms of" - echo "the $TheLicense." - echo - echo "Type '?' to view the $TheLicense." - echo "Type 'yes' to accept this license offer." - echo "Type 'no' to decline this license offer." - echo - echo $ECHO_N "Do you accept the terms of the $TheLicense? $ECHO_C" - read acceptance - fi - echo - if [ "$acceptance" = "yes" ]; then - break - elif [ "$acceptance" = "no" ]; then - echo "You are not licensed to use this software." - echo - exit 1 - else [ "$acceptance" = "?" ] - more "$outpath/LICENSE" - fi - done -fi - #------------------------------------------------------------------------------- # generate qconfig.cpp #------------------------------------------------------------------------------- From 02556c0dc5c66e5d91a090afd4b87260060d479a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 12 Nov 2013 22:01:44 +0100 Subject: [PATCH 15/24] clean up mess surrounding PLATFORM_MAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit introduce XPLATFORM_MAC which is properly initialized from the spec instead of from the host. use that and BUILD_ON_MAC where appropriate. minor bug: during command line arg validation we use BUILD_ON_MAC even when XPLATFORM_MAC would be in order, because the latter is not available at that point yet. the solution would be delaying the validation, but that doesn't seem worth the effort now. Task-number: QTBUG-33896 Change-Id: I63f361212961bfdd82efde2ca71a1f48904a85fb Reviewed-by: Tor Arne Vestbø Reviewed-by: Thiago Macieira --- configure | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 7ae26726953..b6e14a0cf39 100755 --- a/configure +++ b/configure @@ -328,7 +328,7 @@ getXQMakeConf() { if [ -z "$xspecvals" ]; then xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" | extractQMakeVariables "!host_build"` - if [ "$BUILD_ON_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi + if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi fi getSingleQMakeVariable "$1" "$xspecvals" } @@ -483,10 +483,8 @@ fi #------------------------------------------------------------------------------- BUILD_ON_MAC=no -PLATFORM_MAC=no if [ -d /System/Library/Frameworks/Carbon.framework ]; then BUILD_ON_MAC=yes - PLATFORM_MAC=maybe fi BUILD_ON_MSYS=no HOST_DIRLIST_SEP=":" @@ -701,6 +699,8 @@ RPATH_FLAGS= W_FLAGS= QCONFIG_FLAGS= XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" +XPLATFORM_MAC=no +XPLATFORM_IOS=no XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) XPLATFORM_MAEMO=no @@ -2676,8 +2676,12 @@ case "$XPLATFORM" in XPLATFORM_QNX=yes ;; *ios*) + XPLATFORM_MAC=yes XPLATFORM_IOS=yes ;; + *macx*) + XPLATFORM_MAC=yes + ;; # XPLATFORM_ANDROID should not be set for unsupported/android-g++ *unsupported*) ;; @@ -2713,14 +2717,12 @@ CFG_RTOS_ENABLED=yes EditionString=Commercial if [ -f "$relpath"/LICENSE.PREVIEW.COMMERCIAL ] && [ $COMMERCIAL_USER = "yes" ]; then # Commercial preview release - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes Licensee="Preview" Edition="Preview" QT_EDITION="QT_EDITION_DESKTOP" LicenseType="Technology Preview" elif [ $COMMERCIAL_USER = "yes" ]; then # one of commercial editions - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes # read in the license file [ -z "$LICENSE_FILE" ] && LICENSE_FILE="$QT_LICENSE_FILE" @@ -2817,7 +2819,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then ;; esac ### EMBEDDED_QPA logic missing ### - case "$PlatformCode,$PLATFORM_MAC" in + case "$PlatformCode,$XPLATFORM_MAC" in X9,* | XC,* | XU,* | XW,* | XM,*) # Qt All-OS LICENSE_EXTENSION="-ALLOS" @@ -2836,7 +2838,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then ;; *) Platform=Linux/X11 - [ "$PLATFORM_MAC" = "yes" ] && Platform='Mac OS X' + [ "$XPLATFORM_MAC" = "yes" ] && Platform='Mac OS X' echo echo "You are not licensed for the $Platform platform." echo @@ -2919,7 +2921,6 @@ elif [ $COMMERCIAL_USER = "yes" ]; then fi elif [ $COMMERCIAL_USER = "no" ]; then # Open Source edition - may only be used under the terms of the GPL or LGPL. - [ "$PLATFORM_MAC" = "maybe" ] && PLATFORM_MAC=yes Licensee="Open Source" Edition="OpenSource" EditionString="Open Source" @@ -3113,7 +3114,7 @@ minimal|small|medium|large|full) fi esac -if [ "$PLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "no" -a "$CFG_DEBUG_RELEASE" = "yes" ]; then echo echo "WARNING: -debug-and-release is not supported outside of Mac OS X." echo "Qt can be built in release mode with separate debug information, so" @@ -3291,7 +3292,7 @@ fi # detect build style if [ "$CFG_DEBUG" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then + if [ "$XPLATFORM_MAC" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then CFG_DEBUG_RELEASE=yes CFG_DEBUG=yes elif [ "$CFG_DEV" = "yes" ]; then @@ -3327,7 +3328,7 @@ if [ "$XPLATFORM_IOS" = "yes" ]; then fi # disable GTK style support auto-detection on Mac -if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then CFG_QGTKSTYLE=no fi @@ -3454,7 +3455,7 @@ if [ "$CFG_USE_GNUMAKE" = "auto" ] && "$MAKE" -v | grep "GNU Make" >/dev/null 2> fi # find the default framework value -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then if [ "$CFG_FRAMEWORK" = "auto" ]; then CFG_FRAMEWORK="$CFG_SHARED" elif [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_SHARED" = "no" ]; then @@ -3622,7 +3623,7 @@ fi QT_INSTALL_TRANSLATIONS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TRANSLATIONS"` if [ -z "$QT_INSTALL_SETTINGS" ]; then #default - if [ "$BUILD_ON_MAC" = "yes" ]; then + if [ "$XPLATFORM_MAC" = "yes" ]; then QT_INSTALL_SETTINGS=/Library/Preferences/Qt else QT_INSTALL_SETTINGS=$QT_INSTALL_PREFIX/etc/xdg @@ -4166,7 +4167,7 @@ if [ "$CFG_CXX11" != "no" ]; then # Configure detects compiler features based on cross compiler, so we need # to explicitly disable C++11 on Mac to avoid breaking builds where the # host compiler does not support it. - if [ "$PLATFORM_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then + if [ "$BUILD_ON_MAC" = "yes" ] && [ "$XPLATFORM_ANDROID" = "yes" ]; then CFG_CXX11="no" elif compileTest common/c++11 "C++11"; then CFG_CXX11="yes" @@ -4506,7 +4507,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; odbc) if [ "$CFG_SQL_odbc" != "no" ]; then - if ( [ "$BUILD_ON_MAC" != "yes" ] || [ "$XPLATFORM_MINGW" = "yes" ] ) && compileTest unix/odbc "ODBC"; then + if [ "$XPLATFORM_MAC" != "yes" ] && compileTest unix/odbc "ODBC"; then if [ "$CFG_SQL_odbc" = "auto" ]; then CFG_SQL_odbc=plugin fi @@ -4924,7 +4925,7 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then fi fi # X11/MINGW OpenGL -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then if [ "$CFG_COREWLAN" = "auto" ]; then if compileTest mac/corewlan "CoreWlan"; then CFG_COREWLAN=yes @@ -5326,7 +5327,7 @@ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then if [ "$XPLATFORM_MINGW" = "yes" ]; then QT_QPA_DEFAULT_PLATFORM="windows" - elif [ "$BUILD_ON_MAC" = "yes" ]; then + elif [ "$XPLATFORM_MAC" = "yes" ]; then QT_QPA_DEFAULT_PLATFORM="cocoa" elif [ "$UNAME_SYSTEM" = "QNX" ]; then QT_QPA_DEFAULT_PLATFORM="qnx" @@ -5353,7 +5354,7 @@ if [ "$CFG_KMS" = "yes" ]; then QT_CONFIG="$QT_CONFIG kms" fi -if [ "$BUILD_ON_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then +if [ "$XPLATFORM_MAC" = "no" ] && [ "$XPLATFORM_MINGW" = "no" ] && [ "$XPLATFORM_QNX" = "no" ] && [ "$XPLATFORM_ANDROID" = "no" ]; then if [ "$CFG_XCB" = "no" ] && [ "$CFG_EGLFS" = "no" ] && [ "$CFG_DIRECTFB" = "no" ] && [ "$CFG_LINUXFB" = "no" ] && [ "$CFG_KMS" = "no" ]; then if [ "$QPA_PLATFORM_GUARD" = "yes" ] && ( [ "$ORIG_CFG_XCB" = "auto" ] || [ "$ORIG_CFG_EGLFS" = "auto" ] || [ "$ORIG_CFG_DIRECTFB" = "auto" ] || [ "$ORIG_CFG_LINUXFB" = "auto" ] || [ "$ORIG_CFG_KMS" = "auto" ] ); then @@ -5809,7 +5810,7 @@ if [ "$CFG_WIDGETS" = "no" ]; then QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_WIDGETS" fi -if [ "x$BUILD_ON_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" @@ -5838,7 +5839,7 @@ fi [ '!' -z "$DEFINES" ] && QMakeVar add DEFINES "$DEFINES" [ '!' -z "$L_FLAGS" ] && QMakeVar add LIBS "$L_FLAGS" -if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then if [ "$CFG_RPATH" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname" fi @@ -6139,7 +6140,7 @@ if [ "$CFG_FRAMEWORK" = "yes" ]; then echo "#define QT_MAC_FRAMEWORK_BUILD" >>"$outpath/src/corelib/global/qconfig.h.new" fi -if [ "$BUILD_ON_MAC" = "yes" ]; then +if [ "$XPLATFORM_MAC" = "yes" ]; then cat >>"$outpath/src/corelib/global/qconfig.h.new" <&3 3>&- # restore stdout cat $outpath/config.summary # display config feedback to user -if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then +if [ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then echo echo "Error: debug-only framework builds are not supported. Configure with -no-framework" echo "if you want a pure debug build." From 6a1e534627e87cd92e0e81433d8d0997c8a8ea82 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Nov 2013 16:12:13 +0100 Subject: [PATCH 16/24] fix overquoting in some mkdir calls Change-Id: I2ed418064d43ab8cdab87af48e03d983c023ccf5 Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 3f879202aea..bfecb924c05 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -285,13 +285,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << odir << ".deps/%.d: " << pwd << "/%.cpp\n\t"; if(project->isActiveConfig("echo_depend_creation")) t << "@echo Creating depend for $<\n\t"; - t << mkdir_p_asstring("$(@D)") << "\n\t" + t << mkdir_p_asstring("$(@D)", false) << "\n\t" << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; t << odir << ".deps/%.d: " << pwd << "/%.c\n\t"; if(project->isActiveConfig("echo_depend_creation")) t << "@echo Creating depend for $<\n\t"; - t << mkdir_p_asstring("$(@D)") << "\n\t" + t << mkdir_p_asstring("$(@D)", false) << "\n\t" << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 }; @@ -804,7 +804,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) project->first("OBJECTS_DIR")) + ddir, Option::output_dir, Option::output_dir)); t << "dist: \n\t" - << mkdir_p_asstring(ddir_c) << "\n\t" + << mkdir_p_asstring(ddir_c, false) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); From 0c012b647064bd39eaf751b9a0e467fbf18441ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 10:52:50 +0100 Subject: [PATCH 17/24] iOS: Send expose events in the window's coordinate system, not the parent's Change-Id: I4aa1a354ca14864bd9898ebd331871d7b32d3ae0 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- src/plugins/platforms/ios/qioswindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index af429f9d65a..3d1fe935e53 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -168,7 +168,7 @@ QRect geometry = fromCGRect(self.frame); m_qioswindow->QPlatformWindow::setGeometry(geometry); QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry); - QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), geometry); + QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), QRect(QPoint(), geometry.size())); // If we have a new size here we need to resize the FBO's corresponding buffers, // but we defer that to when the application calls makeCurrent. From 49a3fe0cf8c8cddba6dacfb796e9db13c4ac74c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 17:55:25 +0100 Subject: [PATCH 18/24] tst_QWindow: Use showNormal() to prevent maximize/fullscreen interference We don't want platform behavior for whether or not maximized/fullscreen windows can be resized to affect the test for resize event propagation. Change-Id: I8c118733ca5d2553aacf24d0b8debeb1a4e27103 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Gunnar Sletta --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index bd5959786f8..259c840ae7b 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -177,7 +177,7 @@ void tst_QWindow::resizeEventAfterResize() Window window; window.setGeometry(geometry); - window.show(); + window.showNormal(); QTRY_COMPARE(window.received(QEvent::Resize), 1); From 837228151d085264e8244969349b3d68d6f9cc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 11:32:32 +0100 Subject: [PATCH 19/24] iOS: Don't keep around reference to a single QIOSViewController We might have more of them in a multi-screen setup or when implementing support for modal windows using sub-viewcontrollers. Change-Id: Ibe98273a13af981fffe2704a2c05bfd9d3f3e9e0 Reviewed-by: Richard Moe Gustavsen --- .../platforms/ios/qiosapplicationdelegate.h | 1 - .../platforms/ios/qiosapplicationdelegate.mm | 5 +---- src/plugins/platforms/ios/qiosglobal.h | 1 - src/plugins/platforms/ios/qiosglobal.mm | 11 ----------- src/plugins/platforms/ios/qiosscreen.mm | 2 +- src/plugins/platforms/ios/qioswindow.h | 1 + src/plugins/platforms/ios/qioswindow.mm | 19 +++++++++++++++++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.h b/src/plugins/platforms/ios/qiosapplicationdelegate.h index bfe31af1989..617b740d6e8 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.h +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.h @@ -47,6 +47,5 @@ @interface QIOSApplicationDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) QIOSViewController *qiosViewController; @end diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index 4d88faba756..775074baae1 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -49,7 +49,6 @@ @implementation QIOSApplicationDelegate @synthesize window; -@synthesize qiosViewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @@ -57,8 +56,7 @@ Q_UNUSED(launchOptions); self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; - self.qiosViewController = [[[QIOSViewController alloc] init] autorelease]; - self.window.rootViewController = self.qiosViewController; + self.window.rootViewController = [[[QIOSViewController alloc] init] autorelease]; self.window.hidden = NO; @@ -67,7 +65,6 @@ - (void)dealloc { - [qiosViewController release]; [window release]; [super dealloc]; } diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index fd328c9171b..41b0d7f93a8 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE class QPlatformScreen; bool isQtApplication(); -QIOSViewController *qiosViewController(); CGRect toCGRect(const QRect &rect); QRect fromCGRect(const CGRect &rect); diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 9b8462a6cc3..be68e4d7d5d 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -58,17 +58,6 @@ bool isQtApplication() return isQt; } -QIOSViewController *qiosViewController() -{ - // If Qt controls the application, we have created a root view controller were we place top-level - // QWindows. Note that in a mixed native application, our view controller might later be removed or - // added as a child of another controller. To protect against that, we keep an explicit pointer to the - // view controller in cases where this is the controller we need to access. - static QIOSViewController *c = isQtApplication() ? - static_cast([UIApplication sharedApplication].delegate).qiosViewController : nil; - return c; -} - CGRect toCGRect(const QRect &rect) { return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index d57e6788107..9d01053548a 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -149,7 +149,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) if (isQtApplication()) { // When in a non-mixed environment, let QScreen follow the current interface orientation: - setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation))); + setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation))); } } diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 5ded5892054..6e8683af00c 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -52,6 +52,7 @@ class QIOSWindow; @interface UIView (QIOS) @property(readonly) QWindow *qwindow; +@property(readonly) UIViewController *viewController; @end QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 3d1fe935e53..b13ce456a45 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -348,6 +348,16 @@ return nil; } +- (UIViewController *)viewController +{ + id responder = self; + while ((responder = [responder nextResponder])) { + if ([responder isKindOfClass:UIViewController.class]) + return responder; + } + return nil; +} + @end QT_BEGIN_NAMESPACE @@ -404,7 +414,7 @@ void QIOSWindow::setVisible(bool visible) requestActivateWindow(); } else { // Activate top-most visible QWindow: - NSArray *subviews = qiosViewController().view.subviews; + NSArray *subviews = m_view.viewController.view.subviews; for (int i = int(subviews.count) - 1; i >= 0; --i) { UIView *view = [subviews objectAtIndex:i]; if (!view.hidden) { @@ -460,7 +470,12 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow) UIView *parentView = reinterpret_cast(parentWindow->winId()); [parentView addSubview:m_view]; } else if (isQtApplication()) { - [qiosViewController().view addSubview:m_view]; + for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { + if (uiWindow.screen == static_cast(screen())->uiScreen()) { + [uiWindow.rootViewController.view addSubview:m_view]; + break; + } + } } } From c3e949ac7dd9ddfc3c089061908000c5b4d9dc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 15 Nov 2013 19:33:57 +0100 Subject: [PATCH 20/24] iOS: Allow non-top-level windows to be activated As tested and assumed by tst_QWindow::isActive(). Change-Id: I8d09263ce0acc9c3390a70b4089396257197a1be Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index b13ce456a45..de560848485 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -484,12 +484,14 @@ void QIOSWindow::requestActivateWindow() // Note that several windows can be active at the same time if they exist in the same // hierarchy (transient children). But only one window can be QGuiApplication::focusWindow(). // Dispite the name, 'requestActivateWindow' means raise and transfer focus to the window: - if (!window()->isTopLevel() || blockedByModal()) + if (blockedByModal()) return; [m_view.window makeKeyWindow]; - raise(); + if (window()->isTopLevel()) + raise(); + QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); static_cast(context)->focusViewChanged(m_view); QWindowSystemInterface::handleWindowActivated(window()); From 2e2c7327dd26678d26fd7fc431a78c1d05d94411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 18:25:24 +0100 Subject: [PATCH 21/24] iOS: Prepare platform screen for reacting to dynamic updates to properties Change-Id: Idb378416da2b559ed88eb5a764cacff149264f70 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.h | 3 +- src/plugins/platforms/ios/qiosscreen.mm | 78 ++++++++++--------- .../platforms/ios/qiosviewcontroller.mm | 9 +-- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index 40c7a3ccf76..e70ff4b1a9d 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -72,13 +72,14 @@ public: UIScreen *uiScreen() const; - void setPrimaryOrientation(Qt::ScreenOrientation orientation); + void updateProperties(); private: UIScreen *m_uiScreen; QRect m_geometry; QRect m_availableGeometry; int m_depth; + uint m_unscaledDpi; QSizeF m_physicalSize; QIOSOrientationListener *m_orientationListener; }; diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 9d01053548a..2d8ff7d8e1c 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -132,25 +132,14 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) m_depth = 24; } - int unscaledDpi = 163; // Regular iPhone DPI if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && !deviceIdentifier.contains(QRegularExpression("^iPad2,[567]$")) /* excluding iPad Mini */) { - unscaledDpi = 132; - }; - - CGRect bounds = [m_uiScreen bounds]; - m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); - - CGRect frame = m_uiScreen.applicationFrame; - m_availableGeometry = QRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); - - const qreal millimetersPerInch = 25.4; - m_physicalSize = QSizeF(m_geometry.size()) / unscaledDpi * millimetersPerInch; - - if (isQtApplication()) { - // When in a non-mixed environment, let QScreen follow the current interface orientation: - setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation([UIApplication sharedApplication].statusBarOrientation))); + m_unscaledDpi = 132; + } else { + m_unscaledDpi = 163; // Regular iPhone DPI } + + updateProperties(); } QIOSScreen::~QIOSScreen() @@ -158,6 +147,41 @@ QIOSScreen::~QIOSScreen() [m_orientationListener release]; } +void QIOSScreen::updateProperties() +{ + UIWindow *uiWindow = 0; + for (uiWindow in [[UIApplication sharedApplication] windows]) { + if (uiWindow.screen == m_uiScreen) + break; + } + + bool inPortrait = UIInterfaceOrientationIsPortrait(uiWindow.rootViewController.interfaceOrientation); + QRect geometry = inPortrait ? fromCGRect(m_uiScreen.bounds) + : QRect(m_uiScreen.bounds.origin.x, m_uiScreen.bounds.origin.y, + m_uiScreen.bounds.size.height, m_uiScreen.bounds.size.width); + + if (geometry != m_geometry) { + m_geometry = geometry; + + const qreal millimetersPerInch = 25.4; + m_physicalSize = QSizeF(m_geometry.size()) / m_unscaledDpi * millimetersPerInch; + + QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry); + } + + QRect availableGeometry = geometry; + + CGSize applicationFrameSize = m_uiScreen.applicationFrame.size; + int statusBarHeight = geometry.height() - (inPortrait ? applicationFrameSize.height : applicationFrameSize.width); + + availableGeometry.adjust(0, statusBarHeight, 0, 0); + + if (availableGeometry != m_availableGeometry) { + m_availableGeometry = availableGeometry; + QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); + } +} + QRect QIOSScreen::geometry() const { return m_geometry; @@ -213,28 +237,6 @@ void QIOSScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) } } -void QIOSScreen::setPrimaryOrientation(Qt::ScreenOrientation orientation) -{ - // Note that UIScreen never changes orientation, but QScreen should. To work around - // this, we let QIOSViewController call us whenever interface orientation changes, and - // use that as primary orientation. After all, the viewcontrollers geometry is what we - // place QWindows on top of. A problem with this approach is that QIOSViewController is - // not in use in a mixed environment, which results in no change to primary orientation. - // We see that as acceptable since Qt should most likely not interfere with orientation - // for that case anyway. - bool portrait = screen()->isPortrait(orientation); - if (portrait && m_geometry.width() < m_geometry.height()) - return; - - // Switching portrait/landscape means swapping width/height (and adjusting x/y): - m_geometry = QRect(0, 0, m_geometry.height(), m_geometry.width()); - m_physicalSize = QSizeF(m_physicalSize.height(), m_physicalSize.width()); - m_availableGeometry = fromPortraitToPrimary(fromCGRect(m_uiScreen.applicationFrame), this); - - QWindowSystemInterface::handleScreenGeometryChange(screen(), m_geometry); - QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); -} - UIScreen *QIOSScreen::uiScreen() const { return m_uiScreen; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 656a86027d0..1d5e69beac2 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -62,19 +62,16 @@ return UIInterfaceOrientationMaskAll; } -- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration { Q_UNUSED(duration); + Q_UNUSED(interfaceOrientation); if (!QCoreApplication::instance()) return; // FIXME: Store orientation for later (?) - Qt::ScreenOrientation orientation = toQtScreenOrientation(UIDeviceOrientation(toInterfaceOrientation)); - if (orientation == -1) - return; - QIOSScreen *qiosScreen = static_cast(QGuiApplication::primaryScreen()->handle()); - qiosScreen->setPrimaryOrientation(orientation); + qiosScreen->updateProperties(); } @end From ce6fd574b46cb10204f6ef598ea4377639ad1516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 18:27:37 +0100 Subject: [PATCH 22/24] iOS: Report native orientation of QScreen in relation to size Instead of hard-coding it to assume the properties of the main/device screen. Change-Id: I94c978d4334cae5be9d1094a0c315031e54e8e1f Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 2d8ff7d8e1c..b93511d755a 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -219,7 +219,9 @@ qreal QIOSScreen::devicePixelRatio() const Qt::ScreenOrientation QIOSScreen::nativeOrientation() const { - return Qt::PortraitOrientation; + // A UIScreen stays in the native orientation, regardless of rotation + return m_uiScreen.bounds.size.width >= m_uiScreen.bounds.size.height ? + Qt::LandscapeOrientation : Qt::PortraitOrientation; } Qt::ScreenOrientation QIOSScreen::orientation() const From 16ad93af4959b3c0ae96a4a0d88e25c1626f587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 18 Nov 2013 19:21:10 +0100 Subject: [PATCH 23/24] iOS: Don't use auto resizing masks to deal with maximized/fullscreen It breaks down when the view-controller is fullscreen and we want to take statusbar height into account as well. Unfortunately we can't use constraints either, as it's iOS6+. The approach of managing the geometry manually is closer to what Android does as well. Change-Id: Ib521ba0f50b110c440ab68aacef5a524d5d41154 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 3 +++ src/plugins/platforms/ios/qioswindow.mm | 29 +++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index b93511d755a..de6585fd195 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -180,6 +180,9 @@ void QIOSScreen::updateProperties() m_availableGeometry = availableGeometry; QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry); } + + if (screen()) + resizeMaximizedWindows(); } QRect QIOSScreen::geometry() const diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index de560848485..2413a45e11c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -448,19 +448,26 @@ void QIOSWindow::setWindowState(Qt::WindowState state) // Perhaps setting QWindow to maximized should also mean that we'll show // the statusbar, and vice versa for fullscreen? + if (state != Qt::WindowNoState) + m_normalGeometry = geometry(); + switch (state) { - case Qt::WindowMaximized: - case Qt::WindowFullScreen: { - // Since UIScreen does not take orientation into account when - // reporting geometry, we need to look at the top view instead: - CGSize fullscreenSize = m_view.window.rootViewController.view.bounds.size; - m_view.frame = CGRectMake(0, 0, fullscreenSize.width, fullscreenSize.height); - m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - break; } - default: - m_view.frame = toCGRect(m_normalGeometry); - m_view.autoresizingMask = UIViewAutoresizingNone; + case Qt::WindowNoState: + setGeometry(m_normalGeometry); break; + case Qt::WindowMaximized: + setGeometry(screen()->availableGeometry()); + break; + case Qt::WindowFullScreen: + setGeometry(screen()->geometry()); + break; + case Qt::WindowMinimized: + setGeometry(QRect()); + break; + case Qt::WindowActive: + Q_UNREACHABLE(); + default: + Q_UNREACHABLE(); } } From 54b8c27e03d04c1e5cd35f75d5c0a8111240eb74 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 15 Nov 2013 11:26:38 +0100 Subject: [PATCH 24/24] Fix crash when windowcontainer is used in a dockwidget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dockwidget's toplevel window would be a parent of the container's window when floating. When plugged back into the mainwindow the dockwidget's window is destroyed and the container's window along with it. Added a function toplevelAboutToBeDestroyed to unparent the containers window before this happens so parentWasChanged will work correctly. Change-Id: I06679cfb3a8fa3834c0db0be5973c012b8277275 Reviewed-by: Ulf Hermann Reviewed-by: Jørgen Lind --- src/widgets/kernel/qwidget_qpa.cpp | 6 +++- src/widgets/kernel/qwindowcontainer.cpp | 19 ++++++++++-- src/widgets/kernel/qwindowcontainer_p.h | 1 + .../qwindowcontainer/tst_qwindowcontainer.cpp | 29 +++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 18045e3b09d..3c4985591e4 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -53,6 +53,7 @@ #include #include "QtGui/private/qwindow_p.h" #include "QtGui/private/qguiapplication_p.h" +#include #include #include @@ -267,8 +268,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); // Reparenting toplevel to child - if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) + if (wasCreated && !(f & Qt::Window) && (oldFlags & Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) { + if (extra && extra->hasWindowContainer) + QWindowContainer::toplevelAboutToBeDestroyed(q); q->destroy(); + } adjustFlags(f, q); data.window_flags = f; diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 6914f64f8ec..7c319c50953 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -300,15 +300,28 @@ static void qwindowcontainer_traverse(QWidget *parent, qwindowcontainer_traverse } } +void QWindowContainer::toplevelAboutToBeDestroyed(QWidget *parent) +{ + if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) { + d->window->setParent(&d->fakeParent); + } + qwindowcontainer_traverse(parent, toplevelAboutToBeDestroyed); +} + void QWindowContainer::parentWasChanged(QWidget *parent) { if (QWindowContainerPrivate *d = QWindowContainerPrivate::get(parent)) { if (d->window->parent()) { d->updateUsesNativeWidgets(); d->markParentChain(); - d->window->setParent(d->usesNativeWidgets - ? parent->windowHandle() - : parent->window()->windowHandle()); + QWidget *toplevel = d->usesNativeWidgets ? parent : parent->window(); + if (!toplevel->windowHandle()) { + QWidgetPrivate *tld = static_cast(QWidgetPrivate::get(toplevel)); + tld->createTLExtra(); + tld->createTLSysExtra(); + Q_ASSERT(toplevel->windowHandle()); + } + d->window->setParent(toplevel->windowHandle()); d->updateGeometry(); } } diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index e2446bef426..a21f9bd35af 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -57,6 +57,7 @@ public: explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0); ~QWindowContainer(); + static void toplevelAboutToBeDestroyed(QWidget *parent); static void parentWasChanged(QWidget *parent); static void parentWasMoved(QWidget *parent); static void parentWasRaised(QWidget *parent); diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index c17a03e058e..cd6433bbe7c 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -46,6 +46,8 @@ #include #include +#include +#include class Window : public QWindow @@ -80,6 +82,7 @@ private slots: void testUnparenting(); void testActivation(); void testAncestorChange(); + void testDockWidget(); }; @@ -278,6 +281,7 @@ void tst_QWindowContainer::testAncestorChange() newRoot->setGeometry(100, 100, 200, 200); newRoot->show(); QVERIFY(QTest::qWaitForWindowExposed(newRoot)); + QCOMPARE(newRoot->windowHandle(), window->parent()); // newRoot // + right // + container @@ -285,6 +289,31 @@ void tst_QWindowContainer::testAncestorChange() QCOMPARE(window->geometry(), QRect(100, 0, 100, 100)); } + +void tst_QWindowContainer::testDockWidget() +{ + QMainWindow mainWindow; + mainWindow.resize(200, 200); + + QDockWidget *dock = new QDockWidget(); + QWindow *window = new QWindow(); + QWidget *container = QWidget::createWindowContainer(window); + dock->setWidget(container); + mainWindow.addDockWidget(Qt::RightDockWidgetArea, dock); + + mainWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); + QVERIFY(window->parent() == mainWindow.window()->windowHandle()); + + QTest::qWait(1000); + dock->setFloating(true); + QTRY_VERIFY(window->parent() != mainWindow.window()->windowHandle()); + + QTest::qWait(1000); + dock->setFloating(false); + QTRY_VERIFY(window->parent() == mainWindow.window()->windowHandle()); +} + QTEST_MAIN(tst_QWindowContainer) #include "tst_qwindowcontainer.moc"