Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
0ae8a7c0
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,发现更多精彩内容 >>
提交
0ae8a7c0
编写于
8月 30, 2018
作者:
C
cg2121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add ability to style preview background color
上级
8e53932a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
69 addition
and
6 deletion
+69
-6
UI/data/themes/Acri.qss
UI/data/themes/Acri.qss
+6
-0
UI/data/themes/Dark.qss
UI/data/themes/Dark.qss
+6
-0
UI/data/themes/Default.qss
UI/data/themes/Default.qss
+6
-0
UI/data/themes/Rachni.qss
UI/data/themes/Rachni.qss
+6
-0
UI/qt-display.cpp
UI/qt-display.cpp
+23
-1
UI/qt-display.hpp
UI/qt-display.hpp
+7
-0
libobs/obs-display.c
libobs/obs-display.c
+13
-4
libobs/obs.h
libobs/obs.h
+2
-1
未找到文件。
UI/data/themes/Acri.qss
浏览文件 @
0ae8a7c0
...
...
@@ -880,3 +880,9 @@ FocusList::item {
* [themeID="aboutHLayout"] {
background-color: rgb(8, 8, 11);
}
/* Preview background color */
* [themeID="displayBackgroundColor"] {
qproperty-displayBackgroundColor: #28282A;
}
UI/data/themes/Dark.qss
浏览文件 @
0ae8a7c0
...
...
@@ -656,3 +656,9 @@ QLabel#errorLabel {
* [themeID="aboutHLayout"] {
background-color: rgb(31, 30, 31); /* veryDark */
}
/* Preview background color */
* [themeID="displayBackgroundColor"] {
qproperty-displayBackgroundColor: rgb(76, 76, 76);
}
UI/data/themes/Default.qss
浏览文件 @
0ae8a7c0
...
...
@@ -135,3 +135,9 @@ QLabel#errorLabel {
* [themeID="aboutHLayout"] {
background-color: rgb(169, 169, 169);
}
/* Preview background color */
* [themeID="displayBackgroundColor"] {
qproperty-displayBackgroundColor: rgb(76, 76, 76);
}
UI/data/themes/Rachni.qss
浏览文件 @
0ae8a7c0
...
...
@@ -1234,3 +1234,9 @@ QToolTip {
* [themeID="aboutHLayout"] {
background-color: rgb(35, 38, 41); /* Dark Gray */
}
/* Preview background color */
* [themeID="displayBackgroundColor"] {
qproperty-displayBackgroundColor: rgb(35, 38, 41);
}
UI/qt-display.cpp
浏览文件 @
0ae8a7c0
...
...
@@ -6,6 +6,20 @@
#include <QResizeEvent>
#include <QShowEvent>
static
inline
long
long
color_to_int
(
QColor
color
)
{
auto
shift
=
[
&
](
unsigned
val
,
int
shift
)
{
return
((
val
&
0xff
)
<<
shift
);
};
return
shift
(
color
.
red
(),
0
)
|
shift
(
color
.
green
(),
8
)
|
shift
(
color
.
blue
(),
16
)
|
shift
(
color
.
alpha
(),
24
);
}
OBSQTDisplay
::
OBSQTDisplay
(
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QWidget
(
parent
,
flags
)
{
...
...
@@ -39,6 +53,14 @@ OBSQTDisplay::OBSQTDisplay(QWidget *parent, Qt::WindowFlags flags)
connect
(
windowHandle
(),
&
QWindow
::
visibleChanged
,
windowVisible
);
connect
(
windowHandle
(),
&
QWindow
::
screenChanged
,
sizeChanged
);
this
->
setProperty
(
"themeID"
,
"displayBackgroundColor"
);
}
void
OBSQTDisplay
::
SetDisplayBackgroundColor
(
const
QColor
&
color
)
{
backgroundColor
=
(
uint32_t
)
color_to_int
(
color
);
obs_display_set_background_color
(
display
,
backgroundColor
);
}
void
OBSQTDisplay
::
CreateDisplay
()
...
...
@@ -56,7 +78,7 @@ void OBSQTDisplay::CreateDisplay()
QTToGSWindow
(
winId
(),
info
.
window
);
display
=
obs_display_create
(
&
info
);
display
=
obs_display_create
(
&
info
,
backgroundColor
);
emit
DisplayCreated
(
this
);
}
...
...
UI/qt-display.hpp
浏览文件 @
0ae8a7c0
...
...
@@ -5,6 +5,8 @@
class
OBSQTDisplay
:
public
QWidget
{
Q_OBJECT
Q_PROPERTY
(
QColor
displayBackgroundColor
WRITE
SetDisplayBackgroundColor
NOTIFY
SetDisplayBackgroundColor
)
OBSDisplay
display
;
...
...
@@ -23,4 +25,9 @@ public:
virtual
QPaintEngine
*
paintEngine
()
const
override
;
inline
obs_display_t
*
GetDisplay
()
const
{
return
display
;}
uint32_t
backgroundColor
;
private
slots
:
void
SetDisplayBackgroundColor
(
const
QColor
&
color
);
};
libobs/obs-display.c
浏览文件 @
0ae8a7c0
...
...
@@ -46,17 +46,22 @@ bool obs_display_init(struct obs_display *display,
return
false
;
}
display
->
background_color
=
0x4C4C4C
;
display
->
enabled
=
true
;
return
true
;
}
obs_display_t
*
obs_display_create
(
const
struct
gs_init_data
*
graphics_data
)
obs_display_t
*
obs_display_create
(
const
struct
gs_init_data
*
graphics_data
,
uint32_t
background_color
)
{
struct
obs_display
*
display
=
bzalloc
(
sizeof
(
struct
obs_display
));
gs_enter_context
(
obs
->
video
.
graphics
);
if
(
background_color
)
display
->
background_color
=
background_color
;
else
display
->
background_color
=
0x4c4c4c
;
if
(
!
obs_display_init
(
display
,
graphics_data
))
{
obs_display_destroy
(
display
);
display
=
NULL
;
...
...
@@ -227,6 +232,10 @@ bool obs_display_enabled(obs_display_t *display)
void
obs_display_set_background_color
(
obs_display_t
*
display
,
uint32_t
color
)
{
if
(
display
)
display
->
background_color
=
color
;
if
(
display
)
{
if
(
color
)
display
->
background_color
=
color
;
else
display
->
background_color
=
0x4c4c4c
;
}
}
libobs/obs.h
浏览文件 @
0ae8a7c0
...
...
@@ -748,7 +748,8 @@ EXPORT void obs_view_render(obs_view_t *view);
* @return The new display context, or NULL if failed.
*/
EXPORT
obs_display_t
*
obs_display_create
(
const
struct
gs_init_data
*
graphics_data
);
const
struct
gs_init_data
*
graphics_data
,
uint32_t
backround_color
);
/** Destroys a display context */
EXPORT
void
obs_display_destroy
(
obs_display_t
*
display
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录