[127] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[127] | 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 |
|
---|
[165] | 22 | #include <QtGlobal>
|
---|
| 23 |
|
---|
| 24 | #ifdef Q_OS_WIN
|
---|
[181] | 25 | //#define USE_WINEVENTFILTER
|
---|
[165] | 26 | #endif
|
---|
| 27 |
|
---|
[181] | 28 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
---|
| 29 | #include <QAbstractNativeEventFilter>
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
[127] | 32 | #ifdef SINGLE_INSTANCE
|
---|
| 33 | #include "QtSingleApplication"
|
---|
| 34 |
|
---|
| 35 | class MyApplication : public QtSingleApplication
|
---|
[181] | 36 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
---|
| 37 | , QAbstractNativeEventFilter
|
---|
| 38 | #endif
|
---|
[127] | 39 | {
|
---|
| 40 | Q_OBJECT
|
---|
| 41 |
|
---|
| 42 | public:
|
---|
[181] | 43 | MyApplication ( const QString & appId, int & argc, char ** argv );
|
---|
[127] | 44 |
|
---|
| 45 | virtual void commitData ( QSessionManager & /*manager*/ ) {
|
---|
| 46 | // Nothing to do, let the application to close
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | inline static MyApplication * instance() {
|
---|
| 50 | return qobject_cast<MyApplication*>(QApplication::instance());
|
---|
| 51 | }
|
---|
[165] | 52 |
|
---|
| 53 | #ifdef USE_WINEVENTFILTER
|
---|
| 54 | virtual bool winEventFilter(MSG * msg, long * result);
|
---|
[181] | 55 | #if QT_VERSION >= 0x050000
|
---|
| 56 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
---|
| 57 | #endif
|
---|
[165] | 58 | #endif
|
---|
[127] | 59 | };
|
---|
| 60 |
|
---|
| 61 | #else
|
---|
| 62 | #include <QApplication>
|
---|
| 63 |
|
---|
| 64 | class MyApplication : public QApplication
|
---|
[181] | 65 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
---|
| 66 | , QAbstractNativeEventFilter
|
---|
| 67 | #endif
|
---|
[127] | 68 | {
|
---|
| 69 | Q_OBJECT
|
---|
| 70 |
|
---|
| 71 | public:
|
---|
[181] | 72 | MyApplication ( const QString & appId, int & argc, char ** argv );
|
---|
[127] | 73 |
|
---|
| 74 | virtual void commitData ( QSessionManager & /*manager*/ ) {
|
---|
| 75 | // Nothing to do, let the application to close
|
---|
| 76 | }
|
---|
[165] | 77 |
|
---|
| 78 | #ifdef USE_WINEVENTFILTER
|
---|
| 79 | virtual bool winEventFilter(MSG * msg, long * result);
|
---|
[181] | 80 | #if QT_VERSION >= 0x050000
|
---|
| 81 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
---|
| 82 | #endif
|
---|
[165] | 83 | #endif
|
---|
[127] | 84 | };
|
---|
| 85 |
|
---|
| 86 | #endif
|
---|
| 87 |
|
---|
| 88 | #endif
|
---|
| 89 |
|
---|