satdump/src-interface/main_ui.cpp

107 lines
3.1 KiB
C++
Raw Normal View History

2021-08-15 16:47:44 +02:00
#include "main_ui.h"
#include "settingsui.h"
#include "recorder/recorder_menu.h"
#include "recorder/recorder.h"
#include "credits/credits.h"
#include "global.h"
#include "imgui/imgui_flags.h"
#include "imgui/imgui.h"
#include "offline/offline.h"
#include "processing.h"
#include "live/live.h"
#include "live/live_run.h"
2021-10-07 23:39:44 +02:00
#include "projection/projection.h"
#include "projection/projection_menu.h"
2021-08-15 16:47:44 +02:00
satdump_ui_status satdumpUiStatus = MAIN_MENU;
void initMainUI()
{
offline::initOfflineProcessingMenu();
2021-10-07 23:39:44 +02:00
projection::initProjectionMenu();
2021-08-15 16:47:44 +02:00
#ifdef BUILD_LIVE
2021-08-17 13:39:18 +02:00
live::initLiveProcessingMenu();
2021-08-15 16:47:44 +02:00
findRadioDevices();
#endif
}
void renderMainUI(int wwidth, int wheight)
{
if (satdumpUiStatus == OFFLINE_PROCESSING)
{
uiCallListMutex->lock();
for (std::shared_ptr<ProcessingModule> module : *uiCallList)
{
ImGui::SetNextWindowPos({0, 0});
ImGui::SetNextWindowSize({(float)wwidth, (float)wheight});
module->drawUI(false);
}
uiCallListMutex->unlock();
}
#ifdef BUILD_LIVE
else if (satdumpUiStatus == LIVE_PROCESSING)
{
live::renderLive();
}
else if (satdumpUiStatus == BASEBAND_RECORDER)
{
recorder::renderRecorder(wwidth, wheight);
}
#endif
2021-10-07 23:39:44 +02:00
else if (satdumpUiStatus == PROJECTION)
{
projection::renderProjection(wwidth, wheight);
}
2021-08-15 16:47:44 +02:00
else if (satdumpUiStatus == MAIN_MENU)
{
ImGui::SetNextWindowPos({0, 0});
ImGui::SetNextWindowSize({(float)wwidth, (float)wheight});
ImGui::Begin("Main Window", NULL, NOWINDOW_FLAGS | ImGuiWindowFlags_NoTitleBar);
if (ImGui::BeginTabBar("Main TabBar", ImGuiTabBarFlags_None))
{
if (ImGui::BeginTabItem("Offline processing"))
{
offline::renderOfflineProcessingMenu();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Live processing"))
{
#ifdef BUILD_LIVE
live::renderLiveProcessingMenu();
#else
ImGui::Text("Live support was not enabled in this build. Please rebuild with BUILD_LIVE=ON if you wish to use it.");
#endif
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Baseband Recorder"))
{
#ifdef BUILD_LIVE
recorder::renderRecorderMenu();
#else
ImGui::Text("Live support was not enabled in this build. Please rebuild with BUILD_LIVE=ON if you wish to use it.");
#endif
ImGui::EndTabItem();
}
2021-10-07 23:39:44 +02:00
if (ImGui::BeginTabItem("Projection"))
{
projection::renderProjectionMenu(wwidth, wheight);
ImGui::EndTabItem();
}
2021-08-15 16:47:44 +02:00
if (ImGui::BeginTabItem("Settings"))
{
renderSettings(wwidth, wheight);
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Credits"))
{
credits::renderCredits(wwidth, wheight);
ImGui::EndTabItem();
}
}
ImGui::EndTabBar();
ImGui::End();
}
}