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 |
capela |
3496 |
#if QT_VERSION < 0x050000 |
45 |
|
|
#ifdef CONFIG_XUNIQUE |
46 |
capela |
3494 |
#ifdef CONFIG_X11 |
47 |
|
|
#include <QX11Info> |
48 |
|
|
typedef unsigned long Window; |
49 |
|
|
typedef unsigned long Atom; |
50 |
capela |
3496 |
#endif // CONFIG_X11 |
51 |
|
|
#endif // CONFIG_XUNIQUE |
52 |
|
|
#else |
53 |
|
|
#ifdef CONFIG_XUNIQUE |
54 |
|
|
class QSharedMemory; |
55 |
|
|
class QLocalServer; |
56 |
|
|
#endif // CONFIG_XUNIQUE |
57 |
capela |
3494 |
#endif |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
//------------------------------------------------------------------------- |
61 |
|
|
// Singleton application instance stuff (Qt/X11 only atm.) |
62 |
|
|
// |
63 |
|
|
|
64 |
|
|
class qsamplerApplication : public QApplication |
65 |
|
|
{ |
66 |
capela |
3496 |
Q_OBJECT |
67 |
|
|
|
68 |
capela |
3494 |
public: |
69 |
|
|
|
70 |
|
|
// Constructor. |
71 |
|
|
qsamplerApplication(int& argc, char **argv); |
72 |
|
|
|
73 |
|
|
// Destructor. |
74 |
|
|
~qsamplerApplication(); |
75 |
|
|
|
76 |
|
|
// Main application widget accessors. |
77 |
|
|
void setMainWidget(QWidget *pWidget); |
78 |
|
|
QWidget *mainWidget() const |
79 |
|
|
{ return m_pWidget; } |
80 |
|
|
|
81 |
|
|
// Check if another instance is running, |
82 |
|
|
// and raise its proper main widget... |
83 |
|
|
bool setup(); |
84 |
|
|
|
85 |
capela |
3496 |
#if QT_VERSION < 0x050000 |
86 |
|
|
#ifdef CONFIG_XUNIQUE |
87 |
capela |
3494 |
#ifdef CONFIG_X11 |
88 |
|
|
void x11PropertyNotify(Window w); |
89 |
capela |
3496 |
bool x11EventFilter(XEvent *pEv) |
90 |
|
|
#endif // CONFIG_X11 |
91 |
capela |
3494 |
#endif // CONFIG_XUNIQUE |
92 |
capela |
3496 |
#else |
93 |
|
|
#ifdef CONFIG_XUNIQUE |
94 |
|
|
protected slots: |
95 |
|
|
// Local server slots. |
96 |
|
|
void newConnectionSlot(); |
97 |
|
|
void readyReadSlot(); |
98 |
|
|
#endif // CONFIG_XUNIQUE |
99 |
|
|
#endif |
100 |
capela |
3494 |
|
101 |
|
|
private: |
102 |
|
|
|
103 |
|
|
// Translation support. |
104 |
|
|
QTranslator *m_pQtTranslator; |
105 |
|
|
QTranslator *m_pMyTranslator; |
106 |
|
|
|
107 |
|
|
// Instance variables. |
108 |
|
|
QWidget *m_pWidget; |
109 |
|
|
|
110 |
capela |
3496 |
#if QT_VERSION < 0x050000 |
111 |
|
|
#ifdef CONFIG_XUNIQUE |
112 |
capela |
3494 |
#ifdef CONFIG_X11 |
113 |
|
|
Display *m_pDisplay; |
114 |
|
|
Atom m_aUnique; |
115 |
|
|
Window m_wOwner; |
116 |
capela |
3496 |
#endif // CONFIG_X11 |
117 |
|
|
#endif // CONFIG_XUNIQUE |
118 |
|
|
#else |
119 |
|
|
#ifdef CONFIG_XUNIQUE |
120 |
|
|
QString m_sUnique; |
121 |
|
|
QSharedMemory *m_pMemory; |
122 |
|
|
QLocalServer *m_pServer; |
123 |
|
|
#endif // CONFIG_XUNIQUE |
124 |
capela |
3494 |
#endif |
125 |
|
|
}; |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
#endif // __qsampler_h |
129 |
|
|
|
130 |
|
|
// end of qsampler.h |