--- qsampler/trunk/src/qsampler.cpp 2011/06/05 10:21:53 2181 +++ qsampler/trunk/src/qsampler.cpp 2013/02/14 14:57:43 2415 @@ -1,7 +1,7 @@ // qsampler.cpp // /**************************************************************************** - Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2004-2013, rncbc aka Rui Nuno Capela. All rights reserved. Copyright (C) 2007, 2008 Christian Schoenebeck This program is free software; you can redistribute it and/or @@ -37,6 +37,27 @@ #define darker(x) dark(x) #endif +#define CONFIG_QUOTE1(x) #x +#define CONFIG_QUOTED(x) CONFIG_QUOTE1(x) + +#if defined(DATADIR) +#define CONFIG_DATADIR CONFIG_QUOTED(DATADIR) +#else +#define CONFIG_DATADIR CONFIG_PREFIX "/share" +#endif + +#if defined(LOCALEDIR) +#define CONFIG_LOCALEDIR CONFIG_QUOTED(LOCALEDIR) +#else +#define CONFIG_LOCALEDIR CONFIG_DATADIR "/locale" +#endif + +#if WIN32 +#define RELATIVE_LOCALE_DIR "/share/locale" +#elif defined(__APPLE__) +#define RELATIVE_LOCALE_DIR "/../Resources" +#endif + //------------------------------------------------------------------------- // Singleton application instance stuff (Qt/X11 only atm.) @@ -71,8 +92,8 @@ if (m_pQtTranslator->load(sLocName, sLocPath)) { QApplication::installTranslator(m_pQtTranslator); } else { - #if WIN32 - sLocPath = QApplication::applicationDirPath() + "/share/locale"; + #ifdef RELATIVE_LOCALE_DIR + sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; if (m_pQtTranslator->load(sLocName, sLocPath)) { QApplication::installTranslator(m_pQtTranslator); } else { @@ -85,7 +106,7 @@ sLocPath.toUtf8().constData(), sLocName.toUtf8().constData()); #endif - #if WIN32 + #ifdef RELATIVE_LOCALE_DIR } #endif } @@ -95,10 +116,10 @@ if (m_pMyTranslator->load(sLocName, sLocPath)) { QApplication::installTranslator(m_pMyTranslator); } else { - #if WIN32 - sLocPath = QApplication::applicationDirPath() + "/share/locale"; + #ifdef RELATIVE_LOCALE_DIR + sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; #else - sLocPath = CONFIG_PREFIX "/share/locale"; + sLocPath = CONFIG_LOCALEDIR; #endif if (m_pMyTranslator->load(sLocName, sLocPath)) { QApplication::installTranslator(m_pMyTranslator); @@ -257,6 +278,7 @@ #include #include #include +#include #include void stacktrace ( int signo ) @@ -354,6 +376,19 @@ // Dark themes grayed/disabled color group fix... QPalette pal(app.palette()); if (pal.base().color().value() < 0x7f) { + #if QT_VERSION >= 0x050000 + const QColor& color = pal.window().color(); + const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1; + for (int i = 0; i < iGroups; ++i) { + const QPalette::ColorGroup group = QPalette::ColorGroup(i); + pal.setBrush(group, QPalette::Light, color.lighter(150)); + pal.setBrush(group, QPalette::Midlight, color.lighter(120)); + pal.setBrush(group, QPalette::Dark, color.darker(150)); + pal.setBrush(group, QPalette::Mid, color.darker(120)); + pal.setBrush(group, QPalette::Shadow, color.darker(200)); + } + // pal.setColor(QPalette::Disabled, QPalette::ButtonText, pal.mid().color()); + #endif pal.setColorGroup(QPalette::Disabled, pal.windowText().color().darker(), pal.button(),