|
@@ -214,6 +214,36 @@ static bool CopyProfile(const char *fromPartial, const char *to)
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static bool ProfileNeedsRestart(config_t *newConfig, QString &settings)
|
|
|
|
+{
|
|
|
|
+ OBSBasic *main = OBSBasic::Get();
|
|
|
|
+
|
|
|
|
+ const char *oldSpeakers =
|
|
|
|
+ config_get_string(main->Config(), "Audio", "ChannelSetup");
|
|
|
|
+ uint oldSampleRate =
|
|
|
|
+ config_get_uint(main->Config(), "Audio", "SampleRate");
|
|
|
|
+
|
|
|
|
+ const char *newSpeakers =
|
|
|
|
+ config_get_string(newConfig, "Audio", "ChannelSetup");
|
|
|
|
+ uint newSampleRate = config_get_uint(newConfig, "Audio", "SampleRate");
|
|
|
|
+
|
|
|
|
+ auto appendSetting = [&settings](const char *name) {
|
|
|
|
+ settings += QStringLiteral("\n") + QTStr(name);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ bool result = false;
|
|
|
|
+ if (oldSpeakers != NULL && newSpeakers != NULL) {
|
|
|
|
+ result = strcmp(oldSpeakers, newSpeakers) != 0;
|
|
|
|
+ appendSetting("Basic.Settings.Audio.Channels");
|
|
|
|
+ }
|
|
|
|
+ if (oldSampleRate != 0 && newSampleRate != 0) {
|
|
|
|
+ result |= oldSampleRate != newSampleRate;
|
|
|
|
+ appendSetting("Basic.Settings.Audio.SampleRate");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+}
|
|
|
|
+
|
|
bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
|
bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text,
|
|
const char *init_text, bool rename)
|
|
const char *init_text, bool rename)
|
|
{
|
|
{
|
|
@@ -558,6 +588,10 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
|
newName.c_str());
|
|
newName.c_str());
|
|
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir);
|
|
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir);
|
|
|
|
|
|
|
|
+ QString settingsRequiringRestart;
|
|
|
|
+ bool needsRestart =
|
|
|
|
+ ProfileNeedsRestart(config, settingsRequiringRestart);
|
|
|
|
+
|
|
Auth::Save();
|
|
Auth::Save();
|
|
auth.reset();
|
|
auth.reset();
|
|
DeleteCookies();
|
|
DeleteCookies();
|
|
@@ -583,6 +617,18 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (needsRestart) {
|
|
|
|
+ QMessageBox::StandardButton button = OBSMessageBox::question(
|
|
|
|
+ this, QTStr("Restart"),
|
|
|
|
+ QTStr("LoadProfileNeedsRestart")
|
|
|
|
+ .arg(settingsRequiringRestart));
|
|
|
|
+
|
|
|
|
+ if (button == QMessageBox::Yes) {
|
|
|
|
+ restart = true;
|
|
|
|
+ close();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void OBSBasic::on_actionImportProfile_triggered()
|
|
void OBSBasic::on_actionImportProfile_triggered()
|
|
@@ -714,6 +760,10 @@ void OBSBasic::ChangeProfile()
|
|
const char *newName = config_get_string(config, "General", "Name");
|
|
const char *newName = config_get_string(config, "General", "Name");
|
|
const char *newDir = strrchr(path.c_str(), '/') + 1;
|
|
const char *newDir = strrchr(path.c_str(), '/') + 1;
|
|
|
|
|
|
|
|
+ QString settingsRequiringRestart;
|
|
|
|
+ bool needsRestart =
|
|
|
|
+ ProfileNeedsRestart(config, settingsRequiringRestart);
|
|
|
|
+
|
|
config_set_string(App()->GlobalConfig(), "Basic", "Profile", newName);
|
|
config_set_string(App()->GlobalConfig(), "Basic", "Profile", newName);
|
|
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir);
|
|
config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir);
|
|
|
|
|
|
@@ -738,6 +788,18 @@ void OBSBasic::ChangeProfile()
|
|
|
|
|
|
if (api)
|
|
if (api)
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
|
|
|
|
+
|
|
|
|
+ if (needsRestart) {
|
|
|
|
+ QMessageBox::StandardButton button = OBSMessageBox::question(
|
|
|
|
+ this, QTStr("Restart"),
|
|
|
|
+ QTStr("LoadProfileNeedsRestart")
|
|
|
|
+ .arg(settingsRequiringRestart));
|
|
|
|
+
|
|
|
|
+ if (button == QMessageBox::Yes) {
|
|
|
|
+ restart = true;
|
|
|
|
+ close();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void OBSBasic::CheckForSimpleModeX264Fallback()
|
|
void OBSBasic::CheckForSimpleModeX264Fallback()
|