Merge pull request #5746 from Ovnuniarchos/FileDialogExposed
Corrections and additions to FileDialog
This commit is contained in:
commit
0b75f894c3
2 changed files with 20 additions and 1 deletions
|
@ -475,7 +475,7 @@ void FileDialog::update_filters() {
|
|||
String flt=filters[i].get_slice(";",0).strip_edges();
|
||||
String desc=filters[i].get_slice(";",1).strip_edges();
|
||||
if (desc.length())
|
||||
filter->add_item(desc+" ( "+flt+" )");
|
||||
filter->add_item(String(XL_MESSAGE(desc))+" ( "+flt+" )");
|
||||
else
|
||||
filter->add_item("( "+flt+" )");
|
||||
}
|
||||
|
@ -498,6 +498,16 @@ void FileDialog::add_filter(const String& p_filter) {
|
|||
|
||||
}
|
||||
|
||||
void FileDialog::set_filters(const Vector<String>& p_filters){
|
||||
filters=p_filters;
|
||||
update_filters();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Vector<String> FileDialog::get_filters() const{
|
||||
return filters;
|
||||
}
|
||||
|
||||
String FileDialog::get_current_dir() const {
|
||||
|
||||
return dir->get_text();
|
||||
|
@ -686,6 +696,8 @@ void FileDialog::_bind_methods() {
|
|||
|
||||
ObjectTypeDB::bind_method(_MD("clear_filters"),&FileDialog::clear_filters);
|
||||
ObjectTypeDB::bind_method(_MD("add_filter","filter"),&FileDialog::add_filter);
|
||||
ObjectTypeDB::bind_method(_MD("set_filters","filters"),&FileDialog::set_filters);
|
||||
ObjectTypeDB::bind_method(_MD("get_filters"),&FileDialog::get_filters);
|
||||
ObjectTypeDB::bind_method(_MD("get_current_dir"),&FileDialog::get_current_dir);
|
||||
ObjectTypeDB::bind_method(_MD("get_current_file"),&FileDialog::get_current_file);
|
||||
ObjectTypeDB::bind_method(_MD("get_current_path"),&FileDialog::get_current_path);
|
||||
|
@ -722,6 +734,11 @@ void FileDialog::_bind_methods() {
|
|||
BIND_CONSTANT( ACCESS_USERDATA );
|
||||
BIND_CONSTANT( ACCESS_FILESYSTEM );
|
||||
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Open one,Open many,Open folder,Open any,Save"),_SCS("set_mode"),_SCS("get_mode") );
|
||||
ADD_PROPERTY( PropertyInfo(Variant::INT, "access", PROPERTY_HINT_ENUM, "Resources,User data,File system"),_SCS("set_access"),_SCS("get_access") );
|
||||
ADD_PROPERTY( PropertyInfo(Variant::STRING_ARRAY, "filters"),_SCS("set_filters"),_SCS("get_filters") );
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL, "show_hidden_files"),_SCS("set_show_hidden_files"),_SCS("is_showing_hidden_files") );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -131,6 +131,8 @@ public:
|
|||
|
||||
void clear_filters();
|
||||
void add_filter(const String& p_filter);
|
||||
void set_filters(const Vector<String>& p_filters);
|
||||
Vector<String> get_filters() const;
|
||||
|
||||
void set_enable_multiple_selection(bool p_enable);
|
||||
Vector<String> get_selected_files() const;
|
||||
|
|
Loading…
Reference in a new issue