Skip to content
Permalink
Browse files

gui: BIOS selection window using file browser

  • Loading branch information
JaCzekanski committed Jan 3, 2020
1 parent 29695f7 commit 78eec0f6f792d50283ec6ec583858c5fb2262231

This file was deleted.

This file was deleted.

@@ -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
@@ -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

0 comments on commit 78eec0f

Please sign in to comment.
You can’t perform that action at this time.