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