diff --git a/build/data/obs-studio/locale/en.txt b/build/data/obs-studio/locale/en.txt
index 388ff37bc..5eb58a4e4 100644
--- a/build/data/obs-studio/locale/en.txt
+++ b/build/data/obs-studio/locale/en.txt
@@ -25,6 +25,7 @@ Settings="Settings"
Settings.General="General"
Settings.General.Language="Language:"
+Settings.General.LanguageChanged="The program must be restarted in order to change the language"
Settings.Outputs="Outputs"
diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt
index 3db0544a8..94da97815 100644
--- a/obs/CMakeLists.txt
+++ b/obs/CMakeLists.txt
@@ -44,6 +44,7 @@ add_executable(obs
window-main-basic.cpp
window-settings-basic.cpp
settings-basic-general.cpp
+ settings-basic-video.cpp
wx-subclass.cpp
wx-wrappers.cpp
obs-app.cpp
diff --git a/obs/makefile.am b/obs/makefile.am
index 21d509493..ccb7daed5 100644
--- a/obs/makefile.am
+++ b/obs/makefile.am
@@ -15,6 +15,7 @@ obs_LDADD = $(top_srcdir)/libobs/libobs.la
obs_SOURCES = window-main-basic.cpp \
window-settings-basic.cpp \
settings-basic-general.cpp \
+ settings-basic-video.cpp \
obs-app.cpp \
wx-subclass.cpp \
wx-wrappers.cpp \
diff --git a/obs/obs-app.hpp b/obs/obs-app.hpp
index 966e78d52..8fb12ebce 100644
--- a/obs/obs-app.hpp
+++ b/obs/obs-app.hpp
@@ -54,3 +54,4 @@ wxDECLARE_APP(OBSApp);
inline config_t GetGlobalConfig() {return wxGetApp().GlobalConfig();}
#define Str(lookupVal) wxGetApp().GetString(lookupVal)
+#define WXStr(lookupVal) wxString(Str(lookupVal), wxConvUTF8)
diff --git a/obs/settings-basic-general.cpp b/obs/settings-basic-general.cpp
index 35ea3ce86..c02f4e5b6 100644
--- a/obs/settings-basic-general.cpp
+++ b/obs/settings-basic-general.cpp
@@ -15,15 +15,13 @@
along with this program. If not, see .
******************************************************************************/
-#include
-
#include "obs-app.hpp"
#include "settings-basic.hpp"
#include "window-settings-basic.hpp"
#include "wx-wrappers.hpp"
#include "platform.hpp"
-class GeneralSettings : public BasicSettingsData {
+class BasicGenData : public BasicSettingsData {
ConfigFile localeIni;
WXConnector languageBoxConnector;
@@ -33,7 +31,7 @@ class GeneralSettings : public BasicSettingsData {
void FillLanguageList(const char *currentLang);
public:
- GeneralSettings(OBSBasicSettings *window);
+ BasicGenData(OBSBasicSettings *window);
virtual void Apply();
};
@@ -55,14 +53,14 @@ public:
}
};
-int GeneralSettings::AddLanguage(const char *tag)
+int BasicGenData::AddLanguage(const char *tag)
{
LanguageInfo *info = new LanguageInfo(localeIni, tag);
return window->languageList->Append(wxString(info->name, wxConvUTF8),
info);
}
-void GeneralSettings::FillLanguageList(const char *currentLang)
+void BasicGenData::FillLanguageList(const char *currentLang)
{
size_t numSections = config_num_sections(localeIni);
for (size_t i = 0; i < numSections; i++) {
@@ -74,7 +72,7 @@ void GeneralSettings::FillLanguageList(const char *currentLang)
}
}
-GeneralSettings::GeneralSettings(OBSBasicSettings *window)
+BasicGenData::BasicGenData(OBSBasicSettings *window)
: BasicSettingsData (window)
{
string path;
@@ -90,18 +88,31 @@ GeneralSettings::GeneralSettings(OBSBasicSettings *window)
languageBoxConnector.Connect(
window->languageList,
wxEVT_COMBOBOX,
- wxCommandEventHandler(GeneralSettings::LanguageChanged),
+ wxCommandEventHandler(BasicGenData::LanguageChanged),
NULL,
this);
+
+ window->generalText->Hide();
}
-void GeneralSettings::LanguageChanged(wxCommandEvent &event)
+void BasicGenData::LanguageChanged(wxCommandEvent &event)
{
+ dataChanged = true;
+ window->generalText->SetLabel(
+ WXStr("Settings.General.LanguageChanged"));
+ window->generalText->Show();
}
-void GeneralSettings::Apply()
+void BasicGenData::Apply()
{
-
+ int sel = window->languageList->GetSelection();
+ if (sel == wxNOT_FOUND)
+ return;
+
+ LanguageInfo *info = static_cast(
+ window->languageList->GetClientData(sel));
+
+ config_set_string(GetGlobalConfig(), "General", "Language", info->tag);
}
BasicSettingsData *CreateBasicGeneralSettings(OBSBasicSettings *window)
@@ -109,7 +120,7 @@ BasicSettingsData *CreateBasicGeneralSettings(OBSBasicSettings *window)
BasicSettingsData *data = NULL;
try {
- data = new GeneralSettings(window);
+ data = new BasicGenData(window);
} catch (const char *error) {
blog(LOG_ERROR, "CreateBasicGeneralSettings failed: %s", error);
}
diff --git a/obs/settings-basic-video.cpp b/obs/settings-basic-video.cpp
new file mode 100644
index 000000000..aa64f21a2
--- /dev/null
+++ b/obs/settings-basic-video.cpp
@@ -0,0 +1,46 @@
+/******************************************************************************
+ Copyright (C) 2013 by Hugh Bailey
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+******************************************************************************/
+
+#include "obs-app.hpp"
+#include "settings-basic.hpp"
+#include "window-settings-basic.hpp"
+#include "wx-wrappers.hpp"
+
+#include
+using namespace std;
+
+class BasicVideoData : public BasicSettingsData {
+ ConnectorList connections;
+
+ void BaseResListChanged(wxCommandEvent &event);
+
+public:
+ BasicVideoData(OBSBasicSettings *window);
+};
+
+BasicVideoData::BasicVideoData(OBSBasicSettings *window)
+ : BasicSettingsData(window)
+{
+ connections.Add(window->baseResList, wxEVT_COMBOBOX,
+ wxCommandEventHandler(
+ BasicVideoData::BaseResListChanged),
+ NULL, this);
+}
+
+void BasicVideoData::BaseResListChanged(wxCommandEvent &event)
+{
+}
diff --git a/obs/settings-basic.hpp b/obs/settings-basic.hpp
index 97bab9926..64261ba20 100644
--- a/obs/settings-basic.hpp
+++ b/obs/settings-basic.hpp
@@ -30,3 +30,4 @@ public:
};
BasicSettingsData *CreateBasicGeneralSettings(OBSBasicSettings *window);
+BasicSettingsData *CreateBasicVideoSettings(OBSBasicSettings *window);
diff --git a/obs/window-settings-basic.cpp b/obs/window-settings-basic.cpp
index 839802965..2f902d1db 100644
--- a/obs/window-settings-basic.cpp
+++ b/obs/window-settings-basic.cpp
@@ -31,3 +31,8 @@ void OBSBasicSettings::PageChanged(wxListbookEvent &event)
void OBSBasicSettings::PageChanging(wxListbookEvent &event)
{
}
+
+void OBSBasicSettings::OnClose(wxCloseEvent &event)
+{
+ Destroy();
+}
diff --git a/obs/window-settings-basic.hpp b/obs/window-settings-basic.hpp
index 9a81295b1..1de35722a 100644
--- a/obs/window-settings-basic.hpp
+++ b/obs/window-settings-basic.hpp
@@ -29,6 +29,7 @@ protected:
virtual void PageChanged(wxListbookEvent &event);
virtual void PageChanging(wxListbookEvent &event);
+ virtual void OnClose(wxCloseEvent &event);
public:
OBSBasicSettings(wxWindow *parent);
diff --git a/obs/wx-wrappers.hpp b/obs/wx-wrappers.hpp
index 2fc9490fa..40b7ef5f0 100644
--- a/obs/wx-wrappers.hpp
+++ b/obs/wx-wrappers.hpp
@@ -20,6 +20,8 @@
#include
#include
+#include
+
struct gs_window;
gs_window WxToGSWindow(const wxWindow *window);
@@ -61,6 +63,16 @@ public:
obj->Connect(eventType, func, userData, eventSink);
}
+ inline WXConnector(WXConnector &&c)
+ : obj (c.obj),
+ eventType (c.eventType),
+ func (c.func),
+ userData (c.userData),
+ eventSink (c.eventSink)
+ {
+ c.obj = NULL;
+ }
+
inline ~WXConnector()
{
Disconnect();
@@ -83,8 +95,22 @@ public:
inline void Disconnect()
{
- if (obj)
+ if (obj) {
obj->Disconnect(eventType, func, userData, eventSink);
- obj = NULL;
+ obj = NULL;
+ }
+ }
+};
+
+class ConnectorList {
+ std::vector connectors;
+
+public:
+ inline void Add(wxEvtHandler *obj, wxEventType type,
+ wxObjectEventFunction func, wxObject *userData,
+ wxEvtHandler *eventSink)
+ {
+ WXConnector connector(obj, type, func, userData, eventSink);
+ connectors.push_back(std::move(connector));
}
};
diff --git a/vs/2010/OBS/OBS.vcxproj b/vs/2010/OBS/OBS.vcxproj
index 002186baf..4169a3e83 100644
--- a/vs/2010/OBS/OBS.vcxproj
+++ b/vs/2010/OBS/OBS.vcxproj
@@ -171,6 +171,7 @@
+
diff --git a/vs/2010/OBS/OBS.vcxproj.filters b/vs/2010/OBS/OBS.vcxproj.filters
index 78cca2a7b..950e93859 100644
--- a/vs/2010/OBS/OBS.vcxproj.filters
+++ b/vs/2010/OBS/OBS.vcxproj.filters
@@ -42,6 +42,9 @@
Source Files
+
+ Source Files
+