8#include <filedialog/filedialog.h>
9#include <imgui/imgui.h>
10#include <imgui/imgui_internal.h>
29 ImGui::OpenPopup(
name);
30 show_request_ =
false;
33 ImGui::SetNextWindowSize(ImGui::GetMainViewport()->Size * 0.5f);
35 if(ImGui::BeginPopupModal(
name, &
show))
45auto deploy_panel::get_progress() const ->
float
47 if(deploy_jobs_.empty())
54 for(
const auto& kvp : deploy_jobs_)
56 if(kvp.second.is_ready())
62 return float(ready) / float(deploy_jobs_.size());
68 auto& settings = pm.get_settings();
69 auto& deploy_settings = pm.get_deploy_settings();
71 if(
inspect(ctx, settings.app).edit_finished)
73 pm.save_project_settings(ctx);
76 if(
inspect(ctx, settings.standalone).edit_finished)
78 pm.save_project_settings(ctx);
81 if(
inspect(ctx, deploy_settings).edit_finished)
83 pm.save_deploy_settings();
86 float progress = get_progress();
87 bool is_in_progress = progress < 0.99f;
88 bool valid_location = fs::is_directory(deploy_settings.deploy_location);
89 bool valid_startup_scene = settings.standalone.startup_scene.is_valid();
90 bool can_deploy = valid_location && valid_startup_scene && !is_in_progress;
93 ImGui::AlignedItem(0.5f,
94 ImGui::GetContentRegionAvail().
x,
98 if(ImGui::Button(
"Deploy", ImVec2(300.0f, 0.0f)))
108 auto sz = ImGui::GetContentRegionAvail().x * 0.6f;
109 ImGui::AlignedItem(0.5f,
110 ImGui::GetContentRegionAvail().
x,
114 ImGui::ProgressBar(progress, ImVec2(sz, 0.0f));
117 for(
const auto& kvp : deploy_jobs_)
119 const auto&
name = kvp.first;
120 const auto& job = kvp.second;
122 auto text = fmt::format(
"{} - {}",
name.c_str(), (job.is_ready() ?
"Done." :
"In Progress..."));
123 auto sz = ImGui::CalcTextSize(text.c_str()).x;
124 ImGui::AlignedItem(0.5f,
125 ImGui::GetContentRegionAvail().
x,
129 ImGui::TextUnformatted(text.c_str());
deploy_panel(imgui_panels *parent)
void on_frame_ui_render(rtti::context &ctx, const char *name)
auto inspect(rtti::context &ctx, T &obj) -> inspect_result
Convenience template function for inspecting objects of known type.
static auto deploy_project(rtti::context &ctx, const deploy_settings ¶ms) -> std::map< std::string, tpp::shared_future< void > >