Harmonizing other log controls with minecraft log

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li
2025-04-15 06:00:49 +08:00
parent 1ee1bab067
commit 5634723ecd
3 changed files with 147 additions and 55 deletions

View File

@ -203,6 +203,8 @@ void OtherLogsPage::on_btnReload_clicked()
// Try to determine a level for each line
if (content.back() == '\n')
content = content.removeLast();
ui->text->clear();
m_model->clear();
for (auto& line : content.split('\n')) {
MessageLevel::Enum level = MessageLevel::Unknown;
@ -232,6 +234,11 @@ void OtherLogsPage::on_btnCopy_clicked()
GuiUtil::setClipboardText(ui->text->toPlainText());
}
void OtherLogsPage::on_btnBottom_clicked()
{
ui->text->scrollToBottom();
}
void OtherLogsPage::on_btnDelete_clicked()
{
if (m_currentFile.isEmpty()) {
@ -308,6 +315,24 @@ void OtherLogsPage::on_btnClean_clicked()
}
}
void OtherLogsPage::on_wrapCheckbox_clicked(bool checked)
{
ui->text->setWordWrap(checked);
if (!m_model)
return;
m_model->setLineWrap(checked);
ui->text->scrollToBottom();
}
void OtherLogsPage::on_colorCheckbox_clicked(bool checked)
{
ui->text->setColorLines(checked);
if (!m_model)
return;
m_model->setColorLines(checked);
ui->text->scrollToBottom();
}
void OtherLogsPage::setControlsEnabled(const bool enabled)
{
ui->btnReload->setEnabled(enabled);