]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/simple_preferences.cpp
Qt4 - Preferences, lastfm fix.
[vlc] / modules / gui / qt4 / components / simple_preferences.cpp
1 /*****************************************************************************
2  * simple_preferences.cpp : "Simple preferences"
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id: preferences.cpp 16348 2006-08-25 21:10:10Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Antoine Cellerier <dionoea@videolan.org>
9  *          Jean-Baptiste Kempf <jb@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #include "components/simple_preferences.hpp"
27 #include "components/preferences_widgets.hpp"
28
29 #include <vlc_config_cat.h>
30 #include <vlc_configuration.h>
31
32 #include <QString>
33 #include <QFont>
34 #include <QToolButton>
35 #include <QButtonGroup>
36 #include <QUrl>
37 #include <QVBoxLayout>
38
39 #define ICON_HEIGHT 64
40 #define BUTTON_HEIGHT 74
41
42 /*********************************************************************
43  * The List of categories
44  *********************************************************************/
45 SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
46                                   QWidget( _parent ), p_intf( _p_intf )
47 {
48     QVBoxLayout *layout = new QVBoxLayout();
49
50     QButtonGroup *buttonGroup = new QButtonGroup( this );
51     buttonGroup->setExclusive ( true );
52     CONNECT( buttonGroup, buttonClicked ( int ),
53             this, switchPanel( int ) );
54
55 #define ADD_CATEGORY( button, label, icon, numb )                           \
56     QToolButton * button = new QToolButton( this );                         \
57     button->setIcon( QIcon( ":/pixmaps/" #icon ) );                         \
58     button->setIconSize( QSize( ICON_HEIGHT , ICON_HEIGHT ) );              \
59     button->setText( label );                                               \
60     button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );              \
61     button->resize( BUTTON_HEIGHT , BUTTON_HEIGHT);                         \
62     button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ;  \
63     button->setAutoRaise( true );                                           \
64     button->setCheckable( true );                                           \
65     buttonGroup->addButton( button, numb );                                 \
66     layout->addWidget( button );
67
68     ADD_CATEGORY( SPrefsInterface, qtr("Interface"),
69                   spref_cone_Interface_64.png, 0 );
70     ADD_CATEGORY( SPrefsAudio, qtr("Audio"), spref_cone_Audio_64.png, 1 );
71     ADD_CATEGORY( SPrefsVideo, qtr("Video"), spref_cone_Video_64.png, 2 );
72     ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"),
73                   spref_cone_Subtitles_64.png, 3 );
74     ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"),
75                   spref_cone_Input_64.png, 4 );
76     ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), spref_cone_Hotkeys_64.png, 5 );
77
78     SPrefsInterface->setChecked( true );
79     layout->setMargin( 0 );
80     layout->setSpacing( 1 );
81
82     this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
83     setLayout( layout );
84
85 }
86
87 void SPrefsCatList::switchPanel( int i )
88 {
89     emit currentItemChanged( i );
90 }
91
92 /*********************************************************************
93  * The Panels
94  *********************************************************************/
95 SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
96                           int _number ) : QWidget( _parent ), p_intf( _p_intf )
97 {
98     module_config_t *p_config;
99     ConfigControl *control;
100     number = _number;
101
102 #define CONFIG_GENERIC( option, type, label, qcontrol )                   \
103             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
104             if( p_config )                                                \
105             {                                                             \
106                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
107                            p_config, label, ui.qcontrol, false );         \
108                 controls.append( control );                               \
109             }
110
111 #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol )           \
112             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
113             if( p_config )                                                \
114             {                                                             \
115                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
116                            p_config, label, ui.qcontrol );                \
117                 controls.append( control );                               \
118             }
119
120 #define CONFIG_GENERIC_FILE( option, type, label, qcontrol, qbutton )         \
121                 p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
122                 if( p_config )                                                \
123                 {                                                             \
124                     control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
125                                p_config, label, ui.qcontrol, ui.qbutton,      \
126                             false );                                          \
127                     controls.append( control );                               \
128                 }
129
130 #define START_SPREFS_CAT( name , label )    \
131         case SPrefs ## name:                \
132         {                                   \
133             Ui::SPrefs ## name ui;      \
134             ui.setupUi( panel );            \
135             panel_label->setText( label );
136
137 #define END_SPREFS_CAT      \
138             break;          \
139         }
140
141     QVBoxLayout *panel_layout = new QVBoxLayout();
142     QWidget *panel = new QWidget();
143     panel_layout->setMargin( 3 );
144
145     // Title Label
146     QLabel *panel_label = new QLabel;
147     QFont labelFont = QApplication::font( static_cast<QWidget*>(0) );
148     labelFont.setPointSize( labelFont.pointSize() + 6 );
149     labelFont.setFamily( "Verdana" );
150     panel_label->setFont( labelFont );
151
152     // Title <hr>
153     QFrame *title_line = new QFrame;
154     title_line->setFrameShape(QFrame::HLine);
155     title_line->setFrameShadow(QFrame::Sunken);
156
157     QFont italicFont = QApplication::font( static_cast<QWidget*>(0) );
158     italicFont.setItalic( true );
159
160     switch( number )
161     {
162         /******************************
163          * VIDEO Panel Implementation *
164          ******************************/
165         START_SPREFS_CAT( Video , qtr("General video settings") );
166             CONFIG_GENERIC( "video", Bool, NULL, enableVideo );
167
168             CONFIG_GENERIC( "fullscreen", Bool, NULL, fullscreen );
169             CONFIG_GENERIC( "overlay", Bool, NULL, overlay );
170             CONFIG_GENERIC( "video-on-top", Bool, NULL, alwaysOnTop );
171             CONFIG_GENERIC( "video-deco", Bool, NULL, windowDecorations );
172             CONFIG_GENERIC( "skip-frames" , Bool, NULL, skipFrames );
173             CONFIG_GENERIC( "vout", Module, NULL, outputModule );
174
175 #ifdef WIN32
176             CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode );
177             CONFIG_GENERIC( "directx-device", StringList, NULL,
178                             dXdisplayDevice );
179 #else
180             ui.directXBox->setVisible( false );
181 #endif
182
183             CONFIG_GENERIC_FILE( "snapshot-path", Directory, NULL,
184                     snapshotsDirectory, snapshotsDirectoryBrowse );
185             CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
186             CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
187                             snapshotsSequentialNumbering );
188             CONFIG_GENERIC( "snapshot-format", StringList, NULL,
189                             snapshotsFormat );
190          END_SPREFS_CAT;
191
192         /******************************
193          * AUDIO Panel Implementation *
194          ******************************/
195         START_SPREFS_CAT( Audio, qtr("General audio settings") );
196
197             CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
198
199             /* and hide if necessary */
200
201 #ifdef WIN32
202             ui.OSSControl->hide();
203             ui.alsaControl->hide();
204 #else
205             ui.DirectXControl->hide();
206 #endif
207             ui.lastfm_user_edit->hide();
208             ui.lastfm_user_label->hide();
209             ui.lastfm_pass_edit->hide();
210             ui.lastfm_pass_label->hide();
211
212             /* General Audio Options */
213             CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
214                                      defaultVolume );
215             CONFIG_GENERIC( "audio-language" , String , NULL,
216                             preferredAudioLanguage );
217
218             CONFIG_GENERIC( "spdif", Bool, NULL, spdifBox );
219             CONFIG_GENERIC( "force-dolby-surround" , IntegerList , NULL,
220                             detectionDolby );
221
222             CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect );
223
224             CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float , NULL,
225                                     volNormSpin );
226             CONFIG_GENERIC( "audio-visual" , Module , NULL, visualisation);
227
228             /* Audio Output Specifics */
229             CONFIG_GENERIC( "aout", Module, NULL, outputModule );
230
231             CONNECT( ui.outputModule, currentIndexChanged( int ), this,
232                              updateAudioOptions( int ) );
233
234         //TODO: use modules_Exists
235 #ifndef WIN32
236             CONFIG_GENERIC( "alsadev" , StringList , ui.alsaLabel, alsaDevice );
237             CONFIG_GENERIC_FILE( "dspdev" , File , ui.OSSLabel, OSSDevice,
238                                  OSSBrowse );
239 #else
240             CONFIG_GENERIC( "directx-audio-device", IntegerList,
241                     ui.DirectXLabel, DirectXDevice );
242 #endif
243         // File exists everywhere
244             CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel,
245                                  fileName, fileBrowseButton );
246
247             optionWidgets.append( ui.alsaControl );
248             optionWidgets.append( ui.OSSControl );
249             optionWidgets.append( ui.DirectXControl );
250             optionWidgets.append( ui.fileControl );
251             optionWidgets.append( ui.outputModule );
252             optionWidgets.append( ui.volNormBox );
253             updateAudioOptions( ui.outputModule->currentIndex() );
254
255             /* LastFM */
256             if( module_Exists( p_intf, "Audioscrobbler" ) )
257             {
258                 CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
259                         lastfm_user_edit );
260                 CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
261                         lastfm_pass_edit );
262
263                 if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
264                     ui.lastfm->setCheckState( Qt::Checked );
265                 else
266                     ui.lastfm->setCheckState( Qt::Unchecked );
267                 CONNECT( ui.lastfm, stateChanged( int ), this ,
268                         lastfm_Changed( int ) );
269             }
270
271             /* Normalizer */
272
273             CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin,
274                      setEnabled( bool ) );
275             qs_filter = qfu( config_GetPsz( p_intf, "audio-filter" ) );
276             bool b_normalizer = ( qs_filter.contains( "volnorm" ) );
277             {
278                 ui.volNormBox->setChecked( b_normalizer );
279                 ui.volNormSpin->setEnabled( b_normalizer );
280             }
281
282         END_SPREFS_CAT;
283
284         /* Input and Codecs Panel Implementation */
285         START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs settings") );
286
287             /* Disk Devices */
288             {
289                 ui.DVDDevice->setToolTip(
290                     //BUG: make this sentence understandable
291                     qtr( "If this property is blank, then you have\n"
292                          "values for DVD, VCD, and CDDA.\n"
293                          "You can define a unique one or set that in"
294                          "the advanced preferences" ) );
295                 char *psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
296                 char *psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
297                 char *psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
298                 if( ( *psz_cddadiscpath == *psz_dvddiscpath )
299                    && ( *psz_dvddiscpath == *psz_vcddiscpath ) )
300                 {
301                     ui.DVDDevice->setText( qfu( psz_dvddiscpath ) );
302                 }
303                 delete psz_cddadiscpath; delete psz_dvddiscpath;
304                 delete psz_vcddiscpath;
305             }
306
307             CONFIG_GENERIC_NO_BOOL( "server-port", Integer, NULL, UDPPort );
308             CONFIG_GENERIC( "http-proxy", String , NULL, proxy );
309             CONFIG_GENERIC_NO_BOOL( "ffmpeg-pp-q", Integer, NULL, PostProcLevel );
310             CONFIG_GENERIC( "avi-index", IntegerList, NULL, AviRepair );
311             CONFIG_GENERIC( "rtsp-tcp", Bool, NULL, RTSP_TCPBox );
312 #ifdef WIN32
313             CONFIG_GENERIC( "prefer-system-codecs", Bool, NULL, systemCodecBox );
314 #else
315             ui.systemCodecBox->hide();
316 #endif
317             /* Access Filters */
318             qs_filter = qfu( config_GetPsz( p_intf, "access-filter" ) );
319             ui.timeshiftBox->setChecked( qs_filter.contains( "timeshift" ) );
320             ui.dumpBox->setChecked( qs_filter.contains( "dump" ) );
321             ui.recordBox->setChecked( qs_filter.contains( "record" ) );
322             ui.bandwidthBox->setChecked( qs_filter.contains( "bandwidth" ) );
323
324             optionWidgets.append( ui.recordBox );
325             optionWidgets.append( ui.dumpBox );
326             optionWidgets.append( ui.bandwidthBox );
327             optionWidgets.append( ui.timeshiftBox );
328             optionWidgets.append( ui.DVDDevice );
329             optionWidgets.append( ui.cachingCombo );
330
331             /* Caching */
332             /* Add the things to the ComboBox */
333             #define addToCachingBox( str, cachingNumber ) \
334                 ui.cachingCombo->addItem( str, QVariant( cachingNumber ) );
335             addToCachingBox( "Custom", CachingCustom );
336             addToCachingBox( "Lowest latency", CachingLowest );
337             addToCachingBox( "Low latency", CachingLow );
338             addToCachingBox( "Normal", CachingNormal );
339             addToCachingBox( "High latency", CachingHigh );
340             addToCachingBox( "Higher latency", CachingHigher );
341
342 #define TestCaC( name ) \
343     b_cache_equal =  b_cache_equal && ( i_cache == config_GetInt( p_intf, name ) );
344
345 #define TestCaCi( name, int ) \
346     b_cache_equal = b_cache_equal &&  \
347     ( ( i_cache * int ) == config_GetInt( p_intf, name ) );
348             /* Select the accurate value of the ComboBox */
349             bool b_cache_equal = true;
350             int i_cache = config_GetInt( p_intf, "file-caching");
351
352             TestCaC( "udp-caching" ) TestCaC( "dvdread-caching" )
353             TestCaC( "dvdnav-caching" ) TestCaC( "tcp-caching" )
354             TestCaC( "fake-caching" ) TestCaC( "cdda-caching" )
355             TestCaC( "screen-caching" ) TestCaC( "vcd-caching" )
356             #ifdef WIN32
357             TestCaC( "dshow-caching" )
358             #else
359             TestCaC( "v4l-caching" ) TestCaC( "jack-input-caching" )
360             TestCaC( "v4l2-caching" ) TestCaC( "pvr-caching" )
361             #endif
362             TestCaCi( "rtsp-caching", 4 ) TestCaCi( "ftp-caching", 2 )
363             TestCaCi( "http-caching", 4 ) TestCaCi( "realrtsp-caching", 10 )
364             TestCaCi( "mms-caching", 19 )
365             if( b_cache_equal ) ui.cachingCombo->setCurrentIndex(
366                 ui.cachingCombo->findData( QVariant( i_cache ) ) );
367
368         END_SPREFS_CAT;
369         /*******************
370          * Interface Panel *
371          *******************/
372         START_SPREFS_CAT( Interface, qtr("Interface settings") );
373             ui.defaultLabel->setFont( italicFont );
374             ui.skinsLabel->setFont( italicFont );
375
376 #if defined( WIN32 ) || defined (__APPLE__)
377             CONFIG_GENERIC( "language", StringList, NULL, language );
378 #else
379             ui.language->hide();
380             ui.languageLabel->hide();
381 #endif
382
383             /* interface */
384             char *psz_intf = config_GetPsz( p_intf, "intf" );
385             if( psz_intf )
386             {
387                 msg_Dbg( p_intf, "Interface in config file: %s", psz_intf );
388                 if( strstr( psz_intf, "skin" ) )
389                     ui.skins->setChecked( true );
390                 else if( strstr( psz_intf, "qt" ) )
391                     ui.qt4->setChecked( true );
392             }
393             delete psz_intf;
394
395             optionWidgets.append( ui.skins );
396             optionWidgets.append( ui.qt4 );
397
398             CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel, artFetcher );
399             CONFIG_GENERIC( "fetch-meta", Bool, NULL, metaFetcher );
400             CONFIG_GENERIC( "qt-updates-notif", Bool, NULL, qtUpdates );
401             CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo );
402             CONFIG_GENERIC_FILE( "skins2-last", File, NULL, fileSkin,
403                     skinBrowse );
404 #if defined( WIN32 ) || defined( HAVE_DBUS_3 )
405             CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
406             CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
407                     EnqueueOneInterfaceMode );
408 #else
409             ui.OneInterfaceBox->hide();
410 #endif
411         END_SPREFS_CAT;
412
413         START_SPREFS_CAT( Subtitles, qtr("Subtitles & OSD settings") );
414             CONFIG_GENERIC( "osd", Bool, NULL, OSDBox);
415
416             CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
417             CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
418             CONFIG_GENERIC_FILE( "freetype-font", File, NULL, font,
419                             fontBrowse );
420             CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor );
421             CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL,
422                             fontSize );
423             CONFIG_GENERIC( "freetype-effect", IntegerList, NULL, effect );
424
425         END_SPREFS_CAT;
426
427         case SPrefsHotkeys:
428         {
429             p_config = config_FindConfig( VLC_OBJECT(p_intf), "key-fullscreen" );
430
431             QGridLayout *gLayout = new QGridLayout;
432             panel->setLayout( gLayout );
433             int line = 0;
434
435             KeySelectorControl *ksCtrl =
436                         new KeySelectorControl( VLC_OBJECT(p_intf), p_config ,
437                                                 this, gLayout, line );
438
439             panel_label->setText( qtr( "Configure Hotkeys" ) );
440
441             break;
442         }
443     }
444
445     panel_layout->addWidget( panel_label );
446     panel_layout->addWidget( title_line );
447     panel_layout->addWidget( panel );
448     if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 );
449
450     setLayout( panel_layout );
451 }
452
453 void SPrefsPanel::updateAudioOptions( int number)
454 {
455     QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
456                                             ->itemData( number ).toString();
457
458 #ifndef WIN32
459     optionWidgets[ossW]->setVisible( ( value == "oss" ) );
460     optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );
461 #else
462     optionWidgets[directxW]->setVisible( ( value == "directx" ) );
463 #endif
464     optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
465 }
466
467 /* Function called from the main Preferences dialog on each SPrefs Panel */
468 void SPrefsPanel::apply()
469 {
470     msg_Dbg( p_intf, "Trying to save the %i simple panel", number );
471
472     /* Generic save for ever panel */
473     QList<ConfigControl *>::Iterator i;
474     for( i = controls.begin() ; i != controls.end() ; i++ )
475     {
476         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
477         c->doApply( p_intf );
478     }
479
480     switch( number )
481     {
482     case SPrefsInputAndCodecs:
483     {
484         /* Device default selection */
485         char *psz_devicepath =
486               qtu( qobject_cast<QLineEdit *>(optionWidgets[inputLE] )->text() );
487         if( !EMPTY_STR( psz_devicepath ) )
488         {
489             config_PutPsz( p_intf, "dvd", psz_devicepath );
490             config_PutPsz( p_intf, "vcd", psz_devicepath );
491             config_PutPsz( p_intf, "cd-audio", psz_devicepath );
492         }
493
494         /* Access filters */
495 #define saveBox( name, box ) {\
496         if( box->isChecked() ) { \
497             if( b_first ) { \
498                 qs_filter.append( name ); \
499                 b_first = false; \
500             } \
501             else qs_filter.append( ":" ).append( name ); \
502         } }
503
504         bool b_first = true;
505         qs_filter.clear();
506         saveBox( "record", qobject_cast<QCheckBox *>(optionWidgets[recordChB]) );
507         saveBox( "dump", qobject_cast<QCheckBox *>(optionWidgets[dumpChB]) );
508         saveBox( "timeshift", qobject_cast<QCheckBox *>(optionWidgets[timeshiftChB]) );
509         saveBox( "bandwidth", qobject_cast<QCheckBox *>(optionWidgets[bandwidthChB] ) );
510         config_PutPsz( p_intf, "access-filter", qtu( qs_filter ) );
511
512 #define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue );
513 #define CaC( name ) CaCi( name, 1 );
514         /* Caching */
515         QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
516         int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
517         if( i_comboValue )
518         {
519             msg_Dbg( p_intf, "Adjusting all cache values at: %i", i_comboValue );
520             CaC( "udp-caching" ); CaC( "dvdread-caching" );
521             CaC( "dvdnav-caching" ); CaC( "tcp-caching" ); CaC( "vcd-caching" );
522             CaC( "fake-caching" ); CaC( "cdda-caching" ); CaC( "file-caching" );
523             CaC( "screen-caching" );
524             CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 );
525             CaCi( "http-caching", 4 ); CaCi( "realrtsp-caching", 10 );
526             CaCi( "mms-caching", 19 );
527             #ifdef WIN32
528             CaC( "dshow-caching" );
529             #else
530             CaC( "v4l-caching" ); CaC( "jack-input-caching" );
531             CaC( "v4l2-caching" ); CaC( "pvr-caching" );
532             #endif
533             //CaCi( "dv-caching" ) too short...
534         }
535         break;
536     }
537
538     /* Interfaces */
539     case SPrefsInterface:
540     {
541         if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
542             config_PutPsz( p_intf, "intf", "skins2" );
543         if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
544             config_PutPsz( p_intf, "intf", "qt4" );
545         break;
546     }
547
548     case SPrefsAudio:
549     {
550         bool b_normChecked =
551             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
552         if( qs_filter.isEmpty() )
553         {
554             /* the psz_filter is already empty, so we just append it needed */
555             if( b_normChecked ) qs_filter = "volnorm";
556         }
557         else /* Not Empty */
558         {
559             if( qs_filter.contains( "volnorm" ) )
560             {
561                 /* The qs_filter not empty and contains "volnorm"
562                    that we have to remove */
563                 if( !b_normChecked )
564                 {
565                     /* Ugly :D */
566                     qs_filter.remove( "volnorm:" );
567                     qs_filter.remove( ":volnorm" );
568                     qs_filter.remove( "volnorm" );
569                 }
570             }
571             else /* qs_filter not empty, but doesn't have volnorm inside */
572                 if( b_normChecked ) qs_filter.append( ":volnorm" );
573         }
574         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter ) );
575         break;
576     }
577     }
578 }
579
580 void SPrefsPanel::clean()
581 {}
582
583 void SPrefsPanel::lastfm_Changed( int i_state )
584 {
585     if( i_state == Qt::Checked )
586         config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
587     else if( i_state == Qt::Unchecked )
588         config_RemoveIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
589 }