Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
f887bc3f
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f887bc3f
编写于
6月 21, 2020
作者:
J
Jim
提交者:
GitHub
6月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2970 from cg2121/adv-audio-config
UI: Add percent checkbox to advanced audio dialog
上级
ef6f94e1
9db6a337
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
40 deletion
+31
-40
UI/window-basic-adv-audio.cpp
UI/window-basic-adv-audio.cpp
+29
-38
UI/window-basic-adv-audio.hpp
UI/window-basic-adv-audio.hpp
+2
-2
未找到文件。
UI/window-basic-adv-audio.cpp
浏览文件 @
f887bc3f
...
...
@@ -26,6 +26,27 @@ OBSBasicAdvAudio::OBSBasicAdvAudio(QWidget *parent)
QWidget
*
widget
;
QLabel
*
label
;
QLabel
*
volLabel
=
new
QLabel
(
QTStr
(
"Basic.AdvAudio.Volume"
));
volLabel
->
setStyleSheet
(
"font-weight: bold;"
);
usePercent
=
new
QCheckBox
();
usePercent
->
setStyleSheet
(
"font-weight: bold;"
);
usePercent
->
setText
(
"%"
);
connect
(
usePercent
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
SetVolumeType
(
bool
)));
VolumeType
volType
=
(
VolumeType
)
config_get_int
(
GetGlobalConfig
(),
"BasicWindow"
,
"AdvAudioVolumeType"
);
if
(
volType
==
VolumeType
::
Percent
)
usePercent
->
setChecked
(
true
);
QHBoxLayout
*
volLayout
=
new
QHBoxLayout
();
volLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
volLayout
->
addWidget
(
volLabel
);
volLayout
->
addStretch
();
volLayout
->
addWidget
(
usePercent
);
int
idx
=
0
;
mainLayout
=
new
QGridLayout
;
mainLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
...
...
@@ -37,9 +58,7 @@ OBSBasicAdvAudio::OBSBasicAdvAudio(QWidget *parent)
label
=
new
QLabel
(
QTStr
(
"Basic.Stats.Status"
));
label
->
setStyleSheet
(
"font-weight: bold;"
);
mainLayout
->
addWidget
(
label
,
0
,
idx
++
);
label
=
new
QLabel
(
QTStr
(
"Basic.AdvAudio.Volume"
));
label
->
setStyleSheet
(
"font-weight: bold;"
);
mainLayout
->
addWidget
(
label
,
0
,
idx
++
);
mainLayout
->
addLayout
(
volLayout
,
0
,
idx
++
);
label
=
new
QLabel
(
QTStr
(
"Basic.AdvAudio.Mono"
));
label
->
setStyleSheet
(
"font-weight: bold;"
);
mainLayout
->
addWidget
(
label
,
0
,
idx
++
);
...
...
@@ -193,10 +212,14 @@ void OBSBasicAdvAudio::SourceRemoved(OBSSource source)
}
}
void
OBSBasicAdvAudio
::
SetVolumeType
()
void
OBSBasicAdvAudio
::
SetVolumeType
(
bool
percent
)
{
QAction
*
action
=
reinterpret_cast
<
QAction
*>
(
sender
());
VolumeType
type
=
(
VolumeType
)
action
->
property
(
"volumeType"
).
toInt
();
VolumeType
type
;
if
(
percent
)
type
=
VolumeType
::
Percent
;
else
type
=
VolumeType
::
dB
;
for
(
size_t
i
=
0
;
i
<
controls
.
size
();
i
++
)
controls
[
i
]
->
SetVolumeWidget
(
type
);
...
...
@@ -205,38 +228,6 @@ void OBSBasicAdvAudio::SetVolumeType()
(
int
)
type
);
}
void
OBSBasicAdvAudio
::
ShowContextMenu
(
const
QPoint
&
pos
)
{
VolumeType
type
=
(
VolumeType
)
config_get_int
(
GetGlobalConfig
(),
"BasicWindow"
,
"AdvAudioVolumeType"
);
QMenu
*
contextMenu
=
new
QMenu
(
this
);
QAction
*
percent
=
new
QAction
(
QTStr
(
"Percent"
),
this
);
QAction
*
dB
=
new
QAction
(
QTStr
(
"dB"
),
this
);
percent
->
setProperty
(
"volumeType"
,
(
int
)
VolumeType
::
Percent
);
dB
->
setProperty
(
"volumeType"
,
(
int
)
VolumeType
::
dB
);
connect
(
percent
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
SetVolumeType
()),
Qt
::
DirectConnection
);
connect
(
dB
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
SetVolumeType
()),
Qt
::
DirectConnection
);
percent
->
setCheckable
(
true
);
dB
->
setCheckable
(
true
);
if
(
type
==
VolumeType
::
Percent
)
percent
->
setChecked
(
true
);
else
if
(
type
==
VolumeType
::
dB
)
dB
->
setChecked
(
true
);
contextMenu
->
addAction
(
dB
);
contextMenu
->
addAction
(
percent
);
contextMenu
->
exec
(
mapToGlobal
(
pos
));
}
void
OBSBasicAdvAudio
::
ActiveOnlyChanged
(
bool
checked
)
{
SetShowInactive
(
!
checked
);
...
...
UI/window-basic-adv-audio.hpp
浏览文件 @
f887bc3f
...
...
@@ -18,6 +18,7 @@ private:
QWidget
*
controlArea
;
QGridLayout
*
mainLayout
;
QPointer
<
QCheckBox
>
activeOnly
;
QPointer
<
QCheckBox
>
usePercent
;
OBSSignal
sourceAddedSignal
;
OBSSignal
sourceRemovedSignal
;
bool
showInactive
;
...
...
@@ -36,8 +37,7 @@ public slots:
void
SourceAdded
(
OBSSource
source
);
void
SourceRemoved
(
OBSSource
source
);
void
ShowContextMenu
(
const
QPoint
&
pos
);
void
SetVolumeType
();
void
SetVolumeType
(
bool
percent
);
void
ActiveOnlyChanged
(
bool
checked
);
public:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录