]> git.sesse.net Git - vlc/blob - modules/gui/qt4/qt4.hpp
A bit of headers cleanup
[vlc] / modules / gui / qt4 / qt4.hpp
1 /*****************************************************************************
2  * qt4.hpp : QT4 interface
3  ****************************************************************************
4  * Copyright (C) 2006 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 #ifndef _QVLC_H_
24 #define _QVLC_H_
25
26 #include <vlc/vlc.h>
27 #include <vlc_interface.h>
28 #include <vlc_playlist.h>
29 #include <QEvent>
30
31 class QApplication;
32 class QMenu;
33 class MainInterface;
34 class DialogsProvider;
35 class VideoWidget;
36
37 struct intf_sys_t
38 {
39     QApplication *p_app;
40     MainInterface *p_mi;
41     playlist_t *p_playlist;
42     msg_subscription_t *p_sub; ///< Subscription to the message bank
43
44     VideoWidget *p_video;
45     int i_saved_height, i_saved_width;
46
47     QMenu * p_popup_menu;
48 };
49
50 #define THEPL p_intf->p_sys->p_playlist
51 #define QPL_LOCK vlc_mutex_lock( &THEPL->object_lock );
52 #define QPL_UNLOCK vlc_mutex_unlock( &THEPL->object_lock );
53
54 #define THEDP DialogsProvider::getInstance()
55 #define THEMIM MainInputManager::getInstance( NULL )
56
57 #define qfu( i ) QString::fromUtf8( i )
58 #define qtr( i ) QString::fromUtf8( _(i) )
59 #define qtu( i ) i.toUtf8().data()
60 #define qta( i ) i.toAscii().data()
61
62 #define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
63 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
64 #define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout(), this, act )
65
66 #define BUTTON_SET( button, text, tooltip ) \
67     button->setText( text ); \
68     button->setToolTip( tooltip );
69
70 #define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \
71     BUTTON_SET( button, text, tooltip ); \
72     BUTTONACT( button, thisslot );
73
74 #define BUTTON_SET_IMG( button, text, image, tooltip ) \
75     BUTTON_SET( button, text, tooltip ); \
76     button->setIcon( QIcon( ":/pixmaps/"#image ) );
77
78 #define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \
79     BUTTON_SET_IMG( button, text, image, tooltip ); \
80     BUTTONACT( button, thisslot );
81
82 static int DialogEvent_Type = QEvent::User + 1;
83 static int PLUndockEvent_Type = QEvent::User + 2;
84 static int PLDockEvent_Type = QEvent::User + 3;
85
86 class DialogEvent : public QEvent
87 {
88 public:
89     DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
90                  QEvent( (QEvent::Type)(DialogEvent_Type) )
91     {
92         i_dialog = _i_dialog;
93         i_arg = _i_arg;
94         p_arg = _p_arg;
95     };
96     virtual ~DialogEvent() {};
97
98     int i_arg, i_dialog;
99     intf_dialog_args_t *p_arg;
100 };
101
102 /* Ugly to put it here, but don't want more files ... */
103 #include <QFrame>
104 class BasePlaylistWidget : public QFrame
105 {
106 public:
107     BasePlaylistWidget( intf_thread_t *_p_i ) : p_intf( _p_i)  {};
108     virtual ~BasePlaylistWidget() {};
109 protected:
110     intf_thread_t *p_intf;
111 };
112
113 #endif