1 |
// qsampler.cpp |
// qsampler.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2013, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, 2008 Christian Schoenebeck |
Copyright (C) 2007, 2008 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
28 |
#include <QLibraryInfo> |
#include <QLibraryInfo> |
29 |
#include <QTranslator> |
#include <QTranslator> |
30 |
#include <QLocale> |
#include <QLocale> |
31 |
|
|
32 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
33 |
#include <QDir> |
#include <QDir> |
34 |
#endif |
#endif |
35 |
|
|
36 |
#if QT_VERSION < 0x040300 |
#define CONFIG_QUOTE1(x) #x |
37 |
#define lighter(x) light(x) |
#define CONFIG_QUOTED(x) CONFIG_QUOTE1(x) |
38 |
#define darker(x) dark(x) |
|
39 |
|
#if defined(DATADIR) |
40 |
|
#define CONFIG_DATADIR CONFIG_QUOTED(DATADIR) |
41 |
|
#else |
42 |
|
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
43 |
|
#endif |
44 |
|
|
45 |
|
#if defined(LOCALEDIR) |
46 |
|
#define CONFIG_LOCALEDIR CONFIG_QUOTED(LOCALEDIR) |
47 |
|
#else |
48 |
|
#define CONFIG_LOCALEDIR CONFIG_DATADIR "/locale" |
49 |
|
#endif |
50 |
|
|
51 |
|
#if WIN32 |
52 |
|
#define RELATIVE_LOCALE_DIR "/share/locale" |
53 |
|
#elif defined(__APPLE__) |
54 |
|
#define RELATIVE_LOCALE_DIR "/../Resources" |
55 |
#endif |
#endif |
56 |
|
|
57 |
|
|
88 |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
89 |
QApplication::installTranslator(m_pQtTranslator); |
QApplication::installTranslator(m_pQtTranslator); |
90 |
} else { |
} else { |
91 |
#if WIN32 |
#ifdef RELATIVE_LOCALE_DIR |
92 |
sLocPath = QApplication::applicationDirPath() + "/share/locale"; |
sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; |
93 |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
94 |
QApplication::installTranslator(m_pQtTranslator); |
QApplication::installTranslator(m_pQtTranslator); |
95 |
} else { |
} else { |
102 |
sLocPath.toUtf8().constData(), |
sLocPath.toUtf8().constData(), |
103 |
sLocName.toUtf8().constData()); |
sLocName.toUtf8().constData()); |
104 |
#endif |
#endif |
105 |
#if WIN32 |
#ifdef RELATIVE_LOCALE_DIR |
106 |
} |
} |
107 |
#endif |
#endif |
108 |
} |
} |
112 |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
113 |
QApplication::installTranslator(m_pMyTranslator); |
QApplication::installTranslator(m_pMyTranslator); |
114 |
} else { |
} else { |
115 |
#if WIN32 |
#ifdef RELATIVE_LOCALE_DIR |
116 |
sLocPath = QApplication::applicationDirPath() + "/share/locale"; |
sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; |
117 |
#else |
#else |
118 |
sLocPath = CONFIG_PREFIX "/share/locale"; |
sLocPath = CONFIG_LOCALEDIR; |
119 |
#endif |
#endif |
120 |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
121 |
QApplication::installTranslator(m_pMyTranslator); |
QApplication::installTranslator(m_pMyTranslator); |
274 |
#include <stdio.h> |
#include <stdio.h> |
275 |
#include <errno.h> |
#include <errno.h> |
276 |
#include <signal.h> |
#include <signal.h> |
277 |
|
#include <unistd.h> |
278 |
#include <sys/wait.h> |
#include <sys/wait.h> |
279 |
|
|
280 |
void stacktrace ( int signo ) |
void stacktrace ( int signo ) |
372 |
// Dark themes grayed/disabled color group fix... |
// Dark themes grayed/disabled color group fix... |
373 |
QPalette pal(app.palette()); |
QPalette pal(app.palette()); |
374 |
if (pal.base().color().value() < 0x7f) { |
if (pal.base().color().value() < 0x7f) { |
375 |
|
#if QT_VERSION >= 0x050000 |
376 |
|
const QColor& color = pal.window().color(); |
377 |
|
const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1; |
378 |
|
for (int i = 0; i < iGroups; ++i) { |
379 |
|
const QPalette::ColorGroup group = QPalette::ColorGroup(i); |
380 |
|
pal.setBrush(group, QPalette::Light, color.lighter(150)); |
381 |
|
pal.setBrush(group, QPalette::Midlight, color.lighter(120)); |
382 |
|
pal.setBrush(group, QPalette::Dark, color.darker(150)); |
383 |
|
pal.setBrush(group, QPalette::Mid, color.darker(120)); |
384 |
|
pal.setBrush(group, QPalette::Shadow, color.darker(200)); |
385 |
|
} |
386 |
|
// pal.setColor(QPalette::Disabled, QPalette::ButtonText, pal.mid().color()); |
387 |
|
#endif |
388 |
pal.setColorGroup(QPalette::Disabled, |
pal.setColorGroup(QPalette::Disabled, |
389 |
pal.windowText().color().darker(), |
pal.windowText().color().darker(), |
390 |
pal.button(), |
pal.button(), |