UI: Remove duplicate missing files code
The same code was in different places, so call single function to clean up code.
This commit is contained in:
parent
3f86354863
commit
6eb5a922a7
@ -1770,8 +1770,7 @@ obs_data_array_t *OBSBasic::SaveTransitions()
|
||||
return transitions;
|
||||
}
|
||||
|
||||
void OBSBasic::LoadTransitions(obs_data_array_t *transitions,
|
||||
obs_load_source_cb cb, void *private_data)
|
||||
void OBSBasic::LoadTransitions(obs_data_array_t *transitions)
|
||||
{
|
||||
size_t count = obs_data_array_count(transitions);
|
||||
|
||||
|
@ -1035,22 +1035,10 @@ void OBSBasic::LoadData(obs_data_t *data, const char *file)
|
||||
obs_data_array_push_back_array(sources, groups);
|
||||
}
|
||||
|
||||
obs_missing_files_t *files = obs_missing_files_create();
|
||||
|
||||
auto cb = [](void *private_data, obs_source_t *source) {
|
||||
obs_missing_files_t *f = (obs_missing_files_t *)private_data;
|
||||
obs_missing_files_t *sf = obs_source_get_missing_files(source);
|
||||
|
||||
obs_missing_files_append(f, sf);
|
||||
obs_missing_files_destroy(sf);
|
||||
|
||||
UNUSED_PARAMETER(source);
|
||||
};
|
||||
|
||||
obs_load_sources(sources, cb, files);
|
||||
obs_load_sources(sources, nullptr, nullptr);
|
||||
|
||||
if (transitions)
|
||||
LoadTransitions(transitions, cb, files);
|
||||
LoadTransitions(transitions);
|
||||
if (sceneOrder)
|
||||
LoadSceneListOrder(sceneOrder);
|
||||
|
||||
@ -1171,20 +1159,8 @@ retryScene:
|
||||
|
||||
LogScenes();
|
||||
|
||||
if (obs_missing_files_count(files) > 0 &&
|
||||
!App()->IsMissingFilesCheckDisabled()) {
|
||||
/* the window hasn't fully initialized by this point on macOS,
|
||||
* so put this at the end of the current task queue. Fixes a
|
||||
* bug where the window be behind OBS on startup */
|
||||
QTimer::singleShot(0, [this, files] {
|
||||
missDialog = new OBSMissingFiles(files, this);
|
||||
missDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
missDialog->show();
|
||||
missDialog->raise();
|
||||
});
|
||||
} else {
|
||||
obs_missing_files_destroy(files);
|
||||
}
|
||||
if (!App()->IsMissingFilesCheckDisabled())
|
||||
on_actionShowMissingFiles_triggered();
|
||||
|
||||
disableSaving--;
|
||||
|
||||
@ -4895,15 +4871,24 @@ void OBSBasic::on_actionShowMissingFiles_triggered()
|
||||
obs_enum_all_sources(cb_transitions, files);
|
||||
|
||||
if (obs_missing_files_count(files) > 0) {
|
||||
missDialog = new OBSMissingFiles(files, this);
|
||||
missDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
missDialog->show();
|
||||
missDialog->raise();
|
||||
/* When loading the missing files dialog on launch, the
|
||||
* window hasn't fully initialized by this point on macOS,
|
||||
* so put this at the end of the current task queue. Fixes
|
||||
* a bug where the window is behind OBS on startup. */
|
||||
QTimer::singleShot(0, [this, files] {
|
||||
missDialog = new OBSMissingFiles(files, this);
|
||||
missDialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
missDialog->show();
|
||||
missDialog->raise();
|
||||
});
|
||||
} else {
|
||||
obs_missing_files_destroy(files);
|
||||
OBSMessageBox::information(
|
||||
this, QTStr("MissingFiles.NoMissing.Title"),
|
||||
QTStr("MissingFiles.NoMissing.Text"));
|
||||
|
||||
/* Only raise dialog if triggered manually */
|
||||
if (!disableSaving)
|
||||
OBSMessageBox::information(
|
||||
this, QTStr("MissingFiles.NoMissing.Title"),
|
||||
QTStr("MissingFiles.NoMissing.Text"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,8 +439,7 @@ private:
|
||||
obs_source_t *FindTransition(const char *name);
|
||||
OBSSource GetCurrentTransition();
|
||||
obs_data_array_t *SaveTransitions();
|
||||
void LoadTransitions(obs_data_array_t *transitions,
|
||||
obs_load_source_cb cb, void *private_data);
|
||||
void LoadTransitions(obs_data_array_t *transitions);
|
||||
|
||||
obs_source_t *fadeTransition;
|
||||
obs_source_t *cutTransition;
|
||||
|
Loading…
x
Reference in New Issue
Block a user