Exposed mode, access, filters, and show hidden files to the editor. Also, two functions to get/set the filter list.
This commit is contained in:
parent
b23889eb41
commit
3698332f6b
|
@ -475,7 +475,7 @@ void FileDialog::update_filters() {
|
||||||
String flt=filters[i].get_slice(";",0).strip_edges();
|
String flt=filters[i].get_slice(";",0).strip_edges();
|
||||||
String desc=filters[i].get_slice(";",1).strip_edges();
|
String desc=filters[i].get_slice(";",1).strip_edges();
|
||||||
if (desc.length())
|
if (desc.length())
|
||||||
filter->add_item(desc+" ( "+flt+" )");
|
filter->add_item(String(XL_MESSAGE(desc))+" ( "+flt+" )");
|
||||||
else
|
else
|
||||||
filter->add_item("( "+flt+" )");
|
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 {
|
String FileDialog::get_current_dir() const {
|
||||||
|
|
||||||
return dir->get_text();
|
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("clear_filters"),&FileDialog::clear_filters);
|
||||||
ObjectTypeDB::bind_method(_MD("add_filter","filter"),&FileDialog::add_filter);
|
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_dir"),&FileDialog::get_current_dir);
|
||||||
ObjectTypeDB::bind_method(_MD("get_current_file"),&FileDialog::get_current_file);
|
ObjectTypeDB::bind_method(_MD("get_current_file"),&FileDialog::get_current_file);
|
||||||
ObjectTypeDB::bind_method(_MD("get_current_path"),&FileDialog::get_current_path);
|
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_USERDATA );
|
||||||
BIND_CONSTANT( ACCESS_FILESYSTEM );
|
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 clear_filters();
|
||||||
void add_filter(const String& p_filter);
|
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);
|
void set_enable_multiple_selection(bool p_enable);
|
||||||
Vector<String> get_selected_files() const;
|
Vector<String> get_selected_files() const;
|
||||||
|
|
Loading…
Reference in New Issue