mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-03 01:53:35 +00:00
Merge 52938748cf
into 9d67bf2662
This commit is contained in:
commit
23b2191f36
|
@ -120,6 +120,7 @@ Automatic="Automatic"
|
|||
# warning for plugin load failures
|
||||
PluginsFailedToLoad.Title="Plugin Load Error"
|
||||
PluginsFailedToLoad.Text="The following OBS plugins failed to load:\n\n%1\nPlease update or remove these plugins."
|
||||
HideProjectorFrame="Hide the window frame"
|
||||
|
||||
# warning if program already open
|
||||
AlreadyRunning.Title="OBS is already running"
|
||||
|
@ -883,6 +884,7 @@ Basic.Settings.General.WarnBeforeStoppingStream="Show confirmation dialog when s
|
|||
Basic.Settings.General.WarnBeforeStoppingRecord="Show confirmation dialog when stopping recording"
|
||||
Basic.Settings.General.Projectors="Projectors"
|
||||
Basic.Settings.General.HideProjectorCursor="Hide cursor over projectors"
|
||||
Basic.Settings.General.HideProjectorFrame="Hide window frames on projectors"
|
||||
Basic.Settings.General.ProjectorAlwaysOnTop="Make projectors always on top"
|
||||
Basic.Settings.General.Snapping="Source Alignment Snapping"
|
||||
Basic.Settings.General.ScreenSnapping="Snap Sources to edge of screen"
|
||||
|
|
|
@ -538,20 +538,27 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="hideProjectorFrame">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.General.HideProjectorFrame</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="projectorAlwaysOnTop">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.General.ProjectorAlwaysOnTop</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="saveProjectors">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.General.SaveProjectors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="closeProjectors">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.General.CloseExistingProjectors</string>
|
||||
|
@ -8359,6 +8366,7 @@
|
|||
<tabstop>sourceSnapping</tabstop>
|
||||
<tabstop>centerSnapping</tabstop>
|
||||
<tabstop>hideProjectorCursor</tabstop>
|
||||
<tabstop>hideProjectorFrame</tabstop>
|
||||
<tabstop>projectorAlwaysOnTop</tabstop>
|
||||
<tabstop>saveProjectors</tabstop>
|
||||
<tabstop>closeProjectors</tabstop>
|
||||
|
|
|
@ -10953,6 +10953,12 @@ void OBSBasic::UpdateProjectorHideCursor()
|
|||
projectors[i]->SetHideCursor();
|
||||
}
|
||||
|
||||
void OBSBasic::UpdateProjectorHideFrame(bool hideFrame)
|
||||
{
|
||||
for (size_t i = 0; i < projectors.size(); i++)
|
||||
projectors[i]->SetHideFrame(hideFrame);
|
||||
}
|
||||
|
||||
void OBSBasic::UpdateProjectorAlwaysOnTop(bool top)
|
||||
{
|
||||
for (size_t i = 0; i < projectors.size(); i++)
|
||||
|
|
|
@ -622,6 +622,7 @@ private:
|
|||
int GetOverrideTransitionDuration(OBSSource source);
|
||||
|
||||
void UpdateProjectorHideCursor();
|
||||
void UpdateProjectorHideFrame(bool hideFrame);
|
||||
void UpdateProjectorAlwaysOnTop(bool top);
|
||||
void ResetProjectors();
|
||||
|
||||
|
|
|
@ -379,6 +379,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
|||
HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->warnBeforeRecordStop, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->hideProjectorFrame, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->keepRecordStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
|
||||
|
@ -1492,6 +1493,10 @@ void OBSBasicSettings::LoadGeneralSettings()
|
|||
GetGlobalConfig(), "BasicWindow", "HideProjectorCursor");
|
||||
ui->hideProjectorCursor->setChecked(hideProjectorCursor);
|
||||
|
||||
bool hideProjectorFrame = config_get_bool(
|
||||
GetGlobalConfig(), "BasicWindow", "HideProjectorFrame");
|
||||
ui->hideProjectorFrame->setChecked(hideProjectorFrame);
|
||||
|
||||
bool projectorAlwaysOnTop = config_get_bool(
|
||||
GetGlobalConfig(), "BasicWindow", "ProjectorAlwaysOnTop");
|
||||
ui->projectorAlwaysOnTop->setChecked(projectorAlwaysOnTop);
|
||||
|
@ -3465,6 +3470,14 @@ void OBSBasicSettings::SaveGeneralSettings()
|
|||
main->UpdateProjectorHideCursor();
|
||||
}
|
||||
|
||||
if (WidgetChanged(ui->hideProjectorFrame)) {
|
||||
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
||||
"HideProjectorFrame",
|
||||
ui->hideProjectorFrame->isChecked());
|
||||
main->UpdateProjectorHideFrame(
|
||||
ui->hideProjectorFrame->isChecked());
|
||||
}
|
||||
|
||||
if (WidgetChanged(ui->projectorAlwaysOnTop)) {
|
||||
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
||||
"ProjectorAlwaysOnTop",
|
||||
|
|
|
@ -31,7 +31,13 @@ OBSProjector::OBSProjector(QWidget *widget, obs_source_t *source_, int monitor,
|
|||
"ProjectorAlwaysOnTop");
|
||||
|
||||
if (isAlwaysOnTop)
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
setWindowFlag(Qt::WindowStaysOnTopHint, isAlwaysOnTop);
|
||||
|
||||
hideFrame = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
||||
"HideProjectorFrame");
|
||||
|
||||
if (hideFrame)
|
||||
setWindowFlag(Qt::FramelessWindowHint, hideFrame);
|
||||
|
||||
// Mark the window as a projector so SetDisplayAffinity
|
||||
// can skip it
|
||||
|
@ -152,6 +158,38 @@ void OBSProjector::SetHideCursor()
|
|||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void OBSProjector::SetHideFrame(bool hideFrame)
|
||||
{
|
||||
if (isFullScreen())
|
||||
return;
|
||||
|
||||
// Calculate the current content position.
|
||||
QRect contentBox = geometry();
|
||||
|
||||
// Calculate the current window geometry position.
|
||||
QPoint contentPos = pos();
|
||||
|
||||
// Only update window if setting changed.
|
||||
if (this->hideFrame != hideFrame) {
|
||||
setWindowFlag(Qt::FramelessWindowHint, hideFrame);
|
||||
|
||||
// Restore the window.
|
||||
showNormal();
|
||||
|
||||
// Keep content in the same screen location.
|
||||
if (hideFrame) {
|
||||
move(contentPos.x(), contentPos.y());
|
||||
} else {
|
||||
QPoint offset = QPoint(contentPos.x() - geometry().x(),
|
||||
contentPos.y() - geometry().y());
|
||||
move(contentPos.x() + offset.x(),
|
||||
contentPos.y() + offset.y());
|
||||
}
|
||||
}
|
||||
|
||||
this->hideFrame = hideFrame;
|
||||
}
|
||||
|
||||
void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy)
|
||||
{
|
||||
OBSProjector *window = (OBSProjector *)data;
|
||||
|
@ -288,6 +326,19 @@ void OBSProjector::mousePressEvent(QMouseEvent *event)
|
|||
this, &OBSProjector::ResizeToContent);
|
||||
}
|
||||
|
||||
QAction *hideFrameAction =
|
||||
new QAction(QTStr("HideProjectorFrame"), this);
|
||||
hideFrameAction->setCheckable(true);
|
||||
hideFrameAction->setChecked(hideFrame);
|
||||
if (isFullScreen()) {
|
||||
hideFrameAction->setDisabled(true);
|
||||
}
|
||||
|
||||
connect(hideFrameAction, &QAction::toggled, this,
|
||||
&OBSProjector::SetHideFrame);
|
||||
|
||||
popup.addAction(hideFrameAction);
|
||||
|
||||
QAction *alwaysOnTopButton = new QAction(
|
||||
QTStr("Basic.MainMenu.View.AlwaysOnTop"), this);
|
||||
alwaysOnTopButton->setCheckable(true);
|
||||
|
|
|
@ -30,6 +30,7 @@ private:
|
|||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
bool hideFrame;
|
||||
bool isAlwaysOnTop;
|
||||
bool isAlwaysOnTopOverridden = false;
|
||||
int savedMonitor = -1;
|
||||
|
@ -69,5 +70,6 @@ public:
|
|||
|
||||
bool IsAlwaysOnTop() const;
|
||||
bool IsAlwaysOnTopOverridden() const;
|
||||
void SetHideFrame(bool hideFrame);
|
||||
void SetIsAlwaysOnTop(bool isAlwaysOnTop, bool isOverridden);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue