| 345 | } |
| 346 | |
| 347 | void Probe::delayedInit() |
| 348 | { |
| 349 | QCoreApplication::instance()->installEventFilter(this); |
| 350 | |
| 351 | QString appName = qApp->applicationName(); |
| 352 | if (appName.isEmpty() && !qApp->arguments().isEmpty()) { |
| 353 | appName = qApp->arguments().first().remove(qApp->applicationDirPath()); |
| 354 | if (appName.startsWith('.')) |
| 355 | appName = appName.right(appName.length() - 1); |
| 356 | if (appName.startsWith('/')) |
| 357 | appName = appName.right(appName.length() - 1); |
| 358 | } |
| 359 | if (appName.isEmpty()) |
| 360 | appName = tr("PID %1").arg(qApp->applicationPid()); |
| 361 | m_server->setLabel(appName); |
| 362 | // The applicationName might be translated, so let's go with the application file base name |
| 363 | m_server->setKey(QFileInfo(qApp->applicationFilePath()).completeBaseName()); |
| 364 | m_server->setPid(qApp->applicationPid()); |
| 365 | |
| 366 | if (ProbeSettings::value(QStringLiteral("RemoteAccessEnabled"), true).toBool()) { |
| 367 | const auto serverStarted = m_server->listen(); |
| 368 | if (serverStarted) { |
| 369 | ProbeSettings::sendServerAddress(m_server->externalAddress()); |
| 370 | } else { |
| 371 | ProbeSettings::sendServerLaunchError(m_server->errorString()); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | if (ProbeSettings::value(QStringLiteral("InProcessUi"), false).toBool()) |
| 376 | showInProcessUi(); |
| 377 | } |
| 378 | |
| 379 | void Probe::shutdown() |
| 380 | { |
nothing calls this directly
no test coverage detected