Refactor log helpers and add option to disable logging
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

This commit is contained in:
WarmUpTill
2025-04-30 22:22:05 +02:00
committed by WarmUpTill
parent 9633a61a65
commit e9d57a0f4a
16 changed files with 112 additions and 68 deletions

View File

@@ -113,12 +113,12 @@ void AdvSceneSwitcher::on_startupBehavior_currentIndexChanged(int index)
static_cast<SwitcherData::StartupBehavior>(index);
}
void AdvSceneSwitcher::on_logLevel_currentIndexChanged(int value)
void AdvSceneSwitcher::on_logLevel_currentIndexChanged(int idx)
{
if (loading) {
return;
}
switcher->logLevel = static_cast<SwitcherData::LogLevel>(value);
SetLogLevel(static_cast<LogLevel>(ui->logLevel->itemData(idx).toInt()));
}
void AdvSceneSwitcher::on_autoStartEvent_currentIndexChanged(int index)
@@ -529,8 +529,8 @@ void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
obs_data_set_int(obj, "autoStartEvent",
static_cast<int>(autoStartEvent));
obs_data_set_int(obj, "logLevel", static_cast<int>(logLevel));
obs_data_set_int(obj, "logLevelVersion", 1);
SaveLogLevel(obj);
obs_data_set_bool(obj, "showSystemTrayNotifications",
showSystemTrayNotifications);
obs_data_set_bool(obj, "disableHints", disableHints);
@@ -586,25 +586,7 @@ void SwitcherData::LoadGeneralSettings(obs_data_t *obj)
autoStartEvent =
static_cast<AutoStart>(obs_data_get_int(obj, "autoStartEvent"));
logLevel = static_cast<LogLevel>(obs_data_get_int(obj, "logLevel"));
if (obs_data_get_int(obj, "logLevelVersion") < 1) {
enum OldLogLevel { DEFAULT, LOG_ACTION, VERBOSE };
OldLogLevel oldLogLevel = static_cast<OldLogLevel>(
obs_data_get_int(obj, "logLevel"));
switch (oldLogLevel) {
case DEFAULT:
logLevel = LogLevel::DEFAULT;
break;
case LOG_ACTION:
logLevel = LogLevel::LOG_ACTION;
break;
case VERBOSE:
logLevel = LogLevel::VERBOSE;
break;
default:
break;
}
}
LoadLogLevel(obj);
showSystemTrayNotifications =
obs_data_get_bool(obj, "showSystemTrayNotifications");
@@ -894,7 +876,9 @@ void AdvSceneSwitcher::SetupGeneralTab()
SIGNAL(DurationChanged(const Duration &)), this,
SLOT(CooldownDurationChanged(const Duration &)));
ui->logLevel->setCurrentIndex(static_cast<int>(switcher->logLevel));
PopulateLogLevelSelection(ui->logLevel);
ui->logLevel->setCurrentIndex(
ui->logLevel->findData(static_cast<int>(GetLogLevel())));
ui->saveWindowGeo->setChecked(switcher->saveWindowGeo);
ui->showTrayNotifications->setChecked(