2023-07-26 12:24:18 +02:00
|
|
|
#include "./start_screen.hpp"
|
|
|
|
|
|
|
|
#include "./main_screen.hpp"
|
|
|
|
|
2023-08-03 13:05:19 +02:00
|
|
|
#include <imgui/imgui.h>
|
|
|
|
|
2023-07-26 12:24:18 +02:00
|
|
|
#include <memory>
|
2023-08-03 13:05:19 +02:00
|
|
|
#include <filesystem>
|
2023-07-26 12:24:18 +02:00
|
|
|
|
2023-07-26 20:09:57 +02:00
|
|
|
StartScreen::StartScreen(SDL_Renderer* renderer) : _renderer(renderer) {
|
2023-07-26 12:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Screen* StartScreen::poll(bool&) {
|
|
|
|
|
|
|
|
// TODO: imgui tox profile selector?
|
2023-08-03 13:05:19 +02:00
|
|
|
|
2023-07-26 12:55:50 +02:00
|
|
|
// +----------------------------
|
|
|
|
// | |*tox profile*| plugins |
|
2023-07-26 12:24:18 +02:00
|
|
|
// | +------+ +--------
|
|
|
|
// | | ICON | | fileselector/dropdown?
|
|
|
|
// | | | | password input
|
|
|
|
// | +------+ +--------
|
2023-07-26 12:55:50 +02:00
|
|
|
// +----------------------------
|
2023-07-26 12:24:18 +02:00
|
|
|
|
2023-08-03 13:05:19 +02:00
|
|
|
if (ImGui::BeginTabBar("view")) {
|
|
|
|
if (ImGui::BeginTabItem("load profile")) {
|
|
|
|
ImGui::Text("TODO: profile path");
|
|
|
|
ImGui::Text("TODO: profile password");
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
|
|
|
if (ImGui::BeginTabItem("create profile")) {
|
|
|
|
ImGui::Text("TODO: profile path");
|
|
|
|
ImGui::Text("TODO: profile name");
|
|
|
|
ImGui::Text("TODO: profile password");
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
|
|
|
if (ImGui::BeginTabItem("plugins")) {
|
|
|
|
// list of selected plugins (in order)
|
|
|
|
for (auto it = queued_plugin_paths.begin(); it != queued_plugin_paths.end();) {
|
|
|
|
if (ImGui::SmallButton("-")) {
|
|
|
|
it = queued_plugin_paths.erase(it);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::TextUnformatted(it->c_str());
|
|
|
|
|
|
|
|
it++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImGui::Button("+")) {
|
|
|
|
_fss.requestFile(
|
|
|
|
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
|
|
|
|
[this](const auto& path) {
|
|
|
|
queued_plugin_paths.push_back(path.string());
|
|
|
|
},
|
|
|
|
[](){}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
|
|
|
ImGui::EndTabBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
|
|
|
if (ImGui::Button("load", {60, 25})) {
|
|
|
|
auto new_screen = std::make_unique<MainScreen>(_renderer, "tomato.tox", queued_plugin_paths);
|
|
|
|
return new_screen.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
_fss.render();
|
|
|
|
|
|
|
|
return nullptr;
|
2023-07-26 12:24:18 +02:00
|
|
|
}
|
|
|
|
|