-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui: BIOS selection window using file browser
- Loading branch information
1 parent
29695f7
commit 78eec0f
Showing
12 changed files
with
435 additions
and
360 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "open.h" | ||
#include "config.h" | ||
|
||
namespace gui::file { | ||
Open::Open() { windowName = "Open file##file_dialog"; } | ||
|
||
bool Open::isFileSupported(const gui::helper::File& f) { | ||
constexpr std::array<const char*, 9> supportedFiles = { | ||
".iso", // | ||
".cue", // | ||
".bin", // | ||
".img", // | ||
".chd", // | ||
".exe", // | ||
".psexe", // | ||
".psf", // | ||
".minipsf", // | ||
}; | ||
|
||
return std::find(supportedFiles.begin(), supportedFiles.end(), f.extension) != supportedFiles.end(); | ||
} | ||
|
||
bool Open::onFileSelected(const gui::helper::File& f) { | ||
auto path = f.entry.path(); | ||
config["gui"]["lastPath"] = path.parent_path().string(); | ||
|
||
bus.notify(Event::File::Load{path.string(), true}); | ||
return true; | ||
} | ||
|
||
void Open::displayWindows() { | ||
if (openWindowOpen) { | ||
display(openWindowOpen); | ||
} | ||
} | ||
}; // namespace gui::file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#include "platform/windows/gui/helper/file_dialog.h" | ||
|
||
namespace gui::file { | ||
class Open : public gui::helper::FileDialog { | ||
bool isFileSupported(const gui::helper::File& f) override; | ||
bool onFileSelected(const gui::helper::File& f) override; | ||
|
||
public: | ||
bool openWindowOpen = false; | ||
|
||
Open(); | ||
void displayWindows(); | ||
}; | ||
}; // namespace gui::file |
Oops, something went wrong.