Remove some duplicate code

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li 2025-06-05 16:15:29 +08:00
parent e4a801fdf7
commit ef3bf75715
No known key found for this signature in database
7 changed files with 31 additions and 50 deletions

View file

@ -696,8 +696,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
m_settings->registerSetting("ConsoleMaxLines", 100000);
m_settings->registerSetting("ConsoleOverflowStop", true);
logModel->setMaxLines(getConsoleMaxLines());
logModel->setStopOnOverflow(shouldStopOnConsoleOverflow());
logModel->setMaxLines(getConsoleMaxLines(settings()));
logModel->setStopOnOverflow(shouldStopOnConsoleOverflow(settings()));
logModel->setOverflowMessage(tr("Cannot display this log since the log length surpassed %1 lines.").arg(logModel->getMaxLines()));
// Folders
@ -1605,23 +1605,6 @@ 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());