mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-08 03:00:24 +00:00
Qt: Separate window and file log timestamp options
This commit is contained in:
parent
eb503c4029
commit
5b3e843b08
@ -501,6 +501,9 @@ void Log::FileOutputLogCallback(void* pUserParam, MessageCategory cat, const cha
|
||||
void Log::SetFileOutputParams(bool enabled, const char* filename, bool timestamps /* = true */)
|
||||
{
|
||||
std::unique_lock lock(s_state.callbacks_mutex);
|
||||
|
||||
s_state.file_output_timestamp = timestamps;
|
||||
|
||||
if (s_state.file_output_enabled == enabled)
|
||||
return;
|
||||
|
||||
@ -523,7 +526,6 @@ void Log::SetFileOutputParams(bool enabled, const char* filename, bool timestamp
|
||||
}
|
||||
|
||||
s_state.file_output_enabled = enabled;
|
||||
s_state.file_output_timestamp = timestamps;
|
||||
}
|
||||
|
||||
Log::Level Log::GetLogLevel()
|
||||
|
@ -1164,6 +1164,7 @@ void Settings::SetDefaultLogConfig(SettingsInterface& si)
|
||||
si.SetBoolValue("Logging", "LogToDebug", false);
|
||||
si.SetBoolValue("Logging", "LogToWindow", false);
|
||||
si.SetBoolValue("Logging", "LogToFile", false);
|
||||
si.SetBoolValue("Logging", "LogFileTimestamps", false);
|
||||
|
||||
for (const char* channel_name : Log::GetChannelNames())
|
||||
si.SetBoolValue("Logging", channel_name, true);
|
||||
@ -1179,6 +1180,7 @@ void Settings::UpdateLogConfig(const SettingsInterface& si)
|
||||
const bool log_to_debug = si.GetBoolValue("Logging", "LogToDebug", false);
|
||||
const bool log_to_window = si.GetBoolValue("Logging", "LogToWindow", false);
|
||||
const bool log_to_file = si.GetBoolValue("Logging", "LogToFile", false);
|
||||
const bool log_file_timestamps = si.GetBoolValue("Logging", "LogFileTimestamps", false);
|
||||
|
||||
const bool any_logs_enabled = (log_to_console || log_to_debug || log_to_window || log_to_file);
|
||||
Log::SetLogLevel(any_logs_enabled ? log_level : Log::Level::None);
|
||||
@ -1189,7 +1191,7 @@ void Settings::UpdateLogConfig(const SettingsInterface& si)
|
||||
if (log_to_file)
|
||||
{
|
||||
Log::SetFileOutputParams(log_to_file, Path::Combine(EmuFolders::DataRoot, "duckstation.log").c_str(),
|
||||
log_timestamps);
|
||||
log_file_timestamps);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -180,6 +180,11 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToDebug, "Logging", "LogToDebug", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToWindow, "Logging", "LogToWindow", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logToFile, "Logging", "LogToFile", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logTimestamps, "Logging", "LogTimestamps", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.logFileTimestamps, "Logging", "LogFileTimestamps", false);
|
||||
connect(m_ui.logToConsole, &QCheckBox::checkStateChanged, this, &AdvancedSettingsWidget::onAnyLogSinksChanged);
|
||||
connect(m_ui.logToWindow, &QCheckBox::checkStateChanged, this, &AdvancedSettingsWidget::onAnyLogSinksChanged);
|
||||
connect(m_ui.logToFile, &QCheckBox::checkStateChanged, this, &AdvancedSettingsWidget::onAnyLogSinksChanged);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showDebugMenu, "Main", "ShowDebugMenu", false);
|
||||
|
||||
@ -205,6 +210,10 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
|
||||
tr("Logs messages to the window."));
|
||||
dialog->registerWidgetHelp(m_ui.logToFile, tr("Log To File"), tr("User Preference"),
|
||||
tr("Logs messages to duckstation.log in the user directory."));
|
||||
dialog->registerWidgetHelp(m_ui.logTimestamps, tr("Log Timestamps"), tr("User Preference"),
|
||||
tr("Includes the elapsed time since the application start in window and console logs."));
|
||||
dialog->registerWidgetHelp(m_ui.logFileTimestamps, tr("Log File Timestamps"), tr("User Preference"),
|
||||
tr("Includes the elapsed time since the application start in file logs."));
|
||||
dialog->registerWidgetHelp(m_ui.showDebugMenu, tr("Show Debug Menu"), tr("Unchecked"),
|
||||
tr("Shows a debug menu bar with additional statistics and quick settings."));
|
||||
}
|
||||
@ -218,6 +227,16 @@ void AdvancedSettingsWidget::onLogChannelsButtonClicked()
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void AdvancedSettingsWidget::onAnyLogSinksChanged()
|
||||
{
|
||||
const bool log_to_console = m_dialog->getEffectiveBoolValue("Logging", "LogToConsole", false);
|
||||
const bool log_to_window = m_dialog->getEffectiveBoolValue("Logging", "LogToWindow", false);
|
||||
const bool log_to_file = m_dialog->getEffectiveBoolValue("Logging", "LogToFile", false);
|
||||
|
||||
m_ui.logTimestamps->setEnabled(log_to_console || log_to_window);
|
||||
m_ui.logFileTimestamps->setEnabled(log_to_file);
|
||||
}
|
||||
|
||||
void AdvancedSettingsWidget::onShowDebugOptionsStateChanged()
|
||||
{
|
||||
const bool enabled = QtHost::ShouldShowDebugOptions();
|
||||
|
@ -22,6 +22,7 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onLogChannelsButtonClicked();
|
||||
void onAnyLogSinksChanged();
|
||||
void onShowDebugOptionsStateChanged();
|
||||
|
||||
private:
|
||||
|
@ -58,10 +58,10 @@
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="logToConsole">
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="logToFile">
|
||||
<property name="text">
|
||||
<string>Log To System Console</string>
|
||||
<string>Log To File</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -72,6 +72,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="logToConsole">
|
||||
<property name="text">
|
||||
<string>Log To System Console</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="logToDebug">
|
||||
<property name="text">
|
||||
@ -79,10 +86,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="logToFile">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="logTimestamps">
|
||||
<property name="text">
|
||||
<string>Log To File</string>
|
||||
<string>Log Timestamps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="logFileTimestamps">
|
||||
<property name="text">
|
||||
<string>Log File Timestamps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -2314,6 +2314,8 @@ void MainWindow::connectSignals()
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionLogToFile, "Logging", "LogToFile", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionLogToWindow, "Logging", "LogToWindow", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionLogTimestamps, "Logging", "LogTimestamps", true);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionLogFileTimestamps, "Logging", "LogFileTimestamps",
|
||||
false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(nullptr, m_ui.actionEnableSafeMode, "Main", "DisableAllEnhancements",
|
||||
false);
|
||||
|
@ -169,6 +169,7 @@
|
||||
<addaction name="actionLogToWindow"/>
|
||||
<addaction name="actionLogToFile"/>
|
||||
<addaction name="actionLogTimestamps"/>
|
||||
<addaction name="actionLogFileTimestamps"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCPUDebugger"/>
|
||||
<addaction name="separator"/>
|
||||
@ -955,6 +956,14 @@
|
||||
<string>Log Timestamps</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLogFileTimestamps">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log File Timestamps</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLogToSystemConsole">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
|
Loading…
x
Reference in New Issue
Block a user