Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
37069d37
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,发现更多精彩内容 >>
提交
37069d37
编写于
11月 01, 2014
作者:
P
Palana
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add Start/Stop Recording/Streaming hotkeys
上级
6192b34a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
81 addition
and
0 deletion
+81
-0
obs/data/locale/en-US.ini
obs/data/locale/en-US.ini
+4
-0
obs/window-basic-main.cpp
obs/window-basic-main.cpp
+74
-0
obs/window-basic-main.hpp
obs/window-basic-main.hpp
+3
-0
未找到文件。
obs/data/locale/en-US.ini
浏览文件 @
37069d37
...
...
@@ -362,6 +362,10 @@ Basic.Settings.Hotkeys="Hotkeys"
Basic.Settings.Hotkeys.Pair
=
"Key combinations shared with '%1' act as toggles"
# basic mode hotkeys
Basic.Hotkeys.StartStreaming
=
"Start Streaming"
Basic.Hotkeys.StopStreaming
=
"Stop Streaming"
Basic.Hotkeys.StartRecording
=
"Start Recording"
Basic.Hotkeys.StopRecording
=
"Stop Recording"
Basic.Hotkeys.SelectScene
=
"Switch to scene"
# hotkeys that may lack translation on certain operating systems
...
...
obs/window-basic-main.cpp
浏览文件 @
37069d37
...
...
@@ -662,6 +662,7 @@ void OBSBasic::OBSInit()
obs_load_all_modules
();
ResetOutputs
();
CreateHotkeys
();
if
(
!
InitService
())
throw
"Failed to initialize service"
;
...
...
@@ -750,6 +751,77 @@ void OBSBasic::HotkeyTriggered(void *data, obs_hotkey_id id, bool pressed)
Q_ARG
(
obs_hotkey_id
,
id
),
Q_ARG
(
bool
,
pressed
));
}
void
OBSBasic
::
CreateHotkeys
()
{
auto
LoadHotkeyData
=
[
&
](
const
char
*
name
)
->
OBSData
{
const
char
*
info
=
config_get_string
(
basicConfig
,
"Hotkeys"
,
name
);
if
(
!
info
)
return
{};
obs_data_t
*
data
=
obs_data_create_from_json
(
info
);
if
(
!
data
)
return
{};
OBSData
res
=
data
;
obs_data_release
(
data
);
return
res
;
};
auto
LoadHotkeyPair
=
[
&
](
obs_hotkey_pair_id
id
,
const
char
*
name0
,
const
char
*
name1
)
{
obs_data_array_t
*
array0
=
obs_data_get_array
(
LoadHotkeyData
(
name0
),
"bindings"
);
obs_data_array_t
*
array1
=
obs_data_get_array
(
LoadHotkeyData
(
name1
),
"bindings"
);
obs_hotkey_pair_load
(
id
,
array0
,
array1
);
obs_data_array_release
(
array0
);
obs_data_array_release
(
array1
);
};
#define MAKE_CALLBACK(pred, method) \
[](void *data, obs_hotkey_pair_id, obs_hotkey_t*, bool pressed) \
{ \
OBSBasic &basic = *static_cast<OBSBasic*>(data); \
if (pred && pressed) { \
method(); \
return true; \
} \
return false; \
}
streamingHotkeys
=
obs_hotkey_pair_register_frontend
(
"OBSBasic.StartStreaming"
,
Str
(
"Basic.Hotkeys.StartStreaming"
),
"OBSBasic.StopStreaming"
,
Str
(
"Basic.Hotkeys.StopStreaming"
),
MAKE_CALLBACK
(
!
basic
.
outputHandler
->
StreamingActive
(),
basic
.
StartStreaming
),
MAKE_CALLBACK
(
basic
.
outputHandler
->
StreamingActive
(),
basic
.
StopStreaming
),
this
,
this
);
LoadHotkeyPair
(
streamingHotkeys
,
"OBSBasic.StartStreaming"
,
"OBSBasic.StopStreaming"
);
recordingHotkeys
=
obs_hotkey_pair_register_frontend
(
"OBSBasic.StartRecording"
,
Str
(
"Basic.Hotkeys.StartRecording"
),
"OBSBasic.StopRecording"
,
Str
(
"Basic.Hotkeys.StopRecording"
),
MAKE_CALLBACK
(
!
basic
.
outputHandler
->
RecordingActive
(),
basic
.
StartRecording
),
MAKE_CALLBACK
(
basic
.
outputHandler
->
RecordingActive
(),
basic
.
StopRecording
),
this
,
this
);
LoadHotkeyPair
(
recordingHotkeys
,
"OBSBasic.StartRecording"
,
"OBSBasic.StopRecording"
);
#undef MAKE_CALLBACK
}
OBSBasic
::~
OBSBasic
()
{
bool
previewEnabled
=
obs_preview_enabled
();
...
...
@@ -764,6 +836,8 @@ OBSBasic::~OBSBasic()
os_cpu_usage_info_destroy
(
cpuUsageInfo
);
obs_hotkey_set_callback_routing_func
(
nullptr
,
nullptr
);
obs_hotkey_pair_unregister
(
streamingHotkeys
);
obs_hotkey_pair_unregister
(
recordingHotkeys
);
service
=
nullptr
;
outputHandler
.
reset
();
...
...
obs/window-basic-main.hpp
浏览文件 @
37069d37
...
...
@@ -113,6 +113,7 @@ private:
void
Load
(
const
char
*
file
);
void
InitHotkeys
();
void
CreateHotkeys
();
bool
InitService
();
...
...
@@ -151,6 +152,8 @@ private:
void
Nudge
(
int
dist
,
MoveDir
dir
);
void
OpenProjector
(
obs_source_t
*
source
,
int
monitor
);
obs_hotkey_pair_id
streamingHotkeys
,
recordingHotkeys
;
public
slots
:
void
StartStreaming
();
void
StopStreaming
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录