]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/simple_preferences.cpp
Qt: Reusing the titles from the simple preferences submenu as tooltip for the simple...
[vlc] / modules / gui / qt4 / components / simple_preferences.cpp
1 /*****************************************************************************
2  * simple_preferences.cpp : "Simple preferences"
3  ****************************************************************************
4  * Copyright (C) 2006-2010 the VideoLAN team
5  * $Id$
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 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include "components/simple_preferences.hpp"
31 #include "components/preferences_widgets.hpp"
32 #include "dialogs/ml_configuration.hpp"
33
34 #include <vlc_config_cat.h>
35 #include <vlc_configuration.h>
36 #include <vlc_aout_intf.h>
37
38 #include <QString>
39 #include <QFont>
40 #include <QToolButton>
41 #include <QButtonGroup>
42 #include <QVBoxLayout>
43 #include <QScrollArea>
44
45 #include <QStyleFactory>
46 #include <QSettings>
47 #include <QtAlgorithms>
48 #include <QDir>
49
50 #define ICON_HEIGHT 64
51
52 #ifdef WIN32
53 # include <vlc_windows_interfaces.h>
54 #endif
55 #include <vlc_modules.h>
56
57 /*********************************************************************
58  * The List of categories
59  *********************************************************************/
60 SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool small ) :
61                                   QWidget( _parent ), p_intf( _p_intf )
62 {
63     QVBoxLayout *layout = new QVBoxLayout();
64
65     QButtonGroup *buttonGroup = new QButtonGroup( this );
66     buttonGroup->setExclusive ( true );
67     CONNECT( buttonGroup, buttonClicked ( int ),
68             this, switchPanel( int ) );
69
70     short icon_height = small ? ICON_HEIGHT /2 : ICON_HEIGHT;
71
72 #define ADD_CATEGORY( button, label, ltooltip, icon, numb )                 \
73     QToolButton * button = new QToolButton( this );                         \
74     button->setIcon( QIcon( ":/prefsmenu/" #icon ) );                       \
75     button->setText( label );                                               \
76     button->setToolTip( ltooltip );                                         \
77     button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );              \
78     button->setIconSize( QSize( icon_height, icon_height ) );               \
79     button->resize( icon_height + 6 , icon_height + 6 );                    \
80     button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ;  \
81     button->setAutoRaise( true );                                           \
82     button->setCheckable( true );                                           \
83     buttonGroup->addButton( button, numb );                                 \
84     layout->addWidget( button );
85
86     ADD_CATEGORY( SPrefsInterface, qtr("Interface"), qtr("Interface Settings"),
87                   cone_interface_64, 0 );
88     ADD_CATEGORY( SPrefsAudio, qtr("Audio"), qtr("Audio Settings"),
89                   cone_audio_64, 1 );
90     ADD_CATEGORY( SPrefsVideo, qtr("Video"), qtr("Video Settings"),
91                   cone_video_64, 2 );
92     ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles && OSD"), qtr("Subtitles & On Screen Display Settings"),
93                   cone_subtitles_64, 3 );
94     ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input && Codecs"), qtr("Input & Codecs Settings"),
95                   cone_input_64, 4 );
96     ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), qtr("Configure Hotkeys"),
97                   cone_hotkeys_64, 5 );
98
99 #undef ADD_CATEGORY
100
101     SPrefsInterface->setChecked( true );
102     layout->setMargin( 0 );
103     layout->setSpacing( 1 );
104
105     setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
106     setLayout( layout );
107
108 }
109
110 void SPrefsCatList::switchPanel( int i )
111 {
112     emit currentItemChanged( i );
113 }
114
115 /*********************************************************************
116  * The Panels
117  *********************************************************************/
118 SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
119                           int _number, bool small ) : QWidget( _parent ), p_intf( _p_intf )
120 {
121     module_config_t *p_config;
122     ConfigControl *control;
123     number = _number;
124
125 #define CONFIG_GENERIC( option, type, label, qcontrol )                   \
126             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
127             if( p_config )                                                \
128             {                                                             \
129                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
130                            p_config, label, ui.qcontrol, false );         \
131                 controls.append( control );                               \
132             }                                                             \
133             else {                                                        \
134                 ui.qcontrol->setEnabled( false );                         \
135                 if( label ) label->setEnabled( false );                   \
136             }
137
138 #define CONFIG_BOOL( option, qcontrol )                           \
139             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
140             if( p_config )                                                \
141             {                                                             \
142                 control =  new BoolConfigControl( VLC_OBJECT(p_intf),     \
143                            p_config, NULL, ui.qcontrol );          \
144                 controls.append( control );                               \
145             }                                                             \
146             else { ui.qcontrol->setEnabled( false ); }
147
148
149 #define CONFIG_GENERIC_NO_UI( option, type, label, qcontrol )             \
150             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
151             if( p_config )                                                \
152             {                                                             \
153                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
154                            p_config, label, qcontrol, false );            \
155                 controls.append( control );                               \
156             }                                                             \
157             else {                                                        \
158                 QWidget *widget = label;                                  \
159                 qcontrol->setVisible( false );                            \
160                 if( widget ) widget->setEnabled( false );                 \
161             }
162
163
164 #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol )           \
165             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
166             if( p_config )                                                \
167             {                                                             \
168                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
169                            p_config, label, ui.qcontrol );                \
170                 controls.append( control );                               \
171             }
172
173 #define CONFIG_GENERIC_FILE( option, type, label, qcontrol, qbutton )     \
174             p_config =  config_FindConfig( VLC_OBJECT(p_intf), option );  \
175             if( p_config )                                                \
176             {                                                             \
177                 control =  new type ## ConfigControl( VLC_OBJECT(p_intf), \
178                            p_config, label, qcontrol, qbutton );          \
179                 controls.append( control );                               \
180             }
181
182 #define START_SPREFS_CAT( name , label )    \
183         case SPrefs ## name:                \
184         {                                   \
185             Ui::SPrefs ## name ui;      \
186             ui.setupUi( panel );            \
187             panel_label->setText( label );
188
189 #define END_SPREFS_CAT      \
190             break;          \
191         }
192
193     QVBoxLayout *panel_layout = new QVBoxLayout();
194     QWidget *panel = new QWidget();
195     panel_layout->setMargin( 3 );
196
197     // Title Label
198     QLabel *panel_label = new QLabel;
199     QFont labelFont = QApplication::font();
200     labelFont.setPointSize( labelFont.pointSize() + 6 );
201     panel_label->setFont( labelFont );
202
203     // Title <hr>
204     QFrame *title_line = new QFrame;
205     title_line->setFrameShape(QFrame::HLine);
206     title_line->setFrameShadow(QFrame::Sunken);
207
208     QFont italicFont = QApplication::font();
209     italicFont.setItalic( true );
210
211     switch( number )
212     {
213         /******************************
214          * VIDEO Panel Implementation *
215          ******************************/
216         START_SPREFS_CAT( Video , qtr("Video Settings") );
217             CONFIG_BOOL( "video", enableVideo );
218
219             CONFIG_BOOL( "fullscreen", fullscreen );
220             CONFIG_BOOL( "overlay", overlay );
221             CONFIG_BOOL( "video-on-top", alwaysOnTop );
222             CONFIG_BOOL( "video-deco", windowDecorations );
223             CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule );
224
225 #ifdef WIN32
226             CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel,
227                             dXdisplayDevice );
228             CONFIG_BOOL( "directx-hw-yuv", hwYUVBox );
229             CONNECT( ui.overlay, toggled( bool ), ui.hwYUVBox, setEnabled( bool ) );
230 #else
231             ui.directXBox->setVisible( false );
232             ui.hwYUVBox->setVisible( false );
233 #endif
234
235 #ifdef __OS2__
236             CONFIG_BOOL( "kva-fixt23", kvaFixT23 );
237             CONFIG_GENERIC( "kva-video-mode", StringList, ui.kvaVideoModeLabel,
238                             kvaVideoMode );
239 #else
240             ui.kvaBox->setVisible( false );
241 #endif
242
243             CONFIG_GENERIC( "deinterlace", IntegerList, ui.deinterLabel, deinterlaceBox );
244             CONFIG_GENERIC( "deinterlace-mode", StringList, ui.deinterModeLabel, deinterlaceModeBox );
245             CONFIG_GENERIC( "aspect-ratio", String, ui.arLabel, arLine );
246
247             CONFIG_GENERIC_FILE( "snapshot-path", Directory, ui.dirLabel,
248                                  ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse );
249             CONFIG_GENERIC( "snapshot-prefix", String, ui.prefixLabel, snapshotsPrefix );
250             CONFIG_BOOL( "snapshot-sequential",
251                             snapshotsSequentialNumbering );
252             CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel,
253                             snapshotsFormat );
254          END_SPREFS_CAT;
255
256         /******************************
257          * AUDIO Panel Implementation *
258          ******************************/
259         START_SPREFS_CAT( Audio, qtr("Audio Settings") );
260
261             CONFIG_BOOL( "audio", enableAudio );
262             ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() );
263             CONNECT( ui.enableAudio, toggled( bool ),
264                      ui.SPrefsAudio_zone, setEnabled( bool ) );
265
266 #define audioCommon( name ) \
267             QWidget * name ## Control = new QWidget( ui.outputAudioBox ); \
268             QHBoxLayout * name ## Layout = new QHBoxLayout( name ## Control); \
269             name ## Layout->setMargin( 0 ); \
270             name ## Layout->setSpacing( 0 ); \
271             QLabel * name ## Label = new QLabel( qtr( "Device:" ), name ## Control ); \
272             name ## Label->setMinimumSize(QSize(250, 0)); \
273             name ## Layout->addWidget( name ## Label ); \
274
275 #define audioControl( name) \
276             audioCommon( name ) \
277             QComboBox * name ## Device = new QComboBox( name ## Control ); \
278             name ## Layout->addWidget( name ## Device ); \
279             name ## Label->setBuddy( name ## Device ); \
280             name ## Device->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred  );\
281             outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 );
282
283 #define audioControl2( name) \
284             audioCommon( name ) \
285             QLineEdit * name ## Device = new QLineEdit( name ## Control ); \
286             name ## Layout->addWidget( name ## Device ); \
287             name ## Label->setBuddy( name ## Device ); \
288             QPushButton * name ## Browse = new QPushButton( qtr( "Browse..." ), name ## Control); \
289             name ## Layout->addWidget( name ## Browse ); \
290             outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 );
291
292             /* Build if necessary */
293             QGridLayout * outputAudioLayout = qobject_cast<QGridLayout *>(ui.outputAudioBox->layout());
294 #ifdef WIN32
295             audioControl( DirectX );
296             optionWidgets.append( DirectXControl );
297             CONFIG_GENERIC_NO_UI( "directx-audio-device-name", StringList,
298                     DirectXLabel, DirectXDevice );
299 #elif defined( __OS2__ )
300             audioControl( kai );
301             optionWidgets.append( kaiControl );
302             CONFIG_GENERIC_NO_UI( "kai-audio-device", StringList, kaiLabel,
303                     kaiDevice );
304 #else
305             if( module_exists( "alsa" ) )
306             {
307                 audioControl( alsa );
308                 optionWidgets.append( alsaControl );
309                 CONFIG_GENERIC_NO_UI( "alsa-audio-device" , StringList, alsaLabel,
310                                 alsaDevice );
311             }
312             else
313                 optionWidgets.append( NULL );
314             if( module_exists( "oss" ) )
315             {
316                 audioControl2( OSS );
317                 optionWidgets.append( OSSControl );
318                 CONFIG_GENERIC_FILE( "oss-audio-device" , File, NULL, OSSDevice,
319                                  OSSBrowse );
320             }
321             else
322                 optionWidgets.append( NULL );
323 #endif
324
325 #undef audioControl2
326 #undef audioControl
327 #undef audioCommon
328
329             /* Audio Options */
330             ui.volumeValue->setMaximum( (AOUT_VOLUME_DEFAULT * 2) / AOUT_VOLUME_DEFAULT * 100 );
331             CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
332                                      defaultVolume );
333             CONNECT( ui.defaultVolume, valueChanged( int ),
334                      this, updateAudioVolume( int ) );
335
336             CONFIG_BOOL( "qt-autosave-volume", keepVolumeRadio );
337             ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() );
338             CONNECT( ui.resetVolumeRadio, toggled( bool ),
339                      ui.defaultVolume_zone, setEnabled( bool ) );
340
341             CONFIG_GENERIC( "audio-language" , String , ui.langLabel,
342                             preferredAudioLanguage );
343
344             CONFIG_BOOL( "spdif", spdifBox );
345             CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel,
346                             detectionDolby );
347
348             CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float, NULL,
349                                     volNormSpin );
350             CONFIG_GENERIC( "audio-replay-gain-mode", StringList, ui.replayLabel,
351                             replayCombo );
352             CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel,
353                             visualisation);
354             CONFIG_BOOL( "audio-time-stretch", autoscaleBox );
355
356             /* Audio Output Specifics */
357             CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule );
358
359             CONNECT( ui.outputModule, currentIndexChanged( int ),
360                      this, updateAudioOptions( int ) );
361
362             /* File output exists on all platforms */
363             CONFIG_GENERIC_FILE( "audiofile-file", File, ui.fileLabel,
364                                  ui.fileName, ui.fileBrowseButton );
365
366             optionWidgets.append( ui.fileControl );
367             optionWidgets.append( ui.outputModule );
368             optionWidgets.append( ui.volNormBox );
369             /*Little mofification of ui.volumeValue to compile with Qt < 4.3 */
370             ui.volumeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
371             optionWidgets.append( ui.volumeValue );
372             optionWidgets.append( ui.headphoneEffect );
373             optionWidgets.append( ui.spdifBox );
374             updateAudioOptions( ui.outputModule->currentIndex() );
375
376             /* LastFM */
377             if( module_exists( "audioscrobbler" ) )
378             {
379                 CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
380                         lastfm_user_edit );
381                 CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
382                         lastfm_pass_edit );
383
384                 if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
385                     ui.lastfm->setChecked( true );
386                 else
387                     ui.lastfm->setChecked( false );
388
389                 ui.lastfm_zone->setVisible( ui.lastfm->isChecked() );
390
391                 CONNECT( ui.lastfm, toggled( bool ),
392                          ui.lastfm_zone, setVisible( bool ) );
393                 CONNECT( ui.lastfm, stateChanged( int ),
394                          this, lastfm_Changed( int ) );
395             }
396             else
397             {
398                 ui.lastfm->hide();
399                 ui.lastfm_zone->hide();
400             }
401
402             /* Normalizer */
403             CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin,
404                      setEnabled( bool ) );
405
406             char* psz = config_GetPsz( p_intf, "audio-filter" );
407             qs_filter = qfu( psz ).split( ':', QString::SkipEmptyParts );
408             free( psz );
409
410             bool b_enabled = ( qs_filter.contains( "normvol" ) );
411             ui.volNormBox->setChecked( b_enabled );
412             ui.volNormSpin->setEnabled( b_enabled );
413
414             b_enabled = ( qs_filter.contains( "headphone" ) );
415             ui.headphoneEffect->setChecked( b_enabled );
416
417             /* Volume Label */
418             updateAudioVolume( ui.defaultVolume->value() ); // First time init
419
420         END_SPREFS_CAT;
421
422         /* Input and Codecs Panel Implementation */
423         START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs Settings") );
424
425             /* Disk Devices */
426             {
427                 ui.DVDDeviceComboBox->setToolTip(
428                     qtr( "If this property is blank, different values\n"
429                          "for DVD, VCD, and CDDA are set.\n"
430                          "You can define a unique one or configure them \n"
431                          "individually in the advanced preferences." ) );
432                 char *psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
433                 char *psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
434                 char *psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
435                 if( psz_dvddiscpath && psz_vcddiscpath && psz_cddadiscpath )
436                 if( !strcmp( psz_cddadiscpath, psz_dvddiscpath ) &&
437                     !strcmp( psz_dvddiscpath, psz_vcddiscpath ) )
438                 {
439                     ui.DVDDeviceComboBox->setEditText( qfu( psz_dvddiscpath ) );
440                 }
441                 free( psz_cddadiscpath );
442                 free( psz_dvddiscpath );
443                 free( psz_vcddiscpath );
444             }
445 #ifndef WIN32
446             QStringList DVDDeviceComboBoxStringList = QStringList();
447             DVDDeviceComboBoxStringList
448                     << "dvd*" << "scd*" << "sr*" << "sg*" << "cd*";
449             ui.DVDDeviceComboBox->addItems( QDir( "/dev/" )
450                     .entryList( DVDDeviceComboBoxStringList, QDir::System )
451                     .replaceInStrings( QRegExp("^"), "/dev/" )
452             );
453 #endif
454             CONFIG_GENERIC( "dvd", String, ui.DVDLabel,
455                             DVDDeviceComboBox->lineEdit() );
456             CONFIG_GENERIC_FILE( "input-record-path", Directory, ui.recordLabel,
457                                  ui.recordPath, ui.recordBrowse );
458
459             CONFIG_GENERIC( "http-proxy", String , ui.httpProxyLabel, proxy );
460             CONFIG_GENERIC_NO_BOOL( "postproc-q", Integer, ui.ppLabel,
461                                     PostProcLevel );
462             CONFIG_GENERIC( "avi-index", IntegerList, ui.aviLabel, AviRepair );
463
464             /* live555 module prefs */
465             CONFIG_BOOL( "rtsp-tcp",
466                                 live555TransportRTSP_TCPRadio );
467             if ( !module_exists( "live555" ) )
468             {
469                 ui.live555TransportRTSP_TCPRadio->hide();
470                 ui.live555TransportHTTPRadio->hide();
471                 ui.live555TransportLabel->hide();
472             }
473             CONFIG_BOOL( "ffmpeg-hw", hwAccelBox );
474 #ifdef WIN32
475             CONFIG_BOOL( "prefer-system-codecs", systemCodecBox );
476             HINSTANCE hdxva2_dll = LoadLibrary(TEXT("DXVA2.DLL") );
477             if( !hdxva2_dll )
478                 ui.hwAccelBox->setEnabled( false );
479             else
480                 FreeLibrary( hdxva2_dll );
481 #else
482             ui.systemCodecBox->hide();
483 #endif
484             optionWidgets.append( ui.DVDDeviceComboBox );
485             optionWidgets.append( ui.cachingCombo );
486             CONFIG_GENERIC( "ffmpeg-skiploopfilter", IntegerList, ui.filterLabel, loopFilterBox );
487             CONFIG_GENERIC( "sout-x264-tune", StringList, ui.x264Label, tuneBox );
488             CONFIG_GENERIC( "sout-x264-preset", StringList, ui.x264Label, presetBox );
489             CONFIG_GENERIC( "sout-x264-profile", StringList, ui.x264profileLabel, profileBox );
490             CONFIG_GENERIC( "sout-x264-level", String, ui.x264profileLabel, levelBox );
491             CONFIG_BOOL( "mkv-preload-local-dir", mkvPreloadBox );
492
493             /* Caching */
494             /* Add the things to the ComboBox */
495             #define addToCachingBox( str, cachingNumber ) \
496                 ui.cachingCombo->addItem( qtr(str), QVariant( cachingNumber ) );
497             addToCachingBox( N_("Custom"), CachingCustom );
498             addToCachingBox( N_("Lowest latency"), CachingLowest );
499             addToCachingBox( N_("Low latency"), CachingLow );
500             addToCachingBox( N_("Normal"), CachingNormal );
501             addToCachingBox( N_("High latency"), CachingHigh );
502             addToCachingBox( N_("Higher latency"), CachingHigher );
503             #undef addToCachingBox
504
505 #define TestCaC( name, factor ) \
506     b_cache_equal =  b_cache_equal && \
507      ( i_cache * factor == config_GetInt( p_intf, name ) );
508             /* Select the accurate value of the ComboBox */
509             bool b_cache_equal = true;
510             int i_cache = config_GetInt( p_intf, "file-caching" );
511
512             TestCaC( "network-caching", 10/3 );
513             TestCaC( "disc-caching", 1);
514             TestCaC( "live-caching", 1 );
515             if( b_cache_equal == 1 )
516                 ui.cachingCombo->setCurrentIndex(
517                 ui.cachingCombo->findData( QVariant( i_cache ) ) );
518 #undef TestCaC
519
520         END_SPREFS_CAT;
521         /*******************
522          * Interface Panel *
523          *******************/
524         START_SPREFS_CAT( Interface, qtr("Interface Settings") );
525 //            ui.defaultLabel->setFont( italicFont );
526             ui.skinsLabel->setText(
527                     qtr( "This is VLC's skinnable interface. You can download other skins at" )
528                     + QString( " <a href=\"http://www.videolan.org/vlc/skins.php\">" )
529                     + qtr( "VLC skins website" )+ QString( "</a>." ) );
530             ui.skinsLabel->setFont( italicFont );
531
532 #if defined( WIN32 )
533             CONFIG_GENERIC( "language", StringList, ui.languageLabel, language );
534             BUTTONACT( ui.assoButton, assoDialog() );
535 #else
536             ui.languageBox->hide();
537             ui.assoButton->hide();
538             ui.assocLabel->hide();
539 #endif
540 #ifdef MEDIA_LIBRARY
541             BUTTONACT( ui.sqlMLbtn, configML() );
542 #endif
543
544             /* interface */
545             char *psz_intf = config_GetPsz( p_intf, "intf" );
546             if( psz_intf )
547             {
548                 if( strstr( psz_intf, "skin" ) )
549                     ui.skins->setChecked( true );
550             } else {
551                 /* defaults to qt */
552                 ui.qt4->setChecked( true );
553             }
554             free( psz_intf );
555
556             optionWidgets.append( ui.skins );
557             optionWidgets.append( ui.qt4 );
558 #if !defined( WIN32)
559             ui.stylesCombo->addItem( qtr("System's default") );
560             ui.stylesCombo->addItems( QStyleFactory::keys() );
561             ui.stylesCombo->setCurrentIndex( ui.stylesCombo->findText(
562                         getSettings()->value( "MainWindow/QtStyle", "" ).toString() ) );
563             ui.stylesCombo->insertSeparator( 1 );
564             if ( ui.stylesCombo->currentIndex() < 0 )
565                 ui.stylesCombo->setCurrentIndex( 0 ); /* default */
566
567             CONNECT( ui.stylesCombo, currentIndexChanged( QString ), this, changeStyle( QString ) );
568             optionWidgets.append( ui.stylesCombo );
569 #else
570             ui.stylesCombo->hide();
571             ui.stylesLabel->hide();
572             optionWidgets.append( NULL );
573 #endif
574             radioGroup = new QButtonGroup(this);
575             radioGroup->addButton( ui.qt4, 0 );
576             radioGroup->addButton( ui.skins, 1 );
577             CONNECT( radioGroup, buttonClicked( int ),
578                      ui.styleStackedWidget, setCurrentIndex( int ) );
579             ui.styleStackedWidget->setCurrentIndex( radioGroup->checkedId() );
580
581             CONNECT( ui.minimalviewBox, toggled( bool ),
582                      ui.mainPreview, setNormalPreview( bool ) );
583             CONFIG_BOOL( "qt-minimal-view", minimalviewBox );
584             ui.mainPreview->setNormalPreview( ui.minimalviewBox->isChecked() );
585             ui.skinsPreview->setPreview( InterfacePreviewWidget::SKINS );
586
587             CONFIG_BOOL( "embedded-video", embedVideo );
588             CONFIG_BOOL( "qt-video-autoresize", resizingBox );
589             CONNECT( ui.embedVideo, toggled( bool ), ui.resizingBox, setEnabled( bool ) );
590             ui.resizingBox->setEnabled( ui.embedVideo->isChecked() );
591
592             CONFIG_BOOL( "qt-fs-controller", fsController );
593             CONFIG_BOOL( "qt-system-tray", systrayBox );
594             CONFIG_BOOL( "qt-notification", sysPop );
595             CONNECT( ui.systrayBox, toggled( bool ), ui.sysPop, setEnabled( bool ) );
596             ui.sysPop->setEnabled( ui.systrayBox->isChecked() );
597
598             CONFIG_BOOL( "qt-pause-minimized", pauseMinimizedBox );
599             CONFIG_BOOL( "playlist-tree", treePlaylist );
600             CONFIG_BOOL( "play-and-pause", playPauseBox );
601             CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel,
602                                  ui.fileSkin, ui.skinBrowse );
603
604             CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
605                                                       artFetcher );
606
607             /* UPDATE options */
608 #ifdef UPDATE_CHECK
609             CONFIG_BOOL( "qt-updates-notif", updatesBox );
610             CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL,
611                     updatesDays );
612             ui.updatesDays->setEnabled( ui.updatesBox->isChecked() );
613             CONNECT( ui.updatesBox, toggled( bool ),
614                      ui.updatesDays, setEnabled( bool ) );
615 #else
616             ui.updateNotifierZone->hide();
617 #endif
618             /* ONE INSTANCE options */
619 #if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__)
620             CONFIG_BOOL( "one-instance", OneInterfaceMode );
621             CONFIG_BOOL( "playlist-enqueue",
622                     EnqueueOneInterfaceMode );
623             ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() );
624             CONNECT( ui.OneInterfaceMode, toggled( bool ),
625                      ui.EnqueueOneInterfaceMode, setEnabled( bool ) );
626 #else
627             ui.OneInterfaceBox->hide();
628 #endif
629             /* RECENTLY PLAYED options */
630             CONNECT( ui.saveRecentlyPlayed, toggled( bool ),
631                      ui.recentlyPlayedFilters, setEnabled( bool ) );
632             ui.recentlyPlayedFilters->setEnabled( false );
633             CONFIG_BOOL( "qt-recentplay", saveRecentlyPlayed );
634             CONFIG_GENERIC( "qt-recentplay-filter", String, ui.filterLabel,
635                     recentlyPlayedFilters );
636
637         END_SPREFS_CAT;
638
639         START_SPREFS_CAT( Subtitles,
640                             qtr("Subtitles & On Screen Display Settings") );
641             CONFIG_BOOL( "osd", OSDBox);
642             CONFIG_BOOL( "video-title-show", OSDTitleBox);
643             CONFIG_GENERIC( "video-title-position", IntegerList,
644                             ui.OSDTitlePosLabel, OSDTitlePos );
645
646             CONFIG_GENERIC( "subsdec-encoding", StringList, ui.encodLabel,
647                             encoding );
648             CONFIG_GENERIC( "sub-language", String, ui.subLangLabel,
649                             preferredLanguage );
650
651             CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList,
652                             ui.fontSizeLabel, fontSize );
653
654             CONFIG_GENERIC_NO_BOOL( "freetype-font", Font, ui.fontLabel, font );
655             CONFIG_GENERIC_NO_BOOL( "freetype-color", Color, ui.fontColorLabel,
656                             fontColor );
657             CONFIG_GENERIC( "freetype-outline-thickness", IntegerList,
658                             ui.fontEffectLabel, effect );
659             CONFIG_GENERIC_NO_BOOL( "freetype-outline-color", Color, ui.outlineColorLabel,
660                             outlineColor );
661
662             CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer, ui.subsPosLabel, subsPosition );
663
664             ui.shadowCheck->setChecked( config_GetInt( p_intf, "freetype-shadow-opacity" ) > 0 );
665             ui.backgroundCheck->setChecked( config_GetInt( p_intf, "freetype-background-opacity" ) > 0 );
666             optionWidgets.append( ui.shadowCheck );
667             optionWidgets.append( ui.backgroundCheck );
668
669         END_SPREFS_CAT;
670
671         case SPrefsHotkeys:
672         {
673             p_config = config_FindConfig( VLC_OBJECT(p_intf), "key-play" );
674
675             QGridLayout *gLayout = new QGridLayout;
676             panel->setLayout( gLayout );
677             int line = 0;
678
679             panel_label->setText( qtr( "Configure Hotkeys" ) );
680             control = new KeySelectorControl( VLC_OBJECT(p_intf), p_config ,
681                                                 this, gLayout, line );
682             controls.append( control );
683
684             line++;
685
686             QFrame *sepline = new QFrame;
687             sepline->setFrameStyle(QFrame::HLine | QFrame::Sunken);
688             gLayout->addWidget( sepline, line, 0, 1, -1 );
689
690             line++;
691
692             p_config = config_FindConfig( VLC_OBJECT(p_intf), "hotkeys-mousewheel-mode" );
693             control = new IntegerListConfigControl( VLC_OBJECT(p_intf),
694                     p_config, this, false, gLayout, line );
695             controls.append( control );
696
697 #ifdef WIN32
698             line++;
699
700             p_config = config_FindConfig( VLC_OBJECT(p_intf), "qt-disable-volume-keys" );
701             control = new BoolConfigControl( VLC_OBJECT(p_intf), p_config, this, gLayout, line );
702             controls.append( control );
703 #endif
704
705             break;
706         }
707     }
708
709     panel_layout->addWidget( panel_label );
710     panel_layout->addWidget( title_line );
711
712     if( small )
713     {
714         QScrollArea *scroller= new QScrollArea;
715         scroller->setWidget( panel );
716         scroller->setWidgetResizable( true );
717         scroller->setFrameStyle( QFrame::NoFrame );
718         panel_layout->addWidget( scroller );
719     }
720     else
721     {
722         panel_layout->addWidget( panel );
723         if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 );
724     }
725
726     setLayout( panel_layout );
727
728 #undef END_SPREFS_CAT
729 #undef START_SPREFS_CAT
730 #undef CONFIG_GENERIC_FILE
731 #undef CONFIG_GENERIC_NO_BOOL
732 #undef CONFIG_GENERIC_NO_UI
733 #undef CONFIG_GENERIC
734 #undef CONFIG_BOOL
735 }
736
737
738 void SPrefsPanel::updateAudioOptions( int number)
739 {
740     QString value = qobject_cast<QComboBox *>(optionWidgets[audioOutCoB])
741                                             ->itemData( number ).toString();
742 #ifdef WIN32
743     optionWidgets[directxW]->setVisible( ( value == "aout_directx" ) );
744 #elif defined( __OS2__ )
745     optionWidgets[kaiW]->setVisible( ( value == "kai" ) );
746 #else
747     /* optionWidgets[ossW] can be NULL */
748     if( optionWidgets[ossW] )
749         optionWidgets[ossW]->setVisible( ( value == "oss" ) );
750     /* optionWidgets[alsaW] can be NULL */
751     if( optionWidgets[alsaW] )
752         optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );
753 #endif
754     optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
755     optionWidgets[spdifChB]->setVisible( ( value == "alsa" || value == "oss" || value == "auhal" ||
756                                            value == "aout_directx" || value == "waveout" ) );
757 }
758
759
760 SPrefsPanel::~SPrefsPanel()
761 {
762     qDeleteAll( controls ); controls.clear();
763 }
764
765 void SPrefsPanel::updateAudioVolume( int volume )
766 {
767     qobject_cast<QSpinBox *>(optionWidgets[volLW])
768         ->setValue( volume * 100 / AOUT_VOLUME_DEFAULT );
769 }
770
771
772 /* Function called from the main Preferences dialog on each SPrefs Panel */
773 void SPrefsPanel::apply()
774 {
775     /* Generic save for ever panel */
776     QList<ConfigControl *>::const_iterator i;
777     for( i = controls.begin() ; i != controls.end() ; ++i )
778     {
779         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
780         c->doApply();
781     }
782
783     switch( number )
784     {
785     case SPrefsInputAndCodecs:
786     {
787         /* Device default selection */
788         QByteArray devicepath =
789             qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText().toUtf8();
790         if( devicepath.size() > 0 )
791         {
792             config_PutPsz( p_intf, "dvd", devicepath );
793             config_PutPsz( p_intf, "vcd", devicepath );
794             config_PutPsz( p_intf, "cd-audio", devicepath );
795         }
796
797 #define CaC( name, factor ) config_PutInt( p_intf, name, i_comboValue * factor )
798         /* Caching */
799         QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
800         int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
801         if( i_comboValue )
802         {
803             CaC( "file-caching", 1 );
804             CaC( "network-caching", 10/3 );
805             CaC( "disc-caching", 1 );
806             CaC( "live-caching", 1 );
807         }
808         break;
809 #undef CaC
810     }
811
812     /* Interfaces */
813     case SPrefsInterface:
814     {
815         if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
816             config_PutPsz( p_intf, "intf", "skins2,any" );
817         else
818         //if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
819             config_PutPsz( p_intf, "intf", "" );
820         if( qobject_cast<QComboBox *>(optionWidgets[styleCB]) )
821             getSettings()->setValue( "MainWindow/QtStyle",
822                 qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
823
824         break;
825     }
826
827     case SPrefsAudio:
828     {
829         bool b_checked =
830             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
831         if( b_checked && !qs_filter.contains( "normvol" ) )
832             qs_filter.append( "normvol" );
833         if( !b_checked && qs_filter.contains( "normvol" ) )
834             qs_filter.removeAll( "normvol" );
835
836         b_checked =
837             qobject_cast<QCheckBox *>(optionWidgets[headphoneB])->isChecked();
838
839         if( b_checked && !qs_filter.contains( "headphone" ) )
840             qs_filter.append( "headphone" );
841         if( !b_checked && qs_filter.contains( "headphone" ) )
842             qs_filter.removeAll( "headphone" );
843
844         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) );
845         break;
846     }
847     case SPrefsSubtitles:
848     {
849         bool b_checked = qobject_cast<QCheckBox *>(optionWidgets[shadowCB])->isChecked();
850         if( b_checked && config_GetInt( p_intf, "freetype-shadow-opacity" ) == 0 ) {
851             config_PutInt( p_intf, "freetype-shadow-opacity", 128 );
852         }
853         else if (!b_checked ) {
854             config_PutInt( p_intf, "freetype-shadow-opacity", 0 );
855         }
856
857         b_checked = qobject_cast<QCheckBox *>(optionWidgets[backgroundCB])->isChecked();
858         if( b_checked && config_GetInt( p_intf, "freetype-background-opacity" ) == 0 ) {
859             config_PutInt( p_intf, "freetype-background-opacity", 128 );
860         }
861         else if (!b_checked ) {
862             config_PutInt( p_intf, "freetype-background-opacity", 0 );
863         }
864
865     }
866     }
867 }
868
869 void SPrefsPanel::clean()
870 {}
871
872 void SPrefsPanel::lastfm_Changed( int i_state )
873 {
874     if( i_state == Qt::Checked )
875         config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
876     else if( i_state == Qt::Unchecked )
877         config_RemoveIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
878 }
879
880 void SPrefsPanel::changeStyle( QString s_style )
881 {
882     QApplication::setStyle( s_style );
883
884     /* force refresh on all widgets */
885     QWidgetList widgets = QApplication::allWidgets();
886     QWidgetList::iterator it = widgets.begin();
887     while( it != widgets.end() ) {
888         (*it)->update();
889         ++it;
890     };
891 }
892
893 void SPrefsPanel::configML()
894 {
895 #ifdef MEDIA_LIBRARY
896     MLConfDialog *mld = new MLConfDialog( this, p_intf );
897     mld->exec();
898     delete mld;
899 #endif
900 }
901
902 #ifdef WIN32
903 #include <QDialogButtonBox>
904 #include "util/registry.hpp"
905
906 bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
907                            QTreeWidgetItem* parent, QVLCRegistry *qvReg )
908 {
909     bool b_temp;
910     const char* psz_VLC = "VLC";
911     current = new QTreeWidgetItem( parent, QStringList( psz_ext ) );
912
913     if( strstr( qvReg->ReadRegistryString( psz_ext, "", "" ), psz_VLC ) )
914     {
915         current->setCheckState( 0, Qt::Checked );
916         b_temp = false;
917     }
918     else
919     {
920         current->setCheckState( 0, Qt::Unchecked );
921         b_temp = true;
922     }
923     listAsso.append( current );
924     return b_temp;
925 }
926
927 void SPrefsPanel::assoDialog()
928 {
929     LPAPPASSOCREGUI p_appassoc;
930     CoInitialize( 0 );
931
932     if( S_OK == CoCreateInstance( &clsid_IApplication2,
933                 NULL, CLSCTX_INPROC_SERVER,
934                 IID_IApplicationAssociationRegistrationUI,
935                 (void **)&p_appassoc) )
936     {
937         if(S_OK == p_appassoc->vt->LaunchAdvancedAssociationUI(p_appassoc, L"VLC" ) )
938         {
939             CoUninitialize();
940             return;
941         }
942     }
943
944     CoUninitialize();
945
946     QDialog *d = new QDialog( this );
947     d->setWindowTitle( qtr( "File associations" ) );
948     QGridLayout *assoLayout = new QGridLayout( d );
949
950     QTreeWidget *filetypeList = new QTreeWidget;
951     assoLayout->addWidget( filetypeList, 0, 0, 1, 4 );
952     filetypeList->header()->hide();
953
954     QVLCRegistry * qvReg = new QVLCRegistry( HKEY_CLASSES_ROOT );
955
956     QTreeWidgetItem *audioType = new QTreeWidgetItem( QStringList( qtr( "Audio Files" ) ) );
957     QTreeWidgetItem *videoType = new QTreeWidgetItem( QStringList( qtr( "Video Files" ) ) );
958     QTreeWidgetItem *otherType = new QTreeWidgetItem( QStringList( qtr( "Playlist Files" ) ) );
959
960     filetypeList->addTopLevelItem( audioType );
961     filetypeList->addTopLevelItem( videoType );
962     filetypeList->addTopLevelItem( otherType );
963
964     audioType->setExpanded( true ); audioType->setCheckState( 0, Qt::Unchecked );
965     videoType->setExpanded( true ); videoType->setCheckState( 0, Qt::Unchecked );
966     otherType->setExpanded( true ); otherType->setCheckState( 0, Qt::Unchecked );
967
968     QTreeWidgetItem *currentItem = NULL;
969
970     int i_temp = 0;
971 #define aTa( name ) i_temp += addType( name, currentItem, audioType, qvReg )
972 #define aTv( name ) i_temp += addType( name, currentItem, videoType, qvReg )
973 #define aTo( name ) i_temp += addType( name, currentItem, otherType, qvReg )
974
975     aTa( ".a52" ); aTa( ".aac" ); aTa( ".ac3" ); aTa( ".dts" ); aTa( ".flac" );
976     aTa( ".m4a" ); aTa( ".m4p" ); aTa( ".mka" ); aTa( ".mod" ); aTa( ".mp1" );
977     aTa( ".mp2" ); aTa( ".mp3" ); aTa( ".oma" ); aTa( ".oga" ); aTa( ".spx" );
978     aTa( ".tta" ); aTa( ".wav" ); aTa( ".wma" ); aTa( ".xm" );
979     audioType->setCheckState( 0, ( i_temp > 0 ) ?
980                               ( ( i_temp == audioType->childCount() ) ?
981                                Qt::Checked : Qt::PartiallyChecked )
982                             : Qt::Unchecked );
983
984     i_temp = 0;
985     aTv( ".asf" ); aTv( ".avi" ); aTv( ".divx" ); aTv( ".dv" ); aTv( ".flv" );
986     aTv( ".gxf" ); aTv( ".m1v" ); aTv( ".m2v" ); aTv( ".m2ts" ); aTv( ".m4v" );
987     aTv( ".mkv" ); aTv( ".mov" ); aTv( ".mp2" ); aTv( ".mp4" ); aTv( ".mpeg" );
988     aTv( ".mpeg1" ); aTv( ".mpeg2" ); aTv( ".mpeg4" ); aTv( ".mpg" );
989     aTv( ".mts" ); aTv( ".mtv" ); aTv( ".mxf" );
990     aTv( ".ogg" ); aTv( ".ogm" ); aTv( ".ogx" ); aTv( ".ogv" );  aTv( ".ts" );
991     aTv( ".vob" ); aTv( ".vro" ); aTv( ".wmv" );
992     videoType->setCheckState( 0, ( i_temp > 0 ) ?
993                               ( ( i_temp == audioType->childCount() ) ?
994                                Qt::Checked : Qt::PartiallyChecked )
995                             : Qt::Unchecked );
996
997     i_temp = 0;
998     aTo( ".asx" ); aTo( ".b4s" ); aTo( ".ifo" ); aTo( ".m3u" ); aTo( ".pls" );
999     aTo( ".sdp" ); aTo( ".vlc" ); aTo( ".xspf" );
1000     otherType->setCheckState( 0, ( i_temp > 0 ) ?
1001                               ( ( i_temp == audioType->childCount() ) ?
1002                                Qt::Checked : Qt::PartiallyChecked )
1003                             : Qt::Unchecked );
1004
1005 #undef aTo
1006 #undef aTv
1007 #undef aTa
1008
1009     QDialogButtonBox *buttonBox = new QDialogButtonBox( d );
1010     QPushButton *closeButton = new QPushButton( qtr( "&Apply" ) );
1011     QPushButton *clearButton = new QPushButton( qtr( "&Cancel" ) );
1012     buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
1013     buttonBox->addButton( clearButton, QDialogButtonBox::ActionRole );
1014
1015     assoLayout->addWidget( buttonBox, 1, 2, 1, 2 );
1016
1017     CONNECT( closeButton, clicked(), this, saveAsso() );
1018     CONNECT( clearButton, clicked(), d, reject() );
1019     d->resize( 300, 400 );
1020     d->exec();
1021     delete d;
1022     delete qvReg;
1023     listAsso.clear();
1024 }
1025
1026 void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
1027 {
1028     QString s_path( "VLC" ); s_path += psz_ext;
1029     QString s_path2 = s_path;
1030
1031     /* Save a backup if already assigned */
1032     char *psz_value = qvReg->ReadRegistryString( psz_ext, "", ""  );
1033
1034     if( !EMPTY_STR(psz_value) )
1035         qvReg->WriteRegistryString( psz_ext, "VLC.backup", psz_value );
1036     delete psz_value;
1037
1038     /* Put a "link" to VLC.EXT as default */
1039     qvReg->WriteRegistryString( psz_ext, "", qtu( s_path ) );
1040
1041     /* Create the needed Key if they weren't done in the installer */
1042     if( !qvReg->RegistryKeyExists( qtu( s_path ) ) )
1043     {
1044         qvReg->WriteRegistryString( psz_ext, "", qtu( s_path ) );
1045         qvReg->WriteRegistryString( qtu( s_path ), "", "Media file" );
1046         qvReg->WriteRegistryString( qtu( s_path.append( "\\shell" ) ), "", "Play" );
1047
1048         /* Get the installer path */
1049         QVLCRegistry *qvReg2 = new QVLCRegistry( HKEY_LOCAL_MACHINE );
1050         QString str_temp = qvReg2->ReadRegistryString( "Software\\VideoLAN\\VLC", "", "" );
1051
1052         if( str_temp.size() )
1053         {
1054             qvReg->WriteRegistryString( qtu( s_path.append( "\\Play\\command" ) ),
1055                 "", qtu( str_temp.append(" --started-from-file \"%1\"" ) ) );
1056
1057             qvReg->WriteRegistryString( qtu( s_path2.append( "\\DefaultIcon" ) ),
1058                         "", qtu( str_temp.append(",0") ) );
1059         }
1060         delete qvReg2;
1061     }
1062 }
1063
1064 void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
1065 {
1066     char psz_VLC[] = "VLC";
1067     char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" );
1068
1069     if( psz_value && !strcmp( strcat( psz_VLC, psz_ext ), psz_value ) )
1070     {
1071         free( psz_value );
1072         psz_value = qvReg->ReadRegistryString( psz_ext, "VLC.backup", "" );
1073         if( psz_value )
1074             qvReg->WriteRegistryString( psz_ext, "", psz_value );
1075
1076         qvReg->DeleteKey( psz_ext, "VLC.backup" );
1077     }
1078     delete( psz_value );
1079 }
1080 void SPrefsPanel::saveAsso()
1081 {
1082     QVLCRegistry * qvReg = NULL;
1083     for( int i = 0; i < listAsso.size(); i ++ )
1084     {
1085         qvReg  = new QVLCRegistry( HKEY_CLASSES_ROOT );
1086         if( listAsso[i]->checkState( 0 ) > 0 )
1087         {
1088             addAsso( qvReg, qtu( listAsso[i]->text( 0 ) ) );
1089         }
1090         else
1091         {
1092             delAsso( qvReg, qtu( listAsso[i]->text( 0 ) ) );
1093         }
1094     }
1095     /* Gruik ? Naaah */
1096     qobject_cast<QDialog *>(listAsso[0]->treeWidget()->parent())->accept();
1097     delete qvReg;
1098 }
1099
1100 #endif /* WIN32 */
1101