qvlcapp.hpp 1.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*****************************************************************************
 * qvlcapp.hpp : A few helpers
 *****************************************************************************
 * Copyright (C) 2008 the VideoLAN team
 * $Id$
 *
 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/


25 26
#ifndef VLC_QT_QVLCAPP_HPP_
#define VLC_QT_QVLCAPP_HPP_
27 28 29 30

#include <QApplication>
#include <QEvent>

31
#if defined(Q_OS_WIN)
32
#   include "qt4.hpp"
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
33
#   include <windows.h>
34
#   include "input_manager.hpp"
Laurent Aimar's avatar
Laurent Aimar committed
35 36
#endif

37 38
class QVLCApp : public QApplication
{
39 40
    Q_OBJECT

41 42 43 44 45 46 47
private slots:
    void doQuit()
    {
        closeAllWindows();
        quit();
    }

48
public:
49 50
    QVLCApp( int & argc, char ** argv ) : QApplication( argc, argv, true )
    {
51
        connect( this, SIGNAL(quitSignal()), this, SLOT(doQuit()) );
52 53 54 55
    }

    static void triggerQuit()
    {
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
56 57 58
        QVLCApp *app = qobject_cast<QVLCApp*>( instance() );
        if( app )
            emit app->quitSignal();
59
    }
60

61 62 63
signals:
    void quitSignal();

64 65
};
#endif