mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-20 14:11:42 +00:00
Add new FolderChooserChoice
This commit is contained in:
parent
e6bc3d83f8
commit
74a33ab98d
@ -692,4 +692,28 @@ std::string FileChooserChoice::ValueText() const {
|
||||
return path.GetFilename();
|
||||
}
|
||||
|
||||
FolderChooserChoice::FolderChooserChoice(std::string *value, const std::string &text, LayoutParams *layoutParams)
|
||||
: AbstractChoiceWithValueDisplay(text, layoutParams), value_(value) {
|
||||
OnClick.Add([=](UI::EventParams &) {
|
||||
System_BrowseForFolder(text_, [=](const std::string &returnValue, int) {
|
||||
if (*value_ != returnValue) {
|
||||
*value = returnValue;
|
||||
UI::EventParams e{};
|
||||
e.s = *value;
|
||||
OnChange.Trigger(e);
|
||||
}
|
||||
});
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
}
|
||||
|
||||
std::string FolderChooserChoice::ValueText() const {
|
||||
if (value_->empty()) {
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
return di->T("Default");
|
||||
}
|
||||
Path path(*value_);
|
||||
return path.GetFilename();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -436,4 +436,17 @@ private:
|
||||
BrowseFileType fileType_;
|
||||
};
|
||||
|
||||
class FolderChooserChoice : public AbstractChoiceWithValueDisplay {
|
||||
public:
|
||||
FolderChooserChoice(std::string *value, const std::string &title, LayoutParams *layoutParams = nullptr);
|
||||
std::string ValueText() const override;
|
||||
|
||||
Event OnChange;
|
||||
|
||||
private:
|
||||
std::string *value_;
|
||||
BrowseFileType fileType_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace UI
|
||||
|
Loading…
x
Reference in New Issue
Block a user