]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
Fix SLIDERCOL_LONGTEXT like in commit 2848880a144e0aa184 of jb
[vlc] / modules / gui / qt4 / qt4.cpp
index 530d57ad2ada317fe5b4d0d2cbd46e72b6fa7b0f..ab6b15717cd2a75cbe2b4f34b2ba9bc861166eaa 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * qt4.cpp : QT4 interface
  ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright © 2006-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
@@ -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"
@@ -93,11 +92,6 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
                              " This option only works with Windows and " \
                              "X11 with composite extensions." )
 
-#define SHOWFLAGS_TEXT N_( "Define what columns to show in playlist window" )
-#define SHOWFLAGS_LONGTEXT N_( "Enter the sum of the options that you want: \n" \
-                               "Title: 1; Duration: 2; Artist: 4; Genre: 8; " \
-                           "Copyright: 16; Collection/album: 32; Rating: 256." )
-
 #define ERROR_TEXT N_( "Show unimportant error and warnings dialogs" )
 
 #define UPDATER_TEXT N_( "Activate the updates availability notification" )
@@ -111,10 +105,17 @@ 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" )
 
+#define SLIDERCOL_TEXT N_( "Define the colours of the volume slider " )
+#define SLIDERCOL_LONGTEXT N_( "Define the colours of the volume slider\n " \
+                       "By specifying the 12 numbers separated by a ';'\n " \
+            "Default is '255;255;255;20;226;20;255;176;15;235;30;20'\n " \
+            "An alternative can be '30;30;50;40;40;100;50;50;160;150;150;255' ")
 
 #define VIEWDETAIL_TEXT N_( "Show the opening dialog view in detail mode" )
 
@@ -169,6 +170,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();
@@ -186,13 +189,9 @@ vlc_module_begin();
         add_integer( "qt-updates-days", 14, NULL, UPDATER_DAYS_TEXT,
                 UPDATER_DAYS_TEXT, VLC_FALSE );
 #endif
-
-        add_integer( "qt-pl-showflags",
-                VLC_META_ENGINE_ARTIST|VLC_META_ENGINE_TITLE|
-                VLC_META_ENGINE_DURATION|VLC_META_ENGINE_COLLECTION,
-                NULL, SHOWFLAGS_TEXT,
-                SHOWFLAGS_LONGTEXT, VLC_TRUE );
-            change_autosave();
+        add_string( "qt-slider-colours",
+                "255;255;255;20;226;20;255;176;15;235;30;20",
+                NULL, SLIDERCOL_TEXT, SLIDERCOL_LONGTEXT, VLC_FALSE );
 
         add_bool( "qt-open-detail", VLC_FALSE, NULL, VIEWDETAIL_TEXT,
                 VIEWDETAIL_TEXT, VLC_FALSE );
@@ -209,7 +208,7 @@ vlc_module_end();
 static int Open( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
-    p_intf->pf_run = Run;
+
 #if defined Q_WS_X11 && defined HAVE_X11_XLIB_H
     /* Thanks for libqt4 calling exit() in QApplication::QApplication()
      * instead of returning an error, we have to check the X11 display */
@@ -221,6 +220,7 @@ static int Open( vlc_object_t *p_this )
     }
     XCloseDisplay( p_display );
 #endif
+
     p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
     if( !p_intf->p_sys )
     {
@@ -229,9 +229,12 @@ static int Open( vlc_object_t *p_this )
     }
     memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
 
+    p_intf->pf_run = Run;
+
     p_intf->p_sys->p_playlist = pl_Yield( p_intf );
     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
 
+    /* We support play on start */
     p_intf->b_play = VLC_TRUE;
 
     return VLC_SUCCESS;
@@ -251,10 +254,19 @@ static int OpenDialogs( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
+
     vlc_mutex_lock( &p_intf->object_lock );
     p_intf->b_dead = VLC_TRUE;
     vlc_mutex_unlock( &p_intf->object_lock );
 
+    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 );
+    }
+
     vlc_object_release( p_intf->p_sys->p_playlist );
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
     free( p_intf->p_sys );
@@ -290,7 +302,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 */
@@ -311,9 +324,13 @@ 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;
+    }
 
 
 #ifdef ENABLE_NLS
@@ -325,7 +342,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
@@ -338,7 +355,7 @@ static void Init( intf_thread_t *p_intf )
     /* Start playing if needed */
     if( !p_intf->pf_show_dialog && p_intf->b_play )
     {
-        playlist_Control( THEPL, PLAYLIST_AUTOPLAY, VLC_FALSE );
+        playlist_Control( THEPL, PLAYLIST_PLAY, VLC_FALSE );
     }
 
     /* Explain to the core how to show a dialog :D */
@@ -353,13 +370,14 @@ static void Init( intf_thread_t *p_intf )
                            : p_intf->p_libvlc->psz_homedir;
 
 #ifdef UPDATE_CHECK
+    /* Checking for VLC updates */
     if( config_GetInt( p_intf, "qt-updates-notif" ) )
     {
         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 */
             UpdateDialog::getInstance( p_intf );
             settings.setValue( "updatedate", QDate::currentDate() );
@@ -374,7 +392,7 @@ static void Init( intf_thread_t *p_intf )
 
     /* Destroy first the main interface because it is connected to some slots
        in the MainInputManager */
-    if( p_intf->p_sys->p_mi ) delete p_intf->p_sys->p_mi;
+    delete p_intf->p_sys->p_mi;
 
     /* Destroy then other windows, because some are connected to some slots
        in the MainInputManager */
@@ -383,10 +401,10 @@ static void Init( intf_thread_t *p_intf )
     /* Destroy the MainInputManager */
     MainInputManager::killInstance();
 
+    delete app;
+
     config_PutPsz( p_intf, "qt-filedialog-path", p_intf->p_sys->psz_filepath );
     free( psz_path );
-
-    delete app;
 }
 
 /*****************************************************************************