Merge pull request #4274 from lioncash/log

LogWindow: Minor changes
This commit is contained in:
shuffle2 2016-10-02 20:43:31 -07:00 committed by GitHub
commit a61c6c6e2f
1 changed files with 5 additions and 5 deletions

View File

@ -30,9 +30,9 @@
#include "DolphinWX/WxUtils.h"
// Milliseconds between msgQueue flushes to wxTextCtrl
#define UPDATETIME 200
constexpr int UPDATE_TIME_MS = 200;
// Max size of msgQueue, old messages will be discarded when there are too many.
#define MSGQUEUE_MAX_SIZE 100
constexpr size_t MSGQUEUE_MAX_SIZE = 100;
CLogWindow::CLogWindow(CFrame* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
long style, const wxString& name)
@ -48,7 +48,7 @@ CLogWindow::CLogWindow(CFrame* parent, wxWindowID id, const wxPoint& pos, const
CreateGUIControls();
m_LogTimer.SetOwner(this);
m_LogTimer.Start(UPDATETIME);
m_LogTimer.Start(UPDATE_TIME_MS);
}
void CLogWindow::CreateGUIControls()
@ -292,7 +292,7 @@ void CLogWindow::UpdateLog()
// the GUI will lock up, which could be an issue if new messages are flooding in faster than
// this function can render them to the screen.
// So we limit this function to processing MSGQUEUE_MAX_SIZE messages each time it's called.
for (int num = 0; num < MSGQUEUE_MAX_SIZE; num++)
for (size_t num = 0; num < MSGQUEUE_MAX_SIZE; num++)
{
u8 log_level;
wxString log_msg;
@ -355,5 +355,5 @@ void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char* text)
if (msgQueue.size() >= MSGQUEUE_MAX_SIZE)
msgQueue.pop();
msgQueue.push(std::make_pair(u8(level), StrToWxStr(text)));
msgQueue.emplace(static_cast<u8>(level), StrToWxStr(text));
}