#endif
#include <QApplication>
-#include <QLocale>
-#include <QTranslator>
#include <QDate>
-#include <QMutex>
-#include <QMutexLocker>
-#include <QWaitCondition>
#include "qt4.hpp"
#include "../../../share/vlc32x32-christmas.xpm"
#include <vlc_plugin.h>
-#ifdef WIN32
+#ifdef WIN32 /* For static builds */
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
/*****************************************/
/* Ugly, but the Qt4 interface assumes single instance anyway */
-static struct
-{
- QMutex lock;
- QWaitCondition ready;
-} iface;
+static vlc_sem_t ready;
/*****************************************************************************
* Module callbacks
return VLC_EGENERIC;
}
XCloseDisplay( p_display );
+ putenv( (char *)"XLIB_SKIP_ARGB_VISUALS=1" );
#endif
/* Allocations of p_sys */
p_sys->p_playlist = pl_Hold( p_intf );
/* */
+ vlc_sem_init (&ready, 0);
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
pl_Release (p_sys->p_playlist);
}
/* */
- QMutexLocker locker (&iface.lock);
- vlc_value_t val;
+ vlc_sem_wait (&ready);
+ vlc_sem_destroy (&ready);
- while( p_sys->p_mi == NULL && !p_sys->b_isDialogProvider )
- iface.ready.wait( &iface.lock );
if( !p_sys->b_isDialogProvider )
{
+ vlc_value_t val;
var_Create (p_this->p_libvlc, "qt4-iface", VLC_VAR_ADDRESS);
val.p_address = p_this;
var_Set (p_this->p_libvlc, "qt4-iface", val);
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys = p_intf->p_sys;
- var_Destroy (p_this->p_libvlc, "qt4-iface");
+ if( !p_sys->b_isDialogProvider )
+ var_Destroy (p_this->p_libvlc, "qt4-iface");
+
QVLCApp::triggerQuit();
vlc_join (p_sys->thread, NULL);
intf_thread_t *p_intf = (intf_thread_t *)obj;
MainInterface *p_mi;
char dummy[] = "vlc"; /* for WM_CLASS */
- char *argv[] = { dummy, NULL, };
+ char *argv[4] = { dummy, NULL, };
int argc = 1;
Q_INIT_RESOURCE( vlc );
/* Icon setting */
if( QDate::currentDate().dayOfYear() >= 352 ) /* One Week before Xmas */
- app.setWindowIcon( QIcon( QPixmap(vlc_christmas_xpm) ) );
+ app.setWindowIcon( QIcon(vlc_christmas_xpm) );
else
- app.setWindowIcon( QIcon( QPixmap(vlc_xpm) ) );
+ app.setWindowIcon( QIcon(vlc_xpm) );
/* Initialize timers and the Dialog Provider */
DialogsProvider::getInstance( p_intf );
p_mi = NULL;
/* */
- iface.lock.lock();
p_intf->p_sys->p_mi = p_mi;
p_intf->p_sys->b_isDialogProvider = p_mi == NULL;
- iface.ready.wakeAll();
- iface.lock.unlock();
+ vlc_sem_post (&ready);
/* Explain to the core how to show a dialog :D */
p_intf->pf_show_dialog = ShowDialog;
-#ifdef ENABLE_NLS
- // Translation - get locale
-# if defined (WIN32) || defined (__APPLE__)
- char* psz_tmp = config_GetPsz( p_intf, "language" );
- QString lang = qfu( psz_tmp );
- free( psz_tmp);
- if (lang == "auto")
- lang = QLocale::system().name();
-# else
- QString lang = QLocale::system().name();
-# endif
- // Translations for qt's own dialogs
- QTranslator qtTranslator( 0 );
- // Let's find the right path for the translation file
-#if !defined( WIN32 )
- QString path = QString( QT4LOCALEDIR );
-#else
- QString path = QString( QString(config_GetDataDir()) + DIR_SEP +
- "locale" + DIR_SEP + "qt4" + DIR_SEP );
-#endif
- // files depending on locale
- bool b_loaded = qtTranslator.load( path + "qt_" + lang );
- if (!b_loaded)
- msg_Dbg( p_intf, "Error while initializing qt-specific localization" );
- app.installTranslator( &qtTranslator );
-#endif //ENABLE_NLS
-
/* Last settings */
app.setQuitOnLastWindowClosed( false );
if( s_style.compare("") != 0 )
QApplication::setStyle( s_style );
-
/* Launch */
app.exec();
if (p_mi != NULL)
{
- QMutexLocker locker (&iface.lock);
+ /* FIXME: are we sure that video window is already destroyed? */
msg_Dbg (p_intf, "destroying the main Qt4 interface");
p_intf->p_sys->p_mi = NULL;
MainInputManager::killInstance();
-
/* Delete the application automatically */
#ifdef Q_WS_X11
free( display );
if( p_wnd->cfg->is_standalone )
return VLC_EGENERIC;
- QMutexLocker( &iface.lock );
-
vlc_value_t val;
if( var_Get( p_obj->p_libvlc, "qt4-iface", &val ) )
unsigned i_height = p_wnd->cfg->height;
#if defined (Q_WS_X11)
- p_wnd->handle.xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
- if( !p_wnd->handle.xid )
+ p_wnd->xid = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+ if( !p_wnd->xid )
return VLC_EGENERIC;
#elif defined (WIN32)
- p_wnd->handle.hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
- if( !p_wnd->handle.hwnd )
+ p_wnd->hwnd = p_mi->getVideo( &i_x, &i_y, &i_width, &i_height );
+ if( !p_wnd->hwnd )
return VLC_EGENERIC;
#endif
static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
{
MainInterface *p_mi = (MainInterface *)p_wnd->sys;
- QMutexLocker locker(&iface.lock);
-
return p_mi->controlVideo( i_query, args );
}
vout_window_t *p_wnd = (vout_window_t*)p_obj;
MainInterface *p_mi = (MainInterface *)p_wnd->sys;
- QMutexLocker locker( &iface.lock );
-
msg_Dbg( p_obj, "releasing video..." );
p_mi->releaseVideo();
}
+