refactor: Rework features that use external libraries into optional plugins (#1470)

This commit is contained in:
Nik
2023-12-23 21:09:41 +01:00
committed by GitHub
parent 84bfd10416
commit 61bfe10bc2
149 changed files with 2940 additions and 2390 deletions

View File

@@ -351,30 +351,24 @@ namespace hex::plugin::builtin {
ImGui::TableHeadersRow();
ImGuiListClipper clipper;
clipper.Begin(plugins.size());
for (const auto &plugin : plugins) {
if (plugin.isLibraryPlugin())
continue;
while (clipper.Step()) {
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
const auto &plugin = plugins[i];
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGuiExt::TextFormattedColored(
plugin.isBuiltinPlugin() ? ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight) : ImGui::GetStyleColorVec4(ImGuiCol_Text),
"{}", plugin.getPluginName().c_str()
);
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.getPluginAuthor().c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.getPluginDescription().c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.isLoaded() ? ICON_VS_CHECK : ICON_VS_CLOSE);
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGuiExt::TextFormattedColored(
plugin.isBuiltinPlugin() ? ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_Highlight) : ImGui::GetStyleColorVec4(ImGuiCol_Text),
"{}", plugin.getPluginName().c_str()
);
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.getPluginAuthor().c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.getPluginDescription().c_str());
ImGui::TableNextColumn();
ImGui::TextUnformatted(plugin.isLoaded() ? ICON_VS_CHECK : ICON_VS_CLOSE);
}
clipper.End();
ImGui::EndTable();
}
}
@@ -480,7 +474,7 @@ namespace hex::plugin::builtin {
}
} else {
// Draw a spinner while the release notes are loading
ImGuiExt::TextSpinner("hex.builtin.common.loading"_lang);
ImGuiExt::TextSpinner("hex.ui.common.loading"_lang);
}
}
@@ -597,7 +591,7 @@ namespace hex::plugin::builtin {
} catch (std::exception &e) {
commits.emplace_back(
"hex.builtin.common.error"_lang,
"hex.ui.common.error"_lang,
e.what(),
"",
"",
@@ -607,7 +601,7 @@ namespace hex::plugin::builtin {
} else {
// An error occurred, display it
commits.emplace_back(
"hex.builtin.common.error"_lang,
"hex.ui.common.error"_lang,
"HTTP " + std::to_string(response.getStatusCode()),
"",
"",
@@ -616,7 +610,7 @@ namespace hex::plugin::builtin {
}
} else {
// Draw a spinner while the commits are loading
ImGuiExt::TextSpinner("hex.builtin.common.loading"_lang);
ImGuiExt::TextSpinner("hex.ui.common.loading"_lang);
}
}