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