Add support for view older launcher logs

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li 2025-06-03 06:08:24 +08:00
parent c58cc3396a
commit 289645266a
No known key found for this signature in database
8 changed files with 560 additions and 183 deletions

View file

@ -697,16 +697,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
m_settings->registerSetting("ConsoleMaxLines", 100000);
m_settings->registerSetting("ConsoleOverflowStop", true);
auto lineSetting = settings()->getSetting("ConsoleMaxLines");
bool conversionOk = false;
int maxLines = lineSetting->get().toInt(&conversionOk);
if (!conversionOk) {
maxLines = lineSetting->defValue().toInt();
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
}
logModel->setMaxLines(maxLines);
logModel->setStopOnOverflow(settings()->get("ConsoleOverflowStop").toBool());
logModel->setOverflowMessage(tr("Cannot display this log since the log length surpassed %1 lines.").arg(maxLines));
logModel->setMaxLines(getConsoleMaxLines());
logModel->setStopOnOverflow(shouldStopOnConsoleOverflow());
logModel->setOverflowMessage(tr("Cannot display this log since the log length surpassed %1 lines.").arg(logModel->getMaxLines()));
// Folders
m_settings->registerSetting("InstanceDir", "instances");
@ -1614,6 +1607,23 @@ void Application::updateIsRunning(bool running)
m_updateRunning = running;
}
int Application::getConsoleMaxLines() const
{
auto lineSetting = settings()->getSetting("ConsoleMaxLines");
bool conversionOk = false;
int maxLines = lineSetting->get().toInt(&conversionOk);
if (!conversionOk) {
maxLines = lineSetting->defValue().toInt();
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
}
return maxLines;
}
bool Application::shouldStopOnConsoleOverflow() const
{
return settings()->get("ConsoleOverflowStop").toBool();
}
void Application::controllerSucceeded()
{
auto controller = qobject_cast<LaunchController*>(QObject::sender());