| 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 | //#define USE_WINEVENTFILTER
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
|---|
| 29 | #include <QAbstractNativeEventFilter>
|
|---|
| 30 | #endif
|
|---|
| 31 |
|
|---|
| 32 | #ifdef SINGLE_INSTANCE
|
|---|
| 33 | #include "QtSingleApplication"
|
|---|
| 34 |
|
|---|
| 35 | class MyApplication : public QtSingleApplication
|
|---|
| 36 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
|---|
| 37 | , QAbstractNativeEventFilter
|
|---|
| 38 | #endif
|
|---|
| 39 | {
|
|---|
| 40 | Q_OBJECT
|
|---|
| 41 |
|
|---|
| 42 | public:
|
|---|
| 43 | MyApplication ( const QString & appId, int & argc, char ** argv );
|
|---|
| 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 | }
|
|---|
| 52 |
|
|---|
| 53 | #ifdef USE_WINEVENTFILTER
|
|---|
| 54 | virtual bool winEventFilter(MSG * msg, long * result);
|
|---|
| 55 | #if QT_VERSION >= 0x050000
|
|---|
| 56 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
|---|
| 57 | #endif
|
|---|
| 58 | #endif
|
|---|
| 59 | };
|
|---|
| 60 |
|
|---|
| 61 | #else
|
|---|
| 62 | #include <QApplication>
|
|---|
| 63 |
|
|---|
| 64 | class MyApplication : public QApplication
|
|---|
| 65 | #if defined(USE_WINEVENTFILTER) && QT_VERSION >= 0x050000
|
|---|
| 66 | , QAbstractNativeEventFilter
|
|---|
| 67 | #endif
|
|---|
| 68 | {
|
|---|
| 69 | Q_OBJECT
|
|---|
| 70 |
|
|---|
| 71 | public:
|
|---|
| 72 | MyApplication ( const QString & appId, int & argc, char ** argv );
|
|---|
| 73 |
|
|---|
| 74 | virtual void commitData ( QSessionManager & /*manager*/ ) {
|
|---|
| 75 | // Nothing to do, let the application to close
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | #ifdef USE_WINEVENTFILTER
|
|---|
| 79 | virtual bool winEventFilter(MSG * msg, long * result);
|
|---|
| 80 | #if QT_VERSION >= 0x050000
|
|---|
| 81 | virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
|
|---|
| 82 | #endif
|
|---|
| 83 | #endif
|
|---|
| 84 | };
|
|---|
| 85 |
|
|---|
| 86 | #endif
|
|---|
| 87 |
|
|---|
| 88 | #endif
|
|---|
| 89 |
|
|---|