25 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
26 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
27 |
|
|
28 |
|
#include "qsamplerPaletteForm.h" |
29 |
|
|
30 |
|
#include <QDir> |
31 |
|
|
32 |
|
#include <QStyleFactory> |
33 |
|
|
34 |
#include <QLibraryInfo> |
#include <QLibraryInfo> |
35 |
#include <QTranslator> |
#include <QTranslator> |
36 |
#include <QLocale> |
#include <QLocale> |
47 |
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
48 |
#endif |
#endif |
49 |
|
|
50 |
|
#ifndef CONFIG_LIBDIR |
51 |
|
#if defined(__x86_64__) |
52 |
|
#define CONFIG_LIBDIR CONFIG_PREFIX "/lib64" |
53 |
|
#else |
54 |
|
#define CONFIG_LIBDIR CONFIG_PREFIX "/lib" |
55 |
|
#endif |
56 |
|
#endif |
57 |
|
|
58 |
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) |
59 |
|
#define CONFIG_PLUGINSDIR CONFIG_LIBDIR "/qt4/plugins" |
60 |
|
#else |
61 |
|
#define CONFIG_PLUGINSDIR CONFIG_LIBDIR "/qt5/plugins" |
62 |
|
#endif |
63 |
|
|
64 |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) |
65 |
#define RELATIVE_LOCALE_DIR "/share/locale" |
#define RELATIVE_LOCALE_DIR "/share/locale" |
66 |
#elif defined(__APPLE__) |
#elif defined(__APPLE__) |
517 |
return 2; |
return 2; |
518 |
} |
} |
519 |
|
|
520 |
// Dark themes grayed/disabled color group fix... |
// Special custom styles... |
521 |
|
if (QDir(CONFIG_PLUGINSDIR).exists()) |
522 |
|
app.addLibraryPath(CONFIG_PLUGINSDIR); |
523 |
|
if (!options.sCustomStyleTheme.isEmpty()) |
524 |
|
app.setStyle(QStyleFactory::create(options.sCustomStyleTheme)); |
525 |
|
|
526 |
|
// Custom color theme (eg. "KXStudio")... |
527 |
QPalette pal(app.palette()); |
QPalette pal(app.palette()); |
528 |
if (pal.base().color().value() < 0x7f) { |
if (QSampler::PaletteForm::namedPalette( |
529 |
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) |
&options.settings(), options.sCustomColorTheme, pal)) |
|
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(), |
|
|
pal.light(), |
|
|
pal.dark(), |
|
|
pal.mid(), |
|
|
pal.text().color().darker(), |
|
|
pal.text().color().lighter(), |
|
|
pal.base(), |
|
|
pal.window()); |
|
530 |
app.setPalette(pal); |
app.setPalette(pal); |
|
} |
|
531 |
|
|
532 |
// Set default base font... |
// Set default base font... |
533 |
if (options.iBaseFontSize > 0) |
if (options.iBaseFontSize > 0) |