From 7161dbffec623270f22e299f6ca496a725325fea Mon Sep 17 00:00:00 2001 From: bartvbl <bartvblokl@gmail.com> Date: Mon, 24 Feb 2025 10:18:52 +0100 Subject: [PATCH] Reverted changes. Windows is just windows I guess --- .../animationwindow/src/AnimationWindow.cpp | 49 ++----------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/dependencies/subprojects/animationwindow/src/AnimationWindow.cpp b/dependencies/subprojects/animationwindow/src/AnimationWindow.cpp index dae186a..14c872c 100644 --- a/dependencies/subprojects/animationwindow/src/AnimationWindow.cpp +++ b/dependencies/subprojects/animationwindow/src/AnimationWindow.cpp @@ -15,7 +15,6 @@ #include "internal/FontCache.h" #include "internal/KeyboardKeyConverter.h" #include "internal/nuklear_configured.h" -#include "internal/portable-file-dialogs.h" #include "widgets/Button.h" static bool sdlHasBeenInitialised = false; @@ -338,52 +337,12 @@ void TDT4102::AnimationWindow::add(TDT4102::Widget& widgetToAdd) { widgets.emplace_back(widgetToAdd); } -namespace TDT4102::internal { - pfd::icon messageTypeToPFDIcon(TDT4102::MessageType type) { - pfd::icon messageIcon = pfd::icon::info; - if(type == TDT4102::MessageType::ERROR) { - messageIcon = pfd::icon::error; - } else if(type == TDT4102::MessageType::WARNING) { - messageIcon = pfd::icon::warning; - } else if(type == TDT4102::MessageType::QUESTION) { - messageIcon = pfd::icon::question; - } - return messageIcon; - } -} - -void TDT4102::AnimationWindow::show_message(std::string title, std::string message, TDT4102::MessageType type) const { - pfd::icon messageIcon = internal::messageTypeToPFDIcon(type); - pfd::message(title, message, pfd::choice::ok, messageIcon); -} - -bool TDT4102::AnimationWindow::show_yesno_dialog(std::string title, std::string message, TDT4102::MessageType type) const { - pfd::icon messageIcon = internal::messageTypeToPFDIcon(type); - pfd::button pressedButton = pfd::message(title, message, pfd::choice::yes_no, messageIcon).result(); - return pressedButton == pfd::button::yes; -} - -void TDT4102::AnimationWindow::show_notification(std::string title, std::string message, TDT4102::MessageType type) const { - pfd::icon messageIcon = internal::messageTypeToPFDIcon(type); - pfd::notify(title, message, messageIcon); -} - -std::filesystem::path TDT4102::AnimationWindow::show_open_file_dialog(std::string title, std::filesystem::path initialDirectory) const { - std::vector<std::string> selectedFiles = pfd::open_file(title, initialDirectory.string()).result(); - if(selectedFiles.empty()) { - throw std::runtime_error("No file was selected!"); - } - return std::filesystem::path(selectedFiles.at(0)); -} - -std::filesystem::path TDT4102::AnimationWindow::show_select_directory_dialog(std::string title, std::filesystem::path initialDirectory) const { - std::string selectedFile = pfd::select_folder(title, initialDirectory.string()).result(); - return std::filesystem::path(selectedFile); +void TDT4102::AnimationWindow::show_info_dialog(const std::string& message) const { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Information", message.c_str(), windowHandle); } -std::filesystem::path TDT4102::AnimationWindow::show_save_file_dialog(std::string title, std::filesystem::path initialDirectory) const { - std::string selectedFile = pfd::save_file(title, initialDirectory.string()).result(); - return std::filesystem::path(selectedFile); +void TDT4102::AnimationWindow::show_error_dialog(const std::string& message) const { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", message.c_str(), windowHandle); } TDT4102::Point TDT4102::AnimationWindow::getWindowDimensions() const { -- GitLab