mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
Minor refactor for creation of sub-windows
This refactors the sub-window code a bit so that instead of deleting the window pointers, it calls QWidget::close() on them to safely trigger a normal close on them instead (which will also delete them). Moves setting the DeleteOnClose flag from inside of the Dialog classes into the OBSBasic class, to make that behaviour more obvious.
This commit is contained in:
+23
-13
@@ -588,8 +588,11 @@ OBSBasic::~OBSBasic()
|
||||
delete cpuUsageTimer;
|
||||
os_cpu_usage_info_destroy(cpuUsageInfo);
|
||||
|
||||
delete properties;
|
||||
delete transformWindow;
|
||||
if (properties)
|
||||
delete properties;
|
||||
|
||||
if (transformWindow)
|
||||
delete transformWindow;
|
||||
|
||||
ClearVolumeControls();
|
||||
ui->sources->clear();
|
||||
@@ -648,11 +651,18 @@ void OBSBasic::InsertSceneItem(obs_sceneitem_t item)
|
||||
ui->sources->setCurrentRow(0);
|
||||
|
||||
/* if the source was just created, open properties dialog */
|
||||
if (sourceSceneRefs[source] == 0 && loaded) {
|
||||
delete properties;
|
||||
properties = new OBSBasicProperties(this, source);
|
||||
properties->Init();
|
||||
}
|
||||
if (sourceSceneRefs[source] == 0 && loaded)
|
||||
CreatePropertiesWindow(source);
|
||||
}
|
||||
|
||||
void OBSBasic::CreatePropertiesWindow(obs_source_t source)
|
||||
{
|
||||
if (properties)
|
||||
properties->close();
|
||||
|
||||
properties = new OBSBasicProperties(this, source);
|
||||
properties->Init();
|
||||
properties->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
}
|
||||
|
||||
/* Qt callbacks for invokeMethod */
|
||||
@@ -1674,11 +1684,8 @@ void OBSBasic::on_actionSourceProperties_triggered()
|
||||
OBSSceneItem item = GetCurrentSceneItem();
|
||||
OBSSource source = obs_sceneitem_getsource(item);
|
||||
|
||||
if (source) {
|
||||
delete properties;
|
||||
properties = new OBSBasicProperties(this, source);
|
||||
properties->Init();
|
||||
}
|
||||
if (source)
|
||||
CreatePropertiesWindow(source);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionSourceUp_triggered()
|
||||
@@ -2112,9 +2119,12 @@ config_t OBSBasic::Config() const
|
||||
|
||||
void OBSBasic::on_actionEditTransform_triggered()
|
||||
{
|
||||
delete transformWindow;
|
||||
if (transformWindow)
|
||||
transformWindow->close();
|
||||
|
||||
transformWindow = new OBSBasicTransform(this);
|
||||
transformWindow->show();
|
||||
transformWindow->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionResetTransform_triggered()
|
||||
|
||||
Reference in New Issue
Block a user