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