Much better solution to avoid the gtk+ style on Linux

Thiago showed me how to find out which style is in use and if we see a
user is running gtk+ we simply switch Subsurface to Oxygen (using the
old plastique in the previous patch was a result of reading an old Qt
book, I guess).

Solved-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-31 17:43:38 +10:00
parent a31a8ca759
commit 5c2a2691fd

View file

@ -30,6 +30,8 @@
#include <QTranslator>
#include <QSettings>
#include <QDesktopWidget>
#include <QStyle>
#include <QDebug>
const char *default_dive_computer_vendor;
const char *default_dive_computer_product;
@ -84,17 +86,14 @@ const char *getSetting(QSettings &s, QString name)
void init_ui(int *argcp, char ***argvp)
{
QVariant v;
#ifdef __linux__
// for people running under Gnome the default style is
// really ugly; this seems like a bad hack, but it makes
// things look somewhat better
// I'd much rather be able to check if it is using the Gnome
// style and only then force plastique but I haven't been
// able to figure out how to do that
QApplication::setStyle("plastique");
#endif
application = new QApplication(*argcp, *argvp);
// the Gtk theme makes things unbearably ugly
// so switch to Oxygen in this case
if (application->style()->objectName() == "gtk+")
application->setStyle("Oxygen");
#if QT_VERSION < 0x050000
// ask QString in Qt 4 to interpret all char* as UTF-8,
// like Qt 5 does.