Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
213d8ce1
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,发现更多精彩内容 >>
提交
213d8ce1
编写于
1月 22, 2016
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add "Always On Top" option to file menu
上级
9991f6a7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
107 addition
and
0 deletion
+107
-0
obs/data/locale/en-US.ini
obs/data/locale/en-US.ini
+1
-0
obs/forms/OBSBasic.ui
obs/forms/OBSBasic.ui
+10
-0
obs/platform-osx.mm
obs/platform-osx.mm
+18
-0
obs/platform-windows.cpp
obs/platform-windows.cpp
+13
-0
obs/platform-x11.cpp
obs/platform-x11.cpp
+18
-0
obs/platform.hpp
obs/platform.hpp
+5
-0
obs/window-basic-main.cpp
obs/window-basic-main.cpp
+38
-0
obs/window-basic-main.hpp
obs/window-basic-main.hpp
+4
-0
未找到文件。
obs/data/locale/en-US.ini
浏览文件 @
213d8ce1
...
...
@@ -250,6 +250,7 @@ Basic.MainMenu.File.Remux="Re&mux Recordings"
Basic.MainMenu.File.Settings
=
"&Settings"
Basic.MainMenu.File.ShowSettingsFolder
=
"Show Settings Folder"
Basic.MainMenu.File.ShowProfileFolder
=
"Show Profile Folder"
Basic.MainMenu.AlwaysOnTop
=
"&Always On Top"
Basic.MainMenu.File.Exit
=
"E&xit"
# basic mode edit menu
...
...
obs/forms/OBSBasic.ui
浏览文件 @
213d8ce1
...
...
@@ -542,6 +542,8 @@
<addaction
name=
"actionShowSettingsFolder"
/>
<addaction
name=
"actionShowProfileFolder"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionAlwaysOnTop"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionE_xit"
/>
</widget>
<widget
class=
"QMenu"
name=
"menuBasic_MainMenu_Help"
>
...
...
@@ -975,6 +977,14 @@
<string>
Basic.MainMenu.File.ShowProfileFolder
</string>
</property>
</action>
<action
name=
"actionAlwaysOnTop"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Basic.MainMenu.AlwaysOnTop
</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
...
...
obs/platform-osx.mm
浏览文件 @
213d8ce1
...
...
@@ -130,3 +130,21 @@ vector<string> GetPreferredLocales()
return
result
;
}
bool
IsAlwaysOnTop
(
QMainWindow
*
window
)
{
return
(
window
->
windowFlags
()
&
Qt
::
WindowStaysOnTopHint
)
!=
0
;
}
void
SetAlwaysOnTop
(
QMainWindow
*
window
,
bool
enable
)
{
Qt
::
WindowFlags
flags
=
window
->
windowFlags
();
if
(
enable
)
flags
|=
Qt
::
WindowStaysOnTopHint
;
else
flags
&=
~
Qt
::
WindowStaysOnTopHint
;
window
->
setWindowFlags
(
flags
);
window
->
show
();
}
obs/platform-windows.cpp
浏览文件 @
213d8ce1
...
...
@@ -202,3 +202,16 @@ void SetAeroEnabled(bool enable)
func
(
enable
?
DWM_EC_ENABLECOMPOSITION
:
DWM_EC_DISABLECOMPOSITION
);
}
bool
IsAlwaysOnTop
(
QMainWindow
*
window
)
{
DWORD
exStyle
=
GetWindowLong
((
HWND
)
window
->
winId
(),
GWL_EXSTYLE
);
return
(
exStyle
&
WS_EX_TOPMOST
)
!=
0
;
}
void
SetAlwaysOnTop
(
QMainWindow
*
window
,
bool
enable
)
{
HWND
hwnd
=
(
HWND
)
window
->
winId
();
SetWindowPos
(
hwnd
,
enable
?
HWND_TOPMOST
:
HWND_NOTOPMOST
,
0
,
0
,
0
,
0
,
SWP_NOMOVE
|
SWP_NOSIZE
|
SWP_NOACTIVATE
);
}
obs/platform-x11.cpp
浏览文件 @
213d8ce1
...
...
@@ -147,3 +147,21 @@ vector<string> GetPreferredLocales()
return
{};
}
bool
IsAlwaysOnTop
(
QMainWindow
*
window
)
{
return
(
window
->
windowFlags
()
&
Qt
::
WindowStaysOnTopHint
)
!=
0
;
}
void
SetAlwaysOnTop
(
QMainWindow
*
window
,
bool
enable
)
{
Qt
::
WindowFlags
flags
=
window
->
windowFlags
();
if
(
enable
)
flags
|=
Qt
::
WindowStaysOnTopHint
;
else
flags
&=
~
Qt
::
WindowStaysOnTopHint
;
window
->
setWindowFlags
(
flags
);
window
->
show
();
}
obs/platform.hpp
浏览文件 @
213d8ce1
...
...
@@ -22,6 +22,8 @@
#include <string>
#include <vector>
class
QMainWindow
;
struct
MonitorInfo
{
int32_t
x
,
y
;
uint32_t
cx
,
cy
;
...
...
@@ -43,6 +45,9 @@ std::string GetDefaultVideoSavePath();
std
::
vector
<
std
::
string
>
GetPreferredLocales
();
bool
IsAlwaysOnTop
(
QMainWindow
*
window
);
void
SetAlwaysOnTop
(
QMainWindow
*
window
,
bool
enable
);
#ifdef _WIN32
uint32_t
GetWindowsVersion
();
void
SetAeroEnabled
(
bool
enable
);
...
...
obs/window-basic-main.cpp
浏览文件 @
213d8ce1
...
...
@@ -928,7 +928,20 @@ void OBSBasic::OBSInit()
connect
(
ui
->
preview
,
&
OBSQTDisplay
::
DisplayCreated
,
addDisplay
);
#ifdef _WIN32
show
();
#endif
bool
alwaysOnTop
=
config_get_bool
(
App
()
->
GlobalConfig
(),
"BasicWindow"
,
"AlwaysOnTop"
);
if
(
alwaysOnTop
)
{
SetAlwaysOnTop
(
this
,
true
);
ui
->
actionAlwaysOnTop
->
setChecked
(
true
);
}
#ifndef _WIN32
show
();
#endif
QList
<
int
>
defSizes
;
...
...
@@ -1177,6 +1190,7 @@ OBSBasic::~OBSBasic()
QRect
lastGeom
=
normalGeometry
();
QList
<
int
>
splitterSizes
=
ui
->
mainSplitter
->
sizes
();
bool
alwaysOnTop
=
IsAlwaysOnTop
(
this
);
config_set_int
(
App
()
->
GlobalConfig
(),
"BasicWindow"
,
"cx"
,
lastGeom
.
width
());
...
...
@@ -1192,6 +1206,8 @@ OBSBasic::~OBSBasic()
splitterSizes
[
1
]);
config_set_bool
(
App
()
->
GlobalConfig
(),
"BasicWindow"
,
"PreviewEnabled"
,
previewEnabled
);
config_set_bool
(
App
()
->
GlobalConfig
(),
"BasicWindow"
,
"AlwaysOnTop"
,
alwaysOnTop
);
config_save_safe
(
App
()
->
GlobalConfig
(),
"tmp"
,
nullptr
);
#ifdef _WIN32
...
...
@@ -3326,6 +3342,28 @@ void OBSBasic::on_previewDisabledLabel_customContextMenuRequested(
UNUSED_PARAMETER
(
pos
);
}
void
OBSBasic
::
on_actionAlwaysOnTop_triggered
()
{
CloseDialogs
();
/* Make sure all dialogs are safely and successfully closed before
* switching the always on top mode due to the fact that windows all
* have to be recreated, so queue the actual toggle to happen after
* all events related to closing the dialogs have finished */
QMetaObject
::
invokeMethod
(
this
,
"ToggleAlwaysOnTop"
,
Qt
::
QueuedConnection
);
}
void
OBSBasic
::
ToggleAlwaysOnTop
()
{
bool
isAlwaysOnTop
=
IsAlwaysOnTop
(
this
);
ui
->
actionAlwaysOnTop
->
setChecked
(
!
isAlwaysOnTop
);
SetAlwaysOnTop
(
this
,
!
isAlwaysOnTop
);
show
();
}
void
OBSBasic
::
GetFPSCommon
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
const
char
*
val
=
config_get_string
(
basicConfig
,
"Video"
,
"FPSCommon"
);
...
...
obs/window-basic-main.hpp
浏览文件 @
213d8ce1
...
...
@@ -229,6 +229,8 @@ private slots:
void
RemoveSelectedScene
();
void
RemoveSelectedSceneItem
();
void
ToggleAlwaysOnTop
();
void
ReorderSources
(
OBSScene
scene
);
void
ProcessHotkey
(
obs_hotkey_id
id
,
bool
pressed
);
...
...
@@ -377,6 +379,8 @@ private slots:
void
on_actionShowSettingsFolder_triggered
();
void
on_actionShowProfileFolder_triggered
();
void
on_actionAlwaysOnTop_triggered
();
void
logUploadFinished
(
const
QString
&
text
,
const
QString
&
error
);
void
updateFileFinished
(
const
QString
&
text
,
const
QString
&
error
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录