1 | /* smplayer, GUI front-end for mplayer.
|
---|
2 | Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
3 |
|
---|
4 | This program is free software; you can redistribute it and/or modify
|
---|
5 | it under the terms of the GNU General Public License as published by
|
---|
6 | the Free Software Foundation; either version 2 of the License, or
|
---|
7 | (at your option) any later version.
|
---|
8 |
|
---|
9 | This program is distributed in the hope that it will be useful,
|
---|
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this program; if not, write to the Free Software
|
---|
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef MYAPPLICATION_H
|
---|
20 | #define MYAPPLICATION_H
|
---|
21 |
|
---|
22 | #include <QtGlobal>
|
---|
23 |
|
---|
24 | #ifdef Q_OS_WIN
|
---|
25 | #if QT_VERSION < 0x050000
|
---|
26 | #define USE_WINEVENTFILTER
|
---|
27 | #endif
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #ifdef SINGLE_INSTANCE
|
---|
31 | #include "QtSingleApplication"
|
---|
32 |
|
---|
33 | class MyApplication : public QtSingleApplication
|
---|
34 | {
|
---|
35 | Q_OBJECT
|
---|
36 |
|
---|
37 | public:
|
---|
38 | MyApplication ( const QString & appId, int & argc, char ** argv )
|
---|
39 | : QtSingleApplication(appId, argc, argv) {};
|
---|
40 |
|
---|
41 | virtual void commitData ( QSessionManager & /*manager*/ ) {
|
---|
42 | // Nothing to do, let the application to close
|
---|
43 | }
|
---|
44 |
|
---|
45 | inline static MyApplication * instance() {
|
---|
46 | return qobject_cast<MyApplication*>(QApplication::instance());
|
---|
47 | }
|
---|
48 |
|
---|
49 | #ifdef USE_WINEVENTFILTER
|
---|
50 | virtual bool winEventFilter(MSG * msg, long * result);
|
---|
51 | #endif
|
---|
52 | };
|
---|
53 |
|
---|
54 | #else
|
---|
55 | #include <QApplication>
|
---|
56 |
|
---|
57 | class MyApplication : public QApplication
|
---|
58 | {
|
---|
59 | Q_OBJECT
|
---|
60 |
|
---|
61 | public:
|
---|
62 | MyApplication ( const QString & appId, int & argc, char ** argv ) : QApplication(argc, argv) {};
|
---|
63 |
|
---|
64 | virtual void commitData ( QSessionManager & /*manager*/ ) {
|
---|
65 | // Nothing to do, let the application to close
|
---|
66 | }
|
---|
67 |
|
---|
68 | #ifdef USE_WINEVENTFILTER
|
---|
69 | virtual bool winEventFilter(MSG * msg, long * result);
|
---|
70 | #endif
|
---|
71 | };
|
---|
72 |
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #endif
|
---|
76 |
|
---|