qt4.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * qt4.hpp : QT4 interface
00003  ****************************************************************************
00004  * Copyright (C) 2006-2007 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Clément Stenac <zorglub@videolan.org>
00008  *          Jean-Baptiste Kempf <jb@videolan.org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef _QVLC_H_
00026 #define _QVLC_H_
00027 
00028 #ifdef HAVE_CONFIG_H
00029 # include "config.h"
00030 #endif
00031 
00032 #include <vlc_common.h>
00033 #include <vlc_interface.h>
00034 #include <vlc_playlist.h>
00035 
00036 #include <QEvent>
00037 
00038 #define HAS_QT43 ( QT_VERSION >= 0x040300 )
00039 
00040 #define QT_NORMAL_MODE 0
00041 #define QT_ALWAYS_VIDEO_MODE 1
00042 #define QT_MINIMAL_MODE 2
00043 
00044 class QApplication;
00045 class QMenu;
00046 class MainInterface;
00047 class DialogsProvider;
00048 class VideoWidget;
00049 class QSettings;
00050 
00051 struct intf_sys_t
00052 {
00053     QApplication *p_app;
00054     MainInterface *p_mi;
00055 
00056     QSettings *mainSettings;
00057 
00058     bool b_isDialogProvider;
00059 
00060     playlist_t *p_playlist;
00061     msg_subscription_t *p_sub; ///< Subscription to the message bank
00062 
00063     VideoWidget *p_video;
00064 
00065     const char *psz_filepath;
00066     QMenu * p_popup_menu;
00067 };
00068 
00069 #define THEPL p_intf->p_sys->p_playlist
00070 #define QPL_LOCK vlc_object_lock( THEPL );
00071 #define QPL_UNLOCK vlc_object_unlock( THEPL );
00072 
00073 #define THEDP DialogsProvider::getInstance()
00074 #define THEMIM MainInputManager::getInstance( p_intf )
00075 
00076 #define qfu( i ) QString::fromUtf8( i )
00077 #define qtr( i ) QString::fromUtf8( _(i) )
00078 #define qtu( i ) (i).toUtf8().data()
00079 #define qta( i ) (i).toAscii().data()
00080 
00081 #define CONNECT( a, b, c, d ) connect( a, SIGNAL( b ), c, SLOT(d) )
00082 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
00083 #define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout(), this, act )
00084 
00085 #define BUTTON_SET( button, text, tooltip )  \
00086     button->setText( text );                 \
00087     button->setToolTip( tooltip );
00088 
00089 #define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \
00090     BUTTON_SET( button, text, tooltip );                  \
00091     BUTTONACT( button, thisslot );
00092 
00093 #define BUTTON_SET_IMG( button, text, image, tooltip )    \
00094     BUTTON_SET( button, text, tooltip );                  \
00095     button->setIcon( QIcon( ":/"#image ) );
00096 
00097 #define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \
00098     BUTTON_SET_IMG( button, text, image, tooltip );                \
00099     BUTTONACT( button, thisslot );
00100 
00101 #define VISIBLE(i) (i && i->isVisible())
00102 
00103 #define TOGGLEV( x ) { if( x->isVisible() ) x->hide();          \
00104             else  x->show(); }
00105 
00106 #if QT43
00107     #define setLayoutMargins( a, b, c, d, e) setContentsMargins( a, b, c, d )
00108 #else
00109     #define setLayoutMargins( a, b, c, d, e) setMargin( e )
00110 #endif
00111 
00112 #define getSettings() p_intf->p_sys->mainSettings
00113 
00114 enum {
00115     DialogEventType = 0,
00116     IMEventType     = 100,
00117     PLEventType     = 200
00118 };
00119 
00120 static const int DialogEvent_Type = QEvent::User + DialogEventType + 1;
00121 //static const int PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
00122 //static const int PLDockEvent_Type = QEvent::User + DialogEventType + 3;
00123 static const int SetVideoOnTopEvent_Type = QEvent::User + DialogEventType + 4;
00124 
00125 class DialogEvent : public QEvent
00126 {
00127 public:
00128     DialogEvent( int _i_dialog, int _i_arg, intf_dialog_args_t *_p_arg ) :
00129                  QEvent( (QEvent::Type)(DialogEvent_Type) )
00130     {
00131         i_dialog = _i_dialog;
00132         i_arg = _i_arg;
00133         p_arg = _p_arg;
00134     };
00135     virtual ~DialogEvent() {};
00136 
00137     int i_arg, i_dialog;
00138     intf_dialog_args_t *p_arg;
00139 };
00140 
00141 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1