Merge pull request #1703 from cg2121/preview-program-labels
UI: Add preview/program labels in studio mode
This commit is contained in:
commit
ed374645aa
@ -604,6 +604,7 @@ Basic.Settings.General.OverflowAlwaysVisible="Overflow always visible"
|
||||
Basic.Settings.General.OverflowSelectionHidden="Show overflow even when source is invisible"
|
||||
Basic.Settings.General.SwitchOnDoubleClick="Transition to scene when double-clicked"
|
||||
Basic.Settings.General.StudioPortraitLayout="Enable portrait/vertical layout"
|
||||
Basic.Settings.General.TogglePreviewProgramLabels="Show preview/program labels"
|
||||
Basic.Settings.General.Multiview="Multiview"
|
||||
Basic.Settings.General.Multiview.MouseSwitch="Click to switch between scenes"
|
||||
Basic.Settings.General.Multiview.DrawSourceNames="Show scene names"
|
||||
|
@ -907,3 +907,11 @@ FocusList::item {
|
||||
* [themeID="displayBackgroundColor"] {
|
||||
qproperty-displayBackgroundColor: #28282A;
|
||||
}
|
||||
|
||||
/* Preview/Program labels */
|
||||
|
||||
* [themeID="previewProgramLabels"] {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: rgb(122,121,122);
|
||||
}
|
||||
|
@ -698,3 +698,11 @@ QLabel#errorLabel {
|
||||
* [themeID="displayBackgroundColor"] {
|
||||
qproperty-displayBackgroundColor: rgb(76, 76, 76);
|
||||
}
|
||||
|
||||
/* Preview/Program labels */
|
||||
|
||||
* [themeID="previewProgramLabels"] {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: rgb(122,121,122);
|
||||
}
|
||||
|
@ -141,3 +141,11 @@ QLabel#errorLabel {
|
||||
* [themeID="displayBackgroundColor"] {
|
||||
qproperty-displayBackgroundColor: rgb(76, 76, 76);
|
||||
}
|
||||
|
||||
/* Preview/Program labels */
|
||||
|
||||
* [themeID="previewProgramLabels"] {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: rgb(122,121,122);
|
||||
}
|
||||
|
@ -1263,3 +1263,11 @@ QToolTip {
|
||||
* [themeID="displayBackgroundColor"] {
|
||||
qproperty-displayBackgroundColor: rgb(35, 38, 41);
|
||||
}
|
||||
|
||||
/* Preview/Program labels */
|
||||
|
||||
* [themeID="previewProgramLabels"] {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: rgb(122,121,122);
|
||||
}
|
||||
|
@ -69,6 +69,13 @@
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="previewLabel">
|
||||
<property name="text">
|
||||
<string>StudioMode.Preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OBSBasicPreview" name="preview" native="true">
|
||||
<property name="sizePolicy">
|
||||
@ -106,7 +113,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1079</width>
|
||||
<height>21</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
@ -644,7 +651,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>230</width>
|
||||
<width>82</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -698,7 +705,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>16</width>
|
||||
<height>230</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -144,9 +144,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>801</width>
|
||||
<height>931</height>
|
||||
<y>-540</y>
|
||||
<width>804</width>
|
||||
<height>1264</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
@ -634,6 +634,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="prevProgLabelToggle">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.General.TogglePreviewProgramLabels</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1144,8 +1154,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>601</width>
|
||||
<height>640</height>
|
||||
<width>890</width>
|
||||
<height>791</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@ -3845,8 +3855,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>63</width>
|
||||
<height>16</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -4259,8 +4269,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>594</width>
|
||||
<height>833</height>
|
||||
<width>867</width>
|
||||
<height>1061</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
|
@ -418,6 +418,8 @@ bool OBSApp::InitGlobalConfigDefaults()
|
||||
"ShowListboxToolbars", true);
|
||||
config_set_default_bool(globalConfig, "BasicWindow",
|
||||
"ShowStatusBar", true);
|
||||
config_set_default_bool(globalConfig, "BasicWindow",
|
||||
"StudioModeLabels", true);
|
||||
|
||||
if (!config_get_bool(globalConfig, "General", "Pre21Defaults")) {
|
||||
config_set_default_string(globalConfig, "General",
|
||||
|
@ -696,6 +696,7 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force, bool direct)
|
||||
void OBSBasic::CreateProgramDisplay()
|
||||
{
|
||||
program = new OBSQTDisplay();
|
||||
|
||||
program->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(program.data(), &QWidget::customContextMenuRequested,
|
||||
this, &OBSBasic::on_program_customContextMenuRequested);
|
||||
@ -1192,6 +1193,8 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
|
||||
if (IsPreviewProgramMode() == enabled)
|
||||
return;
|
||||
|
||||
ui->previewLabel->setHidden(!enabled);
|
||||
|
||||
ui->modeSwitch->setChecked(enabled);
|
||||
os_atomic_set_bool(&previewProgramMode, enabled);
|
||||
|
||||
@ -1230,10 +1233,28 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
|
||||
|
||||
RefreshQuickTransitions();
|
||||
|
||||
programLabel = new QLabel(QTStr("StudioMode.Program"));
|
||||
programLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
programLabel->setProperty("themeID", "previewProgramLabels");
|
||||
|
||||
programWidget = new QWidget();
|
||||
programLayout = new QVBoxLayout();
|
||||
|
||||
programLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
programLayout->addWidget(programLabel);
|
||||
programLayout->addWidget(program);
|
||||
|
||||
bool labels = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "StudioModeLabels");
|
||||
|
||||
programLabel->setHidden(!labels);
|
||||
|
||||
programWidget->setLayout(programLayout);
|
||||
|
||||
ui->previewLayout->addWidget(programOptions);
|
||||
ui->previewLayout->addWidget(program);
|
||||
ui->previewLayout->addWidget(programWidget);
|
||||
ui->previewLayout->setAlignment(programOptions, Qt::AlignCenter);
|
||||
program->show();
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);
|
||||
@ -1251,6 +1272,8 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
|
||||
|
||||
delete programOptions;
|
||||
delete program;
|
||||
delete programLabel;
|
||||
delete programWidget;
|
||||
|
||||
if (lastScene) {
|
||||
OBSSource actualLastScene = OBSGetStrongRef(lastScene);
|
||||
|
@ -371,6 +371,17 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
QPoint statsDockPos = curSize / 2 - statsDockSize / 2;
|
||||
QPoint newPos = curPos + statsDockPos;
|
||||
statsDock->move(newPos);
|
||||
|
||||
ui->previewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
ui->previewLabel->setProperty("themeID", "previewProgramLabels");
|
||||
|
||||
bool labels = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "StudioModeLabels");
|
||||
|
||||
if (!previewProgramMode)
|
||||
ui->previewLabel->setHidden(true);
|
||||
else
|
||||
ui->previewLabel->setHidden(!labels);
|
||||
}
|
||||
|
||||
static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent,
|
||||
@ -3437,10 +3448,19 @@ void OBSBasic::ResetUI()
|
||||
bool studioPortraitLayout = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "StudioPortraitLayout");
|
||||
|
||||
bool labels = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "StudioModeLabels");
|
||||
|
||||
if (studioPortraitLayout)
|
||||
ui->previewLayout->setDirection(QBoxLayout::TopToBottom);
|
||||
else
|
||||
ui->previewLayout->setDirection(QBoxLayout::LeftToRight);
|
||||
|
||||
if (previewProgramMode)
|
||||
ui->previewLabel->setHidden(!labels);
|
||||
|
||||
if (programLabel)
|
||||
programLabel->setHidden(!labels);
|
||||
}
|
||||
|
||||
int OBSBasic::ResetVideo()
|
||||
|
@ -229,6 +229,10 @@ private:
|
||||
QPointer<QMenu> perSceneTransitionMenu;
|
||||
QPointer<QObject> shortcutFilter;
|
||||
|
||||
QPointer<QWidget> programWidget;
|
||||
QPointer<QVBoxLayout> programLayout;
|
||||
QPointer<QLabel> programLabel;
|
||||
|
||||
void UpdateMultiviewProjectorMenu();
|
||||
|
||||
void DrawBackdrop(float cx, float cy);
|
||||
|
@ -325,6 +325,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
HookWidget(ui->overflowSelectionHide,CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->doubleClickSwitch, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->studioPortraitLayout, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->prevProgLabelToggle, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->multiviewMouseSwitch, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->multiviewDrawNames, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
HookWidget(ui->multiviewDrawAreas, CHECK_CHANGED, GENERAL_CHANGED);
|
||||
@ -1120,6 +1121,10 @@ void OBSBasicSettings::LoadGeneralSettings()
|
||||
"BasicWindow", "StudioPortraitLayout");
|
||||
ui->studioPortraitLayout->setChecked(studioPortraitLayout);
|
||||
|
||||
bool prevProgLabels = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "StudioModeLabels");
|
||||
ui->prevProgLabelToggle->setChecked(prevProgLabels);
|
||||
|
||||
bool multiviewMouseSwitch = config_get_bool(GetGlobalConfig(),
|
||||
"BasicWindow", "MultiviewMouseSwitch");
|
||||
ui->multiviewMouseSwitch->setChecked(multiviewMouseSwitch);
|
||||
@ -2767,6 +2772,14 @@ void OBSBasicSettings::SaveGeneralSettings()
|
||||
main->ResetUI();
|
||||
}
|
||||
|
||||
if (WidgetChanged(ui->prevProgLabelToggle)) {
|
||||
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
||||
"StudioModeLabels",
|
||||
ui->prevProgLabelToggle->isChecked());
|
||||
|
||||
main->ResetUI();
|
||||
}
|
||||
|
||||
bool multiviewChanged = false;
|
||||
if (WidgetChanged(ui->multiviewMouseSwitch)) {
|
||||
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
||||
|
Loading…
x
Reference in New Issue
Block a user