Commit 7d1569ca authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Start mode configuration simplification.

parent 83210184
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
...@@ -102,6 +103,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -102,6 +103,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/** /**
* Configuration and settings * Configuration and settings
* Pre-building of interface
**/ **/
settings = new QSettings( "vlc", "vlc-qt-interface" ); settings = new QSettings( "vlc", "vlc-qt-interface" );
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
...@@ -113,13 +115,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -113,13 +115,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) ); setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
/* Set The Video In emebedded Mode or not */ /* Set The Video In emebedded Mode or not */
videoEmbeddedFlag = false; videoEmbeddedFlag = config_GetInt( p_intf, "embedded-video" );
if( config_GetInt( p_intf, "embedded-video" ) ) videoEmbeddedFlag = true;
/* Are we in the enhanced always-video mode or not ? */ /* Are we in the enhanced always-video mode or not ? */
alwaysVideoFlag = false; i_visualmode = config_GetInt( p_intf, "qt-display-mode" );
if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" ) )
alwaysVideoFlag = true;
/* Set the other interface settings */ /* Set the other interface settings */
//TODO: I don't like that code //TODO: I don't like that code
...@@ -211,17 +210,14 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -211,17 +210,14 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
if( b_systrayAvailable && b_createSystray ) if( b_systrayAvailable && b_createSystray )
createSystray(); createSystray();
if( config_GetInt( p_intf, "qt-minimal-view" ) )
toggleMinimalView();
/******************** /********************
* Input Manager * * Input Manager *
********************/ ********************/
MainInputManager::getInstance( p_intf ); MainInputManager::getInstance( p_intf );
/******************** /**************************
* Various CONNECTs * * Various CONNECTs on IM *
********************/ **************************/
/* Connect the input manager to the GUI elements it manages */ /* Connect the input manager to the GUI elements it manages */
/* It is also connected to the control->slider, see the ControlsWidget */ /* 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 ) ...@@ -295,6 +291,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, doComponentsUpdate() );
/* Size and placement of interface */
move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() ); move( settings->value( "pos", QPoint( 0, 0 ) ).toPoint() );
QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize(); QSize newSize = settings->value( "size", QSize( 350, 60 ) ).toSize();
...@@ -307,6 +305,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -307,6 +305,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
msg_Warn( p_intf, "Invalid size in constructor" ); msg_Warn( p_intf, "Invalid size in constructor" );
} }
/* Playlist */
int tgPlay = settings->value( "playlist-visible", 0 ).toInt(); int tgPlay = settings->value( "playlist-visible", 0 ).toInt();
settings->endGroup(); settings->endGroup();
...@@ -315,8 +314,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -315,8 +314,12 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
togglePlaylist(); togglePlaylist();
} }
updateGeometry();
if( i_visualmode == QT_MINIMAL_MODE )
toggleMinimalView();
/* Update the geometry TODO: is it useful */
updateGeometry();
} }
MainInterface::~MainInterface() MainInterface::~MainInterface()
...@@ -417,7 +420,8 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -417,7 +420,8 @@ void MainInterface::handleMainUi( QSettings *settings )
#endif #endif
/* And video Outputs */ /* And video Outputs */
if( alwaysVideoFlag ) if( i_visualmode == QT_ALWAYS_VIDEO_MODE ||
i_visualmode == QT_MINIMAL_MODE )
{ {
bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
bgWidget->resize( bgWidget->resize(
......
...@@ -121,10 +121,10 @@ private: ...@@ -121,10 +121,10 @@ private:
bool videoIsActive; ///< Having a video now / THEMIM->hasV bool videoIsActive; ///< Having a video now / THEMIM->hasV
bool videoEmbeddedFlag; ///< Want an external Video Window bool videoEmbeddedFlag; ///< Want an external Video Window
bool playlistVisible; ///< Is the playlist visible ? bool playlistVisible; ///< Is the playlist visible ?
bool alwaysVideoFlag; ///< Always show the background
bool visualSelectorEnabled; bool visualSelectorEnabled;
bool notificationEnabled; /// Systray Notifications bool notificationEnabled; /// Systray Notifications
bool b_remainingTime; /* showing elapsed or remaining time */ bool b_remainingTime; /* showing elapsed or remaining time */
int i_visualmode; ///< Visual Mode
input_thread_t *p_input; ///< Main input associated to the playlist input_thread_t *p_input; ///< Main input associated to the playlist
......
...@@ -57,16 +57,9 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); ...@@ -57,16 +57,9 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * 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_TEXT N_( "Show advanced prefs over simple ones" )
#define ADVANCED_PREFS_LONGTEXT N_( "Show advanced preferences and not simple " \ #define ADVANCED_PREFS_LONGTEXT N_( "Show advanced preferences and not simple "\
"preferences when opening the preferences " \ "preferences when opening the preferences "\
"dialog." ) "dialog." )
#define SYSTRAY_TEXT N_( "Systray icon" ) #define SYSTRAY_TEXT N_( "Systray icon" )
...@@ -103,12 +96,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); ...@@ -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_TEXT N_( "Define what columns to show in playlist window" )
#define SHOWFLAGS_LONGTEXT N_( "Enter the sum of the options that you want: \n" \ #define SHOWFLAGS_LONGTEXT N_( "Enter the sum of the options that you want: \n" \
"Title: 1; Duration: 2; Artist: 4; Genre: 8; " \ "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 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_TEXT N_( "Activate the updates availability notification" )
#define UPDATER_LONGTEXT N_( "Activate the automatic notification of new " \ #define UPDATER_LONGTEXT N_( "Activate the automatic notification of new " \
"versions of the software. It runs once a week." ) "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 * ); ...@@ -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 PRIVACY_TEXT N_( "Ask for network policy at start" )
#define VIEWDETAIL_TEXT N_( "Show the opening dialog view in detail mode" ) #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(); vlc_module_begin();
set_shortname( (char *)"Qt" ); set_shortname( (char *)"Qt" );
set_description( (char*)_("Qt interface") ); set_description( (char*)_("Qt interface") );
...@@ -140,10 +148,9 @@ vlc_module_begin(); ...@@ -140,10 +148,9 @@ vlc_module_begin();
set_description( "Dialogs provider" ); set_description( "Dialogs provider" );
set_capability( "dialogs provider", 51 ); set_capability( "dialogs provider", 51 );
add_bool( "qt-always-video", VLC_FALSE, NULL, ALWAYS_VIDEO_TEXT, add_integer( "qt-display-mode", QT_NORMAL_MODE, NULL,
ALWAYS_VIDEO_LONGTEXT, VLC_TRUE ); QT_MODE_TEXT, QT_MODE_LONGTEXT, VLC_FALSE );
add_bool( "qt-minimal-view", VLC_FALSE, NULL, MINIMAL_TEXT, change_integer_list( i_mode_list, psz_mode_list_text, 0 );
MINIMAL_TEXT, VLC_TRUE );
add_bool( "qt-notification", VLC_TRUE, NULL, NOTIFICATION_TEXT, add_bool( "qt-notification", VLC_TRUE, NULL, NOTIFICATION_TEXT,
NOTIFICATION_LONGTEXT, VLC_FALSE ); NOTIFICATION_LONGTEXT, VLC_FALSE );
...@@ -193,7 +200,6 @@ vlc_module_begin(); ...@@ -193,7 +200,6 @@ vlc_module_begin();
add_bool( "qt-privacy-ask", VLC_TRUE, NULL, PRIVACY_TEXT, PRIVACY_TEXT, add_bool( "qt-privacy-ask", VLC_TRUE, NULL, PRIVACY_TEXT, PRIVACY_TEXT,
VLC_FALSE ); VLC_FALSE );
set_callbacks( OpenDialogs, Close ); set_callbacks( OpenDialogs, Close );
vlc_module_end(); vlc_module_end();
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#define VLC_META_ENGINE_DURATION 0x00000002 #define VLC_META_ENGINE_DURATION 0x00000002
#define VLC_META_DURATION N_( "Duration" ) #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 QApplication;
class QMenu; class QMenu;
class MainInterface; class MainInterface;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment