]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/simple_preferences.cpp
Qt4 - Unification of Hotkeys for Sprefs et Adv Preferences.
[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
30
31 #include <vlc_config_cat.h>
32 #include <vlc_configuration.h>
33
34 #include <QString>
35 #include <QFont>
36 #include <QToolButton>
37 #include <QButtonGroup>
38 #include <QUrl>
39 #include <QVBoxLayout>
40
41 #define ICON_HEIGHT 64
42 #define BUTTON_HEIGHT 74
43
44 /*********************************************************************
45  * The List of categories
46  *********************************************************************/
47 SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
48                                   QWidget( _parent ), p_intf( _p_intf )
49 {
50     QVBoxLayout *layout = new QVBoxLayout();
51
52     QButtonGroup *buttonGroup = new QButtonGroup( this );
53     buttonGroup->setExclusive ( true );
54     CONNECT( buttonGroup, buttonClicked ( int ),
55             this, switchPanel( int ) );
56
57 #define ADD_CATEGORY( button, label, icon, numb )                           \
58     QToolButton * button = new QToolButton( this );                         \
59     button->setIcon( QIcon( ":/pixmaps/" #icon ) );                         \
60     button->setIconSize( QSize( ICON_HEIGHT , ICON_HEIGHT ) );              \
61     button->setText( label );                                               \
62     button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );              \
63     button->resize( BUTTON_HEIGHT , BUTTON_HEIGHT);                         \
64     button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ;  \
65     button->setAutoRaise( true );                                           \
66     button->setCheckable( true );                                           \
67     buttonGroup->addButton( button, numb );                                 \
68     layout->addWidget( button );
69
70     ADD_CATEGORY( SPrefsInterface, qtr("Interface"),
71                   spref_cone_Interface_64.png, 0 );
72     ADD_CATEGORY( SPrefsAudio, qtr("Audio"), spref_cone_Audio_64.png, 1 );
73     ADD_CATEGORY( SPrefsVideo, qtr("Video"), spref_cone_Video_64.png, 2 );
74     ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"),
75                   spref_cone_Subtitles_64.png, 3 );
76     ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"),
77                   spref_cone_Input_64.png, 4 );
78     ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), spref_cone_Hotkeys_64.png, 5 );
79
80     SPrefsInterface->setChecked( true );
81     layout->setMargin( 0 );
82     layout->setSpacing( 1 );
83
84     this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
85     setLayout( layout );
86
87 }
88
89 void SPrefsCatList::switchPanel( int i )
90 {
91     emit currentItemChanged( i );
92 }
93
94 /*********************************************************************
95  * The Panels
96  *********************************************************************/
97 SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
98                           int _number ) : QWidget( _parent ), p_intf( _p_intf )
99 {
100     module_config_t *p_config;
101     ConfigControl *control;
102     number = _number;
103
104 #define CONFIG_GENERIC( option, type, label, qcontrol )                   \
105             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
106             if( p_config )                                                \
107             {                                                             \
108                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
109                            p_config, label, ui.qcontrol, false );         \
110                 controls.append( control );                               \
111             }
112
113 #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol )           \
114             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
115             if( p_config )                                                \
116             {                                                             \
117                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
118                            p_config, label, ui.qcontrol );                \
119                 controls.append( control );                               \
120             }
121
122 #define CONFIG_GENERIC_FILE( option, type, label, qcontrol, qbutton )         \
123                 p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
124                 if( p_config )                                                \
125                 {                                                             \
126                     control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
127                                p_config, label, ui.qcontrol, ui.qbutton,      \
128                             false );                                          \
129                     controls.append( control );                               \
130                 }
131
132 #define START_SPREFS_CAT( name , label )    \
133         case SPrefs ## name:                \
134         {                                   \
135             Ui::SPrefs ## name ui;      \
136             ui.setupUi( panel );            \
137             panel_label->setText( label );
138
139 #define END_SPREFS_CAT      \
140             break;          \
141         }
142
143     QVBoxLayout *panel_layout = new QVBoxLayout();
144     QWidget *panel = new QWidget();
145     panel_layout->setMargin( 3 );
146
147     // Title Label
148     QLabel *panel_label = new QLabel;
149     QFont labelFont = QApplication::font( static_cast<QWidget*>(0) );
150     labelFont.setPointSize( labelFont.pointSize() + 6 );
151     labelFont.setFamily( "Verdana" );
152     panel_label->setFont( labelFont );
153
154     // Title <hr>
155     QFrame *title_line = new QFrame;
156     title_line->setFrameShape(QFrame::HLine);
157     title_line->setFrameShadow(QFrame::Sunken);
158
159     QFont italicFont = QApplication::font( static_cast<QWidget*>(0) );
160     italicFont.setItalic( true );
161
162     switch( number )
163     {
164         /******************************
165          * VIDEO Panel Implementation *
166          ******************************/
167         START_SPREFS_CAT( Video , qtr("General video settings") );
168             CONFIG_GENERIC( "video", Bool, NULL, enableVideo );
169
170             CONFIG_GENERIC( "fullscreen", Bool, NULL, fullscreen );
171             CONFIG_GENERIC( "overlay", Bool, NULL, overlay );
172             CONFIG_GENERIC( "video-on-top", Bool, NULL, alwaysOnTop );
173             CONFIG_GENERIC( "video-deco", Bool, NULL, windowDecorations );
174             CONFIG_GENERIC( "skip-frames" , Bool, NULL, skipFrames );
175             CONFIG_GENERIC( "overlay", Bool, NULL, overlay );
176             CONFIG_GENERIC( "vout", Module, NULL, outputModule );
177
178 #ifdef WIN32
179             CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode );
180             CONFIG_GENERIC( "directx-device", StringList, NULL,
181                             dXdisplayDevice );
182 #else
183             ui.directXBox->setVisible( false );
184 #endif
185
186             CONFIG_GENERIC_FILE( "snapshot-path", Directory, NULL,
187                     snapshotsDirectory, snapshotsDirectoryBrowse );
188             CONFIG_GENERIC( "snapshot-prefix", String, NULL, snapshotsPrefix );
189             CONFIG_GENERIC( "snapshot-sequential", Bool, NULL,
190                             snapshotsSequentialNumbering );
191             CONFIG_GENERIC( "snapshot-format", StringList, NULL,
192                             snapshotsFormat );
193          END_SPREFS_CAT;
194
195         /******************************
196          * AUDIO Panel Implementation *
197          ******************************/
198         START_SPREFS_CAT( Audio, qtr("General audio settings") );
199
200             CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
201
202             /* and hide if necessary */
203
204 #ifdef WIN32
205             ui.OSSControl->hide();
206             ui.alsaControl->hide();
207 #else
208             ui.DirectXControl->hide();
209 #endif
210             ui.lastfm_user_edit->hide();
211             ui.lastfm_user_label->hide();
212             ui.lastfm_pass_edit->hide();
213             ui.lastfm_pass_label->hide();
214
215             /* General Audio Options */
216             CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
217                                      defaultVolume );
218             CONFIG_GENERIC( "audio-language" , String , NULL,
219                             preferredAudioLanguage );
220
221             CONFIG_GENERIC( "spdif", Bool, NULL, spdifBox );
222             CONFIG_GENERIC( "force-dolby-surround" , IntegerList , NULL,
223                             detectionDolby );
224
225             CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect );
226
227             CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float , NULL,
228                                     volNormSpin );
229             CONFIG_GENERIC( "audio-visual" , Module , NULL, visualisation);
230
231             /* Audio Output Specifics */
232             CONFIG_GENERIC( "aout", Module, NULL, outputModule );
233
234             CONNECT( ui.outputModule, currentIndexChanged( int ), this,
235                              updateAudioOptions( int ) );
236
237
238         //TODO: use modules_Exists
239 #ifndef WIN32
240             CONFIG_GENERIC( "alsadev" , StringList , ui.alsaLabel, alsaDevice );
241             CONFIG_GENERIC_FILE( "dspdev" , File , ui.OSSLabel, OSSDevice,
242                                  OSSBrowse );
243 #else
244             CONFIG_GENERIC( "directx-audio-device", IntegerList,
245                     ui.DirectXLabel, DirectXDevice );
246 #endif
247         // File exists everywhere
248             CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.fileLabel,
249                                  fileName, fileBrowseButton );
250
251             optionWidgets.append( ui.alsaControl );
252             optionWidgets.append( ui.OSSControl );
253             optionWidgets.append( ui.DirectXControl );
254             optionWidgets.append( ui.fileControl );
255             optionWidgets.append( ui.outputModule );
256             optionWidgets.append( ui.volNormBox );
257             updateAudioOptions( ui.outputModule->currentIndex() );
258
259             /* LastFM */
260             CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
261                          lastfm_user_edit );
262             CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
263                          lastfm_pass_edit );
264
265             if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
266                 ui.lastfm->setCheckState( Qt::Checked );
267             else
268                 ui.lastfm->setCheckState( Qt::Unchecked );
269             CONNECT( ui.lastfm, stateChanged( int ), this ,
270                     lastfm_Changed( int ) );
271
272             /* Normalizer */
273
274             CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin,
275                      setEnabled( bool ) );
276             qs_filter = qfu( config_GetPsz( p_intf, "audio-filter" ) );
277             bool b_normalizer = ( qs_filter.contains( "volnorm" ) );
278             {
279                 ui.volNormBox->setChecked( b_normalizer );
280                 ui.volNormSpin->setEnabled( b_normalizer );
281             }
282
283         END_SPREFS_CAT;
284
285         /* Input and Codecs Panel Implementation */
286         START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs settings") );
287
288             /* Disk Devices */
289             {
290                 ui.DVDDevice->setToolTip(
291                     qtr( "If this propriety 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 && ( ( i_cache * int ) == config_GetInt( p_intf, name ) );
347             /* Select the accurate value of the ComboBox */
348             bool b_cache_equal = true;
349             int i_cache = config_GetInt( p_intf, "file-caching");
350
351             TestCaC( "udp-caching" ) TestCaC( "dvdread-caching" )
352             TestCaC( "dvdnav-caching" ) TestCaC( "tcp-caching" )
353             TestCaC( "fake-caching" ) TestCaC( "cdda-caching" )
354             TestCaC( "screen-caching" ) TestCaC( "vcd-caching" )
355             #ifdef WIN32
356             TestCaC( "dshow-caching" )
357             #else
358             TestCaC( "v4l-caching" ) TestCaC( "jack-input-caching" )
359             TestCaC( "v4l2-caching" ) TestCaC( "pvr-caching" )
360             #endif
361             TestCaCi( "rtsp-caching", 4 ) TestCaCi( "ftp-caching", 2 )
362             TestCaCi( "http-caching", 4 ) TestCaCi( "realrtsp-caching", 10 )
363             TestCaCi( "mms-caching", 19 )
364             if( b_cache_equal )
365                ui.cachingCombo->setCurrentIndex( ui.cachingCombo->findData( QVariant( i_cache ) ) );
366
367         END_SPREFS_CAT;
368         /*******************
369          * Interface Panel *
370          *******************/
371         START_SPREFS_CAT( Interface, qtr("Interface settings") );
372             ui.defaultLabel->setFont( italicFont );
373             ui.skinsLabel->setFont( italicFont );
374
375 #if defined( WIN32 ) || defined (__APPLE__)
376             CONFIG_GENERIC( "language", StringList, NULL, language );
377 #else
378             ui.language->hide();
379             ui.languageLabel->hide();
380 #endif
381
382             /* interface */
383             char *psz_intf = config_GetPsz( p_intf, "intf" );
384             if( psz_intf )
385             {
386                 msg_Dbg( p_intf, "Interface in config file: %s", psz_intf );
387                 if( strstr( psz_intf, "skin" ) )
388                     ui.skins->setChecked( true );
389                 else if( strstr( psz_intf, "qt" ) )
390                     ui.qt4->setChecked( true );
391             }
392             delete psz_intf;
393
394             optionWidgets.append( ui.skins );
395             optionWidgets.append( ui.qt4 );
396
397             CONFIG_GENERIC( "qt-always-video", Bool, NULL, qtAlwaysVideo );
398             CONFIG_GENERIC_FILE( "skins2-last", File, NULL, fileSkin,
399                     skinBrowse );
400 #if defined( WIN32 ) || defined( HAVE_DBUS_3 )
401             CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
402             CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
403                     EnqueueOneInterfaceMode );
404 #else
405             ui.OneInterfaceBox->hide();
406 #endif
407         END_SPREFS_CAT;
408
409         START_SPREFS_CAT( Subtitles, qtr("Subtitles & OSD settings") );
410             CONFIG_GENERIC( "osd", Bool, NULL, OSDBox);
411
412             CONFIG_GENERIC( "subsdec-encoding", StringList, NULL, encoding );
413             CONFIG_GENERIC( "sub-language", String, NULL, preferredLanguage );
414             CONFIG_GENERIC_FILE( "freetype-font", File, NULL, font,
415                             fontBrowse );
416             CONFIG_GENERIC( "freetype-color", IntegerList, NULL, fontColor );
417             CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList, NULL,
418                             fontSize );
419             CONFIG_GENERIC( "freetype-effect", IntegerList, NULL, effect );
420
421         END_SPREFS_CAT;
422
423         case SPrefsHotkeys:
424         {
425             p_config = config_FindConfig( VLC_OBJECT(p_intf), "key-fullscreen" );
426
427             QGridLayout *gLayout = new QGridLayout;
428             panel->setLayout( gLayout );
429             int line = 0;
430
431             KeySelectorControl *ksCtrl =
432                         new KeySelectorControl( VLC_OBJECT(p_intf), p_config ,
433                                                 this, gLayout, line );
434
435             panel_label->setText( qtr( "Configure Hotkeys" ) );
436
437             break;
438         }
439     }
440
441     panel_layout->addWidget( panel_label );
442     panel_layout->addWidget( title_line );
443     panel_layout->addWidget( panel );
444     panel_layout->addStretch( 2 );
445
446     setLayout( panel_layout );
447 }
448
449 void SPrefsPanel::updateAudioOptions( int number)
450 {
451     QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
452                                             ->itemData( number ).toString();
453
454 #ifndef WIN32
455     optionWidgets[ossW]->setVisible( ( value == "oss" ) );
456     optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );
457 #else
458     optionWidgets[directxW]->setVisible( ( value == "directx" ) );
459 #endif
460     optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
461 }
462
463 void SPrefsPanel::apply()
464 {
465     msg_Dbg( p_intf, "Trying to save the %i simple panel", number );
466
467     /* Generic save for ever panel */
468     QList<ConfigControl *>::Iterator i;
469     for( i = controls.begin() ; i != controls.end() ; i++ )
470     {
471         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
472         c->doApply( p_intf );
473     }
474
475     /* Devices */
476     if( number == SPrefsInputAndCodecs )
477     {
478         /* Device default selection */
479         char *psz_devicepath =
480               qtu( qobject_cast<QLineEdit *>(optionWidgets[inputLE] )->text() );
481         if( !EMPTY_STR( psz_devicepath ) )
482         {
483             config_PutPsz( p_intf, "dvd", psz_devicepath );
484             config_PutPsz( p_intf, "vcd", psz_devicepath );
485             config_PutPsz( p_intf, "cd-audio", psz_devicepath );
486         }
487
488         /* Access filters */
489 #define saveBox( name, box ) {\
490         if( box->isChecked() ) { \
491             if( b_first ) { \
492                 qs_filter.append( name ); \
493                 b_first = false; \
494             } \
495             else qs_filter.append( ":" ).append( name ); \
496         } }
497
498         bool b_first = true;
499         qs_filter.clear();
500         saveBox( "record", qobject_cast<QCheckBox *>(optionWidgets[recordChB]) );
501         saveBox( "dump", qobject_cast<QCheckBox *>(optionWidgets[dumpChB]) );
502         saveBox( "timeshift", qobject_cast<QCheckBox *>(optionWidgets[timeshiftChB]) );
503         saveBox( "bandwidth", qobject_cast<QCheckBox *>(optionWidgets[bandwidthChB] ) );
504         config_PutPsz( p_intf, "access-filter", qtu( qs_filter ) );
505
506 #define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue );
507 #define CaC( name ) CaCi( name, 1 );
508         /* Caching */
509         QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
510         int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
511         if( i_comboValue )
512         {
513             msg_Dbg( p_intf, "Adjusting all the cache values at level: %i", i_comboValue );
514             CaC( "udp-caching" ); CaC( "dvdread-caching" );
515             CaC( "dvdnav-caching" ); CaC( "tcp-caching" ); CaC( "vcd-caching" );
516             CaC( "fake-caching" ); CaC( "cdda-caching" ); CaC( "file-caching" );
517             CaC( "screen-caching" );
518             CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 );
519             CaCi( "http-caching", 4 ); CaCi( "realrtsp-caching", 10 );
520             CaCi( "mms-caching", 19 );
521             #ifdef WIN32
522             CaC( "dshow-caching" );
523             #else
524             CaC( "v4l-caching" ); CaC( "jack-input-caching" ); CaC( "v4l2-caching" );
525             CaC( "pvr-caching" );
526             #endif
527             //CaCi( "dv-caching" ) too short...
528         }
529     }
530
531     /* Interfaces */
532     if( number == SPrefsInterface )
533     {
534         if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
535             config_PutPsz( p_intf, "intf", "skins2" );
536         if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
537             config_PutPsz( p_intf, "intf", "qt4" );
538     }
539
540     if( number == SPrefsAudio )
541     {
542         bool b_normChecked =
543             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
544         if( qs_filter.isEmpty() )
545         {
546             /* the psz_filter is already empty, so we just append it needed */
547             if( b_normChecked ) qs_filter = "volnorm";
548         }
549         else /* Not Empty */
550         {
551             if( qs_filter.contains( "volnorm" ) )
552             {
553                 /* The qs_filter not empty and contains "volnorm"
554                    that we have to remove */
555                 if( !b_normChecked )
556                 {
557                     /* Ugly :D */
558                     qs_filter.remove( "volnorm:" );
559                     qs_filter.remove( ":volnorm" );
560                     qs_filter.remove( "volnorm" );
561                 }
562             }
563             else /* qs_filter not empty, but doesn't have volnorm inside */
564                 if( b_normChecked ) qs_filter.append( ":volnorm" );
565         }
566         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter ) );
567     }
568 }
569
570 void SPrefsPanel::clean()
571 {}
572
573 void SPrefsPanel::lastfm_Changed( int i_state )
574 {
575     if( i_state == Qt::Checked )
576         config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
577     else if( i_state == Qt::Unchecked )
578         config_RemoveIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
579 }