satdump/src-interface/main_ui.cpp

59 lines
1.7 KiB
C++
Raw Normal View History

2021-08-15 16:47:44 +02:00
#include "main_ui.h"
#include "imgui/imgui_flags.h"
#include "imgui/imgui.h"
#include "processing.h"
#include "offline.h"
2022-03-10 19:56:37 +01:00
#include "error.h"
2021-08-15 16:47:44 +02:00
2022-03-20 20:56:32 +01:00
#include "logger.h"
#include "common/widgets/image_view.h"
#include "common/image/composite.h"
#include "imgui/imgui_stdlib.h"
#include "products/products.h"
2022-03-10 19:56:37 +01:00
namespace satdump
2021-08-15 16:47:44 +02:00
{
2022-03-10 19:56:37 +01:00
void initMainUI()
{
offline::setup();
}
2021-08-15 16:47:44 +02:00
2022-03-10 19:56:37 +01:00
void renderMainUI(int wwidth, int wheight)
2021-08-15 16:47:44 +02:00
{
2022-03-10 19:56:37 +01:00
if (processing::is_processing)
2021-08-15 16:47:44 +02:00
{
2022-03-10 19:56:37 +01:00
processing::ui_call_list_mutex->lock();
float winheight = processing::ui_call_list->size() > 0 ? wheight / processing::ui_call_list->size() : wheight;
float currentPos = 0;
for (std::shared_ptr<ProcessingModule> module : *processing::ui_call_list)
{
ImGui::SetNextWindowPos({0, currentPos});
currentPos += winheight;
ImGui::SetNextWindowSize({(float)wwidth, (float)winheight});
module->drawUI(false);
}
processing::ui_call_list_mutex->unlock();
2021-08-15 16:47:44 +02:00
}
2022-03-10 19:56:37 +01:00
else
{
2022-03-10 19:56:37 +01:00
ImGui::SetNextWindowPos({0, 0});
2022-03-11 09:29:20 +01:00
ImGui::SetNextWindowSize({(float)wwidth, (float)wheight});
2022-03-10 19:56:37 +01:00
ImGui::Begin("Main", __null, NOWINDOW_FLAGS | ImGuiWindowFlags_NoDecoration);
if (ImGui::BeginTabBar("Main TabBar", ImGuiTabBarFlags_None))
{
2022-03-10 19:56:37 +01:00
if (ImGui::BeginTabItem("Offline processing"))
{
offline::render();
ImGui::EndTabItem();
}
}
2022-03-10 19:56:37 +01:00
ImGui::EndTabBar();
ImGui::End();
2022-03-10 19:56:37 +01:00
if (error::hasError)
error::render();
}
}
2022-03-10 19:56:37 +01:00
ctpl::thread_pool ui_thread_pool(8);
2021-08-15 16:47:44 +02:00
}