make tox save file selectable (hacky)

This commit is contained in:
Green Sky 2023-08-03 15:03:12 +02:00
parent b4eda033c6
commit 7a7b55bebf
No known key found for this signature in database
3 changed files with 16 additions and 3 deletions

@ -1 +1 @@
Subproject commit 3c25162ba1ffa03583059ef374590fdb1ede2203 Subproject commit e28c2502d67027f9183a0abe19cd7c9260d54c1c

View File

@ -24,8 +24,20 @@ Screen* StartScreen::poll(bool&) {
if (ImGui::BeginTabBar("view")) { if (ImGui::BeginTabBar("view")) {
if (ImGui::BeginTabItem("load profile")) { if (ImGui::BeginTabItem("load profile")) {
ImGui::Text("TODO: profile path"); if (ImGui::Button("select")) {
_fss.requestFile(
[](const auto& path) -> bool { return std::filesystem::is_regular_file(path); },
[this](const auto& path) {
tox_profile_path = path.string();
},
[](){}
);
}
ImGui::SameLine();
ImGui::Text("profile: %s", tox_profile_path.c_str());
ImGui::Text("TODO: profile password"); ImGui::Text("TODO: profile password");
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("create profile")) { if (ImGui::BeginTabItem("create profile")) {
@ -66,7 +78,7 @@ Screen* StartScreen::poll(bool&) {
ImGui::Separator(); ImGui::Separator();
if (ImGui::Button("load", {60, 25})) { if (ImGui::Button("load", {60, 25})) {
auto new_screen = std::make_unique<MainScreen>(_renderer, "tomato.tox", queued_plugin_paths); auto new_screen = std::make_unique<MainScreen>(_renderer, tox_profile_path, queued_plugin_paths);
return new_screen.release(); return new_screen.release();
} }

View File

@ -16,6 +16,7 @@ struct StartScreen final : public Screen {
SDL_Renderer* _renderer; SDL_Renderer* _renderer;
FileSelector _fss; FileSelector _fss;
std::string tox_profile_path {"tomato.tox"};
std::vector<std::string> queued_plugin_paths; std::vector<std::string> queued_plugin_paths;
StartScreen(void) = delete; StartScreen(void) = delete;