]> git.sesse.net Git - vlc/commitdiff
Qt4 - Start mode configuration simplification.
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 31 Jan 2008 08:28:11 +0000 (08:28 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 31 Jan 2008 08:28:11 +0000 (08:28 +0000)
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.hpp

index e3bcefa89a683670a0c6880ffc159b787e252d8e..85d2a1f989c4001e6098d09800467f565c814cd2 100644 (file)
@@ -22,6 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -102,6 +103,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /**
      *  Configuration and settings
+     *  Pre-building of interface
      **/
     settings = new QSettings( "vlc", "vlc-qt-interface" );
     settings->beginGroup( "MainWindow" );
@@ -113,13 +115,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
 
     /* Set The Video In emebedded Mode or not */
-    videoEmbeddedFlag = false;
-    if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
+    videoEmbeddedFlag = config_GetInt( p_intf, "embedded-video" );
 
     /* Are we in the enhanced always-video mode or not ? */
-    alwaysVideoFlag = false;
-    if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) )
-        alwaysVideoFlag = true;
+    i_visualmode = config_GetInt( p_intf, "qt-display-mode" );
 
     /* Set the other interface settings */
     //TODO: I don't like that code
@@ -211,17 +210,14 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     if( b_systrayAvailable && b_createSystray )
             createSystray();
 
-    if( config_GetInt( p_intf, "qt-minimal-view" ) )
-        toggleMinimalView();
-
     /********************
      * Input Manager    *
      ********************/
     MainInputManager::getInstance( p_intf );
 
-    /********************
-     * Various CONNECTs *
-     ********************/
+    /**************************
+     * Various CONNECTs on IM *
+     **************************/
     /* Connect the input manager to the GUI elements it manages */
 
     /* It is also connected to the control->slider, see the ControlsWidget */
@@ -295,6 +291,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     CONNECT( controls, advancedControlsToggled( bool ),
              this, doComponentsUpdate() );
 
+
+    /* Size and placement of interface */
     move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() );
 
     QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize();
@@ -307,6 +305,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
         msg_Warn( p_intf, "Invalid size in constructor" );
     }
 
+    /* Playlist */
     int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
     settings->endGroup();
 
@@ -315,8 +314,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
         togglePlaylist();
     }
 
-    updateGeometry();
 
+   if( i_visualmode == QT_MINIMAL_MODE )
+           toggleMinimalView();
+
+   /* Update the geometry TODO: is it useful */
+    updateGeometry();
 }
 
 MainInterface::~MainInterface()
@@ -417,7 +420,8 @@ void MainInterface::handleMainUi( QSettings *settings )
     #endif
 
     /* And video Outputs */
-    if( alwaysVideoFlag )
+    if( i_visualmode == QT_ALWAYS_VIDEO_MODE ||
+        i_visualmode == QT_MINIMAL_MODE )
     {
         bgWidget = new BackgroundWidget( p_intf );
         bgWidget->resize(
index 4253fb7b5fdd0008e5eb21fca0765efb7aa7c25d..bb287aea1ddfffb4234103c43958e6bb55fe88c1 100644 (file)
@@ -121,10 +121,10 @@ private:
     bool                 videoIsActive; ///< Having a video now / THEMIM->hasV
     bool                 videoEmbeddedFlag; ///< Want an external Video Window
     bool                 playlistVisible; ///< Is the playlist visible ?
-    bool                 alwaysVideoFlag; ///< Always show the background
     bool                 visualSelectorEnabled;
     bool                 notificationEnabled; /// Systray Notifications
     bool                 b_remainingTime; /* showing elapsed or remaining time */
+    int                  i_visualmode; ///< Visual Mode
 
     input_thread_t      *p_input;    ///< Main input associated to the playlist
 
index ea557087bcfbf3bc14c88b4bce77c201395884a0..5eac3fe5238a4b2d310e90d9a6932bdff229805c 100644 (file)
@@ -57,16 +57,9 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define ALWAYS_VIDEO_TEXT N_( "Always show an area for information when " \
-                              "no video is played" )
-#define ALWAYS_VIDEO_LONGTEXT N_( "Start VLC with a cone image, and " \
-                                  "use this zone to show information as " \
-                                  "lyrics, album arts or visualisation " \
-                                  " when there is no video track." )
-
 #define ADVANCED_PREFS_TEXT N_( "Show advanced prefs over simple ones" )
-#define ADVANCED_PREFS_LONGTEXT N_( "Show advanced preferences and not simple " \
-                                    "preferences when opening the preferences " \
+#define ADVANCED_PREFS_LONGTEXT N_( "Show advanced preferences and not simple "\
+                                    "preferences when opening the preferences "\
                                     "dialog." )
 
 #define SYSTRAY_TEXT N_( "Systray icon" )
