#include "components/simple_preferences.hpp"
#include "components/preferences_widgets.hpp"
-#include "ui/sprefs_input.h"
-#include "ui/sprefs_audio.h"
-#include "ui/sprefs_video.h"
-#include "ui/sprefs_subtitles.h"
-#include "ui/sprefs_hotkeys.h"
-#include "ui/sprefs_interface.h"
+
#include <vlc_config_cat.h>
#include <vlc_configuration.h>
#define START_SPREFS_CAT( name , label ) \
case SPrefs ## name: \
{ \
- Ui::SPrefs ## name ui; \
+ Ui::SPrefs ## name ui; \
ui.setupUi( panel ); \
panel_label->setText( label );
#ifdef WIN32
CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode );
CONFIG_GENERIC( "directx-device", StringList, NULL,
- dXdisplayDevice );
+ dXdisplayDevice );
#else
ui.directXBox->setVisible( false );
#endif
CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
+ /* and hide if necessary */
+
+#ifdef WIN32
+ ui.OSSControl->hide();
+ ui.alsaControl->hide();
+#else
+ ui.DirectXControl->hide();
+#endif
+ ui.lastfm_user_edit->hide();
+ ui.lastfm_user_label->hide();
+ ui.lastfm_pass_edit->hide();
+ ui.lastfm_pass_label->hide();
+
/* General Audio Options */
CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
defaultVolume );
CONNECT( ui.outputModule, currentIndexChanged( int ), this,
updateAudioOptions( int ) );
- audioOutput = ui.outputModule;
+
//TODO: use modules_Exists
#ifndef WIN32
// File exists everywhere
CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel,
fileName, fileBrowseButton );
- alsa_options = ui.alsaControl;
- oss_options = ui.OSSControl;
- directx_options = ui.DirectXControl;
- file_options = ui.fileControl;
-
- /* and hide if necessary */
-#ifdef WIN32
- oss_options->hide();
- alsa_options->hide();
-#else
- directx_options->hide();
-#endif
- updateAudioOptions( audioOutput->currentIndex() );
+ optionWidgets.append( ui.alsaControl );
+ optionWidgets.append( ui.OSSControl );
+ optionWidgets.append( ui.DirectXControl );
+ optionWidgets.append( ui.fileControl );
+ optionWidgets.append( ui.outputModule );
+ optionWidgets.append( ui.volNormBox );
+ updateAudioOptions( ui.outputModule->currentIndex() );
/* LastFM */
CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
lastfm_user_edit );
CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
lastfm_pass_edit );
- ui.lastfm_user_edit->hide();
- ui.lastfm_user_label->hide();
- ui.lastfm_pass_edit->hide();
- ui.lastfm_pass_label->hide();
if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
ui.lastfm->setCheckState( Qt::Checked );
lastfm_Changed( int ) );
/* Normalizer */
- normalizerBox = ui.volNormBox;
- CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin, setEnabled( bool ) );
+
+ CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin,
+ setEnabled( bool ) );
qs_filter = qfu( config_GetPsz( p_intf, "audio-filter" ) );
bool b_normalizer = ( qs_filter.contains( "volnorm" ) );
{
/* Input and Codecs Panel Implementation */
START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs settings") );
- inputDevice = ui.DVDDevice;
- /* Disk Devices */
+
+
+ /* Disk Devices */
{
ui.DVDDevice->setToolTip(
qtr( "If this propriety is blank, then you have\n"
CONFIG_GENERIC_NO_BOOL( "server-port", Integer, NULL, UDPPort );
CONFIG_GENERIC( "http-proxy", String , NULL, proxy );
- /* Caching */
-/* CONFIG_GENERIC( );*/ //FIXME
+ /* Caching */
+ #define addToCachingBox( str, cachingNumber ) \
+ ui.cachingCombo->addItem( str, QVariant( cachingNumber ) );
+ addToCachingBox( "Custom", CachingCustom );
+ addToCachingBox( "Lowest latency", CachingLowest );
+ addToCachingBox( "Low latency", CachingLow );
+ addToCachingBox( "Normal", CachingNormal );
+ addToCachingBox( "High latency", CachingHigh );
+ addToCachingBox( "Higher latency", CachingHigher );
CONFIG_GENERIC_NO_BOOL( "ffmpeg-pp-q", Integer, NULL, PostProcLevel );
CONFIG_GENERIC( "avi-index", IntegerList, NULL, AviRepair );
ui.dumpBox->setChecked( qs_filter.contains( "dump" ) );
ui.recordBox->setChecked( qs_filter.contains( "record" ) );
ui.bandwidthBox->setChecked( qs_filter.contains( "bandwidth" ) );
- timeshiftBox = ui.timeshiftBox;
- recordBox = ui.recordBox;
- dumpBox = ui.dumpBox;
- bandwidthBox = ui.bandwidthBox;
+
+ optionWidgets.append( ui.recordBox );
+ optionWidgets.append( ui.dumpBox );
+ optionWidgets.append( ui.bandwidthBox );
+ optionWidgets.append( ui.timeshiftBox );
+ optionWidgets.append( ui.DVDDevice );
+ optionWidgets.append( ui.cachingCombo );
END_SPREFS_CAT;
- /* Interface Panel */
+ /*******************
+ * Interface Panel *
+ *******************/
START_SPREFS_CAT( Interface, qtr("Interface settings") );
ui.defaultLabel->setFont( italicFont );
ui.skinsLabel->setFont( italicFont );
ui.languageLabel->hide();
#endif
- /* interface */
+ /* interface */
char *psz_intf = config_GetPsz( p_intf, "intf" );
if( psz_intf )
{
else if( strstr( psz_intf, "qt" ) )
ui.qt4->setChecked( true );
}
- skinInterfaceButton = ui.skins;
- qtInterfaceButton = ui.qt4;
delete psz_intf;
+ optionWidgets.append( ui.skins );
+ optionWidgets.append( ui.qt4 );
+
CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo );
CONFIG_GENERIC_FILE( "skins2-last", File, NULL, fileSkin,
skinBrowse );
-#if defined( WIN32 ) || defined(HAVE_DBUS_3)
+#if defined( WIN32 ) || defined( HAVE_DBUS_3 )
CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
EnqueueOneInterfaceMode );
END_SPREFS_CAT;
}
- panel_layout->addWidget(panel_label);
- panel_layout->addWidget(title_line);
+ panel_layout->addWidget( panel_label );
+ panel_layout->addWidget( title_line );
panel_layout->addWidget( panel );
panel_layout->addStretch( 2 );
- this->setLayout(panel_layout);
+ setLayout( panel_layout );
}
void SPrefsPanel::updateAudioOptions( int number)
{
- QString value = audioOutput->itemData( number ).toString();
+ QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
+ ->itemData( number ).toString();
#ifndef WIN32
- oss_options->hide();
- alsa_options->hide();
+ optionWidgets[ossW]->setVisible( ( value == "oss" ) );
+ optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );
#else
- directx_options->hide();
-#endif
- file_options->hide();
-
- if( value == "aout_file" )
- file_options->show();
-#ifndef WIN32
- else if( value == "alsa" )
- alsa_options->show();
- else if( value == "oss" )
- oss_options->show();
-#else
- else if( value == "directx" )
- directx_options->show();
+ optionWidgets[directxW]->setVisible( ( value == "directx" ) );
#endif
+ optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
}
void SPrefsPanel::apply()
/* Devices */
if( number == SPrefsInputAndCodecs )
{
- char *psz_devicepath = qtu( inputDevice->text() );
+ /* Device default selection */
+ char *psz_devicepath =
+ qtu( qobject_cast<QLineEdit *>(optionWidgets[inputLE] )->text() );
if( !EMPTY_STR( psz_devicepath ) )
{
config_PutPsz( p_intf, "dvd", psz_devicepath );
config_PutPsz( p_intf, "cd-audio", psz_devicepath );
}
- bool b_first = true;
+ /* Access filters */
#define saveBox( name, box ) {\
if( box->isChecked() ) { \
if( b_first ) { \
} \
else qs_filter.append( ":" ).append( name ); \
} }
-
- saveBox( "record", recordBox );
- saveBox( "dump", dumpBox );
- saveBox( "timeshift", timeshiftBox );
- saveBox( "bandwidth", bandwidthBox );
+
+ bool b_first = true;
+ saveBox( "record", qobject_cast<QCheckBox *>(optionWidgets[recordChB]) );
+ saveBox( "dump", qobject_cast<QCheckBox *>(optionWidgets[dumpChB]) );
+ saveBox( "timeshift", qobject_cast<QCheckBox *>(optionWidgets[timeshiftChB]) );
+ saveBox( "bandwidth", qobject_cast<QCheckBox *>(optionWidgets[bandwidthChB] ) );
config_PutPsz( p_intf, "access-filter", qtu( qs_filter ) );
+
+ QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
+ /* Caching */
+ msg_Dbg( p_intf, "%i",
+ cachingCombo->itemData( cachingCombo->currentIndex() ).toInt() );
}
/* Interfaces */
if( number == SPrefsInterface )
{
- if( skinInterfaceButton->isChecked() )
+ if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
config_PutPsz( p_intf, "intf", "skins2" );
- if( qtInterfaceButton->isChecked() )
+ if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
config_PutPsz( p_intf, "intf", "qt4" );
}
if( number == SPrefsAudio )
{
- bool b_normChecked = normalizerBox->isChecked();
+ bool b_normChecked =
+ qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
if( qs_filter.isEmpty() )
{
/* the psz_filter is already empty, so we just append it needed */