Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
19464e65
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
19464e65
编写于
7月 22, 2019
作者:
J
Jonathan Baecker
提交者:
jp9000
7月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add ability to disable hotkeys when not in focus
上级
985772d9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
89 addition
and
38 deletion
+89
-38
UI/data/locale/en-US.ini
UI/data/locale/en-US.ini
+3
-0
UI/forms/OBSBasicSettings.ui
UI/forms/OBSBasicSettings.ui
+20
-15
UI/obs-app.cpp
UI/obs-app.cpp
+41
-11
UI/obs-app.hpp
UI/obs-app.hpp
+3
-1
UI/window-basic-settings.cpp
UI/window-basic-settings.cpp
+22
-11
未找到文件。
UI/data/locale/en-US.ini
浏览文件 @
19464e65
...
...
@@ -831,7 +831,10 @@ Basic.Settings.Advanced.Network="Network"
Basic.Settings.Advanced.Network.BindToIP
=
"Bind to IP"
Basic.Settings.Advanced.Network.EnableNewSocketLoop
=
"Enable new networking code"
Basic.Settings.Advanced.Network.EnableLowLatencyMode
=
"Low latency mode"
Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior
=
"Hotkey Focus Behavior"
Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys
=
"Never disable hotkeys"
Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus
=
"Disable hotkeys when main window is in focus"
Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus
=
"Disable hotkeys when main window is not in focus"
Basic.Settings.Advanced.AutoRemux
=
"Automatically remux to mp4"
Basic.Settings.Advanced.AutoRemux.MP4
=
"(record as mkv)"
...
...
UI/forms/OBSBasicSettings.ui
浏览文件 @
19464e65
...
...
@@ -151,8 +151,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
80
6
</width>
<height>
1225
</height>
<width>
80
3
</width>
<height>
954
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_19"
>
...
...
@@ -1173,8 +1173,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
813
</width>
<height>
76
1
</height>
<width>
601
</width>
<height>
63
1
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_21"
>
...
...
@@ -3621,8 +3621,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
767
</width>
<height>
582
</height>
<width>
555
</width>
<height>
469
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_50"
>
...
...
@@ -4436,9 +4436,9 @@
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
80
6
</width>
<height>
933
</height>
<y>
-114
</y>
<width>
80
3
</width>
<height>
761
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_23"
>
...
...
@@ -5136,17 +5136,23 @@
<string>
Basic.Settings.Hotkeys
</string>
</property>
<layout
class=
"QFormLayout"
name=
"formLayout_33"
>
<property
name=
"labelAlignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
<property
name=
"topMargin"
>
<number>
2
</number>
</property>
<item
row=
"0"
column=
"
1
"
>
<widget
class=
"Q
CheckBox"
name=
"disableFocusHotkeys
"
>
<item
row=
"0"
column=
"
0
"
>
<widget
class=
"Q
Label"
name=
"label_21
"
>
<property
name=
"text"
>
<string>
Basic.Settings.Advanced.Hotkeys.
DisableHotkeysInFocus
</string>
<string>
Basic.Settings.Advanced.Hotkeys.
HotkeyFocusBehavior
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"hotkeyFocusType"
/>
</item>
<item
row=
"1"
column=
"0"
>
<spacer
name=
"horizontalSpacer_14"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -5154,7 +5160,7 @@
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
170
</width>
<height>
2
0
</height>
<height>
0
</height>
</size>
</property>
</spacer>
...
...
@@ -5399,7 +5405,6 @@
<tabstop>
enableNewSocketLoop
</tabstop>
<tabstop>
enableLowLatencyMode
</tabstop>
<tabstop>
browserHWAccel
</tabstop>
<tabstop>
disableFocusHotkeys
</tabstop>
</tabstops>
<resources>
<include
location=
"obs.qrc"
/>
...
...
UI/obs-app.cpp
浏览文件 @
19464e65
...
...
@@ -432,6 +432,9 @@ bool OBSApp::InitGlobalConfigDefaults()
"CurrentTheme"
,
DEFAULT_THEME
);
}
config_set_default_string
(
globalConfig
,
"General"
,
"HotkeyFocusType"
,
"NeverDisableHotkeys"
);
config_set_default_bool
(
globalConfig
,
"BasicWindow"
,
"VerticalVolControl"
,
false
);
...
...
@@ -699,9 +702,10 @@ bool OBSApp::InitGlobalConfig()
}
}
uint32_t
lastVersion
=
config_get_int
(
globalConfig
,
"General"
,
"LastVersion"
);
if
(
!
config_has_user_value
(
globalConfig
,
"General"
,
"Pre19Defaults"
))
{
uint32_t
lastVersion
=
config_get_int
(
globalConfig
,
"General"
,
"LastVersion"
);
bool
useOldDefaults
=
lastVersion
&&
lastVersion
<
MAKE_SEMANTIC_VERSION
(
19
,
0
,
0
);
...
...
@@ -712,8 +716,6 @@ bool OBSApp::InitGlobalConfig()
}
if
(
!
config_has_user_value
(
globalConfig
,
"General"
,
"Pre21Defaults"
))
{
uint32_t
lastVersion
=
config_get_int
(
globalConfig
,
"General"
,
"LastVersion"
);
bool
useOldDefaults
=
lastVersion
&&
lastVersion
<
MAKE_SEMANTIC_VERSION
(
21
,
0
,
0
);
...
...
@@ -724,8 +726,6 @@ bool OBSApp::InitGlobalConfig()
}
if
(
!
config_has_user_value
(
globalConfig
,
"General"
,
"Pre23Defaults"
))
{
uint32_t
lastVersion
=
config_get_int
(
globalConfig
,
"General"
,
"LastVersion"
);
bool
useOldDefaults
=
lastVersion
&&
lastVersion
<
MAKE_SEMANTIC_VERSION
(
23
,
0
,
0
);
...
...
@@ -742,6 +742,16 @@ bool OBSApp::InitGlobalConfig()
changed
|=
UpdatePre22MultiviewLayout
(
layout
);
}
if
(
lastVersion
&&
lastVersion
<
MAKE_SEMANTIC_VERSION
(
24
,
0
,
0
))
{
bool
disableHotkeysInFocus
=
config_get_bool
(
globalConfig
,
"General"
,
"DisableHotkeysInFocus"
);
if
(
disableHotkeysInFocus
)
config_set_string
(
globalConfig
,
"General"
,
"HotkeyFocusType"
,
"DisableHotkeysInFocus"
);
changed
=
true
;
}
if
(
changed
)
config_save_safe
(
globalConfig
,
"tmp"
,
nullptr
);
...
...
@@ -1227,8 +1237,7 @@ void OBSApp::AppInit()
EnableOSXVSync
(
false
);
#endif
enableHotkeysInFocus
=
!
config_get_bool
(
globalConfig
,
"General"
,
"DisableHotkeysInFocus"
);
UpdateHotkeyFocusSetting
(
false
);
move_basic_to_profiles
();
move_basic_to_scene_collections
();
...
...
@@ -1257,12 +1266,33 @@ static bool StartupOBS(const char *locale, profiler_name_store_t *store)
inline
void
OBSApp
::
ResetHotkeyState
(
bool
inFocus
)
{
obs_hotkey_enable_background_press
(
!
inFocus
||
enableHotkeysInFocus
);
obs_hotkey_enable_background_press
(
(
inFocus
&&
enableHotkeysInFocus
)
||
(
!
inFocus
&&
enableHotkeysOutOfFocus
));
}
void
OBSApp
::
UpdateHotkeyFocusSetting
(
bool
resetState
)
{
enableHotkeysInFocus
=
true
;
enableHotkeysOutOfFocus
=
true
;
const
char
*
hotkeyFocusType
=
config_get_string
(
globalConfig
,
"General"
,
"HotkeyFocusType"
);
if
(
astrcmpi
(
hotkeyFocusType
,
"DisableHotkeysInFocus"
)
==
0
)
{
enableHotkeysInFocus
=
false
;
}
else
if
(
astrcmpi
(
hotkeyFocusType
,
"DisableHotkeysOutOfFocus"
)
==
0
)
{
enableHotkeysOutOfFocus
=
false
;
}
if
(
resetState
)
ResetHotkeyState
(
applicationState
()
==
Qt
::
ApplicationActive
);
}
void
OBSApp
::
EnableInFocusHotkeys
(
bool
enable
)
void
OBSApp
::
DisableHotkeys
(
)
{
enableHotkeysInFocus
=
enable
;
enableHotkeysInFocus
=
false
;
enableHotkeysOutOfFocus
=
false
;
ResetHotkeyState
(
applicationState
()
==
Qt
::
ApplicationActive
);
}
...
...
UI/obs-app.hpp
浏览文件 @
19464e65
...
...
@@ -80,6 +80,7 @@ private:
int
sleepInhibitRefs
=
0
;
bool
enableHotkeysInFocus
=
true
;
bool
enableHotkeysOutOfFocus
=
true
;
std
::
deque
<
obs_frontend_translate_ui_cb
>
translatorHooks
;
...
...
@@ -105,7 +106,8 @@ public:
void
AppInit
();
bool
OBSInit
();
void
EnableInFocusHotkeys
(
bool
enable
);
void
UpdateHotkeyFocusSetting
(
bool
reset
=
true
);
void
DisableHotkeys
();
inline
bool
HotkeysEnabledInFocus
()
const
{
...
...
UI/window-basic-settings.cpp
浏览文件 @
19464e65
...
...
@@ -463,10 +463,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
);
...
...
@@ -741,16 +751,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
);
}
...
...
@@ -2243,6 +2252,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
;
...
...
@@ -2315,9 +2326,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
;
}
...
...
@@ -2917,9 +2926,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
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录