From 34a819786a82ead0bc56794520e7ca97f6663826 Mon Sep 17 00:00:00 2001 From: Benjamin C Meyer Date: Fri, 27 Mar 2009 19:23:23 -0400 Subject: [PATCH] Add check for the Oxygen style and switch to plastique unless the user specifies oxygen on the command line --- src/main.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 14862b80..9a540666 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,13 +23,43 @@ #include "explorerstyle.h" #endif +#if defined(Q_WS_X11) +#include +#include +#include +#endif + int main(int argc, char **argv) { Q_INIT_RESOURCE(htmls); Q_INIT_RESOURCE(data); + +#if defined(Q_WS_X11) + // See if -style oxygen has been passed as a command line argument + int hasStyle = -1; + int hasOxygen = -1; + for (int i = 0; i < argc; ++i) { + if (QLatin1String(argv[i]) == QLatin1String("-style")) + hasStyle = i; + if (QLatin1String(argv[i]) == QLatin1String("oxygen")) + hasOxygen = i; + } + bool keepOxygen = (hasStyle + 1 == hasOxygen); +#endif BrowserApplication application(argc, argv); if (!application.isRunning()) return 0; + +#if defined(Q_WS_X11) + if (!keepOxygen + && application.style()->objectName() == QLatin1String("oxygen")) { + qWarning() << "Oxygen style has been detected, loading Plastique style." << endl + << " - KDE's 4.2's Oxygen style has too many issues with Qt 4.5 features that Arora uses and while many of the issues have been fixed for KDE 4.3, KDE 4.2 users get a really ugly Arora." + << "Once KDE 4.3 is released this check will be removed." + << "If you are still want to use Oxygen add the arguments -style oxygen on the command line."; + application.setStyle(QLatin1String("plastique")); + } +#endif #ifdef Q_OS_WIN application.setStyle(new ExplorerStyle); #endif