diff options
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 86 |
1 files changed, 67 insertions, 19 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f6e67e05d0..b8bfad4f16 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -68,7 +68,7 @@ #include <qpalette.h> #include <qscreen.h> #include "qsessionmanager.h" -#include <private/qcolorprofile_p.h> +#include <private/qcolortrclut_p.h> #include <private/qscreen_p.h> #include <QtGui/qgenericpluginfactory.h> @@ -1306,6 +1306,58 @@ static void init_plugins(const QList<QByteArray> &pluginList) } } +void QGuiApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options) +{ + QCoreApplicationPrivate::addQtOptions(options); + +#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) + const QByteArray sessionType = qgetenv("XDG_SESSION_TYPE"); + const bool x11 = sessionType == "x11"; + // Technically the x11 aliases are only available if platformName is "xcb", but we can't know that here. +#else + const bool x11 = false; +#endif + + options->append(QCommandLineOption(QStringLiteral("platform"), + QGuiApplication::tr("QPA plugin. See QGuiApplication documentation for available options for each plugin."), QStringLiteral("platformName[:options]"))); + options->append(QCommandLineOption(QStringLiteral("platformpluginpath"), + QGuiApplication::tr("Path to the platform plugins."), QStringLiteral("path"))); + options->append(QCommandLineOption(QStringLiteral("platformtheme"), + QGuiApplication::tr("Platform theme."), QStringLiteral("theme"))); + options->append(QCommandLineOption(QStringLiteral("plugin"), + QGuiApplication::tr("Additional plugins to load, can be specified multiple times."), QStringLiteral("plugin"))); + options->append(QCommandLineOption(QStringLiteral("qwindowgeometry"), + QGuiApplication::tr("Window geometry for the main window, using the X11-syntax, like 100x100+50+50."), QStringLiteral("geometry"))); + options->append(QCommandLineOption(QStringLiteral("qwindowicon"), + QGuiApplication::tr("Default window icon."), QStringLiteral("icon"))); + options->append(QCommandLineOption(QStringLiteral("qwindowtitle"), + QGuiApplication::tr("Title of the first window."), QStringLiteral("title"))); + options->append(QCommandLineOption(QStringLiteral("reverse"), + QGuiApplication::tr("Sets the application's layout direction to Qt::RightToLeft (debugging helper)."))); + options->append(QCommandLineOption(QStringLiteral("session"), + QGuiApplication::tr("Restores the application from an earlier session."), QStringLiteral("session"))); + + if (x11) { + options->append(QCommandLineOption(QStringLiteral("display"), + QGuiApplication::tr("Display name, overrides $DISPLAY."), QStringLiteral("display"))); + options->append(QCommandLineOption(QStringLiteral("name"), + QGuiApplication::tr("Instance name according to ICCCM 4.1.2.5."), QStringLiteral("name"))); + options->append(QCommandLineOption(QStringLiteral("nograb"), + QGuiApplication::tr("Disable mouse grabbing (useful in debuggers)."))); + options->append(QCommandLineOption(QStringLiteral("dograb"), + QGuiApplication::tr("Force mouse grabbing (even when running in a debugger)."))); + options->append(QCommandLineOption(QStringLiteral("visual"), + QGuiApplication::tr("ID of the X11 Visual to use."), QStringLiteral("id"))); + // Not using the "QStringList names" solution for those aliases, because it makes the first column too wide + options->append(QCommandLineOption(QStringLiteral("geometry"), + QGuiApplication::tr("Alias for --windowgeometry."), QStringLiteral("geometry"))); + options->append(QCommandLineOption(QStringLiteral("icon"), + QGuiApplication::tr("Alias for --windowicon."), QStringLiteral("icon"))); + options->append(QCommandLineOption(QStringLiteral("title"), + QGuiApplication::tr("Alias for --windowtitle."), QStringLiteral("title"))); + } +} + void QGuiApplicationPrivate::createPlatformIntegration() { QHighDpiScaling::initHighDpiScaling(); @@ -1648,8 +1700,6 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() platform_theme = 0; delete platform_integration; platform_integration = 0; - delete m_a8ColorProfile.load(); - delete m_a32ColorProfile.load(); window_list.clear(); screen_list.clear(); @@ -1832,7 +1882,11 @@ bool QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(QWindow *window, return platformWindow->windowEvent(event); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result) +#else bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result) +#endif { return window->nativeEvent(eventType, message, result); } @@ -3993,32 +4047,26 @@ void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) } #endif -const QColorProfile *QGuiApplicationPrivate::colorProfileForA8Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA8Text() { #ifdef Q_OS_WIN - QColorProfile *result = m_a8ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering - if (!m_a8ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a8ColorProfile.load(); + if (!m_a8ColorProfile){ + QColorTrcLut *cs = QColorTrcLut::fromGamma(2.31); // This is a hard-coded thing for Windows text rendering + m_a8ColorProfile.reset(cs); } - return result; + return m_a8ColorProfile.get(); #else return colorProfileForA32Text(); #endif } -const QColorProfile *QGuiApplicationPrivate::colorProfileForA32Text() +const QColorTrcLut *QGuiApplicationPrivate::colorProfileForA32Text() { - QColorProfile *result = m_a32ColorProfile.load(); - if (!result){ - QColorProfile *cs = QColorProfile::fromGamma(fontSmoothingGamma); - if (!m_a32ColorProfile.testAndSetRelease(0, cs)) - delete cs; - result = m_a32ColorProfile.load(); + if (!m_a32ColorProfile) { + QColorTrcLut *cs = QColorTrcLut::fromGamma(fontSmoothingGamma); + m_a32ColorProfile.reset(cs); } - return result; + return m_a32ColorProfile.get(); } void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) |