1.5: Fuckin' UE5... #38

Manually merged
williamjcm merged 126 commits from one-point-five into master 2024-07-22 11:06:13 +02:00
2 changed files with 113 additions and 38 deletions
Showing only changes of commit 165ca39e84 - Show all commits

View file

@ -115,6 +115,7 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe
void drawProfileManager(); void drawProfileManager();
void drawBackupListPopup(); void drawBackupListPopup();
void drawBackupFolder(const Managers::Vfs::Directory<Managers::Backup>& dir);
void drawBackupRestorePopup(std::size_t backup_index); void drawBackupRestorePopup(std::size_t backup_index);
void drawBackupDeletePopup(std::size_t backup_index); void drawBackupDeletePopup(std::size_t backup_index);
void drawDeleteProfilePopup(std::size_t profile_index); void drawDeleteProfilePopup(std::size_t profile_index);

View file

@ -175,48 +175,50 @@ Application::drawBackupListPopup() {
ImGui::TableSetColumnIndex(3); ImGui::TableSetColumnIndex(3);
ImGui::TextUnformatted("Actions"); ImGui::TextUnformatted("Actions");
for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { drawBackupFolder(_backupManager->vfs());
auto& backup = _backupManager->backups()[i];
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); //for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) {
ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); // auto& backup = _backupManager->backups()[i];
if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { // ImGui::TableNextRow();
for(const auto& file : backup.includedFiles) {
ImGui::TextUnformatted(file.cbegin());
}
ImGui::EndTooltip();
}
ImGui::TableSetColumnIndex(1); // ImGui::TableSetColumnIndex(0);
ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", // ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend());
backup.timestamp.year, // if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) {
backup.timestamp.month, // for(const auto& file : backup.includedFiles) {
backup.timestamp.day, // ImGui::TextUnformatted(file.cbegin());
backup.timestamp.hour, // }
backup.timestamp.minute, // ImGui::EndTooltip();
backup.timestamp.second); // }
ImGui::TableSetColumnIndex(2); // ImGui::TableSetColumnIndex(1);
ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); // ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i",
// backup.timestamp.year,
// backup.timestamp.month,
// backup.timestamp.day,
// backup.timestamp.hour,
// backup.timestamp.minute,
// backup.timestamp.second);
ImGui::TableSetColumnIndex(3); // ImGui::TableSetColumnIndex(2);
ImGui::PushID(int(i)); // ImGui::TextUnformatted(backup.demo ? "Demo" : "Full");
if(ImGui::SmallButton(ICON_FA_UNDO)) {
backup_index = i; // ImGui::TableSetColumnIndex(3);
ImGui::OpenPopup("Restore backup##RestoreBackupModal"); // ImGui::PushID(int(i));
} // if(ImGui::SmallButton(ICON_FA_UNDO)) {
drawTooltip("Restore"); // backup_index = i;
drawBackupRestorePopup(backup_index); // ImGui::OpenPopup("Restore backup##RestoreBackupModal");
ImGui::SameLine(0.0f, 2.0f); // }
if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { // drawTooltip("Restore");
backup_index = i; // drawBackupRestorePopup(backup_index);
ImGui::OpenPopup("Delete backup##DeleteBackupModal"); // ImGui::SameLine(0.0f, 2.0f);
} // if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) {
drawTooltip("Delete"); // backup_index = i;
drawBackupDeletePopup(backup_index); // ImGui::OpenPopup("Delete backup##DeleteBackupModal");
ImGui::PopID(); // }
} // drawTooltip("Delete");
// drawBackupDeletePopup(backup_index);
// ImGui::PopID();
//}
ImGui::EndTable(); ImGui::EndTable();
} }
@ -241,6 +243,78 @@ Application::drawBackupListPopup() {
ImGui::EndPopup(); ImGui::EndPopup();
} }
void
Application::drawBackupFolder(const Managers::Vfs::Directory<Managers::Backup>& dir) {
if(dir.files().isEmpty() && dir.subdirs().isEmpty()) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextDisabled("<empty>");
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
return;
}
bool open = false;
if(dir.name() != "") {
ImGui::TableNextRow();
ImGui::TableNextColumn();
open = ImGui::TreeNodeEx(dir.name().cbegin(), ImGuiTreeNodeFlags_SpanAllColumns);
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
ImGui::TableNextColumn();
ImGui::TextDisabled("--");
}
for(auto& subdir : dir.subdirs()) {
drawBackupFolder(subdir);
if(open) {
ImGui::TreePop();
}
}
for(auto file : dir.files()) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TreeNodeEx(file->company.cbegin(), ImGuiTreeNodeFlags_SpanAllColumns|ImGuiTreeNodeFlags_Leaf|
ImGuiTreeNodeFlags_Bullet|ImGuiTreeNodeFlags_NoTreePushOnOpen);
ImGui::TableNextColumn();
ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i",
file->timestamp.year,
file->timestamp.month,
file->timestamp.day,
file->timestamp.hour,
file->timestamp.minute,
file->timestamp.second);
ImGui::TableNextColumn();
ImGui::TextUnformatted(file->demo ? "Demo" : "Full");
ImGui::TableNextColumn();
ImGui::PushID(file);
if(ImGui::SmallButton(ICON_FA_UNDO)) {
//ImGui::OpenPopup("Restore backup##RestoreBackupModal");
}
drawTooltip("Restore");
//drawBackupRestorePopup(backup_index);
ImGui::SameLine(0.0f, 2.0f);
if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) {
//ImGui::OpenPopup("Delete backup##DeleteBackupModal");
}
drawTooltip("Delete");
//drawBackupDeletePopup(backup_index);
ImGui::PopID();
}
}
void void
Application::drawBackupRestorePopup(std::size_t backup_index) { Application::drawBackupRestorePopup(std::size_t backup_index) {
if(!ImGui::BeginPopupModal("Restore backup##RestoreBackupModal", nullptr, if(!ImGui::BeginPopupModal("Restore backup##RestoreBackupModal", nullptr,