mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
use a more compact method to add and remove listeners t o all channels
This commit is contained in:
parent
1ad4380fab
commit
ae472e9e67
@ -210,6 +210,20 @@ void LogManager::log(LogMessage msg)
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogManager::addListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
{
|
||||
channel.addListener(listener);
|
||||
}
|
||||
}
|
||||
void LogManager::removeListener(std::shared_ptr<LogListener> listener)
|
||||
{
|
||||
for (auto& channel : mChannels)
|
||||
{
|
||||
channel.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
LogManager& LogManager::getInstance()
|
||||
{
|
||||
|
@ -113,6 +113,8 @@ namespace Log
|
||||
static LogManager& getInstance();
|
||||
LogChannel& getChannel(LogType type);
|
||||
void log(LogMessage msg);
|
||||
void addListener(std::shared_ptr<LogListener> listener);
|
||||
void removeListener(std::shared_ptr<LogListener> listener);
|
||||
#ifdef BUFFERED_LOGGING
|
||||
void consumeLog();
|
||||
#endif
|
||||
|
@ -139,14 +139,7 @@ LogFrame::LogFrame(wxWindow* parent)
|
||||
m_tabs.AddPage(m_log, "Log");
|
||||
m_tabs.AddPage(m_tty, "TTY");
|
||||
|
||||
Log::LogManager::getInstance().getChannel(Log::GENERAL).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::LOADER).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::MEMORY).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::RSX).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::HLE).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::PPU).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::SPU).addListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::TTY).addListener(listener);
|
||||
Log::LogManager::getInstance().addListener(listener);
|
||||
|
||||
wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL);
|
||||
s_main->Add(&m_tabs, 1, wxEXPAND);
|
||||
@ -158,14 +151,7 @@ LogFrame::LogFrame(wxWindow* parent)
|
||||
|
||||
LogFrame::~LogFrame()
|
||||
{
|
||||
Log::LogManager::getInstance().getChannel(Log::GENERAL).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::LOADER).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::MEMORY).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::RSX).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::HLE).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::PPU).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::SPU).removeListener(listener);
|
||||
Log::LogManager::getInstance().getChannel(Log::TTY).removeListener(listener);
|
||||
Log::LogManager::getInstance().removeListener(listener);
|
||||
}
|
||||
|
||||
bool LogFrame::Close(bool force)
|
||||
|
Loading…
Reference in New Issue
Block a user