From dd1c5b43420a50dd8be38d0c5d63151a0c70e8c4 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 14 Dec 2013 21:30:16 -0700 Subject: [PATCH] add some preliminary resolution data to video settings (will need to query monitors in the future) --- obs/obs-app.cpp | 2 +- obs/settings-basic-general.cpp | 2 ++ obs/settings-basic-video.cpp | 28 +++++++++++++++++++++++++++- obs/window-settings-basic.cpp | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index 5af5584b8..fff15bcfd 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -70,7 +70,7 @@ static bool do_mkdir(const char *path) static bool MakeUserDirs() { - BPtr homePath = os_get_home_path(); + BPtr homePath(os_get_home_path()); stringstream str; str << homePath << "/obs-studio"; diff --git a/obs/settings-basic-general.cpp b/obs/settings-basic-general.cpp index c02f4e5b6..8cb547741 100644 --- a/obs/settings-basic-general.cpp +++ b/obs/settings-basic-general.cpp @@ -62,6 +62,8 @@ int BasicGenData::AddLanguage(const char *tag) void BasicGenData::FillLanguageList(const char *currentLang) { + window->languageList->Clear(); + size_t numSections = config_num_sections(localeIni); for (size_t i = 0; i < numSections; i++) { const char *lang = config_get_section(localeIni, i); diff --git a/obs/settings-basic-video.cpp b/obs/settings-basic-video.cpp index 84dc9e381..4cdba1cf8 100644 --- a/obs/settings-basic-video.cpp +++ b/obs/settings-basic-video.cpp @@ -27,17 +27,43 @@ class BasicVideoData : public BasicSettingsData { public: BasicVideoData(OBSBasicSettings *window); + + void Apply(); }; BasicVideoData::BasicVideoData(OBSBasicSettings *window) : BasicSettingsData(window) { - connections.Add(window->baseResList, wxEVT_COMBOBOX, + connections.Add(window->baseResList, wxEVT_TEXT, wxCommandEventHandler( BasicVideoData::BaseResListChanged), NULL, this); + + window->baseResList->Clear(); + window->baseResList->Append("640x480"); + window->baseResList->Append("800x600"); + window->baseResList->Append("1024x768"); + window->baseResList->Append("1280x720"); + window->baseResList->Append("1920x1080"); } void BasicVideoData::BaseResListChanged(wxCommandEvent &event) { } + +void BasicVideoData::Apply() +{ +} + +BasicSettingsData *CreateBasicVideoSettings(OBSBasicSettings *window) +{ + BasicSettingsData *data = NULL; + + try { + data = new BasicVideoData(window); + } catch (const char *error) { + blog(LOG_ERROR, "CreateBasicVideoSettings failed: %s", error); + } + + return data; +} diff --git a/obs/window-settings-basic.cpp b/obs/window-settings-basic.cpp index 2f902d1db..956925537 100644 --- a/obs/window-settings-basic.cpp +++ b/obs/window-settings-basic.cpp @@ -26,6 +26,24 @@ OBSBasicSettings::OBSBasicSettings(wxWindow *parent) void OBSBasicSettings::PageChanged(wxListbookEvent &event) { + wxWindow *curPage = settingsList->GetCurrentPage(); + if (!curPage) + return; + + int id = curPage->GetId(); + + BasicSettingsData *ptr = NULL; + + switch (id) { + case ID_SETTINGS_GENERAL: + ptr = CreateBasicGeneralSettings(this); + break; + case ID_SETTINGS_VIDEO: + ptr = CreateBasicVideoSettings(this); + break; + } + + settings = move(unique_ptr(ptr)); } void OBSBasicSettings::PageChanging(wxListbookEvent &event)