Commit f437e6eb authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Hotkeys, correct some unicode problem and change the default behaviour.

parent d8fd7df3
...@@ -1130,13 +1130,14 @@ KeyInputDialog::KeyInputDialog( QList<module_config_t*>& _values, ...@@ -1130,13 +1130,14 @@ KeyInputDialog::KeyInputDialog( QList<module_config_t*>& _values,
l->addWidget( selected , Qt::AlignCenter ); l->addWidget( selected , Qt::AlignCenter );
l->addWidget( warning, Qt::AlignCenter ); l->addWidget( warning, Qt::AlignCenter );
QDialogButtonBox *buttonBox = new QDialogButtonBox; buttonBox = new QDialogButtonBox;
QPushButton *ok = new QPushButton( qtr("OK") ); QPushButton *ok = new QPushButton( qtr("OK") );
QPushButton *cancel = new QPushButton( qtr("Cancel") ); QPushButton *cancel = new QPushButton( qtr("Cancel") );
buttonBox->addButton( ok, QDialogButtonBox::AcceptRole ); buttonBox->addButton( ok, QDialogButtonBox::AcceptRole );
buttonBox->addButton( cancel, QDialogButtonBox::RejectRole ); buttonBox->addButton( cancel, QDialogButtonBox::RejectRole );
l->addWidget( buttonBox ); l->addWidget( buttonBox );
buttonBox->hide();
CONNECT( buttonBox, accepted(), this, accept() ); CONNECT( buttonBox, accepted(), this, accept() );
CONNECT( buttonBox, rejected(), this, reject() ); CONNECT( buttonBox, rejected(), this, reject() );
...@@ -1146,6 +1147,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey ) ...@@ -1146,6 +1147,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
{ {
conflicts = false; conflicts = false;
module_config_t *p_current = NULL; module_config_t *p_current = NULL;
/* Search for conflicts */
foreach( p_current, values ) foreach( p_current, values )
{ {
if( p_current->value.i == i_vlckey && strcmp( p_current->psz_text, if( p_current->value.i == i_vlckey && strcmp( p_current->psz_text,
...@@ -1155,13 +1157,15 @@ void KeyInputDialog::checkForConflicts( int i_vlckey ) ...@@ -1155,13 +1157,15 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
break; break;
} }
} }
if( conflicts ) if( conflicts )
{ {
warning->setText( warning->setText(
qtr("Warning: the key is already assigned to \"") + qtr("Warning: the key is already assigned to \"") +
QString( p_current->psz_text ) + "\"" ); qfu( p_current->psz_text ) + "\"" );
buttonBox->hide();
} }
else warning->setText( "" ); else accept();
} }
void KeyInputDialog::keyPressEvent( QKeyEvent *e ) void KeyInputDialog::keyPressEvent( QKeyEvent *e )
......
...@@ -50,6 +50,7 @@ class QTreeWidget; ...@@ -50,6 +50,7 @@ class QTreeWidget;
class QTreeWidgetItem; class QTreeWidgetItem;
class QGroupBox; class QGroupBox;
class QGridLayout; class QGridLayout;
class QDialogButtonBox;
class ConfigControl : public QObject class ConfigControl : public QObject
{ {
...@@ -423,6 +424,7 @@ private: ...@@ -423,6 +424,7 @@ private:
QLabel *warning; QLabel *warning;
const char * keyToChange; const char * keyToChange;
QList<module_config_t*> values; QList<module_config_t*> values;
QDialogButtonBox *buttonBox;
}; };
class KeyShortcutEdit: public QLineEdit class KeyShortcutEdit: public QLineEdit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment