Skip to content

Commit

Permalink
gui: BIOS selection window using file browser
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Jan 3, 2020
1 parent 29695f7 commit 78eec0f
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 360 deletions.
265 changes: 0 additions & 265 deletions src/platform/windows/gui/file/file.cpp

This file was deleted.

8 changes: 0 additions & 8 deletions src/platform/windows/gui/file/file.h

This file was deleted.

36 changes: 36 additions & 0 deletions src/platform/windows/gui/file/open.cpp
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
15 changes: 15 additions & 0 deletions src/platform/windows/gui/file/open.h
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
Loading

0 comments on commit 78eec0f

Please sign in to comment.