MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / drawBottom

Method drawBottom

3ds/source/TransferOverlay.cpp:42–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void ReceiveOverlay::drawBottom(void) const
43{
44 TextPool& text = TextPool::get();
45 C2D_DrawRectSolid(0, 0, 0.5f, 320, 240, COLOR_OVERLAY);
46 C2D_DrawRectSolid(30, 40, 0.5f, 260, 160, COLOR_CARD);
47 Gui::drawOutline(30, 40, 260, 160, 2, COLOR_LINE);
48
49 TransferSnapshot ts = TransferStatus::snapshot();
50 const bool networkActive = ts.active && ts.kind == TransferKind::Network;
51
52 bool completed = Transfer::receiverHasCompleted();
53 if (completed && !networkActive) {
54 std::string backupName = Transfer::receiverCompletedName();
55 if (backupName.empty()) {
56 backupName = i18n::t("transfer.unnamed");
57 }
58
59 text.draw(i18n::t("transfer.file_received"), 40, 60, 0.65f, COLOR_TEXT);
60 text.draw(backupName, 40, 92, 0.52f, COLOR_MUTED);
61
62 std::string notice = Transfer::receiverNotice();
63 if (!notice.empty()) {
64 text.draw(notice, 40, 122, 0.45f, COLOR_MUTED);
65 }
66
67 text.draw(i18n::t("transfer.refresh_hint"), 40, 170, 0.5f, COLOR_MUTED);
68 return;
69 }
70
71 std::string info = i18n::t("transfer.receiver_active");
72 if (Transfer::receiverRunning()) {
73 info = StringUtils::format(
74 "IP: %s\nPort: %d\nPIN: %s", Transfer::receiverIp().c_str(), Transfer::receiverPort(), Transfer::receiverToken().c_str());
75 }
76 else {
77 info = i18n::t("transfer.receiver_stopped");
78 }
79
80 text.draw(info, 40, 60, 0.55f, COLOR_TEXT);
81
82 int noticeY = 120;
83 if (networkActive) {
84 u64 total = ts.bytesTotal, done = ts.bytesDone;
85 int pct = total > 0 ? (int)((done * 100) / total) : 0;
86 float frac = total > 0 ? (float)done / (float)total : 0.0f;
87 std::string prefix = ts.mode.empty() ? i18n::t("transfer.downloading") : ts.mode;
88 text.draw(prefix, 40, 112, 0.5f, COLOR_TEXT);
89 Gui::drawProgressBar(40, 132, 240, 10, frac, TransferStatus::bytesToMB(done, total), StringUtils::format("%d%%", pct));
90 noticeY = 158;
91 }
92
93 std::string notice = Transfer::receiverNotice();
94 if (!notice.empty()) {
95 text.draw(notice, 40, noticeY, 0.45f, COLOR_MUTED);
96 }
97
98 std::string hint = networkActive ? (TransferStatus::cancelRequested() ? i18n::t("transfer.cancelling") : i18n::t("transfer.cancel_hint"))
99 : i18n::t("transfer.close_hint");

Callers

nothing calls this directly

Calls 7

getFunction · 0.85
drawOutlineFunction · 0.85
snapshotFunction · 0.70
bytesToMBFunction · 0.70
cancelRequestedFunction · 0.70
emptyMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected