]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/qt4.cpp
Qt4 - Add an option to have the volume slider from 0 to 400 %. Close #952 Close ...
[vlc] / modules / gui / qt4 / qt4.cpp
index a5f97af407a8bbc9db73774e7dfc66be4bf8f4ea..d00c4b9f4ffee0863e3fea690aafea729d2118c1 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *****************************************************************************/
 
 #include <QApplication>
+#include <QLocale>
+#include <QTranslator>
 
 #include "qt4.hpp"
+#include <vlc_os_specific.h>
 #include "dialogs_provider.hpp"
 #include "input_manager.hpp"
 #include "main_interface.hpp"
@@ -66,7 +70,7 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define TITLE_LONGTEXT N_("Show the name of the song or video in the " \
                           "controler window title")
 
-#define FILEDIALOG_PATH_TEXT N_("Path to use in file dialog")
+#define FILEDIALOG_PATH_TEXT N_("Path to use in openfile dialog")
 
 #define NOTIFICATION_TEXT N_("Show notification popup on track change")
 #define NOTIFICATION_LONGTEXT N_( \
@@ -91,6 +95,16 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define ERROR_TEXT N_("Show unimportant error and warnings dialogs" )
 #define MINIMAL_TEXT N_("Start in minimal view (menus hidden)." )
 
+#define UPDATER_TEXT N_("Activate the new updates notification")
+#define UPDATER_LONGTEXT N_("Activate the automatic notification of new " \
+                            "versions of the software. It runs once a week." )
+                            
+#define COMPLETEVOL_TEXT N_("Allow the volume to be set to 400%" )
+#define COMPLETEVOL_LONGTEXT N_("Allow the volume to have range from 0% to " \
+                                "400%, instead of 0% to 200%. This option " \
+                                "can distort the audio, since it uses " \
+                                "software amplification.")
+
 vlc_module_begin();
     set_shortname( (char *)"Qt" );
     set_description( (char*)_("Qt interface") );
@@ -115,6 +129,8 @@ vlc_module_begin();
         add_bool( "qt-minimal-view", VLC_FALSE, NULL, MINIMAL_TEXT,
                 MINIMAL_TEXT, VLC_TRUE );
 
+        add_bool( "qt-volume-complete", VLC_FALSE, NULL, COMPLETEVOL_TEXT,
+                COMPLETEVOL_LONGTEXT, VLC_TRUE);
         add_bool( "qt-name-in-title", VLC_TRUE, NULL, TITLE_TEXT,
                   TITLE_LONGTEXT, VLC_FALSE );
         add_string( "qt-filedialog-path", NULL, NULL, FILEDIALOG_PATH_TEXT,
@@ -133,6 +149,8 @@ vlc_module_begin();
                 ADVANCED_PREFS_LONGTEXT, VLC_FALSE );
         add_bool( "qt-error-dialogs", VLC_TRUE, NULL, ERROR_TEXT,
                 ERROR_TEXT, VLC_FALSE );
+        add_bool( "qt-updates-notif", VLC_TRUE, NULL, UPDATER_TEXT, 
+                UPDATER_LONGTEXT, VLC_FALSE );
 
         add_integer( "qt-pl-showflags",
                 VLC_META_ENGINE_ARTIST|VLC_META_ENGINE_TITLE|
@@ -142,7 +160,6 @@ vlc_module_begin();
         set_callbacks( OpenDialogs, Close );
 vlc_module_end();
 
-
 /*****************************************************************************
  * Module callbacks
  *****************************************************************************/
@@ -245,6 +262,22 @@ static void Init( intf_thread_t *p_intf )
     else
     /*if( p_intf->pf_show_dialog )*/
         vlc_thread_ready( p_intf );
+    // Translation - get locale
+    QLocale ql = QLocale::system ();
+    // 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(system_VLCPath()) + DIR_SEP +
+                            "locale" + DIR_SEP );
+#endif
+    // files depending on locale
+    bool b_loaded = qtTranslator.load( path + "qt_" + ql.name());
+    if (!b_loaded)
+        msg_Dbg(p_intf, "Error while initializing qt-specific localization");
+    app->installTranslator(&qtTranslator);
 
     /* Start playing if needed */
     if( !p_intf->pf_show_dialog && p_intf->b_play )
@@ -265,6 +298,7 @@ static void Init( intf_thread_t *p_intf )
     MainInputManager::killInstance();
     DialogsProvider::killInstance();
     delete p_intf->p_sys->p_mi;
+    delete app;
 }
 
 /*****************************************************************************