chore: Refactor file_dialog.cc and file_dialog.h to use namespace aliases
This commit is contained in:
@@ -206,7 +206,8 @@
|
||||
}
|
||||
|
||||
- (void)openFileAction:(id)sender {
|
||||
if (!yaze::app::SharedRom::shared_rom_->LoadFromFile(FileDialogWrapper::ShowOpenFileDialog())
|
||||
if (!yaze::app::SharedRom::shared_rom_
|
||||
->LoadFromFile(yaze::app::core::FileDialogWrapper::ShowOpenFileDialog())
|
||||
.ok()) {
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
[alert setMessageText:@"Error"];
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "file_dialog.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace core {
|
||||
|
||||
#if defined(__linux__)
|
||||
|
||||
std::string FileDialogWrapper::ShowOpenFileDialog() {
|
||||
@@ -20,4 +24,8 @@ std::vector<std::string> FileDialogWrapper::GetFilesInFolder(
|
||||
return {"Linux: Files in folder"};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace core
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace core {
|
||||
|
||||
#ifdef _WIN32
|
||||
// Include Windows-specific headers
|
||||
#include <shobjidl.h>
|
||||
@@ -83,7 +87,7 @@ class FileDialogWrapper {
|
||||
}
|
||||
|
||||
static std::vector<std::string> GetSubdirectoriesInFolder(
|
||||
const std::string& folder_path) {
|
||||
const std::string &folder_path) {
|
||||
std::vector<std::string> subdirectories;
|
||||
WIN32_FIND_DATA findFileData;
|
||||
HANDLE hFind = FindFirstFile((folder_path + "\\*").c_str(), &findFileData);
|
||||
@@ -102,7 +106,7 @@ class FileDialogWrapper {
|
||||
}
|
||||
|
||||
static std::vector<std::string> GetFilesInFolder(
|
||||
const std::string& folder_path) {
|
||||
const std::string &folder_path) {
|
||||
std::vector<std::string> files;
|
||||
WIN32_FIND_DATA findFileData;
|
||||
HANDLE hFind = FindFirstFile((folder_path + "\\*").c_str(), &findFileData);
|
||||
@@ -135,4 +139,8 @@ class FileDialogWrapper {
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace core
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_CORE_PLATFORM_FILE_DIALOG_H
|
||||
|
||||
@@ -56,7 +56,7 @@ std::vector<std::string> FileDialogWrapper::GetSubdirectoriesInFolder(const std:
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
std::string FileDialogWrapper::ShowOpenFileDialog() {
|
||||
std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() {
|
||||
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
|
||||
[openPanel setCanChooseFiles:YES];
|
||||
[openPanel setCanChooseDirectories:NO];
|
||||
@@ -71,7 +71,7 @@ std::string FileDialogWrapper::ShowOpenFileDialog() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string FileDialogWrapper::ShowOpenFolderDialog() {
|
||||
std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() {
|
||||
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
|
||||
[openPanel setCanChooseFiles:NO];
|
||||
[openPanel setCanChooseDirectories:YES];
|
||||
@@ -86,7 +86,8 @@ std::string FileDialogWrapper::ShowOpenFolderDialog() {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<std::string> FileDialogWrapper::GetFilesInFolder(const std::string& folder) {
|
||||
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetFilesInFolder(
|
||||
const std::string& folder) {
|
||||
std::vector<std::string> filenames;
|
||||
NSFileManager* fileManager = [NSFileManager defaultManager];
|
||||
NSDirectoryEnumerator* enumerator =
|
||||
@@ -101,7 +102,8 @@ std::vector<std::string> FileDialogWrapper::GetFilesInFolder(const std::string&
|
||||
return filenames;
|
||||
}
|
||||
|
||||
std::vector<std::string> FileDialogWrapper::GetSubdirectoriesInFolder(const std::string& folder) {
|
||||
std::vector<std::string> yaze::app::core::FileDialogWrapper::GetSubdirectoriesInFolder(
|
||||
const std::string& folder) {
|
||||
std::vector<std::string> subdirectories;
|
||||
NSFileManager* fileManager = [NSFileManager defaultManager];
|
||||
NSDirectoryEnumerator* enumerator =
|
||||
@@ -125,4 +127,4 @@ std::vector<std::string> FileDialogWrapper::GetSubdirectoriesInFolder(const std:
|
||||
// Unsupported platform
|
||||
#endif // TARGET_OS_MAC
|
||||
|
||||
#endif // __APPLE__ && __MACH__
|
||||
#endif // __APPLE__ && __MACH__
|
||||
Reference in New Issue
Block a user