Skip to content

Commit

Permalink
Add check for the Oxygen style and switch to plastique unless the use…
Browse files Browse the repository at this point in the history
…r specifies oxygen on the command line
  • Loading branch information
icefox committed Mar 27, 2009
1 parent f01c6a6 commit 34a8197
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 34a8197

Please sign in to comment.