Ticket #572: mc_reject_unrecognized_keys.diff
File mc_reject_unrecognized_keys.diff, 3.5 KB (added by , 20 years ago) |
---|
-
mythcontrols/mythcontrols/keygrabber.cpp
40 40 key_label = addLabel("Waiting for key press", Small, false); 41 41 42 42 ok_button = this->addButton(tr("OK"), this, SLOT(acceptBinding())); 43 this->addButton(tr("Cancel"), this, SLOT(cancel()));43 cancel_button = this->addButton(tr("Cancel"), this, SLOT(cancel())); 44 44 45 45 this->grabKeyboard(); 46 46 } … … 71 71 key_name = modifiers + key_name; 72 72 } 73 73 74 this->captured_key_event = key_name; 75 this->key_label->setText("Add key, \"" + key_name + "\"?"); 74 /* keys without a name are no good to us */ 75 if (key_name.isEmpty()) 76 { 77 this->key_label->setText("You have pressed an invalid key!"); 78 this->ok_button->setDisabled(true); 79 this->cancel_button->setFocus(); 80 } 81 else { 82 this->captured_key_event = key_name; 83 this->key_label->setText("Add key, \"" + key_name + "\"?"); 84 this->ok_button->setFocus(); 85 } 86 76 87 this->releaseKeyboard(); 77 this->ok_button->setFocus();78 88 } 79 89 80 90 -
mythcontrols/mythcontrols/keygrabber.h
52 52 53 53 public slots: 54 54 55 /**56 * @brief Accept the captured keybinding.57 *58 * The QString provided in the constructor will be set to the59 * captured key value.60 */61 inline void acceptBinding(void) { done(1); }55 /** 56 * @brief Accept the captured keybinding. 57 * 58 * The QString provided in the constructor will be set to the 59 * captured key value. 60 */ 61 inline void acceptBinding(void) { done(1); } 62 62 63 63 /** 64 64 * @brief Reject the captured key binding. … … 87 87 bool has_captured; 88 88 QString captured_key_event; 89 89 QButton *ok_button; 90 QButton *cancel_button; 90 91 QLabel *key_label; 91 92 }; 92 93 … … 122 123 inline int getOption(void) { return ExecPopup(this,SLOT(finish())); } 123 124 124 125 protected slots: 125 /**126 * @brief Close the popup.127 */128 inline void finish(void) { done(0); }126 /** 127 * @brief Close the popup. 128 */ 129 inline void finish(void) { done(0); } 129 130 }; 130 131 131 132 … … 154 155 155 156 public slots: 156 157 157 /**158 * @brief Slot to connect to when the save button is pressed.159 */160 inline void save(void) { done(OptionsMenu::SAVE); }158 /** 159 * @brief Slot to connect to when the save button is pressed. 160 */ 161 inline void save(void) { done(OptionsMenu::SAVE); } 161 162 162 163 /** 163 164 * @brief Slot to connect to when the cancel button is pressed. … … 193 194 194 195 public slots: 195 196 196 /**197 * @brief Slot to connect to when the set button is pressed.198 */199 inline void set(void) { done(ActionMenu::SET); }197 /** 198 * @brief Slot to connect to when the set button is pressed. 199 */ 200 inline void set(void) { done(ActionMenu::SET); } 200 201 201 202 /** 202 203 * @brief Slot to connect to when the remove button is pressed. … … 235 236 236 237 public slots: 237 238 238 /**239 * @brief Slot to connect to when the save button is pressed.240 */241 inline void save(void) { done(UnsavedMenu::SAVE); }239 /** 240 * @brief Slot to connect to when the save button is pressed. 241 */ 242 inline void save(void) { done(UnsavedMenu::SAVE); } 242 243 243 244 /** 244 245 * @brief Slot to connect to when the cancel button is pressed.