summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-04-17 13:28:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-17 16:24:04 +0200
commite7b791c8bb5e64a4c786bf370b10366815af704f (patch)
tree7edfc2b01ef5c66d63eeb970acf387e74313be29
parent1f753e86eaaed18e7e5db04d72837e6a7a82171d (diff)
downloadqttools-e7b791c8bb5e64a4c786bf370b10366815af704f.tar.gz
Polish qtdiag.
Add missing platform capabilities, style hints. Output network configuration, add command line option for GL extensions. Change-Id: I98277bcc0df578381cfd13d80e3ed60156769799 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/qtdiag/main.cpp13
-rw-r--r--src/qtdiag/qtdiag.cpp59
-rw-r--r--src/qtdiag/qtdiag.h6
-rw-r--r--src/qtdiag/qtdiag.pro5
4 files changed, 75 insertions, 8 deletions
diff --git a/src/qtdiag/main.cpp b/src/qtdiag/main.cpp
index b5657db1d..e786ee527 100644
--- a/src/qtdiag/main.cpp
+++ b/src/qtdiag/main.cpp
@@ -42,6 +42,7 @@
#include "qtdiag.h"
#include <QtGui/QGuiApplication>
+#include <QtCore/QCommandLineParser>
#include <iostream>
#include <string>
@@ -57,6 +58,16 @@ int main(int argc, char **argv)
QCoreApplication::setOrganizationName(QStringLiteral("Qt Project"));
QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org"));
- std::wcout << qtDiag().toStdWString();
+ QCommandLineParser commandLineParser;
+ const QCommandLineOption glExtensionOption(QStringLiteral("gl-extensions"), QStringLiteral("List GL extensions"));
+ commandLineParser.setApplicationDescription(QStringLiteral("Prints diagnostic output about the Qt library."));
+ commandLineParser.addOption(glExtensionOption);
+ commandLineParser.addHelpOption();
+ commandLineParser.process(app);
+ unsigned flags = 0;
+ if (commandLineParser.isSet(glExtensionOption))
+ flags |= QtDiagGlExtensions;
+
+ std::wcout << qtDiag(flags).toStdWString();
return 0;
}
diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp
index bf30ffbb6..4f9eed813 100644
--- a/src/qtdiag/qtdiag.cpp
+++ b/src/qtdiag/qtdiag.cpp
@@ -52,6 +52,10 @@
#endif // QT_NO_OPENGL
#include <QtGui/QWindow>
+#ifdef NETWORK_DIAG
+# include <QSslSocket>
+#endif
+
#include <QtCore/QLibraryInfo>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
@@ -65,6 +69,8 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformtheme.h>
+#include <algorithm>
+
QT_BEGIN_NAMESPACE
QTextStream &operator<<(QTextStream &str, const QSize &s)
@@ -125,7 +131,7 @@ QTextStream &operator<<(QTextStream &str, const QSurfaceFormat &format)
return str;
}
-void dumpGlInfo(QTextStream &str)
+void dumpGlInfo(QTextStream &str, bool listExtensions)
{
QOpenGLContext context;
if (context.create()) {
@@ -151,6 +157,14 @@ void dumpGlInfo(QTextStream &str)
<< "\nVersion: " << reinterpret_cast<const char *>(functions.glGetString(GL_VERSION))
<< "\nShading language: " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))
<< "\nFormat: " << context.format();
+
+ if (listExtensions) {
+ QList<QByteArray> extensionList = context.extensions().toList();
+ std::sort(extensionList.begin(), extensionList.end());
+ str << " \nFound " << extensionList.size() << " extensions:\n";
+ foreach (const QByteArray &extension, extensionList)
+ str << " " << extension << '\n';
+ }
} else {
str << "Unable to create an Open GL context.\n";
}
@@ -178,7 +192,7 @@ static QStringList toNativeSeparators(QStringList in)
str << " " << #loc << ": " << QDir::toNativeSeparators(QLibraryInfo::location(QLibraryInfo::loc)) << '\n';
-QString qtDiag()
+QString qtDiag(unsigned flags)
{
QString result;
QTextStream str(&result);
@@ -227,8 +241,25 @@ QString qtDiag()
DUMP_STANDARDPATH(str, ConfigLocation)
DUMP_STANDARDPATH(str, DownloadLocation)
DUMP_STANDARDPATH(str, GenericCacheLocation)
-
- str << "\nPlatform capabilities:";
+ DUMP_STANDARDPATH(str, GenericConfigLocation)
+
+ str << "\nNetwork:\n ";
+#ifdef NETWORK_DIAG
+# ifndef QT_NO_SSL
+ if (QSslSocket::supportsSsl()) {
+ str << "Using \"" << QSslSocket::sslLibraryVersionString() << "\", version: "
+ << QSslSocket::sslLibraryVersionNumber();
+ } else {
+ str << "\nSSL is not supported.";
+ }
+# else // !QT_NO_SSL
+ str << "SSL is not available.";
+# endif // QT_NO_SSL
+#else
+ str << "Qt Network module is not available.";
+#endif // NETWORK_DIAG
+
+ str << "\n\nPlatform capabilities:";
DUMP_CAPABILITY(str, platformIntegration, ThreadedPixmaps)
DUMP_CAPABILITY(str, platformIntegration, OpenGL)
DUMP_CAPABILITY(str, platformIntegration, ThreadedOpenGL)
@@ -238,11 +269,18 @@ QString qtDiag()
DUMP_CAPABILITY(str, platformIntegration, MultipleWindows)
DUMP_CAPABILITY(str, platformIntegration, ApplicationState)
DUMP_CAPABILITY(str, platformIntegration, ForeignWindows)
+ DUMP_CAPABILITY(str, platformIntegration, NonFullScreenWindows)
+ DUMP_CAPABILITY(str, platformIntegration, NativeWidgets)
+ DUMP_CAPABILITY(str, platformIntegration, WindowManagement)
+ DUMP_CAPABILITY(str, platformIntegration, SyncState)
+ DUMP_CAPABILITY(str, platformIntegration, RasterGLSurface)
DUMP_CAPABILITY(str, platformIntegration, AllGLFunctionsQueryable)
str << '\n';
const QStyleHints *styleHints = QGuiApplication::styleHints();
+ const QChar passwordMaskCharacter = styleHints->passwordMaskCharacter();
str << "\nStyle hints:\n mouseDoubleClickInterval: " << styleHints->mouseDoubleClickInterval() << '\n'
+ << " mousePressAndHoldInterval: " << styleHints->mousePressAndHoldInterval() << '\n'
<< " startDragDistance: " << styleHints->startDragDistance() << '\n'
<< " startDragTime: " << styleHints->startDragTime() << '\n'
<< " startDragVelocity: " << styleHints->startDragVelocity() << '\n'
@@ -251,9 +289,15 @@ QString qtDiag()
<< " cursorFlashTime: " << styleHints->cursorFlashTime() << '\n'
<< " showIsFullScreen: " << styleHints->showIsFullScreen() << '\n'
<< " passwordMaskDelay: " << styleHints->passwordMaskDelay() << '\n'
+ << " passwordMaskCharacter: ";
+ if (passwordMaskCharacter.unicode() >= 32 && passwordMaskCharacter.unicode() < 128)
+ str << '\'' << passwordMaskCharacter << '\'';
+ else
+ str << hex << showbase << passwordMaskCharacter.unicode() << noshowbase << dec;
+ str << '\n'
<< " fontSmoothingGamma: " << styleHints->fontSmoothingGamma() << '\n'
<< " useRtlExtensions: " << styleHints->useRtlExtensions() << '\n'
- << " mousePressAndHoldInterval: " << styleHints->mousePressAndHoldInterval() << '\n';
+ << " setFocusOnTouchRelease: " << styleHints->setFocusOnTouchRelease() << '\n';
const QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme();
str << "\nTheme:\n Styles: " << platformTheme->themeHint(QPlatformTheme::StyleNames).toStringList();
@@ -299,13 +343,16 @@ QString qtDiag()
<< "\n DevicePixelRatio: " << screen->devicePixelRatio()
<< " Primary orientation: " << screen->primaryOrientation()
<< "\n Orientation: " << screen->orientation()
+ << " Native orientation: " << screen->nativeOrientation()
<< " OrientationUpdateMask: " << screen->orientationUpdateMask()
<< "\n\n";
}
#ifndef QT_NO_OPENGL
- dumpGlInfo(str);
+ dumpGlInfo(str, flags & QtDiagGlExtensions);
str << "\n\n";
+#else
+ Q_UNUSED(flags)
#endif // !QT_NO_OPENGL
return result;
}
diff --git a/src/qtdiag/qtdiag.h b/src/qtdiag/qtdiag.h
index 230b0d769..b6c708eac 100644
--- a/src/qtdiag/qtdiag.h
+++ b/src/qtdiag/qtdiag.h
@@ -46,7 +46,11 @@
QT_BEGIN_NAMESPACE
-QString qtDiag();
+enum QtDiagFlags {
+ QtDiagGlExtensions = 0x1
+};
+
+QString qtDiag(unsigned flags = 0);
QT_END_NAMESPACE
diff --git a/src/qtdiag/qtdiag.pro b/src/qtdiag/qtdiag.pro
index 9b33b1cd1..ebda95822 100644
--- a/src/qtdiag/qtdiag.pro
+++ b/src/qtdiag/qtdiag.pro
@@ -3,5 +3,10 @@ load(qt_app)
CONFIG += console
QT += core-private gui-private
+qtHaveModule(network) {
+ QT += network
+ DEFINES += NETWORK_DIAG
+}
+
SOURCES += main.cpp qtdiag.cpp
HEADERS += qtdiag.h