| 254 | } |
| 255 | |
| 256 | void LogWindow::onSaveTriggered() |
| 257 | { |
| 258 | const QString path = QFileDialog::getSaveFileName(this, tr("Select Log File"), QString(), tr("Log Files (*.txt)")); |
| 259 | if (path.isEmpty()) |
| 260 | return; |
| 261 | |
| 262 | QFile file(path); |
| 263 | if (!file.open(QFile::WriteOnly | QFile::Text)) |
| 264 | { |
| 265 | QMessageBox::critical(this, tr("Error"), tr("Failed to open file for writing.")); |
| 266 | return; |
| 267 | } |
| 268 | |
| 269 | file.write(m_text->toPlainText().toUtf8()); |
| 270 | file.close(); |
| 271 | |
| 272 | appendMessage(LOGLEVEL_INFO, Color_Default, tr("Log was written to %1.\n").arg(path)); |
| 273 | } |
| 274 | |
| 275 | void LogWindow::logCallback(LOGLEVEL level, ConsoleColors color, std::string_view message) |
| 276 | { |