Skip to content
Snippets Groups Projects
Commit 7161dbff authored by bartvbl's avatar bartvbl
Browse files

Reverted changes. Windows is just windows I guess

parent 4c923911
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment