1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Merge old and new FileDialogDesc

This commit is contained in:
Gymnasiast
2022-01-28 23:50:24 +01:00
parent f43a4344ce
commit 55591b1b2f
8 changed files with 42 additions and 78 deletions

View File

@@ -1508,23 +1508,11 @@ const utf8* context_get_path_legacy(int32_t pathId)
return result;
}
bool platform_open_common_file_dialog(utf8* outFilename, file_dialog_desc* desc, size_t outSize)
bool platform_open_common_file_dialog(utf8* outFilename, OpenRCT2::Ui::FileDialogDesc& desc, size_t outSize)
{
try
{
FileDialogDesc desc2;
desc2.Type = static_cast<FILE_DIALOG_TYPE>(desc->type);
desc2.Title = String::ToStd(desc->title);
desc2.InitialDirectory = String::ToStd(desc->initial_directory);
desc2.DefaultFilename = String::ToStd(desc->default_filename);
for (const auto& filter : desc->filters)
{
if (filter.name != nullptr)
{
desc2.Filters.push_back({ String::ToStd(filter.name), String::ToStd(filter.pattern) });
}
}
std::string result = GetContext()->GetUiContext()->ShowFileDialog(desc2);
std::string result = GetContext()->GetUiContext()->ShowFileDialog(desc);
String::Set(outFilename, outSize, result.c_str());
return !result.empty();
}