| 48 | LogWindow::~LogWindow() = default; |
| 49 | |
| 50 | void LogWindow::updateSettings() |
| 51 | { |
| 52 | std::unique_lock lock(s_log_mutex); |
| 53 | |
| 54 | const bool new_enabled = Host::GetBaseBoolSettingValue("Logging", "EnableLogWindow", false) && !Host::InNoGUIMode(); |
| 55 | const bool attach_to_main = Host::GetBaseBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true); |
| 56 | const bool curr_enabled = Log::IsHostOutputEnabled(); |
| 57 | const bool input_enabled = Host::GetBaseBoolSettingValue("Logging", "ShowEESIOInput"); |
| 58 | |
| 59 | if (g_log_window && g_log_window->m_line_input) |
| 60 | { |
| 61 | g_log_window->m_input_widget->setVisible(input_enabled); |
| 62 | } |
| 63 | |
| 64 | if (new_enabled == curr_enabled) |
| 65 | { |
| 66 | if (g_log_window && g_log_window->m_attached_to_main_window != attach_to_main) |
| 67 | { |
| 68 | g_log_window->m_attached_to_main_window = attach_to_main; |
| 69 | if (attach_to_main) |
| 70 | g_log_window->reattachToMainWindow(); |
| 71 | } |
| 72 | |
| 73 | // Update level. |
| 74 | if (new_enabled) |
| 75 | Log::SetHostOutputLevel(GetWindowLogLevel(), &LogWindow::logCallback); |
| 76 | |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | if (new_enabled) |
| 81 | { |
| 82 | g_log_window = new LogWindow(attach_to_main); |
| 83 | if (attach_to_main && g_main_window && g_main_window->isVisible()) |
| 84 | g_log_window->reattachToMainWindow(); |
| 85 | |
| 86 | g_log_window->show(); |
| 87 | } |
| 88 | else if (g_log_window) |
| 89 | { |
| 90 | g_log_window->m_destroying = true; |
| 91 | g_log_window->close(); |
| 92 | g_log_window->deleteLater(); |
| 93 | g_log_window = nullptr; |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | void LogWindow::destroy() |
| 98 | { |
nothing calls this directly
no test coverage detected