Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Simplify how projectors are saved/loaded #11203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
30 changes: 8 additions & 22 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1087,28 +1087,23 @@ void OBSBasic::LoadSceneListOrder(obs_data_array_t *array)

void OBSBasic::LoadSavedProjectors(obs_data_array_t *array)
{
for (SavedProjectorInfo *info : savedProjectorsArray) {
delete info;
}
savedProjectorsArray.clear();

size_t num = obs_data_array_count(array);

for (size_t i = 0; i < num; i++) {
OBSDataAutoRelease data = obs_data_array_item(array, i);
SavedProjectorInfo info = {};

SavedProjectorInfo *info = new SavedProjectorInfo();
info->monitor = obs_data_get_int(data, "monitor");
info->type = static_cast<ProjectorType>(
info.monitor = obs_data_get_int(data, "monitor");
info.type = static_cast<ProjectorType>(
obs_data_get_int(data, "type"));
info->geometry =
info.geometry =
std::string(obs_data_get_string(data, "geometry"));
info->name = std::string(obs_data_get_string(data, "name"));
info->alwaysOnTop = obs_data_get_bool(data, "alwaysOnTop");
info->alwaysOnTopOverridden =
info.name = std::string(obs_data_get_string(data, "name"));
info.alwaysOnTop = obs_data_get_bool(data, "alwaysOnTop");
info.alwaysOnTopOverridden =
obs_data_get_bool(data, "alwaysOnTopOverridden");

savedProjectorsArray.emplace_back(info);
OpenSavedProjector(&info);
}
}

Expand Down Expand Up @@ -1378,7 +1373,6 @@ void OBSBasic::LoadData(obs_data_t *data, const char *file)

if (savedProjectors) {
LoadSavedProjectors(savedProjectors);
OpenSavedProjectors();
activateWindow();
}
}
Expand Down Expand Up @@ -9428,13 +9422,6 @@ void OBSBasic::OpenSceneWindow()
OpenProjector(obs_scene_get_source(scene), -1, ProjectorType::Scene);
}

void OBSBasic::OpenSavedProjectors()
{
for (SavedProjectorInfo *info : savedProjectorsArray) {
OpenSavedProjector(info);
}
}

void OBSBasic::OpenSavedProjector(SavedProjectorInfo *info)
{
if (info) {
Expand Down Expand Up @@ -10971,7 +10958,6 @@ void OBSBasic::ResetProjectors()
OBSDataArrayAutoRelease savedProjectorList = SaveProjectors();
ClearProjectors();
LoadSavedProjectors(savedProjectorList);
OpenSavedProjectors();
}

void OBSBasic::on_sourcePropertiesButton_clicked()
Expand Down
3 changes: 0 additions & 3 deletions UI/window-basic-main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ class OBSBasic : public OBSMainWindow {

ConfigFile basicConfig;

std::vector<SavedProjectorInfo *> savedProjectorsArray;
std::vector<OBSProjector *> projectors;

QPointer<QWidget> stats;
Expand Down Expand Up @@ -987,8 +986,6 @@ private slots:
void SystemTrayInit();
void SystemTray(bool firstStarted);

void OpenSavedProjectors();

void CreateInteractionWindow(obs_source_t *source);
void CreatePropertiesWindow(obs_source_t *source);
void CreateFiltersWindow(obs_source_t *source);
Expand Down