Drop support for old settings format

This commit is contained in:
WarmUpTill 2021-04-13 21:08:32 +02:00 committed by WarmUpTill
parent 041a9e7f19
commit acf1ae63aa
10 changed files with 0 additions and 399 deletions

View File

@ -317,94 +317,10 @@ void SwitcherData::saveSceneTriggers(obs_data_t *obj)
obs_data_array_release(triggerArray);
}
// To be removed in future version
void loadOldAutoStopStart(obs_data_t *obj)
{
typedef enum {
RECORDING = 0,
STREAMING = 1,
RECORINDGSTREAMING = 2
} AutoStartStopType;
if (obs_data_get_bool(obj, "autoStopEnable")) {
std::string autoStopScene =
obs_data_get_string(obj, "autoStopSceneName");
int action = obs_data_get_int(obj, "autoStopType");
if (action == RECORDING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStopScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::STOP_RECORDING;
}
if (action == STREAMING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStopScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::STOP_STREAMING;
}
if (action == RECORINDGSTREAMING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStopScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::STOP_RECORDING;
switcher->sceneTriggers.emplace_back();
auto &s2 = switcher->sceneTriggers.back();
s2.scene = GetWeakSourceByName(autoStopScene.c_str());
s2.triggerType = sceneTriggerType::SCENE_ACTIVE;
s2.triggerAction = sceneTriggerAction::STOP_STREAMING;
}
}
if (obs_data_get_bool(obj, "autoStartEnable")) {
std::string autoStartScene =
obs_data_get_string(obj, "autoStartSceneName");
int action = obs_data_get_int(obj, "autoStartType");
if (action == RECORDING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStartScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::START_RECORDING;
}
if (action == STREAMING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStartScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::START_STREAMING;
}
if (action == RECORINDGSTREAMING) {
switcher->sceneTriggers.emplace_back();
auto &s = switcher->sceneTriggers.back();
s.scene = GetWeakSourceByName(autoStartScene.c_str());
s.triggerType = sceneTriggerType::SCENE_ACTIVE;
s.triggerAction = sceneTriggerAction::START_RECORDING;
switcher->sceneTriggers.emplace_back();
auto &s2 = switcher->sceneTriggers.back();
s2.scene = GetWeakSourceByName(autoStartScene.c_str());
s2.triggerType = sceneTriggerType::SCENE_ACTIVE;
s2.triggerAction = sceneTriggerAction::START_STREAMING;
}
}
}
void SwitcherData::loadSceneTriggers(obs_data_t *obj)
{
switcher->sceneTriggers.clear();
loadOldAutoStopStart(obj);
obs_data_array_t *triggerArray = obs_data_get_array(obj, "triggers");
size_t count = obs_data_array_count(triggerArray);

View File

@ -311,41 +311,8 @@ void AudioSwitch::save(obs_data_t *obj)
obs_data_set_bool(obj, "ignoreInactiveSource", ignoreInactiveSource);
}
// To be removed in future version
bool loadOldAudio(obs_data_t *obj, AudioSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
const char *audioSource = obs_data_get_string(obj, "audioSource");
s->audioSource = GetWeakSourceByName(audioSource);
s->volumeThreshold = obs_data_get_int(obj, "volume");
s->condition = (audioCondition)obs_data_get_int(obj, "condition");
s->duration = obs_data_get_double(obj, "duration");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void AudioSwitch::load(obs_data_t *obj)
{
if (loadOldAudio(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
const char *audioSourceName = obs_data_get_string(obj, "audioSource");

View File

@ -199,37 +199,8 @@ void ExecutableSwitch::save(obs_data_t *obj)
obs_data_set_bool(obj, "infocus", inFocus);
}
// To be removed in future version
bool loadOldExe(obs_data_t *obj, ExecutableSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->exe = obs_data_get_string(obj, "exefile");
s->inFocus = obs_data_get_bool(obj, "infocus");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void ExecutableSwitch::load(obs_data_t *obj)
{
if (loadOldExe(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
exe = obs_data_get_string(obj, "exefile");

View File

@ -470,41 +470,8 @@ void FileSwitch::save(obs_data_t *obj)
obs_data_set_bool(obj, "onlyMatchIfChanged", onlyMatchIfChanged);
}
// To be removed in future version
bool loadOldFile(obs_data_t *obj, FileSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->file = obs_data_get_string(obj, "file");
s->text = obs_data_get_string(obj, "text");
s->remote = obs_data_get_bool(obj, "remote");
s->useRegex = obs_data_get_bool(obj, "useRegex");
s->useTime = obs_data_get_bool(obj, "useTime");
s->onlyMatchIfChanged = obs_data_get_bool(obj, "onlyMatchIfChanged");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void FileSwitch::load(obs_data_t *obj)
{
if (loadOldFile(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
file = obs_data_get_string(obj, "file");

View File

@ -271,42 +271,8 @@ void MediaSwitch::save(obs_data_t *obj)
obs_data_set_int(obj, "time", time);
}
// To be removed in future version
bool loadOldMedia(obs_data_t *obj, MediaSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
const char *source = obs_data_get_string(obj, "source");
s->source = GetWeakSourceByName(source);
s->state = (obs_media_state)obs_data_get_int(obj, "state");
s->restriction = (time_restriction)obs_data_get_int(obj, "restriction");
s->time = obs_data_get_int(obj, "time");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void MediaSwitch::load(obs_data_t *obj)
{
if (loadOldMedia(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
const char *sourceName = obs_data_get_string(obj, "source");

View File

@ -231,9 +231,6 @@ void SwitcherData::loadPauseSwitches(obs_data_t *obj)
{
switcher->pauseEntries.clear();
// To be removed in future builds once most users have migrated
loadOldPauseSwitches(obj);
obs_data_array_t *pauseArray = obs_data_get_array(obj, "pauseEntries");
size_t count = obs_data_array_count(pauseArray);
@ -257,50 +254,6 @@ void SwitcherData::loadPauseSwitches(obs_data_t *obj)
obs_data_array_release(pauseArray);
}
void SwitcherData::loadOldPauseSwitches(obs_data_t *obj)
{
if (obs_data_get_int(obj, "oldPauseValuesImported")) {
return;
}
obs_data_array_t *pauseScenesArray =
obs_data_get_array(obj, "pauseScenes");
size_t count = obs_data_array_count(pauseScenesArray);
for (size_t i = 0; i < count; i++) {
obs_data_t *array_obj =
obs_data_array_item(pauseScenesArray, i);
const char *scene =
obs_data_get_string(array_obj, "pauseScene");
switcher->pauseEntries.emplace_back(GetWeakSourceByName(scene),
PauseType::Scene,
PauseTarget::All, "");
obs_data_release(array_obj);
}
obs_data_array_release(pauseScenesArray);
obs_data_array_t *pauseWindowsArray =
obs_data_get_array(obj, "pauseWindows");
count = obs_data_array_count(pauseWindowsArray);
for (size_t i = 0; i < count; i++) {
obs_data_t *array_obj =
obs_data_array_item(pauseWindowsArray, i);
const char *window =
obs_data_get_string(array_obj, "pauseWindow");
switcher->pauseEntries.emplace_back(nullptr, PauseType::Window,
PauseTarget::All, window);
obs_data_release(array_obj);
}
obs_data_array_release(pauseWindowsArray);
}
void AdvSceneSwitcher::setupPauseTab()
{
for (auto &s : switcher->pauseEntries) {

View File

@ -269,40 +269,8 @@ void ScreenRegionSwitch::save(obs_data_t *obj)
obs_data_set_int(obj, "maxY", maxY);
}
// To be removed in future version
bool loadOldRegion(obs_data_t *obj, ScreenRegionSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "screenRegionScene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->minX = obs_data_get_int(obj, "minX");
s->minY = obs_data_get_int(obj, "minY");
s->maxX = obs_data_get_int(obj, "maxX");
s->maxY = obs_data_get_int(obj, "maxY");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void ScreenRegionSwitch::load(obs_data_t *obj)
{
if (loadOldRegion(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
const char *excludeSceneName = obs_data_get_string(obj, "excludeScene");

View File

@ -328,48 +328,8 @@ void SceneSequenceSwitch::save(obs_data_t *obj, bool saveExt)
}
}
// To be removed in future version
bool loadOldScequence(obs_data_t *obj, SceneSequenceSwitch *s)
{
if (!s) {
return false;
}
const char *scene1 = obs_data_get_string(obj, "sceneRoundTripScene1");
if (strcmp(scene1, "") == 0) {
return false;
}
s->startScene = GetWeakSourceByName(scene1);
const char *scene2 = obs_data_get_string(obj, "sceneRoundTripScene2");
s->scene = GetWeakSourceByName(scene2);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->delay = obs_data_get_double(obj, "delay");
int delayMultiplier = obs_data_get_int(obj, "delayMultiplier");
if (delayMultiplier == 0 ||
(delayMultiplier != 1 && delayMultiplier % 60 != 0))
delayMultiplier = 1;
s->delayMultiplier = delayMultiplier;
s->interruptible = obs_data_get_bool(obj, "interruptible");
s->usePreviousScene = strcmp(scene2, previous_scene_name) == 0;
return true;
}
void SceneSequenceSwitch::load(obs_data_t *obj, bool saveExt)
{
if (loadOldScequence(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
startTargetType = static_cast<SwitchTargetType>(
obs_data_get_int(obj, "startTargetType"));

View File

@ -204,37 +204,8 @@ void TimeSwitch::save(obs_data_t *obj)
obs_data_set_string(obj, "time", time.toString().toStdString().c_str());
}
// To be removed in future version
bool loadOldTime(obs_data_t *obj, TimeSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->trigger = (timeTrigger)obs_data_get_int(obj, "trigger");
s->time = QTime::fromString(obs_data_get_string(obj, "time"));
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void TimeSwitch::load(obs_data_t *obj)
{
if (loadOldTime(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
trigger = (timeTrigger)obs_data_get_int(obj, "trigger");

View File

@ -379,46 +379,8 @@ void WindowSwitch::save(obs_data_t *obj)
obs_data_set_bool(obj, "focus", focus);
}
// To be removed in future version
bool loadOldWindow(obs_data_t *obj, WindowSwitch *s)
{
if (!s) {
return false;
}
const char *scene = obs_data_get_string(obj, "scene");
if (strcmp(scene, "") == 0) {
return false;
}
s->scene = GetWeakSourceByName(scene);
const char *transition = obs_data_get_string(obj, "transition");
s->transition = GetWeakTransitionByName(transition);
s->window = obs_data_get_string(obj, "window_title");
s->fullscreen = obs_data_get_bool(obj, "fullscreen");
#if __APPLE__
// TODO:
// not implemented on MacOS as I cannot test it
s->maximized = false;
#else
s->maximized = obs_data_get_bool(obj, "maximized");
#endif
s->focus = obs_data_get_bool(obj, "focus") ||
!obs_data_has_user_value(obj, "focus");
s->usePreviousScene = strcmp(scene, previous_scene_name) == 0;
return true;
}
void WindowSwitch::load(obs_data_t *obj)
{
if (loadOldWindow(obj, this)) {
return;
}
SceneSwitcherEntry::load(obj);
window = obs_data_get_string(obj, "windowTitle");