From 7a7b55bebf9865d16b094bbbbd6512a859dfaaef Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 3 Aug 2023 15:03:12 +0200 Subject: [PATCH] make tox save file selectable (hacky) --- external/solanaceae_tox | 2 +- src/start_screen.cpp | 16 ++++++++++++++-- src/start_screen.hpp | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/external/solanaceae_tox b/external/solanaceae_tox index 3c25162b..e28c2502 160000 --- a/external/solanaceae_tox +++ b/external/solanaceae_tox @@ -1 +1 @@ -Subproject commit 3c25162ba1ffa03583059ef374590fdb1ede2203 +Subproject commit e28c2502d67027f9183a0abe19cd7c9260d54c1c diff --git a/src/start_screen.cpp b/src/start_screen.cpp index da1498e2..5276e469 100644 --- a/src/start_screen.cpp +++ b/src/start_screen.cpp @@ -24,8 +24,20 @@ Screen* StartScreen::poll(bool&) { if (ImGui::BeginTabBar("view")) { 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::EndTabItem(); } if (ImGui::BeginTabItem("create profile")) { @@ -66,7 +78,7 @@ Screen* StartScreen::poll(bool&) { ImGui::Separator(); if (ImGui::Button("load", {60, 25})) { - auto new_screen = std::make_unique(_renderer, "tomato.tox", queued_plugin_paths); + auto new_screen = std::make_unique(_renderer, tox_profile_path, queued_plugin_paths); return new_screen.release(); } diff --git a/src/start_screen.hpp b/src/start_screen.hpp index e628e584..e1986789 100644 --- a/src/start_screen.hpp +++ b/src/start_screen.hpp @@ -16,6 +16,7 @@ struct StartScreen final : public Screen { SDL_Renderer* _renderer; FileSelector _fss; + std::string tox_profile_path {"tomato.tox"}; std::vector queued_plugin_paths; StartScreen(void) = delete;