mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-02-28 04:19:05 -05:00
Merge pull request #1949 from jb-alvarado/master
UI: Add ability to disable hotkeys when not in focus
This commit is contained in:
@@ -464,10 +464,20 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
HookWidget(ui->bindToIP, COMBO_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->disableFocusHotkeys, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->hotkeyFocusType, COMBO_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED);
|
||||
/* clang-format on */
|
||||
|
||||
#define ADD_HOTKEY_FOCUS_TYPE(s) \
|
||||
ui->hotkeyFocusType->addItem( \
|
||||
QTStr("Basic.Settings.Advanced.Hotkeys." s), s)
|
||||
|
||||
ADD_HOTKEY_FOCUS_TYPE("NeverDisableHotkeys");
|
||||
ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysInFocus");
|
||||
ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysOutOfFocus");
|
||||
|
||||
#undef ADD_HOTKEY_FOCUS_TYPE
|
||||
|
||||
ui->simpleOutputVBitrate->setSingleStep(50);
|
||||
ui->simpleOutputVBitrate->setSuffix(" Kbps");
|
||||
ui->advOutFFVBitrate->setSingleStep(50);
|
||||
@@ -742,16 +752,15 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
|
||||
UpdateAutomaticReplayBufferCheckboxes();
|
||||
|
||||
App()->EnableInFocusHotkeys(false);
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
OBSBasicSettings::~OBSBasicSettings()
|
||||
{
|
||||
bool disableHotkeysInFocus = config_get_bool(
|
||||
App()->GlobalConfig(), "General", "DisableHotkeysInFocus");
|
||||
delete ui->filenameFormatting->completer();
|
||||
main->EnableOutputs(true);
|
||||
App()->EnableInFocusHotkeys(!disableHotkeysInFocus);
|
||||
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
|
||||
EnableThreadedMessageBoxes(false);
|
||||
}
|
||||
@@ -2253,6 +2262,8 @@ void OBSBasicSettings::LoadAdvancedSettings()
|
||||
int rbTime = config_get_int(main->Config(), "AdvOut", "RecRBTime");
|
||||
int rbSize = config_get_int(main->Config(), "AdvOut", "RecRBSize");
|
||||
bool autoRemux = config_get_bool(main->Config(), "Video", "AutoRemux");
|
||||
const char *hotkeyFocusType = config_get_string(
|
||||
App()->GlobalConfig(), "General", "HotkeyFocusType");
|
||||
|
||||
loading = true;
|
||||
|
||||
@@ -2325,9 +2336,7 @@ void OBSBasicSettings::LoadAdvancedSettings()
|
||||
ui->browserHWAccel->setChecked(browserHWAccel);
|
||||
#endif
|
||||
|
||||
bool disableFocusHotkeys = config_get_bool(
|
||||
App()->GlobalConfig(), "General", "DisableHotkeysInFocus");
|
||||
ui->disableFocusHotkeys->setChecked(disableFocusHotkeys);
|
||||
SetComboByValue(ui->hotkeyFocusType, hotkeyFocusType);
|
||||
|
||||
loading = false;
|
||||
}
|
||||
@@ -2930,9 +2939,11 @@ void OBSBasicSettings::SaveAdvancedSettings()
|
||||
browserHWAccel);
|
||||
#endif
|
||||
|
||||
bool disableFocusHotkeys = ui->disableFocusHotkeys->isChecked();
|
||||
config_set_bool(App()->GlobalConfig(), "General",
|
||||
"DisableHotkeysInFocus", disableFocusHotkeys);
|
||||
if (WidgetChanged(ui->hotkeyFocusType)) {
|
||||
QString str = GetComboData(ui->hotkeyFocusType);
|
||||
config_set_string(App()->GlobalConfig(), "General",
|
||||
"HotkeyFocusType", QT_TO_UTF8(str));
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (WidgetChanged(ui->disableOSXVSync)) {
|
||||
|
||||
Reference in New Issue
Block a user