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

@@ -9,7 +9,7 @@
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <content/popups/popup_notification.hpp>
#include <popups/popup_notification.hpp>
#include <wolv/io/file.hpp>
@@ -113,7 +113,7 @@ namespace hex::plugin::builtin {
wolv::io::File output(outputPath, wolv::io::File::Mode::Create);
if (!output.isValid()) {
PopupError::open("hex.builtin.tools.file_tools.combiner.error.open_output"_lang);
ui::PopupError::open("hex.builtin.tools.file_tools.combiner.error.open_output"_lang);
return;
}
@@ -126,7 +126,7 @@ namespace hex::plugin::builtin {
wolv::io::File input(file, wolv::io::File::Mode::Read);
if (!input.isValid()) {
PopupError::open(hex::format("hex.builtin.tools.file_tools.combiner.open_input"_lang, wolv::util::toUTF8String(file)));
ui::PopupError::open(hex::format("hex.builtin.tools.file_tools.combiner.open_input"_lang, wolv::util::toUTF8String(file)));
return;
}
@@ -142,7 +142,7 @@ namespace hex::plugin::builtin {
selectedIndex = 0;
outputPath.clear();
PopupInfo::open("hex.builtin.tools.file_tools.combiner.success"_lang);
ui::PopupInfo::open("hex.builtin.tools.file_tools.combiner.success"_lang);
});
}
}

View File

@@ -7,7 +7,7 @@
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <content/popups/popup_notification.hpp>
#include <popups/popup_notification.hpp>
#include <wolv/io/file.hpp>
#include <wolv/utils/guards.hpp>
@@ -54,7 +54,7 @@ namespace hex::plugin::builtin {
wolv::io::File file(selectedFile, wolv::io::File::Mode::Write);
if (!file.isValid()) {
PopupError::open("hex.builtin.tools.file_tools.shredder.error.open"_lang);
ui::PopupError::open("hex.builtin.tools.file_tools.shredder.error.open"_lang);
return;
}
@@ -128,7 +128,7 @@ namespace hex::plugin::builtin {
file.remove();
PopupInfo::open("hex.builtin.tools.file_tools.shredder.success"_lang);
ui::PopupInfo::open("hex.builtin.tools.file_tools.shredder.success"_lang);
});
}
}

View File

@@ -9,7 +9,7 @@
#include <imgui.h>
#include <hex/ui/imgui_imhex_extensions.h>
#include <content/popups/popup_notification.hpp>
#include <popups/popup_notification.hpp>
#include <wolv/io/file.hpp>
#include <wolv/utils/guards.hpp>
@@ -101,12 +101,12 @@ namespace hex::plugin::builtin {
wolv::io::File file(selectedFile, wolv::io::File::Mode::Read);
if (!file.isValid()) {
PopupError::open("hex.builtin.tools.file_tools.splitter.picker.error.open"_lang);
ui::PopupError::open("hex.builtin.tools.file_tools.splitter.picker.error.open"_lang);
return;
}
if (file.getSize() < splitSize) {
PopupError::open("hex.builtin.tools.file_tools.splitter.picker.error.size"_lang);
ui::PopupError::open("hex.builtin.tools.file_tools.splitter.picker.error.size"_lang);
return;
}
@@ -122,7 +122,7 @@ namespace hex::plugin::builtin {
wolv::io::File partFile(path, wolv::io::File::Mode::Create);
if (!partFile.isValid()) {
PopupError::open(hex::format("hex.builtin.tools.file_tools.splitter.picker.error.create"_lang, index));
ui::PopupError::open(hex::format("hex.builtin.tools.file_tools.splitter.picker.error.create"_lang, index));
return;
}
@@ -135,7 +135,7 @@ namespace hex::plugin::builtin {
index++;
}
PopupInfo::open("hex.builtin.tools.file_tools.splitter.picker.success"_lang);
ui::PopupInfo::open("hex.builtin.tools.file_tools.splitter.picker.success"_lang);
});
}
}

View File

@@ -21,7 +21,7 @@ namespace hex::plugin::builtin {
});
}
} else {
if (ImGui::Button("hex.builtin.common.cancel"_lang)) {
if (ImGui::Button("hex.ui.common.cancel"_lang)) {
request.cancel();
}
}
@@ -33,9 +33,9 @@ namespace hex::plugin::builtin {
ImGuiExt::Header("hex.builtin.tools.file_uploader.recent"_lang);
if (ImGui::BeginTable("##links", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg, ImVec2(0, 200))) {
ImGui::TableSetupColumn("hex.builtin.common.file"_lang);
ImGui::TableSetupColumn("hex.builtin.common.link"_lang);
ImGui::TableSetupColumn("hex.builtin.common.size"_lang);
ImGui::TableSetupColumn("hex.ui.common.file"_lang);
ImGui::TableSetupColumn("hex.ui.common.link"_lang);
ImGui::TableSetupColumn("hex.ui.common.size"_lang);
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableHeadersRow();
@@ -81,11 +81,11 @@ namespace hex::plugin::builtin {
json.at("data").at("file").at("metadata").at("size").at("readable")
});
} catch (...) {
PopupError::open("hex.builtin.tools.file_uploader.invalid_response"_lang);
ui::PopupError::open("hex.builtin.tools.file_uploader.invalid_response"_lang);
}
} else if (response.getStatusCode() == 0) {
// Canceled by user, no action needed
} else PopupError::open(hex::format("hex.builtin.tools.file_uploader.error"_lang, response.getStatusCode()));
} else ui::PopupError::open(hex::format("hex.builtin.tools.file_uploader.error"_lang, response.getStatusCode()));
uploadProcess = {};
currFile.clear();