Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
bcd491a3
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,发现更多精彩内容 >>
提交
bcd491a3
编写于
3月 25, 2017
作者:
C
cg2121
提交者:
jp9000
3月 25, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add copying/pasting of sources/filters
Closes jp9000/obs-studio#860
上级
1ef7a48e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
184 addition
and
2 deletion
+184
-2
UI/data/locale/en-US.ini
UI/data/locale/en-US.ini
+8
-0
UI/forms/OBSBasic.ui
UI/forms/OBSBasic.ui
+50
-0
UI/window-basic-main-scene-collections.cpp
UI/window-basic-main-scene-collections.cpp
+2
-0
UI/window-basic-main.cpp
UI/window-basic-main.cpp
+72
-0
UI/window-basic-main.hpp
UI/window-basic-main.hpp
+11
-0
UI/window-basic-source-select.cpp
UI/window-basic-source-select.cpp
+39
-2
UI/window-basic-source-select.hpp
UI/window-basic-source-select.hpp
+2
-0
未找到文件。
UI/data/locale/en-US.ini
浏览文件 @
bcd491a3
...
@@ -61,6 +61,14 @@ Deprecated="Deprecated"
...
@@ -61,6 +61,14 @@ Deprecated="Deprecated"
ReplayBuffer
=
"Replay Buffer"
ReplayBuffer
=
"Replay Buffer"
Import
=
"Import"
Import
=
"Import"
Export
=
"Export"
Export
=
"Export"
Copy
=
"Copy"
Paste
=
"Paste"
PasteReference
=
"Paste (Reference)"
PasteDuplicate
=
"Paste (Duplicate)"
# copy filters
Copy.Filters
=
"Copy Filters"
Paste.Filters
=
"Paste Filters"
# updater
# updater
Updater.Title
=
"New update available"
Updater.Title
=
"New update available"
...
...
UI/forms/OBSBasic.ui
浏览文件 @
bcd491a3
...
@@ -892,6 +892,51 @@
...
@@ -892,6 +892,51 @@
<addaction
name=
"actionScaleCanvas"
/>
<addaction
name=
"actionScaleCanvas"
/>
<addaction
name=
"actionScaleOutput"
/>
<addaction
name=
"actionScaleOutput"
/>
</widget>
</widget>
<action
name=
"actionCopySource"
>
<property
name=
"text"
>
<string>
Copy
</string>
</property>
<property
name=
"shortcut"
>
<string>
Ctrl+C
</string>
</property>
</action>
<action
name=
"actionPasteRef"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
PasteReference
</string>
</property>
<property
name=
"iconText"
>
<string>
PasteReference
</string>
</property>
<property
name=
"toolTip"
>
<string>
PasteReference
</string>
</property>
<property
name=
"shortcut"
>
<string>
Ctrl+V
</string>
</property>
</action>
<action
name=
"actionCopyFilters"
>
<property
name=
"text"
>
<string>
Copy.Filters
</string>
</property>
</action>
<action
name=
"actionPasteFilters"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
Paste.Filters
</string>
</property>
</action>
<addaction
name=
"actionCopySource"
/>
<addaction
name=
"actionPasteRef"
/>
<addaction
name=
"actionPasteDup"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionCopyFilters"
/>
<addaction
name=
"actionPasteFilters"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"transformMenu"
/>
<addaction
name=
"transformMenu"
/>
<addaction
name=
"orderMenu"
/>
<addaction
name=
"orderMenu"
/>
<addaction
name=
"scalingMenu"
/>
<addaction
name=
"scalingMenu"
/>
...
@@ -1409,6 +1454,11 @@
...
@@ -1409,6 +1454,11 @@
<string>
Basic.MainMenu.Edit.Scale.Output
</string>
<string>
Basic.MainMenu.Edit.Scale.Output
</string>
</property>
</property>
</action>
</action>
<action
name=
"actionPasteDup"
>
<property
name=
"text"
>
<string>
PasteDuplicate
</string>
</property>
</action>
</widget>
</widget>
<customwidgets>
<customwidgets>
<customwidget>
<customwidget>
...
...
UI/window-basic-main-scene-collections.cpp
浏览文件 @
bcd491a3
...
@@ -225,6 +225,8 @@ void OBSBasic::RefreshSceneCollections()
...
@@ -225,6 +225,8 @@ void OBSBasic::RefreshSceneCollections()
OBSBasic
*
main
=
reinterpret_cast
<
OBSBasic
*>
(
App
()
->
GetMainWindow
());
OBSBasic
*
main
=
reinterpret_cast
<
OBSBasic
*>
(
App
()
->
GetMainWindow
());
main
->
OpenSavedProjectors
();
main
->
OpenSavedProjectors
();
main
->
ui
->
actionPasteRef
->
setEnabled
(
false
);
main
->
ui
->
actionPasteDup
->
setEnabled
(
false
);
}
}
void
OBSBasic
::
on_actionNewSceneCollection_triggered
()
void
OBSBasic
::
on_actionNewSceneCollection_triggered
()
...
...
UI/window-basic-main.cpp
浏览文件 @
bcd491a3
...
@@ -3347,6 +3347,19 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
...
@@ -3347,6 +3347,19 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
if
(
addSourceMenu
)
if
(
addSourceMenu
)
popup
.
addMenu
(
addSourceMenu
);
popup
.
addMenu
(
addSourceMenu
);
ui
->
actionCopyFilters
->
setEnabled
(
false
);
popup
.
addSeparator
();
popup
.
addAction
(
ui
->
actionCopySource
);
popup
.
addAction
(
ui
->
actionPasteRef
);
popup
.
addAction
(
ui
->
actionPasteDup
);
popup
.
addSeparator
();
popup
.
addSeparator
();
popup
.
addAction
(
ui
->
actionCopyFilters
);
popup
.
addAction
(
ui
->
actionPasteFilters
);
popup
.
addSeparator
();
if
(
item
)
{
if
(
item
)
{
if
(
addSourceMenu
)
if
(
addSourceMenu
)
popup
.
addSeparator
();
popup
.
addSeparator
();
...
@@ -3393,6 +3406,8 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
...
@@ -3393,6 +3406,8 @@ void OBSBasic::CreateSourcePopupMenu(QListWidgetItem *item, bool preview)
SLOT
(
OpenFilters
()));
SLOT
(
OpenFilters
()));
popup
.
addAction
(
QTStr
(
"Properties"
),
this
,
popup
.
addAction
(
QTStr
(
"Properties"
),
this
,
SLOT
(
on_actionSourceProperties_triggered
()));
SLOT
(
on_actionSourceProperties_triggered
()));
ui
->
actionCopyFilters
->
setEnabled
(
true
);
}
}
popup
.
exec
(
QCursor
::
pos
());
popup
.
exec
(
QCursor
::
pos
());
...
@@ -5270,3 +5285,60 @@ bool OBSBasic::sysTrayMinimizeToTray()
...
@@ -5270,3 +5285,60 @@ bool OBSBasic::sysTrayMinimizeToTray()
return
config_get_bool
(
GetGlobalConfig
(),
return
config_get_bool
(
GetGlobalConfig
(),
"BasicWindow"
,
"SysTrayMinimizeToTray"
);
"BasicWindow"
,
"SysTrayMinimizeToTray"
);
}
}
void
OBSBasic
::
on_actionCopySource_triggered
()
{
on_actionCopyTransform_triggered
();
OBSSceneItem
item
=
GetCurrentSceneItem
();
if
(
!
item
)
return
;
OBSSource
source
=
obs_sceneitem_get_source
(
item
);
copyString
=
obs_source_get_name
(
source
);
copyVisible
=
obs_sceneitem_visible
(
item
);
ui
->
actionPasteRef
->
setEnabled
(
true
);
ui
->
actionPasteDup
->
setEnabled
(
true
);
}
void
OBSBasic
::
on_actionPasteRef_triggered
()
{
OBSBasicSourceSelect
::
SourcePaste
(
copyString
,
copyVisible
,
false
);
on_actionPasteTransform_triggered
();
}
void
OBSBasic
::
on_actionPasteDup_triggered
()
{
OBSBasicSourceSelect
::
SourcePaste
(
copyString
,
copyVisible
,
true
);
on_actionPasteTransform_triggered
();
}
void
OBSBasic
::
on_actionCopyFilters_triggered
()
{
OBSSceneItem
item
=
GetCurrentSceneItem
();
if
(
!
item
)
return
;
OBSSource
source
=
obs_sceneitem_get_source
(
item
);
copyFiltersString
=
obs_source_get_name
(
source
);
ui
->
actionPasteFilters
->
setEnabled
(
true
);
}
void
OBSBasic
::
on_actionPasteFilters_triggered
()
{
OBSSource
source
=
obs_get_source_by_name
(
copyFiltersString
);
OBSSceneItem
sceneItem
=
GetCurrentSceneItem
();
OBSSource
dstSource
=
obs_sceneitem_get_source
(
sceneItem
);
if
(
source
==
dstSource
)
return
;
obs_source_copy_filters
(
dstSource
,
source
);
}
UI/window-basic-main.hpp
浏览文件 @
bcd491a3
...
@@ -119,6 +119,10 @@ private:
...
@@ -119,6 +119,10 @@ private:
bool
projectChanged
=
false
;
bool
projectChanged
=
false
;
bool
previewEnabled
=
true
;
bool
previewEnabled
=
true
;
const
char
*
copyString
;
const
char
*
copyFiltersString
;
bool
copyVisible
=
true
;
QPointer
<
QThread
>
updateCheckThread
;
QPointer
<
QThread
>
updateCheckThread
;
QPointer
<
QThread
>
logUploadThread
;
QPointer
<
QThread
>
logUploadThread
;
...
@@ -413,6 +417,13 @@ private slots:
...
@@ -413,6 +417,13 @@ private slots:
void
ToggleShowHide
();
void
ToggleShowHide
();
void
on_actionCopySource_triggered
();
void
on_actionPasteRef_triggered
();
void
on_actionPasteDup_triggered
();
void
on_actionCopyFilters_triggered
();
void
on_actionPasteFilters_triggered
();
private:
private:
/* OBS Callbacks */
/* OBS Callbacks */
static
void
SceneReordered
(
void
*
data
,
calldata_t
*
params
);
static
void
SceneReordered
(
void
*
data
,
calldata_t
*
params
);
...
...
UI/window-basic-source-select.cpp
浏览文件 @
bcd491a3
...
@@ -93,7 +93,28 @@ static void AddSource(void *_data, obs_scene_t *scene)
...
@@ -93,7 +93,28 @@ static void AddSource(void *_data, obs_scene_t *scene)
obs_sceneitem_set_visible
(
sceneitem
,
data
->
visible
);
obs_sceneitem_set_visible
(
sceneitem
,
data
->
visible
);
}
}
static
void
AddExisting
(
const
char
*
name
,
const
bool
visible
)
static
char
*
get_new_source_name
(
const
char
*
name
)
{
struct
dstr
new_name
=
{
0
};
int
inc
=
0
;
dstr_copy
(
&
new_name
,
name
);
for
(;;)
{
obs_source_t
*
existing_source
=
obs_get_source_by_name
(
new_name
.
array
);
if
(
!
existing_source
)
break
;
obs_source_release
(
existing_source
);
dstr_printf
(
&
new_name
,
"%s %d"
,
name
,
++
inc
+
1
);
}
return
new_name
.
array
;
}
static
void
AddExisting
(
const
char
*
name
,
bool
visible
,
bool
duplicate
)
{
{
OBSBasic
*
main
=
reinterpret_cast
<
OBSBasic
*>
(
App
()
->
GetMainWindow
());
OBSBasic
*
main
=
reinterpret_cast
<
OBSBasic
*>
(
App
()
->
GetMainWindow
());
OBSScene
scene
=
main
->
GetCurrentScene
();
OBSScene
scene
=
main
->
GetCurrentScene
();
...
@@ -102,6 +123,17 @@ static void AddExisting(const char *name, const bool visible)
...
@@ -102,6 +123,17 @@ static void AddExisting(const char *name, const bool visible)
obs_source_t
*
source
=
obs_get_source_by_name
(
name
);
obs_source_t
*
source
=
obs_get_source_by_name
(
name
);
if
(
source
)
{
if
(
source
)
{
if
(
duplicate
)
{
obs_source_t
*
from
=
source
;
char
*
new_name
=
get_new_source_name
(
name
);
source
=
obs_source_duplicate
(
from
,
new_name
,
false
);
bfree
(
new_name
);
obs_source_release
(
from
);
if
(
!
source
)
return
;
}
AddSourceData
data
;
AddSourceData
data
;
data
.
source
=
source
;
data
.
source
=
source
;
data
.
visible
=
visible
;
data
.
visible
=
visible
;
...
@@ -155,7 +187,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
...
@@ -155,7 +187,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
if
(
!
item
)
if
(
!
item
)
return
;
return
;
AddExisting
(
QT_TO_UTF8
(
item
->
text
()),
visible
);
AddExisting
(
QT_TO_UTF8
(
item
->
text
()),
visible
,
false
);
}
else
{
}
else
{
if
(
ui
->
sourceName
->
text
().
isEmpty
())
{
if
(
ui
->
sourceName
->
text
().
isEmpty
())
{
QMessageBox
::
information
(
this
,
QMessageBox
::
information
(
this
,
...
@@ -243,3 +275,8 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_)
...
@@ -243,3 +275,8 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_)
obs_enum_sources
(
EnumSources
,
this
);
obs_enum_sources
(
EnumSources
,
this
);
}
}
}
}
void
OBSBasicSourceSelect
::
SourcePaste
(
const
char
*
name
,
bool
visible
,
bool
dup
)
{
AddExisting
(
name
,
visible
,
dup
);
}
UI/window-basic-source-select.hpp
浏览文件 @
bcd491a3
...
@@ -47,4 +47,6 @@ public:
...
@@ -47,4 +47,6 @@ public:
OBSBasicSourceSelect
(
OBSBasic
*
parent
,
const
char
*
id
);
OBSBasicSourceSelect
(
OBSBasic
*
parent
,
const
char
*
id
);
OBSSource
newSource
;
OBSSource
newSource
;
static
void
SourcePaste
(
const
char
*
name
,
bool
visible
,
bool
duplicate
);
};
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录