Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/OBSApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void OBSApp::InitUserConfigDefaults()
config_set_default_bool(userConfig, "BasicWindow", "ShowContextToolbars", true);
config_set_default_bool(userConfig, "BasicWindow", "StudioModeLabels", true);

config_set_default_bool(userConfig, "BasicWindow", "VerticalVolControl", false);
config_set_default_bool(userConfig, "BasicWindow", "VerticalVolControl", true);

config_set_default_bool(userConfig, "BasicWindow", "MultiviewMouseSwitch", true);

Expand Down
10 changes: 5 additions & 5 deletions frontend/forms/OBSBasic.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1086</width>
<height>729</height>
<width>1280</width>
<height>960</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -703,7 +703,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1086</width>
<width>1280</width>
<height>22</height>
</rect>
</property>
Expand Down Expand Up @@ -1289,7 +1289,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>322</width>
<width>380</width>
<height>16</height>
</rect>
</property>
Expand Down Expand Up @@ -2213,7 +2213,7 @@
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Basic.MainMenu.Docks.SideDocks</string>
Expand Down
16 changes: 12 additions & 4 deletions frontend/widgets/OBSBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ OBSBasic::OBSBasic(QWidget *parent) : OBSMainWindow(parent), undo_s(ui), ui(new
controlsDock->setWindowTitle(QTStr("Basic.Main.Controls"));
/* Parenting is done there so controls will be deleted alongside controlsDock */
controlsDock->setWidget(controls);
addDockWidget(Qt::BottomDockWidgetArea, controlsDock);

connect(controls, &OBSBasicControls::StreamButtonClicked, this, &OBSBasic::StreamActionTriggered);

Expand Down Expand Up @@ -342,6 +341,17 @@ OBSBasic::OBSBasic(QWidget *parent) : OBSMainWindow(parent), undo_s(ui), ui(new
connect(ui->transitionDuration, &QSpinBox::valueChanged, this,
[this](int value) { SetTransitionDuration(value); });

/* Main window default layout */
setDockCornersVertical(true);

/* Scenes and Sources dock on left
* This specific arrangement can't be set up in Qt Designer */
addDockWidget(Qt::LeftDockWidgetArea, ui->scenesDock);
splitDockWidget(ui->scenesDock, ui->sourcesDock, Qt::Vertical);
int sideDockWidth = std::min(width() * 30 / 100, 320);
resizeDocks({ui->scenesDock, ui->sourcesDock}, {sideDockWidth, sideDockWidth}, Qt::Horizontal);
addDockWidget(Qt::BottomDockWidgetArea, controlsDock);

startingDockLayout = saveState();

statsDock = new OBSDock();
Expand Down Expand Up @@ -1229,10 +1239,8 @@ void OBSBasic::OBSInit()
ui->lockDocks->blockSignals(false);

bool sideDocks = config_get_bool(App()->GetUserConfig(), "BasicWindow", "SideDocks");
on_sideDocks_toggled(sideDocks);
ui->sideDocks->blockSignals(true);
ui->sideDocks->setChecked(sideDocks);
ui->sideDocks->blockSignals(false);
setDockCornersVertical(sideDocks);

SystemTray(true);

Expand Down
1 change: 1 addition & 0 deletions frontend/widgets/OBSBasic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ public slots:
void RemoveDockWidget(const QString &name);
bool IsDockObjectNameUsed(const QString &name);
void AddCustomDockWidget(QDockWidget *dock);
void setDockCornersVertical(bool vertical);

private slots:
void on_resetDocks_triggered(bool force = false);
Expand Down
53 changes: 28 additions & 25 deletions frontend/widgets/OBSBasic_Docks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,12 @@ void OBSBasic::on_resetDocks_triggered(bool force)
#undef RESET_DOCKLIST

restoreState(startingDockLayout);
ui->sideDocks->setChecked(true);

int cx = width();
int cy = height();
int bottomDocksHeight = height();

int cx22_5 = cx * 225 / 1000;
int cx5 = cx * 5 / 100;
int cx21 = cx * 21 / 100;

cy = cy * 225 / 1000;

int mixerSize = cx - (cx22_5 * 2 + cx5 + cx21);

QList<QDockWidget *> docks{ui->scenesDock, ui->sourcesDock, ui->mixerDock, ui->transitionsDock, controlsDock};

QList<int> sizes{cx22_5, cx22_5, mixerSize, cx5, cx21};
bottomDocksHeight = bottomDocksHeight * 225 / 1000;

ui->scenesDock->setVisible(true);
ui->sourcesDock->setVisible(true);
Expand All @@ -98,8 +89,13 @@ void OBSBasic::on_resetDocks_triggered(bool force)
statsDock->setVisible(false);
statsDock->setFloating(true);

resizeDocks(docks, {cy, cy, cy, cy, cy}, Qt::Vertical);
resizeDocks(docks, sizes, Qt::Horizontal);
QList<QDockWidget *> bottomDocks{ui->mixerDock, ui->transitionsDock, controlsDock};

resizeDocks(bottomDocks, {bottomDocksHeight, bottomDocksHeight, bottomDocksHeight}, Qt::Vertical);
resizeDocks(bottomDocks, {cx * 45 / 100, cx * 14 / 100, cx * 16 / 100}, Qt::Horizontal);

int sideDockWidth = std::min(width() * 30 / 100, 280);
resizeDocks({ui->scenesDock, ui->sourcesDock}, {sideDockWidth, sideDockWidth}, Qt::Horizontal);

activateWindow();
}
Expand Down Expand Up @@ -135,17 +131,9 @@ void OBSBasic::on_lockDocks_toggled(bool lock)

void OBSBasic::on_sideDocks_toggled(bool side)
{
if (side) {
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
} else {
setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
}
config_set_bool(App()->GetUserConfig(), "BasicWindow", "SideDocks", side);

setDockCornersVertical(side);
}

void OBSBasic::AddDockWidget(QDockWidget *dock, Qt::DockWidgetArea area, bool extraBrowser)
Expand Down Expand Up @@ -232,6 +220,21 @@ void OBSBasic::AddCustomDockWidget(QDockWidget *dock)
extraCustomDocks.push_back(dock);
}

void OBSBasic::setDockCornersVertical(bool vertical)
{
if (vertical) {
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
} else {
setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
}
}

void OBSBasic::RepairCustomExtraDockName()
{
QDockWidget *dock = reinterpret_cast<QDockWidget *>(sender());
Expand Down
Loading