From a142261edde8c1a1ce01acd81e66c857802abb45 Mon Sep 17 00:00:00 2001 From: Shaolin Date: Tue, 20 Mar 2018 21:41:39 -0300 Subject: [PATCH] UI: Clarify multiview layout names --- UI/data/locale/en-US.ini | 8 ++++---- UI/obs-app.cpp | 12 ++++++++---- UI/window-basic-settings.cpp | 8 ++++---- UI/window-projector.cpp | 24 ++++++++++++------------ UI/window-projector.hpp | 8 ++++---- 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini index 5c0941479..28d2105d6 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -572,10 +572,10 @@ Basic.Settings.General.SaveProjectors="Save projectors on exit" Basic.Settings.General.SwitchOnDoubleClick="Transition to scene when double-clicked" Basic.Settings.General.StudioPortraitLayout="Enable portrait/vertical layout" Basic.Settings.General.MultiviewLayout="Multiview Layout" -Basic.Settings.General.MultiviewLayout.Horizontal.Top="Horizontal, Top" -Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Horizontal, Bottom" -Basic.Settings.General.MultiviewLayout.Vertical.Left="Vertical, Left" -Basic.Settings.General.MultiviewLayout.Vertical.Right="Vertical, Right" +Basic.Settings.General.MultiviewLayout.Horizontal.Top="Horizontal, Top (8 Scenes)" +Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Horizontal, Bottom (8 Scenes)" +Basic.Settings.General.MultiviewLayout.Vertical.Left="Vertical, Left (8 Scenes)" +Basic.Settings.General.MultiviewLayout.Vertical.Right="Vertical, Right (8 Scenes)" # basic mode 'stream' settings Basic.Settings.Stream="Stream" diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index fa106152e..3eb576057 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -598,25 +598,29 @@ bool OBSApp::UpdatePre22MultiviewLayout(const char *layout) if (astrcmpi(layout, "horizontaltop") == 0) { config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", - static_cast(MultiviewLayout::HORIZONTAL_TOP)); + static_cast( + MultiviewLayout::HORIZONTAL_TOP_8_SCENES)); return true; } if (astrcmpi(layout, "horizontalbottom") == 0) { config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", - static_cast(MultiviewLayout::HORIZONTAL_BOTTOM)); + static_cast( + MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES)); return true; } if (astrcmpi(layout, "verticalleft") == 0) { config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", - static_cast(MultiviewLayout::VERTICAL_LEFT)); + static_cast( + MultiviewLayout::VERTICAL_LEFT_8_SCENES)); return true; } if (astrcmpi(layout, "verticalright") == 0) { config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", - static_cast(MultiviewLayout::VERTICAL_RIGHT)); + static_cast( + MultiviewLayout::VERTICAL_RIGHT_8_SCENES)); return true; } diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index 7ac557e7a..3a0d626a3 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -1102,16 +1102,16 @@ void OBSBasicSettings::LoadGeneralSettings() ui->multiviewLayout->addItem(QTStr( "Basic.Settings.General.MultiviewLayout.Horizontal.Top"), - static_cast(MultiviewLayout::HORIZONTAL_TOP)); + static_cast(MultiviewLayout::HORIZONTAL_TOP_8_SCENES)); ui->multiviewLayout->addItem(QTStr( "Basic.Settings.General.MultiviewLayout.Horizontal.Bottom"), - static_cast(MultiviewLayout::HORIZONTAL_BOTTOM)); + static_cast(MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES)); ui->multiviewLayout->addItem(QTStr( "Basic.Settings.General.MultiviewLayout.Vertical.Left"), - static_cast(MultiviewLayout::VERTICAL_LEFT)); + static_cast(MultiviewLayout::VERTICAL_LEFT_8_SCENES)); ui->multiviewLayout->addItem(QTStr( "Basic.Settings.General.MultiviewLayout.Vertical.Right"), - static_cast(MultiviewLayout::VERTICAL_RIGHT)); + static_cast(MultiviewLayout::VERTICAL_RIGHT_8_SCENES)); ui->multiviewLayout->setCurrentIndex( config_get_int(GetGlobalConfig(), "BasicWindow", diff --git a/UI/window-projector.cpp b/UI/window-projector.cpp index e4688c1cf..af3d8b4db 100644 --- a/UI/window-projector.cpp +++ b/UI/window-projector.cpp @@ -333,19 +333,19 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) auto calcBaseSource = [&](size_t i) { switch (multiviewLayout) { - case MultiviewLayout::VERTICAL_LEFT: + case MultiviewLayout::VERTICAL_LEFT_8_SCENES: sourceX = halfCX; sourceY = (i / 2 ) * quarterCY; if (i % 2 != 0) sourceX = halfCX + quarterCX; break; - case MultiviewLayout::VERTICAL_RIGHT: + case MultiviewLayout::VERTICAL_RIGHT_8_SCENES: sourceX = 0; sourceY = (i / 2 ) * quarterCY; if (i % 2 != 0) sourceX = quarterCX; break; - case MultiviewLayout::HORIZONTAL_BOTTOM: + case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES: if (i < 4) { sourceX = (float(i) * quarterCX); sourceY = 0; @@ -354,7 +354,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) sourceY = quarterCY; } break; - default: // MultiviewLayout::HORIZONTAL_TOP: + default: // MultiviewLayout::HORIZONTAL_TOP_8_SCENES: if (i < 4) { sourceX = (float(i) * quarterCX); sourceY = halfCY; @@ -368,7 +368,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) auto calcPreviewProgram = [&](bool program) { switch (multiviewLayout) { - case MultiviewLayout::VERTICAL_LEFT: + case MultiviewLayout::VERTICAL_LEFT_8_SCENES: sourceX = 2.0f; sourceY = halfCY + 2.0f; labelX = offset; @@ -378,7 +378,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) labelY = halfCY * 0.8f; } break; - case MultiviewLayout::VERTICAL_RIGHT: + case MultiviewLayout::VERTICAL_RIGHT_8_SCENES: sourceX = halfCX + 2.0f; sourceY = halfCY + 2.0f; labelX = halfCX + offset; @@ -388,7 +388,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) labelY = halfCY * 0.8f; } break; - case MultiviewLayout::HORIZONTAL_BOTTOM: + case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES: sourceX = 2.0f; sourceY = halfCY + 2.0f; labelX = offset; @@ -398,7 +398,7 @@ void OBSProjector::OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy) labelX = halfCX + offset; } break; - default: // MultiviewLayout::HORIZONTAL_TOP: + default: // MultiviewLayout::HORIZONTAL_TOP_8_SCENES: sourceX = 2.0f; sourceY = 2.0f; labelX = offset; @@ -665,7 +665,7 @@ static int getSourceByPosition(int x, int y) int pos = -1; switch (multiviewLayout) { - case MultiviewLayout::VERTICAL_LEFT: + case MultiviewLayout::VERTICAL_LEFT_8_SCENES: if (float(cx) / float(cy) > ratio) { int validX = cy * ratio; maxX = halfX + (validX / 2); @@ -684,7 +684,7 @@ static int getSourceByPosition(int x, int y) if (x > minX + ((maxX - minX) / 2)) pos++; break; - case MultiviewLayout::VERTICAL_RIGHT: + case MultiviewLayout::VERTICAL_RIGHT_8_SCENES: if (float(cx) / float(cy) > ratio) { int validX = cy * ratio; minX = halfX - (validX / 2); @@ -703,7 +703,7 @@ static int getSourceByPosition(int x, int y) if (x > minX + ((maxX - minX) / 2)) pos++; break; - case MultiviewLayout::HORIZONTAL_BOTTOM: + case MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES: if (float(cx) / float(cy) > ratio) { int validX = cy * ratio; minX = halfX - (validX / 2); @@ -722,7 +722,7 @@ static int getSourceByPosition(int x, int y) if (y > minY + ((maxY - minY) / 2)) pos += 4; break; - default: // MultiviewLayout::HORIZONTAL_TOP + default: // MultiviewLayout::HORIZONTAL_TOP_8_SCENES if (float(cx) / float(cy) > ratio) { int validX = cy * ratio; minX = halfX - (validX / 2); diff --git a/UI/window-projector.hpp b/UI/window-projector.hpp index 3552b4708..b64ee01d3 100644 --- a/UI/window-projector.hpp +++ b/UI/window-projector.hpp @@ -14,10 +14,10 @@ enum class ProjectorType { class QMouseEvent; enum class MultiviewLayout : uint8_t { - HORIZONTAL_TOP = 0, - HORIZONTAL_BOTTOM = 1, - VERTICAL_LEFT = 2, - VERTICAL_RIGHT = 3 + HORIZONTAL_TOP_8_SCENES = 0, + HORIZONTAL_BOTTOM_8_SCENES = 1, + VERTICAL_LEFT_8_SCENES = 2, + VERTICAL_RIGHT_8_SCENES = 3 }; class OBSProjector : public OBSQTDisplay {