qt4.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 #define QT_NO_CAST_TO_ASCII
00037 #include <QString>
00038
00039 #if ( QT_VERSION < 0x040400 )
00040 # error Update your Qt version to at least 4.4.0
00041 #endif
00042 #if QT_VERSION == 0x040500
00043 # error Please update Qt version to 4.5.1. 4.5.0 is too buggy
00044 #endif
00045
00046 #define HAS_QT45 ( QT_VERSION >= 0x040500 )
00047
00048 enum {
00049 DialogEventType = 0,
00050 IMEventType = 100,
00051 PLEventType = 200,
00052 MsgEventType = 300,
00053 };
00054
00055 class QVLCApp;
00056 class QMenu;
00057 class MainInterface;
00058 class QSettings;
00059
00060 struct intf_sys_t
00061 {
00062 vlc_thread_t thread;
00063
00064 QVLCApp *p_app;
00065 MainInterface *p_mi;
00066
00067 QSettings *mainSettings;
00068
00069 bool b_isDialogProvider;
00070
00071 int i_screenHeight;
00072
00073 playlist_t *p_playlist;
00074
00075 QString filepath;
00076
00077 };
00078
00079 #define THEPL p_intf->p_sys->p_playlist
00080 #define QPL_LOCK playlist_Lock( THEPL );
00081 #define QPL_UNLOCK playlist_Unlock( THEPL );
00082
00083 #define THEDP DialogsProvider::getInstance()
00084 #define THEMIM MainInputManager::getInstance( p_intf )
00085 #define THEAM ActionsManager::getInstance( p_intf )
00086
00087 #define qfu( i ) QString::fromUtf8( i )
00088 #define qtr( i ) QString::fromUtf8( vlc_gettext(i) )
00089 #define qtu( i ) ((i).toUtf8().constData())
00090
00091 #define CONNECT( a, b, c, d ) \
00092 connect( a, SIGNAL( b ), c, SLOT(d) )
00093 #define DCONNECT( a, b, c, d ) \
00094 connect( a, SIGNAL( b ), c, SLOT(d), Qt::DirectConnection )
00095 #define BUTTONACT( b, a ) connect( b, SIGNAL( clicked() ), this, SLOT(a) )
00096
00097 #define BUTTON_SET( button, text, tooltip ) \
00098 button->setText( text ); \
00099 button->setToolTip( tooltip );
00100
00101 #define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \
00102 BUTTON_SET( button, text, tooltip ); \
00103 BUTTONACT( button, thisslot );
00104
00105 #define BUTTON_SET_IMG( button, text, image, tooltip ) \
00106 BUTTON_SET( button, text, tooltip ); \
00107 button->setIcon( QIcon( ":/"#image ) );
00108
00109 #define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \
00110 BUTTON_SET_IMG( button, text, image, tooltip ); \
00111 BUTTONACT( button, thisslot );
00112
00113 #define VISIBLE(i) (i && i->isVisible())
00114
00115 #define TOGGLEV( x ) { if( x->isVisible() ) x->hide(); \
00116 else x->show(); }
00117
00118 #define getSettings() p_intf->p_sys->mainSettings
00119
00120 static inline QString QVLCUserDir( vlc_userdir_t type )
00121 {
00122 char *dir = config_GetUserDir( type );
00123 if( !dir )
00124 abort();
00125 QString res = qfu( dir );
00126 free( dir );
00127 return res;
00128 }
00129
00130 #endif