MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / displayRequest

Method displayRequest

source/frontend/StarJoinRequestDialog.cpp:14–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12JoinRequestDialog::JoinRequestDialog() : m_confirmed(false) {}
13
14void JoinRequestDialog::displayRequest(String const& userName, function<void(P2PJoinRequestReply)> callback) {
15 auto assets = Root::singleton().assets();
16
17 removeAllChildren();
18
19 GuiReader reader;
20
21 m_callback = std::move(callback);
22
23 reader.registerCallback("yes", [this](Widget*){ reply(P2PJoinRequestReply::Yes); });
24 reader.registerCallback("no", [this](Widget*){ reply(P2PJoinRequestReply::No); });
25 reader.registerCallback("ignore", [this](Widget*){ reply(P2PJoinRequestReply::Ignore); });
26
27 m_confirmed = false;
28
29 Json config = assets->json("/interface/windowconfig/joinrequest.config");
30
31 reader.construct(config.get("paneLayout"), this);
32
33 String message = config.getString("joinMessage").replaceTags(StringMap<String>{{"username", userName}});
34 fetchChild<LabelWidget>("message")->setText(message);
35
36 show();
37}
38
39void JoinRequestDialog::reply(P2PJoinRequestReply reply) {
40 m_confirmed = true;

Callers 1

updateMethod · 0.80

Calls 9

singletonClass · 0.85
assetsMethod · 0.80
jsonMethod · 0.80
getStringMethod · 0.80
registerCallbackMethod · 0.45
constructMethod · 0.45
getMethod · 0.45
replaceTagsMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected