Diffstat (limited to 'core/settings/button/buttonsettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/button/buttonsettings.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index c71514c..8b0b0a8 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp | |||
@@ -57,12 +57,13 @@ struct buttoninfo { | |||
57 | 57 | ||
58 | 58 | ||
59 | ButtonSettings::ButtonSettings ( ) | 59 | ButtonSettings::ButtonSettings ( ) |
60 | : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) | 60 | : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) |
61 | { | 61 | { |
62 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); | 62 | const QValueList <ODeviceButton> &buttons = ODevice::inst ( )-> buttons ( ); |
63 | (void) ButtonUtils::inst ( ); // initialise | ||
63 | 64 | ||
64 | setCaption ( tr( "Button Settings" )); | 65 | setCaption ( tr( "Button Settings" )); |
65 | 66 | ||
66 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); | 67 | QVBoxLayout *toplay = new QVBoxLayout ( this, 3, 3 ); |
67 | 68 | ||
68 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); | 69 | QLabel *l = new QLabel ( tr( "<center>Press or hold the button you want to remap.</center>" ), this ); |
@@ -130,12 +131,13 @@ ButtonSettings::ButtonSettings ( ) | |||
130 | m_infos. append ( bi ); | 131 | m_infos. append ( bi ); |
131 | } | 132 | } |
132 | 133 | ||
133 | toplay-> addStretch ( 10 ); | 134 | toplay-> addStretch ( 10 ); |
134 | 135 | ||
135 | m_last_button = 0; | 136 | m_last_button = 0; |
137 | m_lock = false; | ||
136 | 138 | ||
137 | m_timer = new QTimer ( this ); | 139 | m_timer = new QTimer ( this ); |
138 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); | 140 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); |
139 | 141 | ||
140 | updateLabels ( ); | 142 | updateLabels ( ); |
141 | 143 | ||
@@ -205,12 +207,16 @@ void ButtonSettings::keyTimeout ( ) | |||
205 | } | 207 | } |
206 | 208 | ||
207 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) | 209 | void ButtonSettings::edit ( buttoninfo *bi, bool hold ) |
208 | { | 210 | { |
209 | qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); | 211 | qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); |
210 | 212 | ||
213 | if ( m_lock ) | ||
214 | return; | ||
215 | m_lock = true; | ||
216 | |||
211 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); | 217 | RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); |
212 | 218 | ||
213 | d-> showMaximized ( ); | 219 | d-> showMaximized ( ); |
214 | if ( d-> exec ( ) == QDialog::Accepted ) { | 220 | if ( d-> exec ( ) == QDialog::Accepted ) { |
215 | qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( )); | 221 | qDebug ( " -> %s %s", d-> message ( ). channel ( ). data ( ), d-> message ( ). message ( ). data ( )); |
216 | 222 | ||
@@ -224,12 +230,14 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold ) | |||
224 | } | 230 | } |
225 | 231 | ||
226 | updateLabels ( ); | 232 | updateLabels ( ); |
227 | } | 233 | } |
228 | 234 | ||
229 | delete d; | 235 | delete d; |
236 | |||
237 | m_lock = false; | ||
230 | } | 238 | } |
231 | 239 | ||
232 | void ButtonSettings::accept ( ) | 240 | void ButtonSettings::accept ( ) |
233 | { | 241 | { |
234 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { | 242 | for ( QListIterator <buttoninfo> it ( m_infos ); *it; ++it ) { |
235 | buttoninfo *bi = *it; | 243 | buttoninfo *bi = *it; |