X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fpreferences_widgets.cpp;h=59bac28d521dd2747abd28977545464830ee6ac8;hb=09630cc19d698c34002bef4aeeab9a798b9e8e72;hp=466597d87bed08a7a7bf46e563a976f7e45cf918;hpb=ff6613e350a80ed99507d877cfac51e25a9ae606;p=vlc diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 466597d87b..59bac28d52 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -1039,7 +1039,7 @@ void KeySelectorControl::finish() module_config_t *p_item = p_main->p_config + i; if( p_item->i_type & CONFIG_ITEM && p_item->psz_name && - strstr( p_item->psz_name , "key-" ) ) + strstr( p_item->psz_name , "key-" ) && !EMPTY_STR( p_item->psz_text ) ) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(); treeItem->setText( 0, qtr( p_item->psz_text ) ); @@ -1124,19 +1124,18 @@ KeyInputDialog::KeyInputDialog( QList& _values, setWindowTitle( qtr( "Hotkey for " ) + qfu( keyToChange) ); - QVBoxLayout *l = new QVBoxLayout( this ); - selected = new QLabel( qtr("Press the new keys for ") + qfu(keyToChange) ); - warning = new QLabel(); - l->addWidget( selected , Qt::AlignCenter ); - l->addWidget( warning, Qt::AlignCenter ); + vLayout = new QVBoxLayout( this ); + selected = new QLabel( qtr("Press the new keys for ") + qfu( keyToChange ) ); + vLayout->addWidget( selected , Qt::AlignCenter ); - QDialogButtonBox *buttonBox = new QDialogButtonBox; + buttonBox = new QDialogButtonBox; QPushButton *ok = new QPushButton( qtr("OK") ); QPushButton *cancel = new QPushButton( qtr("Cancel") ); buttonBox->addButton( ok, QDialogButtonBox::AcceptRole ); buttonBox->addButton( cancel, QDialogButtonBox::RejectRole ); - l->addWidget( buttonBox ); + vLayout->addWidget( buttonBox ); + buttonBox->hide(); CONNECT( buttonBox, accepted(), this, accept() ); CONNECT( buttonBox, rejected(), this, reject() ); @@ -1146,6 +1145,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey ) { conflicts = false; module_config_t *p_current = NULL; + /* Search for conflicts */ foreach( p_current, values ) { if( p_current->value.i == i_vlckey && strcmp( p_current->psz_text, @@ -1155,13 +1155,17 @@ void KeyInputDialog::checkForConflicts( int i_vlckey ) break; } } + if( conflicts ) { - warning->setText( + QLabel *warning = new QLabel( qtr("Warning: the key is already assigned to \"") + - QString( p_current->psz_text ) + "\"" ); + qfu( p_current->psz_text ) + "\"" ); + warning->setWordWrap( true ); + vLayout->insertWidget( 1, warning ); + buttonBox->show(); } - else warning->setText( "" ); + else accept(); } void KeyInputDialog::keyPressEvent( QKeyEvent *e )