| 479 | } |
| 480 | |
| 481 | void printServerInfo(YACReaderHttpServer *httpServer) |
| 482 | { |
| 483 | auto addresses = getIpAddresses(); |
| 484 | if (addresses.isEmpty()) { |
| 485 | QLOG_WARN() << "Running, but no global network interfaces were detected"; |
| 486 | return; |
| 487 | } |
| 488 | |
| 489 | QLOG_INFO() << "Running on" << addresses.first() + ":" + httpServer->getPort().toLocal8Bit() << "\n"; |
| 490 | |
| 491 | qrcodegen::QrCode code = qrcodegen::QrCode::encodeText( |
| 492 | (addresses.first() + ":" + httpServer->getPort()).toLocal8Bit(), |
| 493 | qrcodegen::QrCode::Ecc::LOW); |
| 494 | int border = 4; |
| 495 | for (int y = -border; y < code.getSize() + border; y += 2) { |
| 496 | QString QRCodeString; |
| 497 | for (int x = -border - 1; x < code.getSize() + border + 1; x++) { |
| 498 | QRCodeString.append((code.getModule(x, y) && code.getModule(x, y + 1)) |
| 499 | ? " " |
| 500 | : code.getModule(x, y + 1) ? "\u2580" |
| 501 | : code.getModule(x, y) ? "\u2584" |
| 502 | : "\u2588"); |
| 503 | } |
| 504 | QLOG_INFO() << QRCodeString; |
| 505 | } |
| 506 | if (addresses.length() > 1) { |
| 507 | QLOG_INFO() << addresses.length() - 1 << "more network interfaces detected"; |
| 508 | } |
| 509 | } |
no test coverage detected