From d7d5e55d2c79f4a201bb752594a3921863de91ed Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 9 Jan 2016 14:20:46 -0800 Subject: [PATCH] UI: Add splitter to main window Allows adjusting the size of the bottom section of the main window --- obs/forms/OBSBasic.ui | 919 ++++++++++++++++++-------------------- obs/window-basic-main.cpp | 24 + 2 files changed, 468 insertions(+), 475 deletions(-) diff --git a/obs/forms/OBSBasic.ui b/obs/forms/OBSBasic.ui index 26f1bfbcd..8ca9bae68 100644 --- a/obs/forms/OBSBasic.ui +++ b/obs/forms/OBSBasic.ui @@ -7,8 +7,8 @@ 0 0 - 920 - 700 + 957 + 724 @@ -34,312 +34,101 @@ - + - - - - 0 - 0 - + + + Qt::Vertical - - - 32 - 32 - + + false - - Qt::ClickFocus - - - Qt::CustomContextMenu - - - - - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - Basic.Main.PreviewDisabled - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 720 - 0 - - - - - 16777215 - 165 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 2 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 150 - 0 - - - - - - - - Basic.Main.Sources - - - - - - - Basic.Main.Scenes - - - - - - - 2 - - - - - true - - - Basic.Main.StartStreaming - - - false - - - - - - - true - - - Basic.Main.StartRecording - - - - - - - Settings - - - - - - - Exit - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - Mixer - - - - - - - - 0 - 0 - - - - - 22 - 22 - - - - - - - - :/res/images/configuration21_16.png:/res/images/configuration21_16.png - - - true - - - configIconSmall - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 209 - 16 - - + + + + - + 0 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - + + + 32 + 32 + + + + Qt::ClickFocus + + + Qt::CustomContextMenu + - - - - - - 0 - - - + + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + Basic.Main.PreviewDisabled + + + Qt::AlignCenter + + + + + + + + + + + + 220 + 0 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 242 + 16 + + - + 0 0 - - - 160 - 0 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - + 0 @@ -355,20 +144,74 @@ 0 - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - QFrame::NoFrame - + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 160 + 0 + + + + + 260 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + QFrame::NoFrame + + + QFrame::Plain + true @@ -378,177 +221,303 @@ QAbstractItemView::InternalMove - - QAbstractItemView::ExtendedSelection + + Qt::TargetMoveAction + + + + + + + + 16 + 16 + + + + false + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 150 + 0 + + + + + + + + + + + + + Basic.Main.Sources + + + + + + + 2 + + + + + + 0 + 0 + + + + Mixer + + + + + + + + 0 + 0 + + + + + 22 + 22 + + + + + + + + :/res/images/configuration21_16.png:/res/images/configuration21_16.png + + + true + + + configIconSmall + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 160 + 0 + + + + + 260 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + QFrame::NoFrame + + + true + + + true + + + QAbstractItemView::InternalMove Qt::TargetMoveAction - - - - - - - - 16 - 16 - - - - false - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 150 - 0 - - - - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - 160 - 0 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 + + QAbstractItemView::ExtendedSelection + + + + + + + + 16 + 16 + + + + false + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 150 + 0 + + + + + + + + + + + + + Basic.Main.Scenes + + + + + + + 2 + + + + + true - - 0 + + Basic.Main.StartStreaming - - 0 + + false - - 0 + + + + + + true - - 0 + + Basic.Main.StartRecording - - - - true - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - QFrame::NoFrame - - - QFrame::Plain - - - true - - - true - - - QAbstractItemView::InternalMove - - - Qt::TargetMoveAction - - - - - - - - - 0 - 0 - - - - - 16 - 16 - - - - false - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 150 - 0 - - - - - - - - - - + + + + + + Settings + + + + + + + Exit + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + @@ -558,7 +527,7 @@ 0 0 - 920 + 957 21 @@ -1058,12 +1027,12 @@ close() - 697 - 615 + 838 + 272 - 463 - 351 + 902 + -10 diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index d21acc17a..32fe344ac 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -925,6 +925,25 @@ void OBSBasic::OBSInit() connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDisplay); show(); + + QList defSizes; + + int top = config_get_int(App()->GlobalConfig(), "BasicWindow", + "splitterTop"); + int bottom = config_get_int(App()->GlobalConfig(), "BasicWindow", + "splitterBottom"); + + if (!top || !bottom) { + defSizes = ui->mainSplitter->sizes(); + int total = defSizes[0] + defSizes[1]; + defSizes[0] = total * 75 / 100; + defSizes[1] = total - defSizes[0]; + } else { + defSizes.push_back(top); + defSizes.push_back(bottom); + } + + ui->mainSplitter->setSizes(defSizes); } void OBSBasic::InitHotkeys() @@ -1153,6 +1172,7 @@ OBSBasic::~OBSBasic() LIBOBS_API_VER); QRect lastGeom = normalGeometry(); + QList splitterSizes = ui->mainSplitter->sizes(); config_set_int(App()->GlobalConfig(), "BasicWindow", "cx", lastGeom.width()); @@ -1162,6 +1182,10 @@ OBSBasic::~OBSBasic() lastGeom.x()); config_set_int(App()->GlobalConfig(), "BasicWindow", "posy", lastGeom.y()); + config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterTop", + splitterSizes[0]); + config_set_int(App()->GlobalConfig(), "BasicWindow", "splitterBottom", + splitterSizes[1]); config_set_bool(App()->GlobalConfig(), "BasicWindow", "PreviewEnabled", previewEnabled); config_save_safe(App()->GlobalConfig(), "tmp", nullptr);