Add line limit to server chat and debug log panes (#784)
Set default maximum block size to 5,000 unless otherwise specified
This commit is contained in:
		
							parent
							
								
									b8a5deeaae
								
							
						
					
					
						commit
						ffcd783c10
					
				@ -9,7 +9,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class AOTextArea : public QTextBrowser {
 | 
					class AOTextArea : public QTextBrowser {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  AOTextArea(QWidget *p_parent = nullptr);
 | 
					  AOTextArea(QWidget *p_parent = nullptr, int p_log_length = 5000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void append_linked(QString p_message);
 | 
					  void append_linked(QString p_message);
 | 
				
			||||||
  void append_chatmessage(QString p_name, QString p_message,
 | 
					  void append_chatmessage(QString p_name, QString p_message,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,9 @@
 | 
				
			|||||||
#include "aotextarea.h"
 | 
					#include "aotextarea.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {}
 | 
					AOTextArea::AOTextArea(QWidget *p_parent, int p_log_length) : QTextBrowser(p_parent)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  this->document()->setMaximumBlockCount(p_log_length);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AOTextArea::append_linked(QString p_message)
 | 
					void AOTextArea::append_linked(QString p_message)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -121,7 +121,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
  log_timestamp = ao_app->get_log_timestamp();
 | 
					  log_timestamp = ao_app->get_log_timestamp();
 | 
				
			||||||
  log_timestamp_format = ao_app->get_log_timestamp_format();
 | 
					  log_timestamp_format = ao_app->get_log_timestamp_format();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_debug_log = new AOTextArea(this);
 | 
					  ui_debug_log = new AOTextArea(this, ao_app->get_max_log_size());
 | 
				
			||||||
  ui_debug_log->setReadOnly(true);
 | 
					  ui_debug_log->setReadOnly(true);
 | 
				
			||||||
  ui_debug_log->setOpenExternalLinks(true);
 | 
					  ui_debug_log->setOpenExternalLinks(true);
 | 
				
			||||||
  ui_debug_log->hide();
 | 
					  ui_debug_log->hide();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user