Skip to content

Commit

Permalink
RMG: improve log dialog clear behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jan 23, 2024
1 parent a6d5a8c commit d94d6ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Source/RMG/UserInterface/Dialog/LogDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ LogDialog::~LogDialog(void)
{
}

int LogDialog::GetLineCount(void)
{
return this->plainTextEdit->document()->lineCount();
}

void LogDialog::AddLogLine(CoreDebugMessageType type, QString context, QString line)
{
QString text;
Expand Down
2 changes: 2 additions & 0 deletions Source/RMG/UserInterface/Dialog/LogDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class LogDialog : public QDialog, private Ui::LogDialog
LogDialog(QWidget* parent = nullptr);
~LogDialog(void);

int GetLineCount(void);

void AddLogLine(CoreDebugMessageType type, QString context, QString line);
void Clear(void);
};
Expand Down
7 changes: 6 additions & 1 deletion Source/RMG/UserInterface/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,12 @@ void MainWindow::on_Action_Audio_ToggleVolumeMute(void)

void MainWindow::on_Emulation_Started(void)
{
this->logDialog.Clear();
// only clear log dialog when we've gone over the limit
if (this->logDialog.GetLineCount() >= 500000)
{
this->logDialog.Clear();
}

this->ui_MessageBoxList.clear();
this->ui_DebugCallbackErrors.clear();
}
Expand Down

0 comments on commit d94d6ce

Please sign in to comment.