mirror of https://github.com/WerWolv/ImHex.git
ux: Only show file chooser popup when there's files in the the relevant folder
This commit is contained in:
parent
eade95dff7
commit
8ab4d25e33
|
@ -118,12 +118,18 @@ namespace hex {
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::showFileChooserPopup(const std::vector<fs::path> &paths, const std::vector<nfdfilteritem_t> &validExtensions, const std::function<void(fs::path)> &callback) {
|
void View::showFileChooserPopup(const std::vector<fs::path> &paths, const std::vector<nfdfilteritem_t> &validExtensions, const std::function<void(fs::path)> &callback) {
|
||||||
View::s_selectableFileIndex = 0;
|
if (paths.empty()) {
|
||||||
View::s_selectableFiles = paths;
|
hex::openFileBrowser("hex.builtin.common.open"_lang, DialogMode::Open, validExtensions, [callback](const auto &path) {
|
||||||
View::s_selectableFilesValidExtensions = validExtensions;
|
callback(path);
|
||||||
View::s_selectableFileOpenCallback = callback;
|
});
|
||||||
|
} else {
|
||||||
|
View::s_selectableFileIndex = 0;
|
||||||
|
View::s_selectableFiles = paths;
|
||||||
|
View::s_selectableFilesValidExtensions = validExtensions;
|
||||||
|
View::s_selectableFileOpenCallback = callback;
|
||||||
|
|
||||||
ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.choose_file"_lang); });
|
ImHexApi::Tasks::doLater([] { ImGui::OpenPopup("hex.builtin.common.choose_file"_lang); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool View::hasViewMenuItemEntry() const {
|
bool View::hasViewMenuItemEntry() const {
|
||||||
|
|
Loading…
Reference in New Issue