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:
parent
ee30a83a6f
commit
f832d14220
@ -376,6 +376,7 @@ void SourceTreeItem::EnterEditMode()
|
|||||||
editor->installEventFilter(this);
|
editor->installEventFilter(this);
|
||||||
boxLayout->insertWidget(index, editor);
|
boxLayout->insertWidget(index, editor);
|
||||||
setFocusProxy(editor);
|
setFocusProxy(editor);
|
||||||
|
App()->DisableHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceTreeItem::ExitEditMode(bool save)
|
void SourceTreeItem::ExitEditMode(bool save)
|
||||||
@ -415,6 +416,7 @@ void SourceTreeItem::ExitEditModeInternal(bool save)
|
|||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
boxLayout->insertWidget(index, label);
|
boxLayout->insertWidget(index, label);
|
||||||
label->setFocus();
|
label->setFocus();
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
|
|
||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
/* check for empty string */
|
/* check for empty string */
|
||||||
|
@ -936,6 +936,7 @@ void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
|
|||||||
list->editItem(item);
|
list->editItem(item);
|
||||||
item->setFlags(flags);
|
item->setFlags(flags);
|
||||||
editActive = true;
|
editActive = true;
|
||||||
|
App()->DisableHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasicFilters::DuplicateItem(QListWidgetItem *item)
|
void OBSBasicFilters::DuplicateItem(QListWidgetItem *item)
|
||||||
@ -1107,6 +1108,7 @@ void OBSBasicFilters::FilterNameEdited(QWidget *editor, QListWidget *list)
|
|||||||
listItem->setText(QString());
|
listItem->setText(QString());
|
||||||
SetupVisibilityItem(list, listItem, filter);
|
SetupVisibilityItem(list, listItem, filter);
|
||||||
editActive = false;
|
editActive = false;
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasicFilters::AsyncFilterNameEdited(
|
void OBSBasicFilters::AsyncFilterNameEdited(
|
||||||
|
@ -67,6 +67,7 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
|
|||||||
};
|
};
|
||||||
|
|
||||||
connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback);
|
connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback);
|
||||||
|
App()->DisableHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSBasicInteraction::~OBSBasicInteraction()
|
OBSBasicInteraction::~OBSBasicInteraction()
|
||||||
@ -74,6 +75,7 @@ OBSBasicInteraction::~OBSBasicInteraction()
|
|||||||
// since QT fakes a mouse movement while destructing a widget
|
// since QT fakes a mouse movement while destructing a widget
|
||||||
// remove our event filter
|
// remove our event filter
|
||||||
ui->preview->removeEventFilter(eventFilter.get());
|
ui->preview->removeEventFilter(eventFilter.get());
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
|
OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
|
||||||
|
@ -4830,6 +4830,7 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
|
|||||||
|
|
||||||
void OBSBasic::EditSceneName()
|
void OBSBasic::EditSceneName()
|
||||||
{
|
{
|
||||||
|
App()->DisableHotkeys();
|
||||||
ui->scenesDock->removeAction(renameScene);
|
ui->scenesDock->removeAction(renameScene);
|
||||||
QListWidgetItem *item = ui->scenes->currentItem();
|
QListWidgetItem *item = ui->scenes->currentItem();
|
||||||
Qt::ItemFlags flags = item->flags();
|
Qt::ItemFlags flags = item->flags();
|
||||||
@ -5063,7 +5064,9 @@ void OBSBasic::on_actionAddScene_triggered()
|
|||||||
|
|
||||||
void OBSBasic::on_actionRemoveScene_triggered()
|
void OBSBasic::on_actionRemoveScene_triggered()
|
||||||
{
|
{
|
||||||
|
App()->DisableHotkeys();
|
||||||
RemoveSelectedScene();
|
RemoveSelectedScene();
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::ChangeSceneIndex(bool relative, int offset, int invalidIdx)
|
void OBSBasic::ChangeSceneIndex(bool relative, int offset, int invalidIdx)
|
||||||
@ -5753,6 +5756,8 @@ void OBSBasic::on_actionRemoveSource_triggered()
|
|||||||
if (!confirmed)
|
if (!confirmed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
App()->DisableHotkeys();
|
||||||
|
|
||||||
/* ----------------------------------------------- */
|
/* ----------------------------------------------- */
|
||||||
/* save undo data */
|
/* save undo data */
|
||||||
|
|
||||||
@ -5783,6 +5788,7 @@ void OBSBasic::on_actionRemoveSource_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreateSceneUndoRedoAction(action_name, undo_data, redo_data);
|
CreateSceneUndoRedoAction(action_name, undo_data, redo_data);
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasic::on_actionInteract_triggered()
|
void OBSBasic::on_actionInteract_triggered()
|
||||||
@ -6068,6 +6074,7 @@ static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
|
|||||||
void OBSBasic::SceneNameEdited(QWidget *editor,
|
void OBSBasic::SceneNameEdited(QWidget *editor,
|
||||||
QAbstractItemDelegate::EndEditHint endHint)
|
QAbstractItemDelegate::EndEditHint endHint)
|
||||||
{
|
{
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
OBSScene scene = GetCurrentScene();
|
OBSScene scene = GetCurrentScene();
|
||||||
QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
|
QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
|
||||||
string text = QT_TO_UTF8(edit->text().trimmed());
|
string text = QT_TO_UTF8(edit->text().trimmed());
|
||||||
|
@ -214,6 +214,8 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|||||||
} else {
|
} else {
|
||||||
preview->hide();
|
preview->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App()->DisableHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSBasicProperties::~OBSBasicProperties()
|
OBSBasicProperties::~OBSBasicProperties()
|
||||||
@ -224,6 +226,7 @@ OBSBasicProperties::~OBSBasicProperties()
|
|||||||
obs_source_dec_showing(source);
|
obs_source_dec_showing(source);
|
||||||
main->SaveProject();
|
main->SaveProject();
|
||||||
main->UpdateContextBar();
|
main->UpdateContextBar();
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasicProperties::AddPreviewButton()
|
void OBSBasicProperties::AddPreviewButton()
|
||||||
|
@ -297,11 +297,13 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
|||||||
obs_sceneitem_release(item);
|
obs_sceneitem_release(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
done(DialogCode::Accepted);
|
done(DialogCode::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasicSourceSelect::on_buttonBox_rejected()
|
void OBSBasicSourceSelect::on_buttonBox_rejected()
|
||||||
{
|
{
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
done(DialogCode::Rejected);
|
done(DialogCode::Rejected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +378,8 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_,
|
|||||||
} else {
|
} else {
|
||||||
obs_enum_sources(EnumSources, this);
|
obs_enum_sources(EnumSources, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App()->DisableHotkeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBSBasicSourceSelect::SourcePaste(const char *name, bool visible, bool dup)
|
void OBSBasicSourceSelect::SourcePaste(const char *name, bool visible, bool dup)
|
||||||
|
@ -67,6 +67,7 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
|||||||
const QString &text, std::string &userTextInput,
|
const QString &text, std::string &userTextInput,
|
||||||
const QString &placeHolder, int maxSize)
|
const QString &placeHolder, int maxSize)
|
||||||
{
|
{
|
||||||
|
App()->DisableHotkeys();
|
||||||
if (maxSize <= 0 || maxSize > 32767)
|
if (maxSize <= 0 || maxSize > 32767)
|
||||||
maxSize = 170;
|
maxSize = 170;
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
|||||||
}
|
}
|
||||||
userTextInput = dialog.userText->text().toUtf8().constData();
|
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||||
CleanWhitespace(userTextInput);
|
CleanWhitespace(userTextInput);
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +96,7 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
|
|||||||
bool &optionChecked,
|
bool &optionChecked,
|
||||||
const QString &placeHolder)
|
const QString &placeHolder)
|
||||||
{
|
{
|
||||||
|
App()->DisableHotkeys();
|
||||||
NameDialog dialog(parent);
|
NameDialog dialog(parent);
|
||||||
dialog.setWindowTitle(title);
|
dialog.setWindowTitle(title);
|
||||||
|
|
||||||
@ -110,5 +113,6 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
|
|||||||
userTextInput = dialog.userText->text().toUtf8().constData();
|
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||||
CleanWhitespace(userTextInput);
|
CleanWhitespace(userTextInput);
|
||||||
optionChecked = dialog.checkbox->isChecked();
|
optionChecked = dialog.checkbox->isChecked();
|
||||||
|
App()->UpdateHotkeyFocusSetting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user