diff --git a/build/data/obs-studio/locale/en.txt b/build/data/obs-studio/locale/en.txt index 1d43f0925..2406ca9b7 100644 --- a/build/data/obs-studio/locale/en.txt +++ b/build/data/obs-studio/locale/en.txt @@ -24,6 +24,8 @@ MainWindow.Volume="Volume:" Settings="Settings" Settings.StreamRestart="All streaming/recording must be stopped in order for these changes to take effect" +Settings.ConfirmTitle="Confirm Changes" +Settings.Confirm="You have unsaved changes. Save changes?" Settings.General="General" Settings.General.Language="Language:" @@ -45,7 +47,7 @@ Settings.Video.FPS.Nanoseconds="Frame Interval (nanoseconds)" Settings.Video.FPS.Numerator="Numerator:" Settings.Video.FPS.Denominator="Denominator:" Settings.Video.Renderer="Renderer:" -Settings.Video.InvalidResolution="Invalid base resolution value. Must be [width]x[height] (i.e. 1920x1080)" +Settings.Video.InvalidResolution="Invalid resolution value. Must be [width]x[height] (i.e. 1920x1080)" Settings.Audio="Audio" Settings.Audio.DesktopAudioDevice="Desktop Audio Device:" diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt index da3572014..b7166fdf4 100644 --- a/obs/CMakeLists.txt +++ b/obs/CMakeLists.txt @@ -43,6 +43,7 @@ endif() add_executable(obs window-main-basic.cpp window-settings-basic.cpp + settings-basic.cpp settings-basic-general.cpp settings-basic-video.cpp wx-subclass.cpp diff --git a/obs/makefile.am b/obs/makefile.am index 83fd3a09d..a1f9f5300 100644 --- a/obs/makefile.am +++ b/obs/makefile.am @@ -14,6 +14,7 @@ obs_PROGRAMS = obs obs_LDADD = $(top_srcdir)/libobs/libobs.la obs_SOURCES = window-main-basic.cpp \ window-settings-basic.cpp \ + settings-basic.cpp \ settings-basic-general.cpp \ settings-basic-video.cpp \ obs-app.cpp \ diff --git a/obs/settings-basic-general.cpp b/obs/settings-basic-general.cpp index 95d756030..85b977e8f 100644 --- a/obs/settings-basic-general.cpp +++ b/obs/settings-basic-general.cpp @@ -99,7 +99,7 @@ BasicGenData::BasicGenData(OBSBasicSettings *window) void BasicGenData::LanguageChanged(wxCommandEvent &event) { - dataChanged = true; + SetChanged(); window->generalChangedText->SetLabel( WXStr("Settings.General.LanguageChanged")); window->generalChangedText->Show(); @@ -118,8 +118,7 @@ void BasicGenData::Apply() config_save(GetGlobalConfig()); - window->generalChangedText->Hide(); - dataChanged = false; + SetSaved(); } BasicSettingsData *CreateBasicGeneralSettings(OBSBasicSettings *window) diff --git a/obs/settings-basic-video.cpp b/obs/settings-basic-video.cpp index 4d693411b..562e545f3 100644 --- a/obs/settings-basic-video.cpp +++ b/obs/settings-basic-video.cpp @@ -50,10 +50,16 @@ class BasicVideoData : public BasicSettingsData { void SaveFPSFraction(); void SaveFPSNanoseconds(); + virtual void SetChanged() + { + BasicSettingsData::SetChanged(); + window->videoChangedText->Show(); + } + public: BasicVideoData(OBSBasicSettings *window); - void Apply(); + virtual void Apply(); }; struct BaseLexer { @@ -107,7 +113,7 @@ int BasicVideoData::AddRes(uint32_t cx, uint32_t cy) { stringstream res; res << cx << "x" << cy; - return window->baseResList->Append(res.str().c_str()); + return window->baseResList->Append(res.str()); } void BasicVideoData::LoadOther() @@ -264,7 +270,13 @@ void BasicVideoData::ResetScaleList(uint32_t cx, uint32_t cy) res << uint32_t(double(cx) / vals[i]); res << "x"; res << uint32_t(double(cy) / vals[i]); - window->outputResList->Append(res.str().c_str()); + window->outputResList->Append(res.str()); + } + + if (numVals) { + stringstream str; + str << cx << "x" << cy; + window->outputResList->SetValue(str.str()); } } @@ -298,7 +310,7 @@ void BasicVideoData::BaseResListChanged(wxCommandEvent &event) return; } - dataChanged = true; + SetChanged(); window->videoChangedText->SetLabel(WXStr("Settings.StreamRestart")); window->videoChangedText->Show(); @@ -315,7 +327,7 @@ void BasicVideoData::OutputResListChanged(wxCommandEvent &event) return; } - dataChanged = true; + SetChanged(); window->videoChangedText->SetLabel(WXStr("Settings.StreamRestart")); window->videoChangedText->Show(); } @@ -398,9 +410,9 @@ void BasicVideoData::Apply() SaveOther(); SaveFPSData(); - window->videoChangedText->Hide(); config_save(GetGlobalConfig()); - dataChanged = false; + + SetSaved(); } BasicSettingsData *CreateBasicVideoSettings(OBSBasicSettings *window) diff --git a/obs/settings-basic.cpp b/obs/settings-basic.cpp new file mode 100644 index 000000000..8f818eb0b --- /dev/null +++ b/obs/settings-basic.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** + 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 "settings-basic.hpp" +#include "window-settings-basic.hpp" + +void BasicSettingsData::SetChanged() +{ + dataChanged = true; + window->applyButton->Enable(); +} + +void BasicSettingsData::SetSaved() +{ + dataChanged = false; + window->applyButton->Disable(); +} diff --git a/obs/settings-basic.hpp b/obs/settings-basic.hpp index 64261ba20..39a649599 100644 --- a/obs/settings-basic.hpp +++ b/obs/settings-basic.hpp @@ -27,6 +27,9 @@ protected: public: inline BasicSettingsData(OBSBasicSettings *window) : window(window) {} + + virtual void SetChanged(); + virtual void SetSaved(); }; BasicSettingsData *CreateBasicGeneralSettings(OBSBasicSettings *window); diff --git a/obs/settings.hpp b/obs/settings.hpp index 4137dfc40..3a1e42005 100644 --- a/obs/settings.hpp +++ b/obs/settings.hpp @@ -27,5 +27,8 @@ public: inline SettingsData() : dataChanged(false) {} virtual void Apply()=0; + virtual void SetChanged()=0; + virtual void SetSaved()=0; + inline bool DataChanged() const {return dataChanged;} }; diff --git a/vs/2013/OBS/OBS.vcxproj b/vs/2013/OBS/OBS.vcxproj index 0df86a4eb..b3e58815b 100644 --- a/vs/2013/OBS/OBS.vcxproj +++ b/vs/2013/OBS/OBS.vcxproj @@ -176,6 +176,7 @@ + diff --git a/vs/2013/OBS/OBS.vcxproj.filters b/vs/2013/OBS/OBS.vcxproj.filters index 950e93859..ded62df8a 100644 --- a/vs/2013/OBS/OBS.vcxproj.filters +++ b/vs/2013/OBS/OBS.vcxproj.filters @@ -45,6 +45,9 @@ Source Files + + Source Files +