Permalink
Browse files

Add check for the Oxygen style and switch to plastique unless the use…

…r specifies oxygen on the command line
  • Loading branch information...
1 parent f01c6a6 commit 34a819786a82ead0bc56794520e7ca97f6663826 @icefox icefox committed Mar 27, 2009
Showing with 30 additions and 0 deletions.
  1. +30 −0 src/main.cpp
View
@@ -23,13 +23,43 @@
#include "explorerstyle.h"
#endif
+#if defined(Q_WS_X11)
+#include <qdebug.h>
+#include <qstyle.h>
+#include <qstylefactory.h>
+#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

0 comments on commit 34a8197

Please sign in to comment.