mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-16 02:08:35 -05:00
UI: Add function for adding extra docks to main window
This commit is contained in:
@@ -6219,6 +6219,36 @@ int OBSBasic::GetProfilePath(char *path, size_t size, const char *file) const
|
||||
|
||||
void OBSBasic::on_resetUI_triggered()
|
||||
{
|
||||
/* prune deleted extra docks */
|
||||
for (int i = extraDocks.size() - 1; i >= 0 ; i--) {
|
||||
if (!extraDocks[i]) {
|
||||
extraDocks.removeAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (extraDocks.size()) {
|
||||
QMessageBox::StandardButton button = QMessageBox::question(
|
||||
this,
|
||||
QTStr("ResetUIWarning.Title"),
|
||||
QTStr("ResetUIWarning.Text"));
|
||||
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
|
||||
/* undock/hide/center extra docks */
|
||||
for (int i = extraDocks.size() - 1; i >= 0 ; i--) {
|
||||
if (extraDocks[i]) {
|
||||
extraDocks[i]->setVisible(true);
|
||||
extraDocks[i]->setFloating(true);
|
||||
extraDocks[i]->move(
|
||||
frameGeometry().topLeft() +
|
||||
rect().center() -
|
||||
extraDocks[i]->rect().center());
|
||||
extraDocks[i]->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
restoreState(startingDockLayout);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
@@ -6273,6 +6303,14 @@ void OBSBasic::on_lockUI_toggled(bool lock)
|
||||
ui->transitionsDock->setFeatures(features);
|
||||
ui->controlsDock->setFeatures(features);
|
||||
statsDock->setFeatures(features);
|
||||
|
||||
for (int i = extraDocks.size() - 1; i >= 0 ; i--) {
|
||||
if (!extraDocks[i]) {
|
||||
extraDocks.removeAt(i);
|
||||
} else {
|
||||
extraDocks[i]->setFeatures(features);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::on_toggleListboxToolbars_toggled(bool visible)
|
||||
@@ -6858,6 +6896,30 @@ void OBSBasic::ResizeOutputSizeOfSource()
|
||||
on_actionFitToScreen_triggered();
|
||||
}
|
||||
|
||||
QAction *OBSBasic::AddDockWidget(QDockWidget *dock)
|
||||
{
|
||||
QAction *action = ui->viewMenuDocks->addAction(dock->windowTitle());
|
||||
action->setCheckable(true);
|
||||
assignDockToggle(dock, action);
|
||||
extraDocks.push_back(dock);
|
||||
|
||||
bool lock = ui->lockUI->isChecked();
|
||||
QDockWidget::DockWidgetFeatures features = lock
|
||||
? QDockWidget::NoDockWidgetFeatures
|
||||
: QDockWidget::AllDockWidgetFeatures;
|
||||
|
||||
dock->setFeatures(features);
|
||||
|
||||
/* prune deleted docks */
|
||||
for (int i = extraDocks.size() - 1; i >= 0 ; i--) {
|
||||
if (!extraDocks[i]) {
|
||||
extraDocks.removeAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
OBSBasic *OBSBasic::Get()
|
||||
{
|
||||
return reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
|
||||
Reference in New Issue
Block a user