move loading of testability driver from QApplication to QGuiApplication

This is useful without QWidget too.

Change-Id: Ic7857e52e4a8f57c1205615a1f30323b486814af
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Alberto Mardegan <mardy@users.sourceforge.net>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Michael Zanetti 2013-09-25 16:11:58 +02:00 committed by Shawn Rutledge
parent 47a66d5eac
commit 35f6b00334
3 changed files with 23 additions and 24 deletions

View File

@ -96,6 +96,10 @@
#include <QtGui/QClipboard>
#endif
#ifndef QT_NO_LIBRARY
#include <QtCore/QLibrary>
#endif
#if defined(Q_OS_MAC)
# include "private/qcore_mac_p.h"
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
@ -1180,6 +1184,7 @@ void QGuiApplicationPrivate::init()
QCoreApplicationPrivate::is_app_running = false; // Starting up.
bool doGrabUnderDebugger = false;
bool loadTestability = false;
QList<QByteArray> pluginList;
// Get command line params
#ifndef QT_NO_SESSIONMANAGER
@ -1230,6 +1235,8 @@ void QGuiApplicationPrivate::init()
is_session_restored = true;
}
#endif
} else if (arg == "-testability") {
loadTestability = true;
} else {
argv[j++] = argv[i];
}
@ -1287,6 +1294,22 @@ void QGuiApplicationPrivate::init()
session_manager = new QSessionManager(q, session_id, session_key);
#endif
#ifndef QT_NO_LIBRARY
if (loadTestability) {
QLibrary testLib(QStringLiteral("qttestability"));
if (testLib.load()) {
typedef void (*TasInitialize)(void);
TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
if (initFunction) {
initFunction();
} else {
qCritical() << "Library qttestability resolve failed!";
}
} else {
qCritical() << "Library qttestability load failed:" << testLib.errorString();
}
}
#endif // QT_NO_LIBRARY
}
extern void qt_cleanupFontDatabase();

View File

@ -92,9 +92,6 @@
#include "qgesture.h"
#include "private/qgesturemanager_p.h"
#include <qpa/qplatformfontdatabase.h>
#ifndef QT_NO_LIBRARY
#include "qlibrary.h"
#endif
#include "qdatetime.h"
@ -415,7 +412,6 @@ int qt_antialiasing_threshold = -1;
QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut
int QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;
bool QApplicationPrivate::widgetCount = false;
bool QApplicationPrivate::load_testability = false;
#ifdef QT_KEYPAD_NAVIGATION
Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadTabOrder;
QWidget *QApplicationPrivate::oldEditFocus = 0;
@ -490,8 +486,6 @@ void QApplicationPrivate::process_cmdline()
#endif
} else if (qstrcmp(arg, "-widgetcount") == 0) {
widgetCount = true;
} else if (qstrcmp(arg, "-testability") == 0) {
load_testability = true;
} else {
argv[j++] = argv[i];
}
@ -582,23 +576,6 @@ void QApplicationPrivate::construct()
extern void qt_gui_eval_init(QCoreApplicationPrivate::Type);
qt_gui_eval_init(application_type);
#endif
#ifndef QT_NO_LIBRARY
if(load_testability) {
QLibrary testLib(QLatin1String("qttestability"));
if (testLib.load()) {
typedef void (*TasInitialize)(void);
TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
if (initFunction) {
initFunction();
} else {
qCritical("Library qttestability resolve failed!");
}
} else {
qCritical("Library qttestability load failed!");
}
}
#endif
}
#ifndef QT_NO_STATEMACHINE

View File

@ -214,7 +214,6 @@ public:
static int enabledAnimations; // Combination of QPlatformTheme::UiEffect
static bool widgetCount; // Coupled with -widgetcount switch
static bool load_testability; // Coupled with -testability switch
static void setSystemPalette(const QPalette &pal);
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);