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