]> git.sesse.net Git - vlc/blob - modules/gui/qt4/qt4.hpp
Qt4 - #include cleaning
[vlc] / modules / gui / qt4 / qt4.hpp
1 /*****************************************************************************
2  * qt4.hpp : QT4 interface
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _QVLC_H_
25 #define _QVLC_H_
26
27 #include <vlc/vlc.h>
28 #include <vlc_interface.h>
29 #include <vlc_playlist.h>
30
31 #include <QEvent>
32
33 #define HAS_QT43 ( QT_VERSION >= 0x040300 )
34
35 /* Add define for duration, VLC_META_ENGINE doesn't include it */
36 #define VLC_META_ENGINE_DURATION   0x00000002
37 #define VLC_META_DURATION          N_("Duration")
38
39 class QApplication;
40 class QMenu;
41 class MainInterface;
42 class DialogsProvider;
43 class VideoWidget;
44
45 struct intf_sys_t
46 {
47     QApplication *p_app;
48     MainInterface *p_mi;
49     playlist_t *p_playlist;
50     msg_subscription_t *p_sub; ///< Subscription to the message bank
51
52     VideoWidget *p_video;
53     int i_saved_height, i_saved_width;
54
55     QMenu * p_popup_menu;
56 };
57
58 #define THEPL p_intf->p_sys->p_playlist
59 #define QPL_LOCK vlc_mutex_lock( &THEPL->object_lock );
60 #define QPL_UNLOCK vlc_mutex_unlock( &THEPL->object_lock );
61
62 #define THEDP DialogsProvider::getInstance()
63 #define THEMIM MainInputManager::getInstance( p_intf )
64
65 #define qfu( i ) QString::fromUtf8( i )
66 #define qtr( i ) QString::fromUtf8( _(i) )
67 #define qtu( i ) i.toUtf8().data()
68 #define qta( i ) i.toAscii().data()
69
70 #define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
71 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
72 #define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout(), this, act )
73
74 #define BUTTON_SET( button, text, tooltip )  \
75     button->setText( text );                 \
76     button->setToolTip( tooltip );
77
78 #define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \
79     BUTTON_SET( button, text, tooltip );                  \
80     BUTTONACT( button, thisslot );
81
82 #define BUTTON_SET_IMG( button, text, image, tooltip )    \
83     BUTTON_SET( button, text, tooltip );                  \
84     button->setIcon( QIcon( ":/pixmaps/"#image ) );
85
86 #define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \
87     BUTTON_SET_IMG( button, text, image, tooltip );                \
88     BUTTONACT( button, thisslot );
89
90 #define VISIBLE(i) (i && i->isVisible())
91
92 #define TOGGLEV( x ) { if( x->isVisible() ) x->hide();          \
93             else  x->show(); }
94
95 static int DialogEvent_Type = QEvent::User + 1;
96 static int PLUndockEvent_Type = QEvent::User + 2;
97 static int PLDockEvent_Type = QEvent::User + 3;
98 static int SetVideoOnTopEvent_Type = QEvent::User + 4;
99
100 class DialogEvent : public QEvent
101 {
102 public:
103     DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
104                  QEvent( (QEvent::Type)(DialogEvent_Type) )
105     {
106         i_dialog = _i_dialog;
107         i_arg = _i_arg;
108         p_arg = _p_arg;
109     };
110     virtual ~DialogEvent() {};
111
112     int i_arg, i_dialog;
113     intf_dialog_args_t *p_arg;
114 };
115
116 #endif