]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/simple_preferences.cpp
Qt: use QString iso std::string
[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, icon, numb )                           \
73     QToolButton * button = new QToolButton( this );                         \
74     button->setIcon( QIcon( ":/prefsmenu/" #icon ) );                       \
75     button->setText( label );                                               \
76     button->setToolTip( label + qtr("Preferences") );                       \
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"),
87                   cone_interface_64, 0 );
88     ADD_CATEGORY( SPrefsAudio, qtr("Audio"),
89                   cone_audio_64, 1 );
90     ADD_CATEGORY( SPrefsVideo, qtr("Video"),
91                   cone_video_64, 2 );
92     ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles && OSD"),
93                   cone_subtitles_64, 3 );
94     ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input && Codecs"),
95                   cone_input_64, 4 );
96     ADD_CATEGORY( SPrefsHotkeys, qtr("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             CONFIG_BOOL( "video-wallpaper", wallpaperMode );
226 #ifdef WIN32
227             CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel,
228                             dXdisplayDevice );
229             CONFIG_BOOL( "directx-hw-yuv", hwYUVBox );
230 #else
231             ui.directXBox->setVisible( false );
232             ui.hwYUVBox->setVisible( false );
233 #endif
234
235             CONFIG_GENERIC( "deinterlace", IntegerList, ui.deinterLabel, deinterlaceBox );
236             CONFIG_GENERIC( "deinterlace-mode", StringList, ui.deinterModeLabel, deinterlaceModeBox );
237             CONFIG_GENERIC( "aspect-ratio", String, ui.arLabel, arLine );
238
239             CONFIG_GENERIC_FILE( "snapshot-path", Directory, ui.dirLabel,
240                                  ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse );
241             CONFIG_GENERIC( "snapshot-prefix", String, ui.prefixLabel, snapshotsPrefix );
242             CONFIG_BOOL( "snapshot-sequential",
243                             snapshotsSequentialNumbering );
244             CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel,
245                             snapshotsFormat );
246          END_SPREFS_CAT;
247
248         /******************************
249          * AUDIO Panel Implementation *
250          ******************************/
251         START_SPREFS_CAT( Audio, qtr("Audio Settings") );
252
253             CONFIG_BOOL( "audio", enableAudio );
254             ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() );
255             CONNECT( ui.enableAudio, toggled( bool ),
256                      ui.SPrefsAudio_zone, setEnabled( bool ) );
257
258 #define audioCommon( name ) \
259             QWidget * name ## Control = new QWidget( ui.outputAudioBox ); \
260             QHBoxLayout * name ## Layout = new QHBoxLayout( name ## Control); \
261             name ## Layout->setMargin( 0 ); \
262             name ## Layout->setSpacing( 0 ); \
263             QLabel * name ## Label = new QLabel( qtr( "Device:" ), name ## Control ); \
264             name ## Label->setMinimumSize(QSize(250, 0)); \
265             name ## Layout->addWidget( name ## Label ); \
266
267 #define audioControl( name) \
268             audioCommon( name ) \
269             QComboBox * name ## Device = new QComboBox( name ## Control ); \
270             name ## Layout->addWidget( name ## Device ); \
271             name ## Label->setBuddy( name ## Device ); \
272             name ## Device->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred  );\
273             outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 );
274
275 #define audioControl2( name) \
276             audioCommon( name ) \
277             QLineEdit * name ## Device = new QLineEdit( name ## Control ); \
278             name ## Layout->addWidget( name ## Device ); \
279             name ## Label->setBuddy( name ## Device ); \
280             QPushButton * name ## Browse = new QPushButton( qtr( "Browse..." ), name ## Control); \
281             name ## Layout->addWidget( name ## Browse ); \
282             outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 );
283
284             /* Build if necessary */
285             QGridLayout * outputAudioLayout = qobject_cast<QGridLayout *>(ui.outputAudioBox->layout());
286 #ifdef WIN32
287             audioControl( DirectX );
288             optionWidgets.append( DirectXControl );
289             CONFIG_GENERIC_NO_UI( "directx-audio-device-name", StringList,
290                     DirectXLabel, DirectXDevice );
291 #else
292             if( module_exists( "alsa" ) )
293             {
294                 audioControl( alsa );
295                 optionWidgets.append( alsaControl );
296                 CONFIG_GENERIC_NO_UI( "alsa-audio-device" , StringList, alsaLabel,
297                                 alsaDevice );
298             }
299             else
300                 optionWidgets.append( NULL );
301             if( module_exists( "oss" ) )
302             {
303                 audioControl2( OSS );
304                 optionWidgets.append( OSSControl );
305                 CONFIG_GENERIC_FILE( "oss-audio-device" , File, NULL, OSSDevice,
306                                  OSSBrowse );
307             }
308             else
309                 optionWidgets.append( NULL );
310 #endif
311
312 #undef audioControl2
313 #undef audioControl
314 #undef audioCommon
315
316             /* Audio Options */
317             ui.volumeValue->setMaximum( QT_VOLUME_MAX / QT_VOLUME_DEFAULT * 100 );
318             CONFIG_GENERIC_NO_BOOL( "qt-startvolume" , IntegerRangeSlider, NULL,
319                                      defaultVolume );
320             CONNECT( ui.defaultVolume, valueChanged( int ),
321                      this, updateAudioVolume( int ) );
322
323             CONFIG_BOOL( "qt-autosave-volume", keepVolumeRadio );
324             ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() );
325             CONNECT( ui.resetVolumeRadio, toggled( bool ),
326                      ui.defaultVolume_zone, setEnabled( bool ) );
327
328             CONFIG_GENERIC( "audio-language" , String , ui.langLabel,
329                             preferredAudioLanguage );
330
331             CONFIG_BOOL( "spdif", spdifBox );
332             CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel,
333                             detectionDolby );
334
335             CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float, NULL,
336                                     volNormSpin );
337             CONFIG_GENERIC( "audio-replay-gain-mode", StringList, ui.replayLabel,
338                             replayCombo );
339             CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel,
340                             visualisation);
341             CONFIG_BOOL( "audio-time-stretch", autoscaleBox );
342
343             /* Audio Output Specifics */
344             CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule );
345
346             CONNECT( ui.outputModule, currentIndexChanged( int ),
347                      this, updateAudioOptions( int ) );
348
349             /* File output exists on all platforms */
350             CONFIG_GENERIC_FILE( "audiofile-file", File, ui.fileLabel,
351                                  ui.fileName, ui.fileBrowseButton );
352
353             optionWidgets.append( ui.fileControl );
354             optionWidgets.append( ui.outputModule );
355             optionWidgets.append( ui.volNormBox );
356             /*Little mofification of ui.volumeValue to compile with Qt < 4.3 */
357             ui.volumeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
358             optionWidgets.append( ui.volumeValue );
359             optionWidgets.append( ui.headphoneEffect );
360             optionWidgets.append( ui.spdifBox );
361             updateAudioOptions( ui.outputModule->currentIndex() );
362
363             /* LastFM */
364             if( module_exists( "audioscrobbler" ) )
365             {
366                 CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label,
367                         lastfm_user_edit );
368                 CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label,
369                         lastfm_pass_edit );
370
371                 if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) )
372                     ui.lastfm->setChecked( true );
373                 else
374                     ui.lastfm->setChecked( false );
375
376                 ui.lastfm_zone->setVisible( ui.lastfm->isChecked() );
377
378                 CONNECT( ui.lastfm, toggled( bool ),
379                          ui.lastfm_zone, setVisible( bool ) );
380                 CONNECT( ui.lastfm, stateChanged( int ),
381                          this, lastfm_Changed( int ) );
382             }
383             else
384             {
385                 ui.lastfm->hide();
386                 ui.lastfm_zone->hide();
387             }
388
389             /* Normalizer */
390             CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin,
391                      setEnabled( bool ) );
392
393             char* psz = config_GetPsz( p_intf, "audio-filter" );
394             qs_filter = qfu( psz ).split( ':', QString::SkipEmptyParts );
395             free( psz );
396
397             bool b_enabled = ( qs_filter.contains( "volnorm" ) );
398             ui.volNormBox->setChecked( b_enabled );
399             ui.volNormSpin->setEnabled( b_enabled );
400
401             b_enabled = ( qs_filter.contains( "headphone" ) );
402             ui.headphoneEffect->setChecked( b_enabled );
403
404             /* Volume Label */
405             updateAudioVolume( ui.defaultVolume->value() ); // First time init
406
407         END_SPREFS_CAT;
408
409         /* Input and Codecs Panel Implementation */
410         START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs Settings") );
411
412             /* Disk Devices */
413             {
414                 ui.DVDDeviceComboBox->setToolTip(
415                     qtr( "If this property is blank, different values\n"
416                          "for DVD, VCD, and CDDA are set.\n"
417                          "You can define a unique one or configure them \n"
418                          "individually in the advanced preferences." ) );
419                 char *psz_dvddiscpath = config_GetPsz( p_intf, "dvd" );
420                 char *psz_vcddiscpath = config_GetPsz( p_intf, "vcd" );
421                 char *psz_cddadiscpath = config_GetPsz( p_intf, "cd-audio" );
422                 if( psz_dvddiscpath && psz_vcddiscpath && psz_cddadiscpath )
423                 if( !strcmp( psz_cddadiscpath, psz_dvddiscpath ) &&
424                     !strcmp( psz_dvddiscpath, psz_vcddiscpath ) )
425                 {
426                     ui.DVDDeviceComboBox->setEditText( qfu( psz_dvddiscpath ) );
427                 }
428                 free( psz_cddadiscpath );
429                 free( psz_dvddiscpath );
430                 free( psz_vcddiscpath );
431             }
432 #ifndef WIN32
433             QStringList DVDDeviceComboBoxStringList = QStringList();
434             DVDDeviceComboBoxStringList
435                     << "dvd*" << "scd*" << "sr*" << "sg*" << "cd*";
436             ui.DVDDeviceComboBox->addItems( QDir( "/dev/" )
437                     .entryList( DVDDeviceComboBoxStringList, QDir::System )
438                     .replaceInStrings( QRegExp("^"), "/dev/" )
439             );
440 #endif
441             CONFIG_GENERIC( "dvd", String, ui.DVDLabel,
442                             DVDDeviceComboBox->lineEdit() );
443             CONFIG_GENERIC_FILE( "input-record-path", Directory, ui.recordLabel,
444                                  ui.recordPath, ui.recordBrowse );
445
446             CONFIG_GENERIC( "http-proxy", String , ui.httpProxyLabel, proxy );
447             CONFIG_GENERIC_NO_BOOL( "postproc-q", Integer, ui.ppLabel,
448                                     PostProcLevel );
449             CONFIG_GENERIC( "avi-index", IntegerList, ui.aviLabel, AviRepair );
450
451             /* live555 module prefs */
452             CONFIG_BOOL( "rtsp-tcp",
453                                 live555TransportRTSP_TCPRadio );
454             if ( !module_exists( "live555" ) )
455             {
456                 ui.live555TransportRTSP_TCPRadio->hide();
457                 ui.live555TransportHTTPRadio->hide();
458                 ui.live555TransportLabel->hide();
459             }
460             CONFIG_BOOL( "ffmpeg-hw", hwAccelBox );
461 #ifdef WIN32
462             CONFIG_BOOL( "prefer-system-codecs", systemCodecBox );
463             HINSTANCE hdxva2_dll = LoadLibrary(TEXT("DXVA2.DLL") );
464             if( !hdxva2_dll )
465                 ui.hwAccelBox->setEnabled( false );
466             else
467                 FreeLibrary( hdxva2_dll );
468 #else
469             ui.systemCodecBox->hide();
470 #endif
471             optionWidgets.append( ui.DVDDeviceComboBox );
472             optionWidgets.append( ui.cachingCombo );
473             CONFIG_GENERIC( "ffmpeg-skiploopfilter", IntegerList, ui.filterLabel, loopFilterBox );
474             CONFIG_GENERIC( "sout-x264-tune", StringList, ui.x264Label, tuneBox );
475             CONFIG_GENERIC( "sout-x264-preset", StringList, ui.x264Label, presetBox );
476             CONFIG_GENERIC( "sout-x264-profile", StringList, ui.x264profileLabel, profileBox );
477             CONFIG_GENERIC( "sout-x264-level", String, ui.x264profileLabel, levelBox );
478
479             /* Caching */
480             /* Add the things to the ComboBox */
481             #define addToCachingBox( str, cachingNumber ) \
482                 ui.cachingCombo->addItem( qtr(str), QVariant( cachingNumber ) );
483             addToCachingBox( N_("Custom"), CachingCustom );
484             addToCachingBox( N_("Lowest latency"), CachingLowest );
485             addToCachingBox( N_("Low latency"), CachingLow );
486             addToCachingBox( N_("Normal"), CachingNormal );
487             addToCachingBox( N_("High latency"), CachingHigh );
488             addToCachingBox( N_("Higher latency"), CachingHigher );
489             #undef addToCachingBox
490
491 #define TestCaC( name ) \
492     b_cache_equal =  b_cache_equal && \
493      ( i_cache == config_GetInt( p_intf, name ) )
494
495 #define TestCaCi( name, int ) \
496     b_cache_equal = b_cache_equal &&  \
497     ( ( i_cache * int ) == config_GetInt( p_intf, name ) )
498             /* Select the accurate value of the ComboBox */
499             bool b_cache_equal = true;
500             int i_cache = config_GetInt( p_intf, "file-caching");
501
502             TestCaC( "udp-caching" );
503             if (module_exists ("dvdread"))
504                 TestCaC( "dvdread-caching" );
505             if (module_exists ("dvdnav"))
506                 TestCaC( "dvdnav-caching" );
507             TestCaC( "tcp-caching" );
508             TestCaC( "cdda-caching" );
509             TestCaC( "screen-caching" ); TestCaC( "vcd-caching" );
510             #ifdef WIN32
511             TestCaC( "dshow-caching" );
512             #else
513             if (module_exists ("access_jack"))
514                 TestCaC( "jack-input-caching" );
515             if (module_exists ("v4l2"))
516                 TestCaC( "v4l2-caching" );
517             if (module_exists ("pvr"))
518                 TestCaC( "pvr-caching" );
519             #endif
520             if (module_exists ("livedotcom"))
521                 TestCaCi( "rtsp-caching", 4 );
522             TestCaCi( "ftp-caching", 2 );
523             TestCaCi( "http-caching", 2 );
524             if (module_exists ("access_realrtsp"))
525                 TestCaCi( "realrtsp-caching", 10 );
526             TestCaCi( "mms-caching", 10 );
527             if( b_cache_equal == 1 )
528                 ui.cachingCombo->setCurrentIndex(
529                 ui.cachingCombo->findData( QVariant( i_cache ) ) );
530 #undef TestCaCi
531 #undef TestCaC
532
533         END_SPREFS_CAT;
534         /*******************
535          * Interface Panel *
536          *******************/
537         START_SPREFS_CAT( Interface, qtr("Interface Settings") );
538 //            ui.defaultLabel->setFont( italicFont );
539             ui.skinsLabel->setText(
540                     qtr( "This is VLC's skinnable interface. You can download other skins at" )
541                     + QString( " <a href=\"http://www.videolan.org/vlc/skins.php\">" )
542                     + qtr( "VLC skins website" )+ QString( "</a>." ) );
543             ui.skinsLabel->setFont( italicFont );
544
545 #if defined( WIN32 )
546             CONFIG_GENERIC( "language", StringList, ui.languageLabel, language );
547             BUTTONACT( ui.assoButton, assoDialog() );
548 #else
549             ui.languageBox->hide();
550             ui.assoButton->hide();
551             ui.assocLabel->hide();
552 #endif
553 #ifdef MEDIA_LIBRARY
554             BUTTONACT( ui.sqlMLbtn, configML() );
555 #endif
556
557             /* interface */
558             char *psz_intf = config_GetPsz( p_intf, "intf" );
559             if( psz_intf )
560             {
561                 if( strstr( psz_intf, "skin" ) )
562                     ui.skins->setChecked( true );
563             } else {
564                 /* defaults to qt */
565                 ui.qt4->setChecked( true );
566             }
567             free( psz_intf );
568
569             optionWidgets.append( ui.skins );
570             optionWidgets.append( ui.qt4 );
571 #if !defined(NDEBUG) || !defined( WIN32)
572             ui.stylesCombo->addItem( qtr("System's default") );
573             ui.stylesCombo->addItems( QStyleFactory::keys() );
574             ui.stylesCombo->setCurrentIndex( ui.stylesCombo->findText(
575                         getSettings()->value( "MainWindow/QtStyle", "" ).toString() ) );
576             ui.stylesCombo->insertSeparator( 1 );
577
578             CONNECT( ui.stylesCombo, currentIndexChanged( QString ), this, changeStyle( QString ) );
579             optionWidgets.append( ui.stylesCombo );
580 #else
581             ui.stylesCombo->hide();
582             optionWidgets.append( NULL );
583 #endif
584             radioGroup = new QButtonGroup(this);
585             radioGroup->addButton( ui.qt4, 0 );
586             radioGroup->addButton( ui.skins, 1 );
587             CONNECT( radioGroup, buttonClicked( int ),
588                      ui.styleStackedWidget, setCurrentIndex( int ) );
589             ui.styleStackedWidget->setCurrentIndex( radioGroup->checkedId() );
590
591             CONNECT( ui.minimalviewBox, toggled( bool ),
592                      ui.mainPreview, setNormalPreview( bool ) );
593             CONFIG_BOOL( "qt-minimal-view", minimalviewBox );
594             ui.mainPreview->setNormalPreview( ui.minimalviewBox->isChecked() );
595             ui.skinsPreview->setPreview( InterfacePreviewWidget::SKINS );
596
597             CONFIG_BOOL( "embedded-video", embedVideo );
598             CONFIG_BOOL( "qt-video-autoresize", resizingBox );
599             CONNECT( ui.embedVideo, toggled( bool ), ui.resizingBox, setEnabled( bool ) );
600             ui.resizingBox->setEnabled( ui.embedVideo->isChecked() );
601
602             CONFIG_BOOL( "qt-fs-controller", fsController );
603             CONFIG_BOOL( "qt-system-tray", systrayBox );
604             CONFIG_BOOL( "qt-notification", sysPop );
605             CONNECT( ui.systrayBox, toggled( bool ), ui.sysPop, setEnabled( bool ) );
606             ui.sysPop->setEnabled( ui.systrayBox->isChecked() );
607
608             CONFIG_BOOL( "qt-pause-minimized", pauseMinimizedBox );
609             CONFIG_BOOL( "playlist-tree", treePlaylist );
610             CONFIG_BOOL( "play-and-pause", playPauseBox );
611             CONFIG_GENERIC_FILE( "skins2-last", File, ui.skinFileLabel,
612                                  ui.fileSkin, ui.skinBrowse );
613
614             CONFIG_GENERIC( "album-art", IntegerList, ui.artFetchLabel,
615                                                       artFetcher );
616
617             /* UPDATE options */
618 #ifdef UPDATE_CHECK
619             CONFIG_BOOL( "qt-updates-notif", updatesBox );
620             CONFIG_GENERIC_NO_BOOL( "qt-updates-days", Integer, NULL,
621                     updatesDays );
622             ui.updatesDays->setEnabled( ui.updatesBox->isChecked() );
623             CONNECT( ui.updatesBox, toggled( bool ),
624                      ui.updatesDays, setEnabled( bool ) );
625 #else
626             ui.updateNotifierZone->hide();
627 #endif
628             /* ONE INSTANCE options */
629 #if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__)
630             CONFIG_BOOL( "one-instance", OneInterfaceMode );
631             CONFIG_BOOL( "playlist-enqueue",
632                     EnqueueOneInterfaceMode );
633             ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() );
634             CONNECT( ui.OneInterfaceMode, toggled( bool ),
635                      ui.EnqueueOneInterfaceMode, setEnabled( bool ) );
636 #else
637             ui.OneInterfaceBox->hide();
638 #endif
639             /* RECENTLY PLAYED options */
640             CONNECT( ui.saveRecentlyPlayed, toggled( bool ),
641                      ui.recentlyPlayedFilters, setEnabled( bool ) );
642             ui.recentlyPlayedFilters->setEnabled( false );
643             CONFIG_BOOL( "qt-recentplay", saveRecentlyPlayed );
644             CONFIG_GENERIC( "qt-recentplay-filter", String, ui.filterLabel,
645                     recentlyPlayedFilters );
646
647         END_SPREFS_CAT;
648
649         START_SPREFS_CAT( Subtitles,
650                             qtr("Subtitles & On Screen Display Settings") );
651             CONFIG_BOOL( "osd", OSDBox);
652             CONFIG_BOOL( "video-title-show", OSDTitleBox);
653             CONFIG_GENERIC( "video-title-position", IntegerList,
654                             ui.OSDTitlePosLabel, OSDTitlePos );
655
656             CONFIG_GENERIC( "subsdec-encoding", StringList, ui.encodLabel,
657                             encoding );
658             CONFIG_GENERIC( "sub-language", String, ui.subLangLabel,
659                             preferredLanguage );
660             CONFIG_GENERIC_NO_BOOL( "freetype-font", Font, ui.fontLabel, font );
661             CONFIG_GENERIC( "freetype-color", IntegerList, ui.fontColorLabel,
662                             fontColor );
663             CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList,
664                             ui.fontSizeLabel, fontSize );
665             CONFIG_GENERIC( "freetype-effect", IntegerList, ui.fontEffectLabel,
666                             effect );
667             CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer, ui.subsPosLabel, subsPosition );
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 #else
745     /* optionWidgets[ossW] can be NULL */
746     if( optionWidgets[ossW] )
747         optionWidgets[ossW]->setVisible( ( value == "oss" ) );
748     /* optionWidgets[alsaW] can be NULL */
749     if( optionWidgets[alsaW] )
750         optionWidgets[alsaW]->setVisible( ( value == "alsa" ) );
751 #endif
752     optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
753     optionWidgets[spdifChB]->setVisible( ( value == "alsa" || value == "oss" || value == "auhal" ||
754                                            value == "aout_directx" || value == "waveout" ) );
755 }
756
757
758 SPrefsPanel::~SPrefsPanel()
759 {
760     qDeleteAll( controls ); controls.clear();
761 }
762
763 void SPrefsPanel::updateAudioVolume( int volume )
764 {
765     qobject_cast<QSpinBox *>(optionWidgets[volLW])
766         ->setValue( volume * 100 / QT_VOLUME_DEFAULT );
767 }
768
769
770 /* Function called from the main Preferences dialog on each SPrefs Panel */
771 void SPrefsPanel::apply()
772 {
773     /* Generic save for ever panel */
774     QList<ConfigControl *>::const_iterator i;
775     for( i = controls.begin() ; i != controls.end() ; ++i )
776     {
777         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
778         c->doApply();
779     }
780
781     switch( number )
782     {
783     case SPrefsInputAndCodecs:
784     {
785         /* Device default selection */
786         QByteArray devicepath =
787             qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText().toUtf8();
788         if( devicepath.size() > 0 )
789         {
790             config_PutPsz( p_intf, "dvd", devicepath );
791             config_PutPsz( p_intf, "vcd", devicepath );
792             config_PutPsz( p_intf, "cd-audio", devicepath );
793         }
794
795 #define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue )
796 #define CaC( name ) CaCi( name, 1 )
797         /* Caching */
798         QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
799         int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
800         if( i_comboValue )
801         {
802             CaC( "udp-caching" );
803             if (module_exists ("dvdread" ))
804                 CaC( "dvdread-caching" );
805             if (module_exists ("dvdnav" ))
806                 CaC( "dvdnav-caching" );
807             CaC( "tcp-caching" ); CaC( "vcd-caching" );
808             CaC( "cdda-caching" ); CaC( "file-caching" );
809             CaC( "screen-caching" ); CaC( "bd-caching" );
810             CaCi( "rtsp-caching", 2 ); CaCi( "ftp-caching", 2 );
811             CaCi( "http-caching", 2 );
812             if (module_exists ("access_realrtsp" ))
813                 CaCi( "realrtsp-caching", 10 );
814             CaCi( "mms-caching", 10 );
815             #ifdef WIN32
816             CaC( "dshow-caching" );
817             #else
818             if (module_exists ( "access_jack" ))
819             CaC( "jack-input-caching" );
820             if (module_exists ( "v4l2" ))
821                 CaC( "v4l2-caching" );
822             if (module_exists ( "pvr" ))
823                 CaC( "pvr-caching" );
824             #endif
825             //CaCi( "dv-caching" ) too short...
826         }
827         break;
828 #undef CaC
829 #undef CaCi
830     }
831
832     /* Interfaces */
833     case SPrefsInterface:
834     {
835         if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
836             config_PutPsz( p_intf, "intf", "skins2,any" );
837         else
838         //if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
839             config_PutPsz( p_intf, "intf", "" );
840         if( qobject_cast<QComboBox *>(optionWidgets[styleCB]) )
841             getSettings()->setValue( "MainWindow/QtStyle",
842                 qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
843
844         break;
845     }
846
847     case SPrefsAudio:
848     {
849         bool b_checked =
850             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
851         if( b_checked && !qs_filter.contains( "volnorm" ) )
852             qs_filter.append( "volnorm" );
853         if( !b_checked && qs_filter.contains( "volnorm" ) )
854             qs_filter.removeAll( "volnorm" );
855
856         b_checked =
857             qobject_cast<QCheckBox *>(optionWidgets[headphoneB])->isChecked();
858
859         if( b_checked && !qs_filter.contains( "headphone" ) )
860             qs_filter.append( "headphone" );
861         if( !b_checked && qs_filter.contains( "headphone" ) )
862             qs_filter.removeAll( "headphone" );
863
864         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) );
865         break;
866     }
867     }
868 }
869
870 void SPrefsPanel::clean()
871 {}
872
873 void SPrefsPanel::lastfm_Changed( int i_state )
874 {
875     if( i_state == Qt::Checked )
876         config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
877     else if( i_state == Qt::Unchecked )
878         config_RemoveIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
879 }
880
881 void SPrefsPanel::changeStyle( QString s_style )
882 {
883     QApplication::setStyle( s_style );
884
885     /* force refresh on all widgets */
886     QWidgetList widgets = QApplication::allWidgets();
887     QWidgetList::iterator it = widgets.begin();
888     while( it != widgets.end() ) {
889         (*it)->update();
890         ++it;
891     };
892 }
893
894 void SPrefsPanel::configML()
895 {
896 #ifdef MEDIA_LIBRARY
897     MLConfDialog *mld = new MLConfDialog( this, p_intf );
898     mld->exec();
899     delete mld;
900 #endif
901 }
902
903 #ifdef WIN32
904 #include <QDialogButtonBox>
905 #include "util/registry.hpp"
906
907 bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
908                            QTreeWidgetItem* parent, QVLCRegistry *qvReg )
909 {
910     bool b_temp;
911     const char* psz_VLC = "VLC";
912     current = new QTreeWidgetItem( parent, QStringList( psz_ext ) );
913
914     if( strstr( qvReg->ReadRegistryString( psz_ext, "", "" ), psz_VLC ) )
915     {
916         current->setCheckState( 0, Qt::Checked );
917         b_temp = false;
918     }
919     else
920     {
921         current->setCheckState( 0, Qt::Unchecked );
922         b_temp = true;
923     }
924     listAsso.append( current );
925     return b_temp;
926 }
927
928 void SPrefsPanel::assoDialog()
929 {
930     LPAPPASSOCREGUI p_appassoc;
931     CoInitialize( 0 );
932
933     if( S_OK == CoCreateInstance( &clsid_IApplication2,
934                 NULL, CLSCTX_INPROC_SERVER,
935                 &IID_IApplicationAssociationRegistrationUI,
936                 (void **)&p_appassoc) )
937     {
938         if(S_OK == p_appassoc->vt->LaunchAdvancedAssociationUI(p_appassoc, L"VLC" ) )
939         {
940             CoUninitialize();
941             return;
942         }
943     }
944
945     CoUninitialize();
946
947     QDialog *d = new QDialog( this );
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