mirror of
https://github.com/obsproject/obs-studio.git
synced 2025-12-28 07:55:01 +00:00
frontend: Rearrange default dock positions
Some checks failed
Push / Format 🔍 (push) Has been cancelled
Push / Build 🧱 (push) Has been cancelled
Push / Validate Compatibility 🕵️ (push) Has been cancelled
Push / Validate Services 🕵️ (push) Has been cancelled
Push / Update Documentation 📖 (push) Has been cancelled
Push / Deploy Documentation to Cloudflare ☁️ (push) Has been cancelled
Push / Create Sparkle Appcast 🎙️ (arm64) (push) Has been cancelled
Push / Create Sparkle Appcast 🎙️ (x86_64) (push) Has been cancelled
Push / merge-appcasts (push) Has been cancelled
Push / Windows Signing ✍️ (push) Has been cancelled
Push / Create Release 🛫 (push) Has been cancelled
Some checks failed
Push / Format 🔍 (push) Has been cancelled
Push / Build 🧱 (push) Has been cancelled
Push / Validate Compatibility 🕵️ (push) Has been cancelled
Push / Validate Services 🕵️ (push) Has been cancelled
Push / Update Documentation 📖 (push) Has been cancelled
Push / Deploy Documentation to Cloudflare ☁️ (push) Has been cancelled
Push / Create Sparkle Appcast 🎙️ (arm64) (push) Has been cancelled
Push / Create Sparkle Appcast 🎙️ (x86_64) (push) Has been cancelled
Push / merge-appcasts (push) Has been cancelled
Push / Windows Signing ✍️ (push) Has been cancelled
Push / Create Release 🛫 (push) Has been cancelled
This commit is contained in:
parent
6a64053256
commit
407944a27c
@ -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);
|
||||
|
||||
|
||||
@ -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">
|
||||
@ -703,7 +703,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1086</width>
|
||||
<width>1280</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1289,7 +1289,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>322</width>
|
||||
<width>380</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -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>
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
@ -1232,10 +1242,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);
|
||||
|
||||
|
||||
@ -456,6 +456,7 @@ public:
|
||||
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);
|
||||
|
||||
@ -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);
|
||||
@ -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();
|
||||
}
|
||||
@ -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)
|
||||
@ -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());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user