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

Method update

source/frontend/StarModsMenu.cpp:61–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void ModsMenu::update(float dt) {
62 Pane::update(dt);
63
64 size_t selectedItem = m_modList->selectedItem();
65 if (selectedItem == NPos) {
66 m_modName->setText("");
67 m_modAuthor->setText("");
68 m_modVersion->setText("");
69 m_modPath->setText("");
70 m_modDescription->setText("");
71
72 } else {
73 String assetsSource = m_assetsSources.at(selectedItem);
74 JsonObject assetsSourceMetadata = Root::singleton().assets()->assetSourceMetadata(assetsSource);
75
76 m_modName->setText(bestModName(assetsSourceMetadata, assetsSource));
77 m_modAuthor->setText(assetsSourceMetadata.value("author", "No Author Set").toString());
78 m_modVersion->setText(assetsSourceMetadata.value("version", "No Version Set").printString());
79 m_modPath->setText(assetsSource);
80 m_modDescription->setText(assetsSourceMetadata.value("description", "").toString());
81
82 String link = assetsSourceMetadata.value("link", "").toString();
83
84 m_linkButton->setEnabled(!link.empty());
85 m_copyLinkButton->setEnabled(!link.empty());
86 }
87}
88
89String ModsMenu::bestModName(JsonObject const& metadata, String const& sourcePath) {
90 if (auto ptr = metadata.ptr("friendlyName"))

Callers

nothing calls this directly

Calls 11

singletonClass · 0.85
assetSourceMetadataMethod · 0.80
assetsMethod · 0.80
printStringMethod · 0.80
selectedItemMethod · 0.45
setTextMethod · 0.45
atMethod · 0.45
toStringMethod · 0.45
valueMethod · 0.45
setEnabledMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected