satdump/plugins/firstparty_support/loader/archive_loader.cpp

65 lines
2.1 KiB
C++
Raw Permalink Normal View History

2024-09-27 20:20:51 +02:00
#include "archive_loader.h"
#include "core/style.h"
2025-08-12 13:42:31 +02:00
#include <filesystem>
2024-09-27 20:20:51 +02:00
namespace satdump
{
2025-08-12 13:42:31 +02:00
ArchiveLoader::ArchiveLoader() : request_time("###archiveloeaderequesttime", time(0), true)
2024-09-27 20:20:51 +02:00
{
2025-08-12 13:42:31 +02:00
products_download_and_process_directory = std::filesystem::temp_directory_path().string() + "/satdump_firstparty";
2024-09-27 20:20:51 +02:00
if (!std::filesystem::exists(products_download_and_process_directory))
std::filesystem::create_directories(products_download_and_process_directory);
}
2025-08-12 13:42:31 +02:00
ArchiveLoader::~ArchiveLoader() {}
2024-09-27 20:20:51 +02:00
void ArchiveLoader::drawUI(bool *_open)
{
2024-12-11 13:30:10 -05:00
ImGui::SetNextWindowSize({500 * ui_scale, 500 * ui_scale}, ImGuiCond_Once);
2024-09-27 20:20:51 +02:00
ImGui::Begin("Archive Loader", _open);
ImGui::BeginTabBar("##archiveloadertabbar");
2024-12-11 13:30:10 -05:00
ImVec2 wsize = ImGui::GetWindowSize();
2024-12-12 22:51:48 -05:00
if (ImGui::BeginTabItem("NOAA AWS"))
2024-12-06 19:45:48 +01:00
{
2024-12-12 22:51:48 -05:00
renderAWS(wsize);
2024-12-06 19:45:48 +01:00
ImGui::EndTabItem();
}
2024-09-27 20:20:51 +02:00
if (ImGui::BeginTabItem("EUMETSAT"))
{
renderEumetsat(wsize);
ImGui::EndTabItem();
}
ImGui::EndTabBar();
2024-12-12 22:51:48 -05:00
file_downloader.render();
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
2025-08-12 13:42:31 +02:00
if (ImGui::BeginChild("##archiveloaderoutputselect", {ImGui::GetWindowContentRegionMax().x, 0}, false, ImGuiWindowFlags_NoScrollbar))
2024-12-12 22:51:48 -05:00
{
bool disable_options = file_downloader.is_busy();
if (disable_options)
style::beginDisabled();
ImGui::TextUnformatted("Decode To:");
ImGui::SameLine();
ImGui::RadioButton("Temporary", &download_location, 0);
ImGui::SameLine();
ImGui::RadioButton("Selected Folder:", &download_location, 1);
if (download_location == 0)
style::beginDisabled();
output_selection.draw();
if (download_location == 0)
style::endDisabled();
if (disable_options)
style::endDisabled();
}
2025-08-12 13:42:31 +02:00
2024-12-12 22:51:48 -05:00
ImGui::EndChild();
2024-09-27 20:20:51 +02:00
ImGui::End();
}
2025-08-12 13:42:31 +02:00
} // namespace satdump