]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/preferences_widgets.cpp
2bcffd12ccc2cefae7145ae9a32fe4048ce6ed14
[vlc] / modules / gui / qt4 / components / preferences_widgets.cpp
1 /*****************************************************************************
2  * preferences_widgets.cpp : Widgets for preferences displays
3  ****************************************************************************
4  * Copyright (C) 2006-2007 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 /**
27  * Todo:
28  *  - Finish implementation (see WX, there might be missing a
29  *    i_action handler for IntegerLists, but I don't see any module using it...
30  *  - Improvements over WX
31  *      - Validator for modulelist
32  */
33 #ifdef HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #include "components/preferences_widgets.hpp"
38 #include "util/customwidgets.hpp"
39 #include <vlc_keys.h>
40
41 #include <QString>
42 #include <QVariant>
43 #include <QGridLayout>
44 #include <QSlider>
45 #include <QFileDialog>
46 #include <QGroupBox>
47 #include <QTreeWidgetItem>
48 #include <QSignalMapper>
49 #include <QDialogButtonBox>
50
51 #define MINWIDTH_BOX 90
52 #define LAST_COLUMN 10
53
54 QString formatTooltip(const QString & tooltip)
55 {
56     QString formatted =
57     "<html><head><meta name=\"qrichtext\" content=\"1\" />"
58     "<style type=\"text/css\"> p, li { white-space: pre-wrap; } </style></head>"
59     "<body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; "
60     "font-style:normal; text-decoration:none;\">"
61     "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; "
62     "margin-right:0px; -qt-block-indent:0; text-indent:0px;\">" +
63     tooltip +
64     "</p></body></html>";
65     return formatted;
66 }
67
68 ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
69                                              module_config_t *p_item,
70                                              QWidget *parent )
71 {
72     int i = 0;
73     return createControl( p_this, p_item, parent, NULL, i );
74 }
75
76 ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
77                                              module_config_t *p_item,
78                                              QWidget *parent,
79                                              QGridLayout *l, int &line )
80 {
81     ConfigControl *p_control = NULL;
82
83     switch( p_item->i_type )
84     {
85     case CONFIG_ITEM_MODULE:
86         p_control = new ModuleConfigControl( p_this, p_item, parent, false,
87                                              l, line );
88         break;
89     case CONFIG_ITEM_MODULE_CAT:
90         p_control = new ModuleConfigControl( p_this, p_item, parent, true,
91                                              l, line );
92         break;
93     case CONFIG_ITEM_MODULE_LIST:
94         p_control = new ModuleListConfigControl( p_this, p_item, parent, false,
95                                              l, line );
96         break;
97     case CONFIG_ITEM_MODULE_LIST_CAT:
98         p_control = new ModuleListConfigControl( p_this, p_item, parent, true,
99                                              l, line );
100         break;
101     case CONFIG_ITEM_STRING:
102         if( !p_item->i_list )
103             p_control = new StringConfigControl( p_this, p_item, parent,
104                                                  l, line, false );
105         else
106             p_control = new StringListConfigControl( p_this, p_item,
107                                             parent, false, l, line );
108         break;
109     case CONFIG_ITEM_PASSWORD:
110         if( !p_item->i_list )
111             p_control = new StringConfigControl( p_this, p_item, parent,
112                                                  l, line, true );
113         else
114             p_control = new StringListConfigControl( p_this, p_item,
115                                             parent, true, l, line );
116         break;
117     case CONFIG_ITEM_INTEGER:
118         if( p_item->i_list )
119             p_control = new IntegerListConfigControl( p_this, p_item,
120                                             parent, false, l, line );
121         else if( p_item->min.i || p_item->max.i )
122             p_control = new IntegerRangeConfigControl( p_this, p_item, parent,
123                                                        l, line );
124         else
125             p_control = new IntegerConfigControl( p_this, p_item, parent,
126                                                   l, line );
127         break;
128     case CONFIG_ITEM_FILE:
129         p_control = new FileConfigControl( p_this, p_item, parent, l,
130                                                 line, false );
131         break;
132     case CONFIG_ITEM_DIRECTORY:
133         p_control = new DirectoryConfigControl( p_this, p_item, parent, l,
134                                                 line, false );
135         break;
136 #if 0
137     case CONFIG_ITEM_FONT:
138         p_control = new FontConfigControl( p_this, p_item, parent, l,
139                                            line, false );
140         break;
141 #endif
142     case CONFIG_ITEM_KEY:
143         p_control = new KeySelectorControl( p_this, p_item, parent, l, line );
144         break;
145     case CONFIG_ITEM_BOOL:
146         p_control = new BoolConfigControl( p_this, p_item, parent, l, line );
147         break;
148     case CONFIG_ITEM_FLOAT:
149         if( p_item->min.f || p_item->max.f )
150             p_control = new FloatRangeConfigControl( p_this, p_item, parent,
151                                                      l, line );
152         else
153             p_control = new FloatConfigControl( p_this, p_item, parent,
154                                                   l, line );
155         break;
156     default:
157         break;
158     }
159     return p_control;
160 }
161
162 void ConfigControl::doApply( intf_thread_t *p_intf )
163 {
164     switch( getType() )
165     {
166         case CONFIG_ITEM_INTEGER:
167         case CONFIG_ITEM_BOOL:
168         {
169             VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(this);
170             assert( vicc );
171             config_PutInt( p_intf, vicc->getName(), vicc->getValue() );
172             break;
173         }
174         case CONFIG_ITEM_FLOAT:
175         {
176             VFloatConfigControl *vfcc =
177                                     qobject_cast<VFloatConfigControl *>(this);
178             assert( vfcc );
179             config_PutFloat( p_intf, vfcc->getName(), vfcc->getValue() );
180             break;
181         }
182         case CONFIG_ITEM_STRING:
183         {
184             VStringConfigControl *vscc =
185                             qobject_cast<VStringConfigControl *>(this);
186             assert( vscc );
187             config_PutPsz( p_intf, vscc->getName(), qtu( vscc->getValue() ) );
188             break;
189         }
190         case CONFIG_ITEM_KEY:
191         {
192             KeySelectorControl *ksc = qobject_cast<KeySelectorControl *>(this);
193             assert( ksc );
194             ksc->doApply();
195         }
196     }
197 }
198
199 /**************************************************************************
200  * String-based controls
201  *************************************************************************/
202
203 /*********** String **************/
204 StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
205                                           module_config_t *_p_item,
206                                           QWidget *_parent, QGridLayout *l,
207                                           int &line, bool pwd ) :
208                            VStringConfigControl( _p_this, _p_item, _parent )
209 {
210     label = new QLabel( qtr(p_item->psz_text) );
211     text = new QLineEdit( qfu(p_item->value.psz) );
212     if( pwd ) text->setEchoMode( QLineEdit::Password );
213     finish();
214
215     if( !l )
216     {
217         QHBoxLayout *layout = new QHBoxLayout();
218         layout->addWidget( label, 0 ); layout->insertSpacing( 1, 10 );
219         layout->addWidget( text, LAST_COLUMN );
220         widget->setLayout( layout );
221     }
222     else
223     {
224         l->addWidget( label, line, 0 );
225         l->setColumnMinimumWidth( 1, 10 );
226         l->addWidget( text, line, LAST_COLUMN );
227     }
228 }
229
230 StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
231                                    module_config_t *_p_item,
232                                    QLabel *_label, QLineEdit *_text, bool pwd ):
233                            VStringConfigControl( _p_this, _p_item )
234 {
235     text = _text;
236     label = _label;
237     finish( );
238 }
239
240 void StringConfigControl::finish()
241 {
242     text->setText( qfu(p_item->value.psz) );
243     text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
244     if( label )
245         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
246 }
247
248 /*********** File **************/
249 FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
250                                           module_config_t *_p_item,
251                                           QWidget *_parent, QGridLayout *l,
252                                           int &line, bool pwd ) :
253                            VStringConfigControl( _p_this, _p_item, _parent )
254 {
255     label = new QLabel( qtr(p_item->psz_text) );
256     text = new QLineEdit( qfu(p_item->value.psz) );
257     browse = new QPushButton( qtr( "Browse..." ) );
258     QHBoxLayout *textAndButton = new QHBoxLayout();
259     textAndButton->setMargin( 0 );
260     textAndButton->addWidget( text, 2 );
261     textAndButton->addWidget( browse, 0 );
262
263     BUTTONACT( browse, updateField() );
264
265     finish();
266
267     if( !l )
268     {
269         QHBoxLayout *layout = new QHBoxLayout();
270         layout->addWidget( label, 0 );
271         layout->insertSpacing( 1, 10 );
272         layout->addLayout( textAndButton, LAST_COLUMN );
273         widget->setLayout( layout );
274     }
275     else
276     {
277         l->addWidget( label, line, 0 );
278         l->setColumnMinimumWidth( 1, 10 );
279         l->addLayout( textAndButton, line, LAST_COLUMN );
280     }
281 }
282
283
284 FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
285                                    module_config_t *_p_item,
286                                    QLabel *_label, QLineEdit *_text,
287                                    QPushButton *_button, bool pwd ):
288                            VStringConfigControl( _p_this, _p_item )
289 {
290     browse = _button;
291     text = _text;
292     label = _label;
293
294     BUTTONACT( browse, updateField() );
295
296     finish( );
297 }
298
299 void FileConfigControl::updateField()
300 {
301     QString file = QFileDialog::getOpenFileName( NULL,
302                   qtr( "Select File" ), qfu( config_GetHomeDir() ) );
303     if( file.isNull() ) return;
304     text->setText( file );
305 }
306
307 void FileConfigControl::finish()
308 {
309     text->setText( qfu(p_item->value.psz) );
310     text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
311     if( label )
312         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
313 }
314
315 /********* String / Directory **********/
316 DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
317                         module_config_t *_p_item, QWidget *_p_widget,
318                         QGridLayout *_p_layout, int& _int, bool _pwd ) :
319      FileConfigControl( _p_this, _p_item, _p_widget, _p_layout, _int, _pwd)
320 {}
321
322 DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
323                         module_config_t *_p_item, QLabel *_p_label,
324                         QLineEdit *_p_line, QPushButton *_p_button, bool _pwd ):
325      FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd)
326 {}
327
328 void DirectoryConfigControl::updateField()
329 {
330     QString dir = QFileDialog::getExistingDirectory( NULL,
331                       qtr( "Select Directory" ),
332                       text->text().isEmpty() ?
333                         qfu( config_GetHomeDir() ) : text->text(),
334                       QFileDialog::ShowDirsOnly |
335                         QFileDialog::DontResolveSymlinks );
336     if( dir.isNull() ) return;
337     text->setText( dir );
338 }
339
340 #if 0
341 #include <QFontDialog>
342
343 /********* String / Font **********/
344 FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
345                         module_config_t *_p_item, QWidget *_p_widget,
346                         QGridLayout *_p_layout, int& _int, bool _pwd ) :
347      FileConfigControl( _p_this, _p_item, _p_widget, _p_layout, _int, _pwd)
348 {}
349
350 FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
351                         module_config_t *_p_item, QLabel *_p_label,
352                         QLineEdit *_p_line, QPushButton *_p_button, bool _pwd ):
353      FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd)
354 {}
355
356 void FontConfigControl::updateField()
357 {
358     bool ok;
359     QFont font = QFontDialog::getFont( &ok, QFont( text->text() ), NULL );
360     if( !ok ) return;
361     text->setText( font.family() );
362 }
363 #endif
364
365 /********* String / choice list **********/
366 StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
367                module_config_t *_p_item, QWidget *_parent, bool bycat,
368                QGridLayout *l, int &line) :
369                VStringConfigControl( _p_this, _p_item, _parent )
370 {
371     label = new QLabel( qtr(p_item->psz_text) );
372     combo = new QComboBox();
373     combo->setMinimumWidth( MINWIDTH_BOX );
374     combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
375
376     module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
377     if(p_module_config && p_module_config->pf_update_list)
378     {
379        vlc_value_t val;
380        val.psz_string = strdup(p_module_config->value.psz);
381
382        p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
383
384        // assume in any case that dirty was set to true
385        // because lazy programmes will use the same callback for
386        // this, like the one behind the refresh push button?
387        p_module_config->b_dirty = false;
388
389        free( val.psz_string );
390     }
391
392     finish( p_module_config, bycat );
393     if( !l )
394     {
395         l = new QGridLayout();
396         l->addWidget( label, 0, 0 ); l->addWidget( combo, 0, LAST_COLUMN );
397         widget->setLayout( l );
398     }
399     else
400     {
401         l->addWidget( label, line, 0 );
402         l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
403     }
404
405     if( p_item->i_action )
406     {
407         QSignalMapper *signalMapper = new QSignalMapper(this);
408
409         /* Some stringLists like Capture listings have action associated */
410         for( int i = 0; i < p_item->i_action; i++ )
411         {
412             QPushButton *button =
413                 new QPushButton( qfu( p_item->ppsz_action_text[i] ));
414             CONNECT( button, clicked(), signalMapper, map() );
415             signalMapper->setMapping( button, i );
416             l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i,
417                     Qt::AlignRight );
418         }
419         CONNECT( signalMapper, mapped( int ),
420                 this, actionRequested( int ) );
421     }
422 }
423
424 void StringListConfigControl::actionRequested( int i_action )
425 {
426     /* Supplementary check for boundaries */
427     if( i_action < 0 || i_action >= p_item->i_action ) return;
428
429     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
430     if(!p_module_config) return;
431
432     vlc_value_t val;
433     val.psz_string =
434         qtu( (combo->itemData( combo->currentIndex() ).toString() ) );
435
436     p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
437
438     if( p_module_config->b_dirty )
439     {
440         combo->clear();
441         finish( p_module_config, true );
442         p_module_config->b_dirty = false;
443     }
444 }
445 StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
446                 module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
447                 bool bycat ) : VStringConfigControl( _p_this, _p_item )
448 {
449     combo = _combo;
450     label = _label;
451
452     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
453
454     finish( p_module_config, bycat );
455 }
456
457 void StringListConfigControl::finish(module_config_t *p_module_config, bool bycat )
458 {
459     combo->setEditable( false );
460
461     if(!p_module_config) return;
462
463     for( int i_index = 0; i_index < p_module_config->i_list; i_index++ )
464     {
465         combo->addItem( qfu((p_module_config->ppsz_list_text &&
466                             p_module_config->ppsz_list_text[i_index])?
467                             p_module_config->ppsz_list_text[i_index] :
468                             p_module_config->ppsz_list[i_index] ),
469                    QVariant( qfu(p_module_config->ppsz_list[i_index] )) );
470         if( p_item->value.psz && !strcmp( p_module_config->value.psz,
471                                           p_module_config->ppsz_list[i_index] ) )
472             combo->setCurrentIndex( combo->count() - 1 );
473     }
474     combo->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) );
475     if( label )
476         label->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) );
477 }
478
479 QString StringListConfigControl::getValue()
480 {
481     return combo->itemData( combo->currentIndex() ).toString();
482 }
483
484 void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
485                         QComboBox *combo, QWidget *parent )
486 {
487     module_config_t *p_config =
488                       config_FindConfig( VLC_OBJECT(p_intf), configname );
489     if( p_config )
490     {
491        if(p_config->pf_update_list)
492         {
493             vlc_value_t val;
494             val.i_int = p_config->value.i;
495             p_config->pf_update_list(VLC_OBJECT(p_intf), configname, val, val, NULL);
496             // assume in any case that dirty was set to true
497             // because lazy programmes will use the same callback for
498             // this, like the one behind the refresh push button?
499             p_config->b_dirty = false;
500         }
501
502         for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
503         {
504             combo->addItem( qfu( p_config->ppsz_list_text[i_index] ),
505                     QVariant( p_config->pi_list[i_index] ) );
506             if( p_config->value.i == p_config->pi_list[i_index] )
507             {
508                 combo->setCurrentIndex( i_index );
509             }
510         }
511         combo->setToolTip( qfu( p_config->psz_longtext ) );
512     }
513 }
514
515 /********* Module **********/
516 ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
517                module_config_t *_p_item, QWidget *_parent, bool bycat,
518                QGridLayout *l, int &line) :
519                VStringConfigControl( _p_this, _p_item, _parent )
520 {
521     label = new QLabel( qtr(p_item->psz_text) );
522     combo = new QComboBox();
523     combo->setMinimumWidth( MINWIDTH_BOX );
524     finish( bycat );
525     if( !l )
526     {
527         QHBoxLayout *layout = new QHBoxLayout();
528         layout->addWidget( label ); layout->addWidget( combo, LAST_COLUMN );
529         widget->setLayout( layout );
530     }
531     else
532     {
533         l->addWidget( label, line, 0 );
534         l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
535     }
536 }
537
538 ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
539                 module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
540                 bool bycat ) : VStringConfigControl( _p_this, _p_item )
541 {
542     combo = _combo;
543     label = _label;
544     finish( bycat );
545 }
546
547 void ModuleConfigControl::finish( bool bycat )
548 {
549     vlc_list_t *p_list;
550     module_t *p_parser;
551
552     combo->setEditable( false );
553
554     /* build a list of available modules */
555     p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
556     combo->addItem( qtr("Default") );
557     for( int i_index = 0; i_index < p_list->i_count; i_index++ )
558     {
559         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
560
561         if( bycat )
562         {
563             if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue;
564
565             unsigned confsize;
566             module_config_t *p_config;
567
568             p_config = module_GetConfig (p_parser, &confsize);
569              for (size_t i = 0; i < confsize; i++)
570             {
571                 /* Hack: required subcategory is stored in i_min */
572                 const module_config_t *p_cfg = p_config + i;
573                 if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
574                     p_cfg->value.i == p_item->min.i )
575                     combo->addItem( qtr( module_GetLongName( p_parser )),
576                                     QVariant( module_GetObjName( p_parser ) ) );
577                 if( p_item->value.psz && !strcmp( p_item->value.psz,
578                                                   module_GetObjName( p_parser ) ) )
579                     combo->setCurrentIndex( combo->count() - 1 );
580             }
581             module_PutConfig (p_config);
582         }
583         else if( module_IsCapable( p_parser, p_item->psz_type ) )
584         {
585             combo->addItem( qtr(module_GetLongName( p_parser ) ),
586                             QVariant( module_GetObjName( p_parser ) ) );
587             if( p_item->value.psz && !strcmp( p_item->value.psz,
588                                               module_GetObjName( p_parser ) ) )
589                 combo->setCurrentIndex( combo->count() - 1 );
590         }
591     }
592     vlc_list_release( p_list );
593     combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
594     if( label )
595         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
596 }
597
598 QString ModuleConfigControl::getValue()
599 {
600     return combo->itemData( combo->currentIndex() ).toString();
601 }
602
603 /********* Module list **********/
604 ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
605         module_config_t *_p_item, QWidget *_parent, bool bycat,
606         QGridLayout *l, int &line) :
607     VStringConfigControl( _p_this, _p_item, _parent )
608 {
609     groupBox = new QGroupBox ( qtr(p_item->psz_text) );
610     text = new QLineEdit();
611     QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
612
613     finish( bycat );
614
615     int boxline = 0;
616     for( QVector<checkBoxListItem*>::iterator it = modules.begin();
617             it != modules.end(); it++ )
618     {
619         layoutGroupBox->addWidget( (*it)->checkBox, boxline++, 0 );
620     }
621     layoutGroupBox->addWidget( text, boxline, 0 );
622
623     if( !l )
624     {
625         QVBoxLayout *layout = new QVBoxLayout();
626         layout->addWidget( groupBox, line, 0 );
627         widget->setLayout( layout );
628     }
629     else
630     {
631         l->addWidget( groupBox, line, 0, 1, -1 );
632     }
633
634     text->setToolTip( formatTooltip( qtr( p_item->psz_longtext) ) );
635 }
636
637 ModuleListConfigControl::~ModuleListConfigControl()
638 {
639     for( QVector<checkBoxListItem*>::iterator it = modules.begin();
640             it != modules.end(); it++ )
641     {
642         delete *it;
643     }
644     delete groupBox;
645     delete text;
646 }
647
648 #define CHECKBOX_LISTS \
649 { \
650        QCheckBox *cb = new QCheckBox( qtr( module_GetLongName( p_parser ) ) );\
651        checkBoxListItem *cbl = new checkBoxListItem; \
652 \
653        CONNECT( cb, stateChanged( int ), this, onUpdate( int ) );\
654        cb->setToolTip( formatTooltip( qtr( module_GetHelp( p_parser ))));\
655        cbl->checkBox = cb; \
656 \
657        cbl->psz_module = strdup( module_GetObjName( p_parser ) ); \
658        modules.push_back( cbl ); \
659 \
660        if( p_item->value.psz && strstr( p_item->value.psz, cbl->psz_module ) ) \
661             cbl->checkBox->setChecked( true ); \
662 }
663
664
665 void ModuleListConfigControl::finish( bool bycat )
666 {
667     vlc_list_t *p_list;
668     module_t *p_parser;
669
670     /* build a list of available modules */
671     p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
672     for( int i_index = 0; i_index < p_list->i_count; i_index++ )
673     {
674         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
675
676         if( bycat )
677         {
678             if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue;
679
680             unsigned confsize;
681             module_config_t *p_config = module_GetConfig (p_parser, &confsize);
682
683             for (size_t i = 0; i < confsize; i++)
684             {
685                 module_config_t *p_cfg = p_config + i;
686                 /* Hack: required subcategory is stored in i_min */
687                 if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
688                         p_cfg->value.i == p_item->min.i )
689                 {
690                     CHECKBOX_LISTS;
691                 }
692             }
693             module_PutConfig (p_config);
694         }
695         else if( module_IsCapable( p_parser, p_item->psz_type ) )
696         {
697             CHECKBOX_LISTS;
698         }
699     }
700     vlc_list_release( p_list );
701     text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
702     if( groupBox )
703         groupBox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
704 }
705 #undef CHECKBOX_LISTS
706
707 QString ModuleListConfigControl::getValue()
708 {
709     return text->text();
710 }
711
712 void ModuleListConfigControl::hide()
713 {
714     for( QVector<checkBoxListItem*>::iterator it = modules.begin();
715          it != modules.end(); it++ )
716     {
717         (*it)->checkBox->hide();
718     }
719     groupBox->hide();
720 }
721
722 void ModuleListConfigControl::show()
723 {
724     for( QVector<checkBoxListItem*>::iterator it = modules.begin();
725          it != modules.end(); it++ )
726     {
727         (*it)->checkBox->show();
728     }
729     groupBox->show();
730 }
731
732
733 void ModuleListConfigControl::onUpdate( int value )
734 {
735     text->clear();
736     bool first = true;
737
738     for( QVector<checkBoxListItem*>::iterator it = modules.begin();
739          it != modules.end(); it++ )
740     {
741         if( (*it)->checkBox->isChecked() )
742         {
743             if( first )
744             {
745                 text->setText( text->text() + (*it)->psz_module );
746                 first = false;
747             }
748             else
749             {
750                 text->setText( text->text() + ":" + (*it)->psz_module );
751             }
752         }
753     }
754 }
755
756 /**************************************************************************
757  * Integer-based controls
758  *************************************************************************/
759
760 /*********** Integer **************/
761 IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
762                                             module_config_t *_p_item,
763                                             QWidget *_parent, QGridLayout *l,
764                                             int &line ) :
765                            VIntConfigControl( _p_this, _p_item, _parent )
766 {
767     label = new QLabel( qtr(p_item->psz_text) );
768     spin = new QSpinBox; spin->setMinimumWidth( MINWIDTH_BOX );
769     spin->setAlignment( Qt::AlignRight );
770     spin->setMaximumWidth( MINWIDTH_BOX );
771     finish();
772
773     if( !l )
774     {
775         QHBoxLayout *layout = new QHBoxLayout();
776         layout->addWidget( label, 0 ); layout->addWidget( spin, LAST_COLUMN );
777         widget->setLayout( layout );
778     }
779     else
780     {
781         l->addWidget( label, line, 0 );
782         l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
783     }
784 }
785 IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
786                                             module_config_t *_p_item,
787                                             QLabel *_label, QSpinBox *_spin ) :
788                                       VIntConfigControl( _p_this, _p_item )
789 {
790     spin = _spin;
791     label = _label;
792     finish();
793 }
794
795 void IntegerConfigControl::finish()
796 {
797     spin->setMaximum( 2000000000 );
798     spin->setMinimum( -2000000000 );
799     spin->setValue( p_item->value.i );
800     spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
801     if( label )
802         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
803 }
804
805 int IntegerConfigControl::getValue()
806 {
807     return spin->value();
808 }
809
810 /********* Integer range **********/
811 IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
812                                             module_config_t *_p_item,
813                                             QWidget *_parent, QGridLayout *l,
814                                             int &line ) :
815             IntegerConfigControl( _p_this, _p_item, _parent, l, line )
816 {
817     finish();
818 }
819
820 IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
821                                             module_config_t *_p_item,
822                                             QLabel *_label, QSpinBox *_spin ) :
823             IntegerConfigControl( _p_this, _p_item, _label, _spin )
824 {
825     finish();
826 }
827
828 void IntegerRangeConfigControl::finish()
829 {
830     spin->setMaximum( p_item->max.i );
831     spin->setMinimum( p_item->min.i );
832 }
833
834 IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl(
835                                             vlc_object_t *_p_this,
836                                             module_config_t *_p_item,
837                                             QLabel *_label, QSlider *_slider ):
838                     VIntConfigControl( _p_this, _p_item )
839 {
840     slider = _slider;
841     label = _label;
842     slider->setMaximum( p_item->max.i );
843     slider->setMinimum( p_item->min.i );
844     slider->setValue( p_item->value.i );
845     slider->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
846     if( label )
847         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
848 }
849
850 int IntegerRangeSliderConfigControl::getValue()
851 {
852         return slider->value();
853 }
854
855
856 /********* Integer / choice list **********/
857 IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
858                module_config_t *_p_item, QWidget *_parent, bool bycat,
859                QGridLayout *l, int &line) :
860                VIntConfigControl( _p_this, _p_item, _parent )
861 {
862     label = new QLabel( qtr(p_item->psz_text) );
863     combo = new QComboBox();
864     combo->setMinimumWidth( MINWIDTH_BOX );
865
866     module_config_t *p_module_config = config_FindConfig( p_this, p_item->psz_name );
867     if(p_module_config && p_module_config->pf_update_list)
868     {
869        vlc_value_t val;
870        val.i_int = p_module_config->value.i;
871
872        p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
873
874        // assume in any case that dirty was set to true
875        // because lazy programmes will use the same callback for
876        // this, like the one behind the refresh push button?
877        p_module_config->b_dirty = false;
878     }
879
880
881     finish( p_module_config, bycat );
882     if( !l )
883     {
884         QHBoxLayout *layout = new QHBoxLayout();
885         layout->addWidget( label ); layout->addWidget( combo, LAST_COLUMN );
886         widget->setLayout( layout );
887     }
888     else
889     {
890         l->addWidget( label, line, 0 );
891         l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
892     }
893
894     if( p_item->i_action )
895     {
896         QSignalMapper *signalMapper = new QSignalMapper(this);
897
898         /* Some stringLists like Capture listings have action associated */
899         for( int i = 0; i < p_item->i_action; i++ )
900         {
901             QPushButton *button =
902                 new QPushButton( qfu( p_item->ppsz_action_text[i] ));
903             CONNECT( button, clicked(), signalMapper, map() );
904             signalMapper->setMapping( button, i );
905             l->addWidget( button, line, LAST_COLUMN - p_item->i_action + i,
906                     Qt::AlignRight );
907         }
908         CONNECT( signalMapper, mapped( int ),
909                 this, actionRequested( int ) );
910     }
911
912 }
913 IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
914                 module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
915                 bool bycat ) : VIntConfigControl( _p_this, _p_item )
916 {
917     combo = _combo;
918     label = _label;
919
920     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
921
922     finish( p_module_config, bycat );
923 }
924
925 void IntegerListConfigControl::finish(module_config_t *p_module_config, bool bycat )
926 {
927     combo->setEditable( false );
928
929     if(!p_module_config) return;
930
931     for( int i_index = 0; i_index < p_module_config->i_list; i_index++ )
932     {
933         combo->addItem( qtr(p_module_config->ppsz_list_text[i_index] ),
934                         QVariant( p_module_config->pi_list[i_index] ) );
935         if( p_module_config->value.i == p_module_config->pi_list[i_index] )
936             combo->setCurrentIndex( combo->count() - 1 );
937     }
938     combo->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) );
939     if( label )
940         label->setToolTip( formatTooltip(qtr(p_module_config->psz_longtext)) );
941 }
942
943 void IntegerListConfigControl::actionRequested( int i_action )
944 {
945     /* Supplementary check for boundaries */
946     if( i_action < 0 || i_action >= p_item->i_action ) return;
947
948     module_config_t *p_module_config = config_FindConfig( p_this, getName() );
949     if(!p_module_config) return;
950
951
952     vlc_value_t val;
953     val.i_int = combo->itemData( combo->currentIndex() ).toInt();
954
955     p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
956
957     if( p_module_config->b_dirty )
958     {
959         combo->clear();
960         finish( p_module_config, true );
961         p_module_config->b_dirty = false;
962     }
963 }
964
965 int IntegerListConfigControl::getValue()
966 {
967     return combo->itemData( combo->currentIndex() ).toInt();
968 }
969
970 /*********** Boolean **************/
971 BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
972                                       module_config_t *_p_item,
973                                       QWidget *_parent, QGridLayout *l,
974                                       int &line ) :
975                     VIntConfigControl( _p_this, _p_item, _parent )
976 {
977     checkbox = new QCheckBox( qtr(p_item->psz_text) );
978     finish();
979
980     if( !l )
981     {
982         QHBoxLayout *layout = new QHBoxLayout();
983         layout->addWidget( checkbox, 0 );
984         widget->setLayout( layout );
985     }
986     else
987     {
988         l->addWidget( checkbox, line, 0 );
989     }
990 }
991 BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
992                                       module_config_t *_p_item,
993                                       QLabel *_label,
994                                       QCheckBox *_checkbox,
995                                       bool bycat ) :
996                    VIntConfigControl( _p_this, _p_item )
997 {
998     checkbox = _checkbox;
999     finish();
1000 }
1001
1002 void BoolConfigControl::finish()
1003 {
1004     checkbox->setCheckState( p_item->value.i == true ? Qt::Checked
1005                                                         : Qt::Unchecked );
1006     checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
1007 }
1008
1009 int BoolConfigControl::getValue()
1010 {
1011     return checkbox->checkState() == Qt::Checked ? true : false;
1012 }
1013
1014 /**************************************************************************
1015  * Float-based controls
1016  *************************************************************************/
1017
1018 /*********** Float **************/
1019 FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
1020                                         module_config_t *_p_item,
1021                                         QWidget *_parent, QGridLayout *l,
1022                                         int &line ) :
1023                     VFloatConfigControl( _p_this, _p_item, _parent )
1024 {
1025     label = new QLabel( qtr(p_item->psz_text) );
1026     spin = new QDoubleSpinBox;
1027     spin->setMinimumWidth( MINWIDTH_BOX );
1028     spin->setMaximumWidth( MINWIDTH_BOX );
1029     spin->setAlignment( Qt::AlignRight );
1030     finish();
1031
1032     if( !l )
1033     {
1034         QHBoxLayout *layout = new QHBoxLayout();
1035         layout->addWidget( label, 0 ); layout->addWidget( spin, LAST_COLUMN );
1036         widget->setLayout( layout );
1037     }
1038     else
1039     {
1040         l->addWidget( label, line, 0 );
1041         l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
1042     }
1043 }
1044
1045 FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
1046                                         module_config_t *_p_item,
1047                                         QLabel *_label,
1048                                         QDoubleSpinBox *_spin ) :
1049                     VFloatConfigControl( _p_this, _p_item )
1050 {
1051     spin = _spin;
1052     label = _label;
1053     finish();
1054 }
1055
1056 void FloatConfigControl::finish()
1057 {
1058     spin->setMaximum( 2000000000. );
1059     spin->setMinimum( -2000000000. );
1060     spin->setSingleStep( 0.1 );
1061     spin->setValue( (double)p_item->value.f );
1062     spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
1063     if( label )
1064         label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
1065 }
1066
1067 float FloatConfigControl::getValue()
1068 {
1069     return (float)spin->value();
1070 }
1071
1072 /*********** Float with range **************/
1073 FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
1074                                         module_config_t *_p_item,
1075                                         QWidget *_parent, QGridLayout *l,
1076                                         int &line ) :
1077                 FloatConfigControl( _p_this, _p_item, _parent, l, line )
1078 {
1079     finish();
1080 }
1081
1082 FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
1083                                         module_config_t *_p_item,
1084                                         QLabel *_label,
1085                                         QDoubleSpinBox *_spin ) :
1086                 FloatConfigControl( _p_this, _p_item, _label, _spin )
1087 {
1088     finish();
1089 }
1090
1091 void FloatRangeConfigControl::finish()
1092 {
1093     spin->setMaximum( (double)p_item->max.f );
1094     spin->setMinimum( (double)p_item->min.f );
1095 }
1096
1097
1098 /**********************************************************************
1099  * Key selector widget
1100  **********************************************************************/
1101 KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this,
1102                                       module_config_t *_p_item,
1103                                       QWidget *_parent, QGridLayout *l,
1104                                       int &line ) :
1105                                 ConfigControl( _p_this, _p_item, _parent )
1106
1107 {
1108     QWidget *keyContainer = new QWidget;
1109     QGridLayout *gLayout = new QGridLayout( keyContainer );
1110
1111     label = new QLabel(
1112             qtr( "Select an action to change the associated hotkey") );
1113
1114     /* Deactivated for now
1115     QLabel *searchLabel = new QLabel( qtr( "Search" ) );
1116     QLineEdit *actionSearch = new QLineEdit;*/
1117
1118     table = new QTreeWidget;
1119     table->setColumnCount(2);
1120     table->headerItem()->setText( 0, qtr( "Action" ) );
1121     table->headerItem()->setText( 1, qtr( "Shortcut" ) );
1122
1123     shortcutValue = new KeyShortcutEdit;
1124     shortcutValue->setReadOnly(true);
1125
1126     QPushButton *clearButton = new QPushButton( qtr( "Clear" ) );
1127     QPushButton *setButton = new QPushButton( qtr( "Set" ) );
1128     setButton->setDefault( true );
1129     finish();
1130
1131     gLayout->addWidget( label, 0, 0, 1, 4 );
1132   /* deactivated for now
1133     gLayout->addWidget( searchLabel, 1, 0, 1, 2 );
1134     gLayout->addWidget( actionSearch, 1, 2, 1, 2 ); */
1135     gLayout->addWidget( table, 2, 0, 1, 4 );
1136     gLayout->addWidget( clearButton, 3, 0, 1, 1 );
1137     gLayout->addWidget( shortcutValue, 3, 1, 1, 2 );
1138     gLayout->addWidget( setButton, 3, 3, 1, 1 );
1139
1140     l->addWidget( keyContainer, line, 0, 1, 2 );
1141
1142     CONNECT( clearButton, clicked(), shortcutValue, clear() );
1143     CONNECT( clearButton, clicked(), this, setTheKey() );
1144     BUTTONACT( setButton, setTheKey() );
1145 }
1146
1147 void KeySelectorControl::finish()
1148 {
1149     if( label )
1150         label->setToolTip( formatTooltip( qtr( p_item->psz_longtext ) ) );
1151
1152     /* Fill the table */
1153     table->setColumnCount( 2 );
1154     table->setAlternatingRowColors( true );
1155
1156     /* Get the main Module */
1157     module_t *p_main = module_Find( p_this, "main" );
1158     assert( p_main );
1159
1160     /* Access to the module_config_t */
1161     unsigned confsize;
1162     module_config_t *p_config;
1163
1164     p_config = module_GetConfig (p_main, &confsize);
1165
1166     for (size_t i = 0; i < confsize; i++)
1167     {
1168         module_config_t *p_item = p_config + i;
1169
1170         /* If we are a key option not empty */
1171         if( p_item->i_type & CONFIG_ITEM && p_item->psz_name
1172             && strstr( p_item->psz_name , "key-" )
1173             && !EMPTY_STR( p_item->psz_text ) )
1174         {
1175             /*
1176                Each tree item has:
1177                 - QString text in column 0
1178                 - QString name in data of column 0
1179                 - KeyValue in String in column 1
1180                 - KeyValue in int in column 1
1181              */
1182             QTreeWidgetItem *treeItem = new QTreeWidgetItem();
1183             treeItem->setText( 0, qtr( p_item->psz_text ) );
1184             treeItem->setData( 0, Qt::UserRole,
1185                                QVariant( qfu( p_item->psz_name ) ) );
1186             treeItem->setText( 1, VLCKeyToString( p_item->value.i ) );
1187             treeItem->setData( 1, Qt::UserRole, QVariant( p_item->value.i ) );
1188             table->addTopLevelItem( treeItem );
1189         }
1190     }
1191     module_PutConfig (p_config);
1192     module_Put (p_main);
1193
1194     table->resizeColumnToContents( 0 );
1195
1196     CONNECT( table, itemDoubleClicked( QTreeWidgetItem *, int ),
1197              this, selectKey( QTreeWidgetItem * ) );
1198     CONNECT( table, itemSelectionChanged (),
1199              this, select1Key() );
1200
1201     CONNECT( shortcutValue, pressed(), this, selectKey() );
1202 }
1203
1204 /* Show the key selected from the table in the keySelector */
1205 void KeySelectorControl::select1Key()
1206 {
1207     QTreeWidgetItem *keyItem = table->currentItem();
1208     shortcutValue->setText( keyItem->text( 1 ) );
1209     shortcutValue->setValue( keyItem->data( 1, Qt::UserRole ).toInt() );
1210 }
1211
1212 void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem )
1213 {
1214     /* This happens when triggered by ClickEater */
1215     if( keyItem == NULL ) keyItem = table->currentItem();
1216
1217     /* This can happen when nothing is selected on the treeView
1218        and the shortcutValue is clicked */
1219     if( !keyItem ) return;
1220
1221     /* Launch a small dialog to ask for a new key */
1222     KeyInputDialog *d = new KeyInputDialog( table, keyItem->text( 0 ), widget );
1223     d->exec();
1224
1225     if( d->result() == QDialog::Accepted )
1226     {
1227         int newValue = d->keyValue;
1228         shortcutValue->setText( VLCKeyToString( newValue ) );
1229         shortcutValue->setValue( newValue );
1230
1231         if( d->conflicts )
1232         {
1233             QTreeWidgetItem *it;
1234             for( int i = 0; i < table->topLevelItemCount() ; i++ )
1235             {
1236                 it = table->topLevelItem(i);
1237                 if( ( keyItem != it )
1238                         && ( it->data( 1, Qt::UserRole ).toInt() == newValue ) )
1239                 {
1240                     it->setData( 1, Qt::UserRole, QVariant( -1 ) );
1241                     it->setText( 1, qtr( "Unset" ) );
1242                 }
1243             }
1244             /* We already made an OK once. */
1245             setTheKey();
1246         }
1247     }
1248     delete d;
1249 }
1250
1251 void KeySelectorControl::setTheKey()
1252 {
1253     table->currentItem()->setText( 1, shortcutValue->text() );
1254     table->currentItem()->setData( 1, Qt::UserRole, shortcutValue->getValue() );
1255 }
1256
1257 void KeySelectorControl::doApply()
1258 {
1259     QTreeWidgetItem *it;
1260     for( int i = 0; i < table->topLevelItemCount() ; i++ )
1261     {
1262         it = table->topLevelItem(i);
1263         if( it->data( 1, Qt::UserRole ).toInt() >= 0 )
1264             config_PutInt( p_this,
1265                            qtu( it->data( 0, Qt::UserRole ).toString() ),
1266                            it->data( 1, Qt::UserRole ).toInt() );
1267     }
1268 }
1269
1270 KeyInputDialog::KeyInputDialog( QTreeWidget *_table,
1271                                 QString keyToChange,
1272                                 QWidget *_parent ) :
1273                                 QDialog( _parent ), keyValue(0)
1274 {
1275     setModal( true );
1276     conflicts = false;
1277
1278     table = _table;
1279     setWindowTitle( qtr( "Hotkey for " ) + keyToChange );
1280
1281     vLayout = new QVBoxLayout( this );
1282     selected = new QLabel( qtr( "Press the new keys for " ) + keyToChange );
1283     vLayout->addWidget( selected , Qt::AlignCenter );
1284
1285     buttonBox = new QDialogButtonBox;
1286     QPushButton *ok = new QPushButton( qtr("OK") );
1287     QPushButton *cancel = new QPushButton( qtr("Cancel") );
1288     buttonBox->addButton( ok, QDialogButtonBox::AcceptRole );
1289     buttonBox->addButton( cancel, QDialogButtonBox::RejectRole );
1290     ok->setDefault( true );
1291
1292     vLayout->addWidget( buttonBox );
1293     buttonBox->hide();
1294
1295     CONNECT( buttonBox, accepted(), this, accept() );
1296     CONNECT( buttonBox, rejected(), this, reject() );
1297 }
1298
1299 void KeyInputDialog::checkForConflicts( int i_vlckey )
1300 {
1301      QList<QTreeWidgetItem *> conflictList =
1302          table->findItems( VLCKeyToString( i_vlckey ), Qt::MatchExactly, 1 );
1303
1304     if( conflictList.size() )
1305     {
1306         QLabel *warning = new QLabel(
1307           qtr("Warning: the key is already assigned to \"") +
1308           conflictList[0]->text( 0 ) + "\"" );
1309         vLayout->insertWidget( 1, warning );
1310         buttonBox->show();
1311
1312         conflicts = true;
1313     }
1314     else accept();
1315 }
1316
1317 void KeyInputDialog::keyPressEvent( QKeyEvent *e )
1318 {
1319     if( e->key() == Qt::Key_Tab ||
1320         e->key() == Qt::Key_Shift ||
1321         e->key() == Qt::Key_Control ||
1322         e->key() == Qt::Key_Meta ||
1323         e->key() == Qt::Key_Alt ||
1324         e->key() == Qt::Key_AltGr )
1325         return;
1326     int i_vlck = qtEventToVLCKey( e );
1327     selected->setText( qtr( "Key: " ) + VLCKeyToString( i_vlck ) );
1328     checkForConflicts( i_vlck );
1329     keyValue = i_vlck;
1330 }
1331
1332 void KeyInputDialog::wheelEvent( QWheelEvent *e )
1333 {
1334     int i_vlck = qtWheelEventToVLCKey( e );
1335     selected->setText( qtr( "Key: " ) + VLCKeyToString( i_vlck ) );
1336     checkForConflicts( i_vlck );
1337     keyValue = i_vlck;
1338 }
1339
1340 void KeyShortcutEdit::mousePressEvent( QMouseEvent *)
1341 {
1342     emit pressed();
1343 }
1344