浏览代码

add some preliminary resolution data to video settings (will need to query monitors in the future)

jp9000 12 年之前
父节点
当前提交
dd1c5b4342
共有 4 个文件被更改,包括 48 次插入2 次删除
  1. 1 1
      obs/obs-app.cpp
  2. 2 0
      obs/settings-basic-general.cpp
  3. 27 1
      obs/settings-basic-video.cpp
  4. 18 0
      obs/window-settings-basic.cpp

+ 1 - 1
obs/obs-app.cpp

@@ -70,7 +70,7 @@ static bool do_mkdir(const char *path)
 
 static bool MakeUserDirs()
 {
-	BPtr<char*> homePath = os_get_home_path();
+	BPtr<char*> homePath(os_get_home_path());
 	stringstream str;
 
 	str << homePath << "/obs-studio";

+ 2 - 0
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);

+ 27 - 1
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;
+}

+ 18 - 0
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<BasicSettingsData>(ptr));
 }
 
 void OBSBasicSettings::PageChanging(wxListbookEvent &event)