chore(cmake): enhance test support linkage and file dialog functionality
- Improved the CMake configuration to conditionally link the yaze_test_support library for the yaze target when tests are enabled, providing clearer feedback on linkage status. - Updated the file dialog implementation to include specific filters for ROM files and all files, enhancing user experience during file selection. - Added status messages to inform users about the linkage of test support and potential issues if the target is not found. Benefits: - Enhanced clarity and maintainability of the CMake configuration. - Improved user interaction with file dialogs through better filtering options.
This commit is contained in:
@@ -11,7 +11,8 @@ namespace util {
|
||||
|
||||
std::string FileDialogWrapper::ShowOpenFileDialog() {
|
||||
nfdchar_t* outPath = nullptr;
|
||||
nfdresult_t result = NFD_OpenDialog(nullptr, nullptr, &outPath);
|
||||
nfdfilteritem_t filterItem[2] = {{"ROM Files", "sfc,smc"}, {"All Files", "*"}};
|
||||
nfdresult_t result = NFD_OpenDialog(&outPath, filterItem, 2, nullptr);
|
||||
|
||||
if (result == NFD_OKAY) {
|
||||
std::string path(outPath);
|
||||
@@ -24,7 +25,7 @@ std::string FileDialogWrapper::ShowOpenFileDialog() {
|
||||
|
||||
std::string FileDialogWrapper::ShowOpenFolderDialog() {
|
||||
nfdchar_t* outPath = nullptr;
|
||||
nfdresult_t result = NFD_PickFolder(nullptr, &outPath);
|
||||
nfdresult_t result = NFD_PickFolder(&outPath, nullptr);
|
||||
|
||||
if (result == NFD_OKAY) {
|
||||
std::string path(outPath);
|
||||
@@ -41,11 +42,11 @@ std::string FileDialogWrapper::ShowSaveFileDialog(const std::string& default_nam
|
||||
nfdfilteritem_t filterItem[1] = {{default_extension.empty() ? "All Files" : default_extension.c_str(),
|
||||
default_extension.empty() ? "*" : default_extension.c_str()}};
|
||||
|
||||
nfdresult_t result = NFD_SaveDialog(default_extension.empty() ? nullptr : filterItem,
|
||||
nfdresult_t result = NFD_SaveDialog(&outPath,
|
||||
default_extension.empty() ? nullptr : filterItem,
|
||||
default_extension.empty() ? 0 : 1,
|
||||
nullptr,
|
||||
default_name.c_str(),
|
||||
&outPath);
|
||||
default_name.c_str());
|
||||
|
||||
if (result == NFD_OKAY) {
|
||||
std::string path(outPath);
|
||||
|
||||
Reference in New Issue
Block a user