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 |
37 |
#define darker(x) dark(x) |
#define darker(x) dark(x) |
38 |
#endif |
#endif |
39 |
|
|
40 |
|
#define CONFIG_QUOTE1(x) #x |
41 |
|
#define CONFIG_QUOTED(x) CONFIG_QUOTE1(x) |
42 |
|
|
43 |
|
#if defined(DATADIR) |
44 |
|
#define CONFIG_DATADIR CONFIG_QUOTED(DATADIR) |
45 |
|
#else |
46 |
|
#define CONFIG_DATADIR CONFIG_PREFIX "/share" |
47 |
|
#endif |
48 |
|
|
49 |
|
#if defined(LOCALEDIR) |
50 |
|
#define CONFIG_LOCALEDIR CONFIG_QUOTED(LOCALEDIR) |
51 |
|
#else |
52 |
|
#define CONFIG_LOCALEDIR CONFIG_DATADIR "/locale" |
53 |
|
#endif |
54 |
|
|
55 |
|
#if WIN32 |
56 |
|
#define RELATIVE_LOCALE_DIR "/share/locale" |
57 |
|
#elif defined(__APPLE__) |
58 |
|
#define RELATIVE_LOCALE_DIR "/../Resources" |
59 |
|
#endif |
60 |
|
|
61 |
|
|
62 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
63 |
// Singleton application instance stuff (Qt/X11 only atm.) |
// Singleton application instance stuff (Qt/X11 only atm.) |
92 |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
93 |
QApplication::installTranslator(m_pQtTranslator); |
QApplication::installTranslator(m_pQtTranslator); |
94 |
} else { |
} else { |
95 |
|
#ifdef RELATIVE_LOCALE_DIR |
96 |
|
sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; |
97 |
|
if (m_pQtTranslator->load(sLocName, sLocPath)) { |
98 |
|
QApplication::installTranslator(m_pQtTranslator); |
99 |
|
} else { |
100 |
|
#endif |
101 |
delete m_pQtTranslator; |
delete m_pQtTranslator; |
102 |
m_pQtTranslator = 0; |
m_pQtTranslator = 0; |
103 |
#ifdef CONFIG_DEBUG |
#ifdef CONFIG_DEBUG |
106 |
sLocPath.toUtf8().constData(), |
sLocPath.toUtf8().constData(), |
107 |
sLocName.toUtf8().constData()); |
sLocName.toUtf8().constData()); |
108 |
#endif |
#endif |
109 |
|
#ifdef RELATIVE_LOCALE_DIR |
110 |
|
} |
111 |
|
#endif |
112 |
} |
} |
113 |
// Try own application translation... |
// Try own application translation... |
114 |
m_pMyTranslator = new QTranslator(this); |
m_pMyTranslator = new QTranslator(this); |
116 |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
117 |
QApplication::installTranslator(m_pMyTranslator); |
QApplication::installTranslator(m_pMyTranslator); |
118 |
} else { |
} else { |
119 |
sLocPath = CONFIG_PREFIX "/share/locale"; |
#ifdef RELATIVE_LOCALE_DIR |
120 |
|
sLocPath = QApplication::applicationDirPath() + RELATIVE_LOCALE_DIR; |
121 |
|
#else |
122 |
|
sLocPath = CONFIG_LOCALEDIR; |
123 |
|
#endif |
124 |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
if (m_pMyTranslator->load(sLocName, sLocPath)) { |
125 |
QApplication::installTranslator(m_pMyTranslator); |
QApplication::installTranslator(m_pMyTranslator); |
126 |
} else { |
} else { |
278 |
#include <stdio.h> |
#include <stdio.h> |
279 |
#include <errno.h> |
#include <errno.h> |
280 |
#include <signal.h> |
#include <signal.h> |
281 |
|
#include <unistd.h> |
282 |
#include <sys/wait.h> |
#include <sys/wait.h> |
283 |
|
|
284 |
void stacktrace ( int signo ) |
void stacktrace ( int signo ) |
292 |
signal(signo, SIG_DFL); |
signal(signo, SIG_DFL); |
293 |
|
|
294 |
static const char *shell = "/bin/sh"; |
static const char *shell = "/bin/sh"; |
295 |
static const char *format = "gdb -q --batch --pid=%d --eval-command=bt"; |
static const char *format = "gdb -q --batch --pid=%d" |
296 |
|
" --eval-command='thread apply all bt'"; |
297 |
|
|
298 |
snprintf(cmd, sizeof(cmd), format, (int) getpid()); |
snprintf(cmd, sizeof(cmd), format, (int) getpid()); |
299 |
|
|
376 |
// Dark themes grayed/disabled color group fix... |
// Dark themes grayed/disabled color group fix... |
377 |
QPalette pal(app.palette()); |
QPalette pal(app.palette()); |
378 |
if (pal.base().color().value() < 0x7f) { |
if (pal.base().color().value() < 0x7f) { |
379 |
|
#if QT_VERSION >= 0x050000 |
380 |
|
const QColor& color = pal.window().color(); |
381 |
|
const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1; |
382 |
|
for (int i = 0; i < iGroups; ++i) { |
383 |
|
const QPalette::ColorGroup group = QPalette::ColorGroup(i); |
384 |
|
pal.setBrush(group, QPalette::Light, color.lighter(150)); |
385 |
|
pal.setBrush(group, QPalette::Midlight, color.lighter(120)); |
386 |
|
pal.setBrush(group, QPalette::Dark, color.darker(150)); |
387 |
|
pal.setBrush(group, QPalette::Mid, color.darker(120)); |
388 |
|
pal.setBrush(group, QPalette::Shadow, color.darker(200)); |
389 |
|
} |
390 |
|
// pal.setColor(QPalette::Disabled, QPalette::ButtonText, pal.mid().color()); |
391 |
|
#endif |
392 |
pal.setColorGroup(QPalette::Disabled, |
pal.setColorGroup(QPalette::Disabled, |
393 |
pal.windowText().color().darker(), |
pal.windowText().color().darker(), |
394 |
pal.button(), |
pal.button(), |