]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
check qt4 version at runtime
[vlc] / modules / gui / qt4 / qt4.cpp
index fb25aa43346194d23f218abc2509d75098766481..40fce2fa4eea5c7b62fcf9606f0bafab058035e9 100644 (file)
@@ -31,7 +31,6 @@
 #include <QDate>
 
 #include "qt4.hpp"
-#include <vlc_os_specific.h>
 #include "dialogs_provider.hpp"
 #include "input_manager.hpp"
 #include "main_interface.hpp"
@@ -106,6 +105,8 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
                                  "can distort the audio, since it uses " \
                                  "software amplification." )
 
+#define SAVEVOL_TEXT N_( "Automatically save the volume on exit" )
+
 #define BLING_TEXT N_( "Use non native buttons and volume slider" )
 
 #define PRIVACY_TEXT N_( "Ask for network policy at start" )
@@ -164,6 +165,8 @@ vlc_module_begin();
 
         add_bool( "qt-volume-complete", VLC_FALSE, NULL, COMPLETEVOL_TEXT,
                 COMPLETEVOL_LONGTEXT, VLC_TRUE );
+        add_bool( "qt-autosave-volume", VLC_FALSE, NULL, SAVEVOL_TEXT,
+                SAVEVOL_TEXT, VLC_TRUE );
         add_string( "qt-filedialog-path", NULL, NULL, FILEDIALOG_PATH_TEXT,
                 FILEDIALOG_PATH_TEXT, VLC_TRUE );
             change_autosave();
@@ -248,8 +251,11 @@ static void Close( vlc_object_t *p_this )
     p_intf->b_dead = VLC_TRUE;
     vlc_mutex_unlock( &p_intf->object_lock );
 
-    if( p_intf->pf_show_dialog )
+    if( p_intf->p_sys->b_isDialogProvider )
     {
+        DialogEvent *event = new DialogEvent( INTF_DIALOG_EXIT, 0, NULL );
+        QApplication::postEvent( THEDP, static_cast<QEvent*>(event) );
+
         vlc_thread_join( p_intf );
     }
 
@@ -288,7 +294,8 @@ static void Init( intf_thread_t *p_intf )
      * see commits 21610 21622 21654 for reference */
 
     /* If you don't have a gconftool-2 binary, you should comment this line */
-//    QApplication::setDesktopSettingsAware( false );
+    if( strcmp( qVersion(), "4.4.0" ) < 0 ) /* fixed in Qt 4.4.0 */
+        QApplication::setDesktopSettingsAware( false );
 #endif
 
     /* Start the QApplication here */
@@ -309,10 +316,12 @@ static void Init( intf_thread_t *p_intf )
         p_intf->p_sys->p_mi = p_mi;
         /* We don't show it because it is done in the MainInterface constructor
         p_mi->show(); */
+        p_intf->p_sys->b_isDialogProvider = false;
     }
     else
     {
         vlc_thread_ready( p_intf );
+        p_intf->p_sys->b_isDialogProvider = true;
     }
 
 
@@ -325,7 +334,7 @@ static void Init( intf_thread_t *p_intf )
 #if !defined( WIN32 )
     QString path =  QString( QT4LOCALEDIR );
 #else
-    QString path = QString( QString(system_VLCPath()) + DIR_SEP +
+    QString path = QString( QString(config_GetDataDir()) + DIR_SEP +
                             "locale" + DIR_SEP );
 #endif
     // files depending on locale
@@ -342,7 +351,7 @@ static void Init( intf_thread_t *p_intf )
     }
 
     /* Explain to the core how to show a dialog :D */
-    //p_intf->pf_show_dialog = ShowDialog;
+    p_intf->pf_show_dialog = ShowDialog;
 
     /* Last settings */
     app->setQuitOnLastWindowClosed( false );
@@ -357,7 +366,8 @@ static void Init( intf_thread_t *p_intf )
     {
         int interval = config_GetInt( p_intf, "qt-updates-days" );
         QSettings settings( "vlc", "vlc-qt-interface" );
-        if( QDate::currentDate() > settings.value( "updatedate" ).toDate().addDays( interval ) )
+        if( QDate::currentDate() >
+                settings.value( "updatedate" ).toDate().addDays( interval ) )
         {
             msg_Dbg( p_intf, "Someone said I need to check updates" );
             /* The constructor of the update Dialog will do the 1st request */
@@ -387,7 +397,6 @@ static void Init( intf_thread_t *p_intf )
 
     config_PutPsz( p_intf, "qt-filedialog-path", p_intf->p_sys->psz_filepath );
     free( psz_path );
-
 }
 
 /*****************************************************************************