1 |
capela |
3494 |
// qsampler.h |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or |
7 |
|
|
modify it under the terms of the GNU General Public License |
8 |
|
|
as published by the Free Software Foundation; either version 2 |
9 |
|
|
of the License, or (at your option) any later version. |
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful, |
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
GNU General Public License for more details. |
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License along |
17 |
|
|
with this program; if not, write to the Free Software Foundation, Inc., |
18 |
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 |
|
|
|
20 |
|
|
*****************************************************************************/ |
21 |
|
|
|
22 |
|
|
#ifndef __qsampler_h |
23 |
|
|
#define __qsampler_h |
24 |
|
|
|
25 |
|
|
#include "qsamplerAbout.h" |
26 |
|
|
|
27 |
|
|
#include <QApplication> |
28 |
|
|
|
29 |
|
|
#if QT_VERSION < 0x050000 |
30 |
|
|
#if defined(Q_WS_X11) |
31 |
|
|
#define CONFIG_X11 |
32 |
|
|
#endif |
33 |
|
|
#else |
34 |
|
|
#if defined(QT_X11EXTRAS_LIB) |
35 |
|
|
#define CONFIG_X11 |
36 |
|
|
#endif |
37 |
|
|
#endif |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
// Forward decls. |
41 |
|
|
class QWidget; |
42 |
|
|
class QTranslator; |
43 |
|
|
|
44 |
|
|
#ifdef CONFIG_X11 |
45 |
|
|
#ifdef CONFIG_XUNIQUE |
46 |
|
|
|
47 |
|
|
#include <QX11Info> |
48 |
|
|
|
49 |
|
|
typedef unsigned long Window; |
50 |
|
|
typedef unsigned long Atom; |
51 |
|
|
|
52 |
|
|
#if QT_VERSION >= 0x050100 |
53 |
|
|
class qsamplerXcbEventFilter; |
54 |
|
|
#endif |
55 |
|
|
|
56 |
|
|
#endif |
57 |
|
|
#endif |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
//------------------------------------------------------------------------- |
61 |
|
|
// Singleton application instance stuff (Qt/X11 only atm.) |
62 |
|
|
// |
63 |
|
|
|
64 |
|
|
class qsamplerApplication : public QApplication |
65 |
|
|
{ |
66 |
|
|
public: |
67 |
|
|
|
68 |
|
|
// Constructor. |
69 |
|
|
qsamplerApplication(int& argc, char **argv); |
70 |
|
|
|
71 |
|
|
// Destructor. |
72 |
|
|
~qsamplerApplication(); |
73 |
|
|
|
74 |
|
|
// Main application widget accessors. |
75 |
|
|
void setMainWidget(QWidget *pWidget); |
76 |
|
|
QWidget *mainWidget() const |
77 |
|
|
{ return m_pWidget; } |
78 |
|
|
|
79 |
|
|
// Check if another instance is running, |
80 |
|
|
// and raise its proper main widget... |
81 |
|
|
bool setup(); |
82 |
|
|
|
83 |
|
|
#ifdef CONFIG_X11 |
84 |
|
|
#ifdef CONFIG_XUNIQUE |
85 |
|
|
void x11PropertyNotify(Window w); |
86 |
|
|
#endif // CONFIG_XUNIQUE |
87 |
|
|
#endif // CONFIG_X11 |
88 |
|
|
|
89 |
|
|
private: |
90 |
|
|
|
91 |
|
|
// Translation support. |
92 |
|
|
QTranslator *m_pQtTranslator; |
93 |
|
|
QTranslator *m_pMyTranslator; |
94 |
|
|
|
95 |
|
|
// Instance variables. |
96 |
|
|
QWidget *m_pWidget; |
97 |
|
|
|
98 |
|
|
#ifdef CONFIG_X11 |
99 |
|
|
#ifdef CONFIG_XUNIQUE |
100 |
|
|
Display *m_pDisplay; |
101 |
|
|
Atom m_aUnique; |
102 |
|
|
Window m_wOwner; |
103 |
|
|
#if QT_VERSION >= 0x050100 |
104 |
|
|
qsamplerXcbEventFilter *m_pXcbEventFilter; |
105 |
|
|
#endif |
106 |
|
|
#endif // CONFIG_XUNIQUE |
107 |
|
|
#endif // CONFIG_X11 |
108 |
|
|
}; |
109 |
|
|
|
110 |
|
|
|
111 |
|
|
#endif // __qsampler_h |
112 |
|
|
|
113 |
|
|
// end of qsampler.h |