Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
dfc8f517
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,发现更多精彩内容 >>
提交
dfc8f517
编写于
6月 15, 2014
作者:
P
Palana
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make properties-view reflect autoselect settings (for property lists)
上级
c2bb9525
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
59 addition
and
17 deletion
+59
-17
build/data/obs-studio/locale/en.txt
build/data/obs-studio/locale/en.txt
+3
-0
obs/properties-view.cpp
obs/properties-view.cpp
+56
-17
未找到文件。
build/data/obs-studio/locale/en.txt
浏览文件 @
dfc8f517
...
...
@@ -66,6 +66,9 @@ Basic.Main.DefaultSceneName.Text="Scene %1"
Basic.SourceSelect.CreateNew="Create new"
Basic.SourceSelect.AddExisting="Add Existing"
# properties window
Basic.PropertiesWindow.AutoSelectFormat="%1 (unsupported; autoselect: %2)"
# transform window
Basic.TransformWindow="Scene Item Transform"
Basic.TransformWindow.Position="Position"
...
...
obs/properties-view.cpp
浏览文件 @
dfc8f517
...
...
@@ -9,6 +9,7 @@
#include <QStandardItem>
#include "qt-wrappers.hpp"
#include "properties-view.hpp"
#include "obs-app.hpp"
#include <string>
using
namespace
std
;
...
...
@@ -172,6 +173,39 @@ static void AddComboItem(QComboBox *combo, obs_property_t prop,
item
->
setFlags
(
Qt
::
NoItemFlags
);
}
template
<
long
long
get_int
(
obs_data_t
,
const
char
*
),
double
get_double
(
obs_data_t
,
const
char
*
),
const
char
*
get_string
(
obs_data_t
,
const
char
*
)>
static
string
from_obs_data
(
obs_data_t
data
,
const
char
*
name
,
obs_combo_format
format
)
{
switch
(
format
)
{
case
OBS_COMBO_FORMAT_INT
:
return
to_string
(
get_int
(
data
,
name
));
case
OBS_COMBO_FORMAT_FLOAT
:
return
to_string
(
get_double
(
data
,
name
));
case
OBS_COMBO_FORMAT_STRING
:
return
get_string
(
data
,
name
);
default:
return
""
;
}
}
static
string
from_obs_data
(
obs_data_t
data
,
const
char
*
name
,
obs_combo_format
format
)
{
return
from_obs_data
<
obs_data_getint
,
obs_data_getdouble
,
obs_data_getstring
>
(
data
,
name
,
format
);
}
static
string
from_obs_data_autoselect
(
obs_data_t
data
,
const
char
*
name
,
obs_combo_format
format
)
{
return
from_obs_data
<
obs_data_get_autoselect_int
,
obs_data_get_autoselect_double
,
obs_data_get_autoselect_string
>
(
data
,
name
,
format
);
}
QWidget
*
OBSPropertiesView
::
AddList
(
obs_property_t
prop
,
bool
&
warning
)
{
const
char
*
name
=
obs_property_name
(
prop
);
...
...
@@ -187,24 +221,13 @@ QWidget *OBSPropertiesView::AddList(obs_property_t prop, bool &warning)
if
(
type
==
OBS_COMBO_TYPE_EDITABLE
)
combo
->
setEditable
(
true
);
if
(
format
==
OBS_COMBO_FORMAT_INT
)
{
int
val
=
(
int
)
obs_data_getint
(
settings
,
name
);
string
valString
=
to_string
(
val
);
idx
=
combo
->
findData
(
QT_UTF8
(
valString
.
c_str
()));
}
else
if
(
format
==
OBS_COMBO_FORMAT_FLOAT
)
{
double
val
=
obs_data_getdouble
(
settings
,
name
);
string
valString
=
to_string
(
val
);
idx
=
combo
->
findData
(
QT_UTF8
(
valString
.
c_str
()));
string
value
=
from_obs_data
(
settings
,
name
,
format
);
}
else
if
(
format
==
OBS_COMBO_FORMAT_STRING
)
{
const
char
*
val
=
obs_data_getstring
(
settings
,
name
);
if
(
type
==
OBS_COMBO_TYPE_EDITABLE
)
combo
->
lineEdit
()
->
setText
(
val
);
else
idx
=
combo
->
findData
(
QT_UTF8
(
val
));
}
if
(
format
==
OBS_COMBO_FORMAT_STRING
&&
type
==
OBS_COMBO_TYPE_EDITABLE
)
combo
->
lineEdit
()
->
setText
(
QT_UTF8
(
value
.
c_str
()));
else
idx
=
combo
->
findData
(
QT_UTF8
(
value
.
c_str
()));
if
(
type
==
OBS_COMBO_TYPE_EDITABLE
)
return
NewWidget
(
prop
,
combo
,
...
...
@@ -212,6 +235,22 @@ QWidget *OBSPropertiesView::AddList(obs_property_t prop, bool &warning)
if
(
idx
!=
-
1
)
combo
->
setCurrentIndex
(
idx
);
if
(
obs_data_has_autoselect
(
settings
,
name
))
{
string
autoselect
=
from_obs_data_autoselect
(
settings
,
name
,
format
);
int
id
=
combo
->
findData
(
QT_UTF8
(
autoselect
.
c_str
()));
if
(
id
!=
-
1
&&
id
!=
idx
)
{
QString
actual
=
combo
->
itemText
(
id
);
QString
selected
=
combo
->
itemText
(
idx
);
QString
combined
=
QTStr
(
"Basic.PropertiesWindow.AutoSelectFormat"
);
combo
->
setItemText
(
idx
,
combined
.
arg
(
selected
).
arg
(
actual
));
}
}
QAbstractItemModel
*
model
=
combo
->
model
();
warning
=
idx
!=
-
1
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录