Skip to content

Commit eb7817d

Browse files
committed
Made ui mod menu cleaner
1 parent 5706f1c commit eb7817d

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

src/port/ui/GhostshipMenuDevTools.cpp

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,29 +148,46 @@ void GhostshipMenu::AddModMenu() {
148148
GameEngine::Instance->LoadScripts();
149149
});
150150

151-
// Assuming you have defined the path where these cards should go
152-
// WidgetPath path = { "Mods", "Installed Mods", SECTION_COLUMN_1 };
153-
154151
for (const auto& entry : *mods) {
155152
const auto& info = entry->GetManifest();
156153
if (info.Name.empty()) {
157154
continue;
158155
}
159156

160-
const bool isCodeMod = !info.Main.empty() || !info.Binaries.empty();
157+
std::string cardTitle = info.Name;
158+
159+
if (!info.Icon.empty()) {
160+
cardTitle = info.Icon + " " + cardTitle;
161+
}
161162

162-
std::string modCardName = info.Name;
163-
if (isCodeMod) {
164-
modCardName += " (Code Mod)";
163+
if (!info.Main.empty() || !info.Binaries.empty()) {
164+
cardTitle += " (Code Mod)";
165165
}
166166

167-
AddWidget(path, modCardName, WIDGET_SEPARATOR_TEXT).Options(UIWidgets::TextOptions{});
167+
AddWidget(path, cardTitle, WIDGET_SEPARATOR_TEXT).Options(UIWidgets::TextOptions{});
168168

169-
AddWidget(path, "Author: " + info.Author + " | Version: " + info.Version, WIDGET_TEXT)
170-
.Options(UIWidgets::TextOptions{});
169+
std::string metadata = "Author: " + (info.Author.empty() ? "Unknown" : info.Author);
171170

172-
std::string securityText = entry->IsSigned() ? "Security: Signed (Trusted)" : "Security: Untrusted";
173-
AddWidget(path, securityText, WIDGET_TEXT).Options(UIWidgets::TextOptions{});
171+
if (!info.Version.empty()) {
172+
metadata += " | Version: " + info.Version;
173+
}
174+
if (!info.License.empty()) {
175+
metadata += " | License: " + info.License;
176+
}
177+
178+
AddWidget(path, metadata, WIDGET_TEXT).Options(UIWidgets::TextOptions{});
179+
180+
std::string securityText;
181+
if (entry->IsSigned()) {
182+
securityText = std::string(ICON_FA_CHECK_CIRCLE) + " Security: Signed (Trusted)";
183+
AddWidget(path, securityText, WIDGET_TEXT).Options(UIWidgets::TextOptions{ .color = Colors::Green });
184+
} else if (entry->IsChecksumValid()) {
185+
securityText = std::string(ICON_FA_EXCLAMATION_TRIANGLE) + " Security: Unsigned (Caution)";
186+
AddWidget(path, securityText, WIDGET_TEXT).Options(UIWidgets::TextOptions{ .color = Colors::Orange });
187+
} else {
188+
securityText = std::string(ICON_FA_EXCLAMATION_TRIANGLE) + " Security: Untrusted";
189+
AddWidget(path, securityText, WIDGET_TEXT).Options(UIWidgets::TextOptions{ .color = Colors::Red });
190+
}
174191

175192
if (!info.Dependencies.empty()) {
176193
std::string depsString = "Dependencies: ";

0 commit comments

Comments
 (0)