refactor: Restructure file dialog handling and introduce utility classes

- Updated file dialog references across the application to utilize a new `util::FileDialogWrapper` for consistent file handling.
- Refactored existing code to replace direct calls to `core::FileDialogWrapper` with the new utility class, enhancing modularity and maintainability.
- Introduced `util::PlatformPaths` for cross-platform directory management, ensuring consistent access to user directories and application data paths.
- Added new utility functions for file operations, improving the overall file handling capabilities within the application.
- Updated CMake configurations to include new utility source files, streamlining the build process.
This commit is contained in:
scawful
2025-10-04 23:26:42 -04:00
parent 429506e503
commit bcc8f8e8f9
39 changed files with 385 additions and 144 deletions

View File

@@ -14,7 +14,7 @@
#include "app/core/service/screenshot_utils.h"
#include "app/gui/widgets/widget_state_capture.h"
#include "app/core/features.h"
#include "app/core/platform/file_dialog.h"
#include "util/file_util.h"
#include "app/gfx/arena.h"
#include "app/gui/icons.h"
#if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE
@@ -1011,7 +1011,7 @@ void TestManager::DrawTestDashboard(bool* show_dashboard) {
: "Bespoke");
// Actually test the file dialog
auto result = core::FileDialogWrapper::ShowOpenFileDialog();
auto result = util::FileDialogWrapper::ShowOpenFileDialog();
if (!result.empty()) {
LOG_INFO("TestManager", "File dialog test successful: %s",
result.c_str());
@@ -1023,7 +1023,7 @@ void TestManager::DrawTestDashboard(bool* show_dashboard) {
ImGui::SameLine();
if (ImGui::Button("Test NFD Directly")) {
auto result = core::FileDialogWrapper::ShowOpenFileDialogNFD();
auto result = util::FileDialogWrapper::ShowOpenFileDialogNFD();
if (!result.empty()) {
LOG_INFO("TestManager", "NFD test successful: %s", result.c_str());
} else {
@@ -1035,7 +1035,7 @@ void TestManager::DrawTestDashboard(bool* show_dashboard) {
ImGui::SameLine();
if (ImGui::Button("Test Bespoke Directly")) {
auto result = core::FileDialogWrapper::ShowOpenFileDialogBespoke();
auto result = util::FileDialogWrapper::ShowOpenFileDialogBespoke();
if (!result.empty()) {
LOG_INFO("TestManager", "Bespoke test successful: %s",
result.c_str());
@@ -1187,13 +1187,13 @@ void TestManager::DrawTestDashboard(bool* show_dashboard) {
ImGui::Text("Test Both Implementations:");
if (ImGui::Button("Quick Test NFD")) {
auto result = core::FileDialogWrapper::ShowOpenFileDialogNFD();
auto result = util::FileDialogWrapper::ShowOpenFileDialogNFD();
LOG_INFO("TestManager", "NFD test result: %s",
result.empty() ? "Failed/Canceled" : result.c_str());
}
ImGui::SameLine();
if (ImGui::Button("Quick Test Bespoke")) {
auto result = core::FileDialogWrapper::ShowOpenFileDialogBespoke();
auto result = util::FileDialogWrapper::ShowOpenFileDialogBespoke();
LOG_INFO("TestManager", "Bespoke test result: %s",
result.empty() ? "Failed/Not Implemented" : result.c_str());
}