@@ -103,12 +96,10 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #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." )
+                           "Copyright: 16; Collection/album: 32; Rating: 256." )
 
 #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 updates availability notification" )
 #define UPDATER_LONGTEXT N_( "Activate the automatic notification of new " \
                             "versions of the software. It runs once a week." )
@@ -124,8 +115,25 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 
 #define PRIVACY_TEXT N_( "Ask for network policy at start" )
 
+
 #define VIEWDETAIL_TEXT N_( "Show the opening dialog view in detail mode" )
 
+#define QT_MODE_TEXT N_( "Selection of the starting mode and look " )
+#define QT_MODE_LONGTEXT N_( "Start VLC with:\n" \
+                             " - normal mode\n"  \
+                             " - a zone always present to show information" \
+                                  "as lyrics, album arts...\n" \
+                             " - minimal mode with limited controls" )
+
+#define QT_NORMAL_MODE_TEXT N_( "Classic look" )
+#define QT_ALWAYS_VIDEO_MODE_TEXT N_( "Complete look with information area" )
+#define QT_MINIMAL_MODE_TEXT N_( "Minimal look with no menus" )
+
+static int i_mode_list[] =
+    { QT_NORMAL_MODE, QT_ALWAYS_VIDEO_MODE, QT_MINIMAL_MODE };
+static const char *psz_mode_list_text[] =
+    { QT_NORMAL_MODE_TEXT, QT_ALWAYS_VIDEO_MODE_TEXT, QT_MINIMAL_MODE_TEXT };
+
 vlc_module_begin();
     set_shortname( (char *)"Qt" );
     set_description( (char*)_("Qt interface") );
@@ -140,10 +148,9 @@ vlc_module_begin();
         set_description( "Dialogs provider" );
         set_capability( "dialogs provider", 51 );
 
-        add_bool( "qt-always-video", VLC_FALSE, NULL, ALWAYS_VIDEO_TEXT,
-                ALWAYS_VIDEO_LONGTEXT, VLC_TRUE );
-        add_bool( "qt-minimal-view", VLC_FALSE, NULL, MINIMAL_TEXT,
-                MINIMAL_TEXT, VLC_TRUE );
+        add_integer( "qt-display-mode", QT_NORMAL_MODE, NULL,
+                     QT_MODE_TEXT, QT_MODE_LONGTEXT, VLC_FALSE );
+            change_integer_list( i_mode_list, psz_mode_list_text, 0 );
 
         add_bool( "qt-notification", VLC_TRUE, NULL, NOTIFICATION_TEXT,
                   NOTIFICATION_LONGTEXT, VLC_FALSE );
@@ -193,7 +200,6 @@ vlc_module_begin();
         add_bool( "qt-privacy-ask", VLC_TRUE, NULL, PRIVACY_TEXT, PRIVACY_TEXT,
                 VLC_FALSE );
 
-
         set_callbacks( OpenDialogs, Close );
 vlc_module_end();
 
index 5face00f3fada494e113fe252d3ab18fe08e3c1d..d0c4283f552f4d2abb0ca980c454d1b567189ce1 100644 (file)
 #define VLC_META_ENGINE_DURATION   0x00000002
 #define VLC_META_DURATION          N_( "Duration" )
 
+#define QT_NORMAL_MODE 0
+#define QT_ALWAYS_VIDEO_MODE 1
+#define QT_MINIMAL_MODE 2
+
 class QApplication;
 class QMenu;
 class MainInterface;