UI: Disable hotkeys when a user is expected to type text

Disable hotkeys when a user starts an interaction with the UI where they
are expected to type text and re-enable hotkeys when the interaction is
completed.
This commit is contained in:
Ryan Foster 2021-04-15 02:01:05 -04:00 • committed by Jim
commit f832d14220
7 changed files with 24 additions and 0 deletions

View file

@ -4830,6 +4830,7 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
void OBSBasic::EditSceneName()
{
App()->DisableHotkeys();
ui->scenesDock->removeAction(renameScene);
QListWidgetItem *item = ui->scenes->currentItem();
Qt::ItemFlags flags = item->flags();
@ -5063,7 +5064,9 @@ void OBSBasic::on_actionAddScene_triggered()
void OBSBasic::on_actionRemoveScene_triggered()
{
App()->DisableHotkeys();
RemoveSelectedScene();
App()->UpdateHotkeyFocusSetting();
}
void OBSBasic::ChangeSceneIndex(bool relative, int offset, int invalidIdx)
@ -5753,6 +5756,8 @@ void OBSBasic::on_actionRemoveSource_triggered()
if (!confirmed)
return;
App()->DisableHotkeys();
/* ----------------------------------------------- */
/* save undo data */
@ -5783,6 +5788,7 @@ void OBSBasic::on_actionRemoveSource_triggered()
}
CreateSceneUndoRedoAction(action_name, undo_data, redo_data);
App()->UpdateHotkeyFocusSetting();
}
void OBSBasic::on_actionInteract_triggered()
@ -6068,6 +6074,7 @@ static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
void OBSBasic::SceneNameEdited(QWidget *editor,
QAbstractItemDelegate::EndEditHint endHint)
{
App()->UpdateHotkeyFocusSetting();
OBSScene scene = GetCurrentScene();
QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
string text = QT_TO_UTF8(edit->text().trimmed());