| 435 | } |
| 436 | |
| 437 | void SettingsScreen::drawNetwork(void) const |
| 438 | { |
| 439 | Configuration& cfg = Configuration::getInstance(); |
| 440 | |
| 441 | // Row 0: the interactive FTP-server toggle. |
| 442 | const bool ftpOn = cfg.isFTPEnabled(); |
| 443 | drawToggleRow(26, i18n::t("settings.network.ftp"), i18n::t("settings.network.ftp.sub"), ftpOn, contentFocus && contentCursor == 0); |
| 444 | |
| 445 | // Row 1: the fixed receive PIN, or "Random" for the per-receive default. |
| 446 | const std::string pin = cfg.defaultReceivePin(); |
| 447 | drawValueRow(60, i18n::t("settings.network.receive_pin"), i18n::t("settings.network.receive_pin.sub"), |
| 448 | pin.empty() ? i18n::t("settings.network.receive_pin.random") : pin, contentFocus && contentCursor == 1); |
| 449 | |
| 450 | // Row 2: the configured server port. The addresses below show the port the |
| 451 | // server bound at launch, so the two differ until the next restart. |
| 452 | drawValueRow(94, i18n::t("settings.network.server_port"), i18n::t("settings.network.server_port.sub"), std::to_string(cfg.serverPort()), |
| 453 | contentFocus && contentCursor == 2); |
| 454 | |
| 455 | // The wireless-transfer master switch stays on the General tab; what is left |
| 456 | // here is read-only status, which starts below the three interactive rows. |
| 457 | int y = 132; |
| 458 | auto field = [&](const std::string& label, const std::string& value, u32 valColor) { |
| 459 | TextPool::get().draw(label, 20, y, 0.4f, COLOR_FAINT); |
| 460 | TextPool::get().draw(value, 20, y + 14, 0.46f, valColor); |
| 461 | y += 30; |
| 462 | }; |
| 463 | |
| 464 | std::string ftpAddress = FTPServer::getAddress(); |
| 465 | field(i18n::t("settings.network.ftp_address"), |
| 466 | ftpOn ? (ftpAddress.empty() ? i18n::t("common.unavailable") : ftpAddress) : i18n::t("common.disabled"), |
| 467 | ftpOn && !ftpAddress.empty() ? COLOR_TEAL : COLOR_MUTED); |
| 468 | |
| 469 | std::string address = Server::getAddress(); |
| 470 | field(i18n::t("settings.network.memory_logs"), address.empty() ? i18n::t("common.unavailable") : address + "/logs/memory", |
| 471 | address.empty() ? COLOR_MUTED : COLOR_TEXT); |
| 472 | field(i18n::t("settings.network.file_logs"), address.empty() ? i18n::t("common.unavailable") : address + "/logs/file", |
| 473 | address.empty() ? COLOR_MUTED : COLOR_TEXT); |
| 474 | |
| 475 | if (contentFocus) { |
| 476 | // Rows 1 and 2 open a keypad rather than flipping a switch, so the verb |
| 477 | // follows the cursor. |
| 478 | const std::string act = i18n::t(contentCursor > 0 ? "hint.edit" : "hint.toggle"); |
| 479 | drawHints(320, 223, std::string(GLYPH_A) + " " + act + " " + GLYPH_B + " " + i18n::t("hint.back")); |
| 480 | } |
| 481 | else { |
| 482 | drawHints(320, 223, std::string(GLYPH_A) + " " + i18n::t("hint.edit")); |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | void SettingsScreen::drawAbout(void) const |
| 487 | { |
nothing calls this directly
no test coverage detected