From 13721d35e76cdcc9ac526b6b9b34179646f788f5 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Fri, 7 Jul 2017 16:16:57 -0700 Subject: [PATCH] DolphinWX: remove INI logic from LogConfigWindow --- Source/Core/DolphinWX/LogConfigWindow.cpp | 41 +++++------------------ Source/Core/DolphinWX/LogConfigWindow.h | 1 - 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/Source/Core/DolphinWX/LogConfigWindow.cpp b/Source/Core/DolphinWX/LogConfigWindow.cpp index 104d191d61..b11c3abefa 100644 --- a/Source/Core/DolphinWX/LogConfigWindow.cpp +++ b/Source/Core/DolphinWX/LogConfigWindow.cpp @@ -12,7 +12,6 @@ #include #include "Common/FileUtil.h" -#include "Common/IniFile.h" #include "Common/Logging/ConsoleListener.h" #include "Common/Logging/Log.h" #include "Common/Logging/LogManager.h" @@ -90,39 +89,18 @@ void LogConfigWindow::CreateGUIControls() void LogConfigWindow::LoadSettings() { - IniFile ini; - ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX)); - - IniFile::Section* options = ini.GetOrCreateSection("Options"); - - // Retrieve the verbosity value from the config ini file. - int verbosity; - options->Get("Verbosity", &verbosity, 0); - - // Ensure the verbosity level is valid. - if (verbosity < 1) - verbosity = 1; - if (verbosity > MAX_LOGLEVEL) - verbosity = MAX_LOGLEVEL; - - // Actually set the logging verbosity. - m_verbosity->SetSelection(verbosity - 1); + m_verbosity->SetSelection(m_LogManager->GetLogLevel()); // Get the logger output settings from the config ini file. - options->Get("WriteToFile", &m_writeFile, false); - m_writeFileCB->SetValue(m_writeFile); - options->Get("WriteToConsole", &m_writeConsole, true); - m_writeConsoleCB->SetValue(m_writeConsole); - options->Get("WriteToWindow", &m_writeWindow, true); - m_writeWindowCB->SetValue(m_writeWindow); + m_writeFileCB->SetValue(m_LogManager->IsListenerEnabled(LogListener::FILE_LISTENER)); + m_writeConsoleCB->SetValue(m_LogManager->IsListenerEnabled(LogListener::CONSOLE_LISTENER)); + m_writeWindowCB->SetValue(m_LogManager->IsListenerEnabled(LogListener::LOG_WINDOW_LISTENER)); // Run through all of the log types and check each checkbox for each logging type // depending on its set value within the config ini. for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { - bool log_enabled; - ini.GetOrCreateSection("Logs")->Get(m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), - &log_enabled, false); + bool log_enabled = m_LogManager->IsEnabled(static_cast(i)); if (log_enabled) enableAll = false; @@ -147,20 +125,17 @@ void LogConfigWindow::OnVerbosityChange(wxCommandEvent& event) void LogConfigWindow::OnWriteFileChecked(wxCommandEvent& event) { - m_writeFile = event.IsChecked(); - m_LogManager->EnableListener(LogListener::FILE_LISTENER, m_writeFile); + m_LogManager->EnableListener(LogListener::FILE_LISTENER, event.IsChecked()); } void LogConfigWindow::OnWriteConsoleChecked(wxCommandEvent& event) { - m_writeConsole = event.IsChecked(); - m_LogManager->EnableListener(LogListener::CONSOLE_LISTENER, m_writeConsole); + m_LogManager->EnableListener(LogListener::CONSOLE_LISTENER, event.IsChecked()); } void LogConfigWindow::OnWriteWindowChecked(wxCommandEvent& event) { - m_writeWindow = event.IsChecked(); - m_LogManager->EnableListener(LogListener::LOG_WINDOW_LISTENER, m_writeWindow); + m_LogManager->EnableListener(LogListener::LOG_WINDOW_LISTENER, event.IsChecked()); } void LogConfigWindow::OnToggleAll(wxCommandEvent& WXUNUSED(event)) diff --git a/Source/Core/DolphinWX/LogConfigWindow.h b/Source/Core/DolphinWX/LogConfigWindow.h index f9a3a4806d..69e4e44d86 100644 --- a/Source/Core/DolphinWX/LogConfigWindow.h +++ b/Source/Core/DolphinWX/LogConfigWindow.h @@ -22,7 +22,6 @@ public: private: LogManager* m_LogManager; - bool m_writeFile, m_writeConsole, m_writeWindow; bool enableAll; // Controls