Commit 6a3cc0c5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: grey out the inexisting options.

parent 518ec833
...@@ -1039,6 +1039,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, ...@@ -1039,6 +1039,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
l->addWidget( checkbox, line, 0 ); l->addWidget( checkbox, line, 0 );
} }
} }
BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, module_config_t *_p_item,
QLabel *_label, QLabel *_label,
......
...@@ -124,15 +124,34 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -124,15 +124,34 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, label, ui.qcontrol, false ); \ p_config, label, ui.qcontrol, false ); \
controls.append( control ); \ controls.append( control ); \
} \
else { \
ui.qcontrol->setEnabled( false ); \
if( label ) label->setEnabled( false ); \
} }
#define CONFIG_GENERIC2( option, type, label, qcontrol ) \ #define CONFIG_BOOL( option, qcontrol ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \
{ \
control = new BoolConfigControl( VLC_OBJECT(p_intf), \
p_config, NULL, ui.qcontrol, false ); \
controls.append( control ); \
} \
else { ui.qcontrol->setEnabled( false ); }
#define CONFIG_GENERIC_NO_UI( option, type, label, qcontrol ) \
p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \
if( p_config ) \ if( p_config ) \
{ \ { \
control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
p_config, label, qcontrol, false ); \ p_config, label, qcontrol, false ); \
controls.append( control ); \ controls.append( control ); \
} \
else { \
qcontrol->setVisible( false ); \
if( label ) label->setEnabled( false ); \
} }
...@@ -190,20 +209,20 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -190,20 +209,20 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
* VIDEO Panel Implementation * * VIDEO Panel Implementation *
******************************/ ******************************/
START_SPREFS_CAT( Video , qtr("Video Settings") ); START_SPREFS_CAT( Video , qtr("Video Settings") );
CONFIG_GENERIC( "video", Bool, NULL, enableVideo ); CONFIG_BOOL( "video", enableVideo );
CONFIG_GENERIC( "fullscreen", Bool, NULL, fullscreen ); CONFIG_BOOL( "fullscreen", fullscreen );
CONFIG_GENERIC( "overlay", Bool, NULL, overlay ); CONFIG_BOOL( "overlay", overlay );
CONFIG_GENERIC( "video-on-top", Bool, NULL, alwaysOnTop ); CONFIG_BOOL( "video-on-top", alwaysOnTop );
CONFIG_GENERIC( "video-deco", Bool, NULL, windowDecorations ); CONFIG_BOOL( "video-deco", windowDecorations );
CONFIG_GENERIC( "skip-frames" , Bool, NULL, skipFrames ); CONFIG_BOOL( "skip-frames", skipFrames );
CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule ); CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule );
CONFIG_GENERIC( "video-wallpaper" , Bool , NULL, wallpaperMode ); CONFIG_BOOL( "video-wallpaper", wallpaperMode );
#ifdef WIN32 #ifdef WIN32
CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel, CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel,
dXdisplayDevice ); dXdisplayDevice );
CONFIG_GENERIC( "directx-hw-yuv", Bool, NULL, hwYUVBox ); CONFIG_BOOL( "directx-hw-yuv", hwYUVBox );
#else #else
ui.directXBox->setVisible( false ); ui.directXBox->setVisible( false );
ui.hwYUVBox->setVisible( false ); ui.hwYUVBox->setVisible( false );
...@@ -216,7 +235,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -216,7 +235,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC_FILE( "snapshot-path", Directory, ui.dirLabel, CONFIG_GENERIC_FILE( "snapshot-path", Directory, ui.dirLabel,
ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse ); ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse );
CONFIG_GENERIC( "snapshot-prefix", String, ui.prefixLabel, snapshotsPrefix ); CONFIG_GENERIC( "snapshot-prefix", String, ui.prefixLabel, snapshotsPrefix );
CONFIG_GENERIC( "snapshot-sequential", Bool, NULL, CONFIG_BOOL( "snapshot-sequential",
snapshotsSequentialNumbering ); snapshotsSequentialNumbering );
CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel, CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel,
snapshotsFormat ); snapshotsFormat );
...@@ -227,7 +246,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -227,7 +246,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
******************************/ ******************************/
START_SPREFS_CAT( Audio, qtr("Audio Settings") ); START_SPREFS_CAT( Audio, qtr("Audio Settings") );
CONFIG_GENERIC( "audio", Bool, NULL, enableAudio ); CONFIG_BOOL( "audio", enableAudio );
ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() ); ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() );
CONNECT( ui.enableAudio, toggled( bool ), CONNECT( ui.enableAudio, toggled( bool ),
ui.SPrefsAudio_zone, setEnabled( bool ) ); ui.SPrefsAudio_zone, setEnabled( bool ) );
...@@ -262,7 +281,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -262,7 +281,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#ifdef WIN32 #ifdef WIN32
audioControl( DirectX ); audioControl( DirectX );
optionWidgets.append( DirectXControl ); optionWidgets.append( DirectXControl );
CONFIG_GENERIC2( "directx-audio-device-name", StringList, CONFIG_GENERIC_NO_UI( "directx-audio-device-name", StringList,
NULL, DirectXDevice ); NULL, DirectXDevice );
#else #else
if( module_exists( "alsa" ) ) if( module_exists( "alsa" ) )
...@@ -270,7 +289,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -270,7 +289,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
audioControl( alsa ); audioControl( alsa );
optionWidgets.append( alsaControl ); optionWidgets.append( alsaControl );
CONFIG_GENERIC2( "alsa-audio-device" , StringList, NULL, CONFIG_GENERIC_NO_UI( "alsa-audio-device" , StringList, NULL,
alsaDevice ); alsaDevice );
} }
else else
...@@ -296,7 +315,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -296,7 +315,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONNECT( ui.defaultVolume, valueChanged( int ), CONNECT( ui.defaultVolume, valueChanged( int ),
this, updateAudioVolume( int ) ); this, updateAudioVolume( int ) );
CONFIG_GENERIC( "qt-autosave-volume", Bool, NULL, keepVolumeRadio ); CONFIG_BOOL( "qt-autosave-volume", keepVolumeRadio );
ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() ); ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() );
CONNECT( ui.resetVolumeRadio, toggled( bool ), CONNECT( ui.resetVolumeRadio, toggled( bool ),
ui.defaultVolume_zone, setEnabled( bool ) ); ui.defaultVolume_zone, setEnabled( bool ) );
...@@ -304,7 +323,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -304,7 +323,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "audio-language" , String , ui.langLabel, CONFIG_GENERIC( "audio-language" , String , ui.langLabel,
preferredAudioLanguage ); preferredAudioLanguage );
CONFIG_GENERIC( "spdif", Bool, NULL, spdifBox ); CONFIG_BOOL( "spdif", spdifBox );
CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel, CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel,
detectionDolby ); detectionDolby );
...@@ -314,7 +333,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -314,7 +333,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
replayCombo ); replayCombo );
CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel, CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel,
visualisation); visualisation);
CONFIG_GENERIC( "audio-time-stretch", Bool, NULL, autoscaleBox ); CONFIG_BOOL( "audio-time-stretch", autoscaleBox );
/* Audio Output Specifics */ /* Audio Output Specifics */
CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule ); CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule );
...@@ -418,7 +437,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -418,7 +437,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "avi-index", IntegerList, ui.aviLabel, AviRepair ); CONFIG_GENERIC( "avi-index", IntegerList, ui.aviLabel, AviRepair );
/* live555 module prefs */ /* live555 module prefs */
CONFIG_GENERIC( "rtsp-tcp", Bool, NULL, CONFIG_BOOL( "rtsp-tcp",
live555TransportRTSP_TCPRadio ); live555TransportRTSP_TCPRadio );
if ( !module_exists( "live555" ) ) if ( !module_exists( "live555" ) )
{ {
...@@ -427,11 +446,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -427,11 +446,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui.live555TransportLabel->hide(); ui.live555TransportLabel->hide();
} }
#ifdef WIN32 #ifdef WIN32
CONFIG_GENERIC( "prefer-system-codecs", Bool, NULL, systemCodecBox ); CONFIG_BOOL( "prefer-system-codecs", systemCodecBox );
#else #else
ui.systemCodecBox->hide(); ui.systemCodecBox->hide();
#endif #endif
CONFIG_GENERIC( "ffmpeg-hw", Bool, NULL, hwAccelBox ); CONFIG_BOOL( "ffmpeg-hw", hwAccelBox );
optionWidgets.append( ui.DVDDevice ); optionWidgets.append( ui.DVDDevice );
optionWidgets.append( ui.cachingCombo ); optionWidgets.append( ui.cachingCombo );
CONFIG_GENERIC( "ffmpeg-skiploopfilter", IntegerList, ui.filterLabel, loopFilterBox ); CONFIG_GENERIC( "ffmpeg-skiploopfilter", IntegerList, ui.filterLabel, loopFilterBox );
...@@ -550,20 +569,20 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -550,20 +569,20 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel, CONFIG_GENERIC( "qt-display-mode", IntegerList, ui.displayLabel,
displayModeBox ); displayModeBox );
CONFIG_GENERIC( "embedded-video", Bool, NULL, embedVideo ); CONFIG_BOOL( "embedded-video", embedVideo );
CONFIG_GENERIC( "qt-fs-controller", Bool, NULL, fsController ); CONFIG_BOOL( "qt-fs-controller", fsController );
CONFIG_GENERIC( "qt-system-tray", Bool, NULL, systrayBox ); CONFIG_BOOL( "qt-system-tray", systrayBox );
CONFIG_GENERIC( "qt-notification", Bool, NULL, sysPop ); CONFIG_BOOL( "qt-notification", sysPop );
CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel, CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel,
ui.fileSkin, ui.skinBrowse ); ui.fileSkin, ui.skinBrowse );
CONFIG_GENERIC( "qt-video-autoresize", Bool, NULL, resizingBox ); CONFIG_BOOL( "qt-video-autoresize", resizingBox );
CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel, CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
artFetcher ); artFetcher );
/* UPDATE options */ /* UPDATE options */
#ifdef UPDATE_CHECK #ifdef UPDATE_CHECK
CONFIG_GENERIC( "qt-updates-notif", Bool, NULL, updatesBox ); CONFIG_BOOL( "qt-updates-notif", updatesBox );
CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL, CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL,
updatesDays ); updatesDays );
ui.updatesDays->setEnabled( ui.updatesBox->isChecked() ); ui.updatesDays->setEnabled( ui.updatesBox->isChecked() );
...@@ -575,8 +594,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -575,8 +594,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#endif #endif
/* ONE INSTANCE options */ /* ONE INSTANCE options */
#if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__) #if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__)
CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode ); CONFIG_BOOL( "one-instance", OneInterfaceMode );
CONFIG_GENERIC( "playlist-enqueue", Bool, NULL, CONFIG_BOOL( "playlist-enqueue",
EnqueueOneInterfaceMode ); EnqueueOneInterfaceMode );
ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() ); ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() );
CONNECT( ui.OneInterfaceMode, toggled( bool ), CONNECT( ui.OneInterfaceMode, toggled( bool ),
...@@ -588,7 +607,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -588,7 +607,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONNECT( ui.saveRecentlyPlayed, toggled( bool ), CONNECT( ui.saveRecentlyPlayed, toggled( bool ),
ui.recentlyPlayedFilters, setEnabled( bool ) ); ui.recentlyPlayedFilters, setEnabled( bool ) );
ui.recentlyPlayedFilters->setEnabled( false ); ui.recentlyPlayedFilters->setEnabled( false );
CONFIG_GENERIC( "qt-recentplay", Bool, NULL, saveRecentlyPlayed ); CONFIG_BOOL( "qt-recentplay", saveRecentlyPlayed );
CONFIG_GENERIC( "qt-recentplay-filter", String, ui.filterLabel, CONFIG_GENERIC( "qt-recentplay-filter", String, ui.filterLabel,
recentlyPlayedFilters ); recentlyPlayedFilters );
...@@ -596,8 +615,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -596,8 +615,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
START_SPREFS_CAT( Subtitles, START_SPREFS_CAT( Subtitles,
qtr("Subtitles & On Screen Display Settings") ); qtr("Subtitles & On Screen Display Settings") );
CONFIG_GENERIC( "osd", Bool, NULL, OSDBox); CONFIG_BOOL( "osd", OSDBox);
CONFIG_GENERIC( "video-title-show", Bool, NULL, OSDTitleBox); CONFIG_BOOL( "video-title-show", OSDTitleBox);
CONFIG_GENERIC( "subsdec-encoding", StringList, ui.encodLabel, CONFIG_GENERIC( "subsdec-encoding", StringList, ui.encodLabel,
...@@ -668,8 +687,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -668,8 +687,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#undef START_SPREFS_CAT #undef START_SPREFS_CAT
#undef CONFIG_GENERIC_FILE #undef CONFIG_GENERIC_FILE
#undef CONFIG_GENERIC_NO_BOOL #undef CONFIG_GENERIC_NO_BOOL
#undef CONFIG_GENERIC2 #undef CONFIG_GENERIC_NO_UI
#undef CONFIG_GENERIC #undef CONFIG_GENERIC
#undef CONFIG_BOOL
} }
......
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