Skip to content

Commit de0e565

Browse files
committed
add an entry for common file types as first one and make it configurable
1 parent ad3f178 commit de0e565

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

config/filetypes.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ Vrml97 = ["wrl", "wrl.gz", "wrz", "x3d", "x3dv"]
3636
[osg]
3737
# add filters for the osg_db plugins supporting any of these formats
3838
extensions = ["wrl", "osg", "ive", "osgb", "osgt", "osgx", "obj", "stl", "ply", "iv", "dxf", "3ds", "flt", "dae", "md2", "geo", "bvh", "fbx"]
39+
40+
[common]
41+
# first entry listing all supported extensions from this list
42+
extensions = ["wrl", "osg", "ive", "osgb", "obj", "stl", "ply", "3ds", "bvh", "fbx", "xvf", "e57", "ptsb", "vwp"]

src/OpenCOVER/cover/coVRFileManager.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,7 @@ void coVRFileManager::updateSupportedFormats()
18611861
}
18621862
};
18631863

1864-
std::vector<FilterList> filterLists;
1864+
std::deque<FilterList> filterLists;
18651865

18661866
std::set<std::string> extensions;
18671867

@@ -1914,6 +1914,7 @@ void coVRFileManager::updateSupportedFormats()
19141914
}
19151915
}
19161916
}
1917+
19171918
// build filter string
19181919
for(const auto &[plugin, exts] : popularPlugins)
19191920
{
@@ -1926,6 +1927,9 @@ void coVRFileManager::updateSupportedFormats()
19261927
std::sort(filterLists.begin(), filterLists.end());
19271928
filterLists.push_back({"All Files", std::set<std::string>({""})});
19281929

1930+
auto commonExtensions = filetypes.array<std::string>("common", "extensions")->value();
1931+
filterLists.push_front({"Common Files", {commonExtensions.begin(), commonExtensions.end()}});
1932+
19291933
m_supportedReadExtentions.clear();
19301934
for (const auto &fl: filterLists)
19311935
{

src/OpenCOVER/plugins/general/WindowTypeQt/QtView.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ QtViewElement *QtView::elementFactoryImplementation(FileBrowser *fb)
443443
formattedFilters.append(f);
444444
selectedFilter = f;
445445
}
446+
selectedFilter = formattedFilters.first(); // default to first filter
446447
filters = formattedFilters.join(";;");
447448
QString dir = QString::fromStdString(fb->value());
448449
QString file = fb->forSaving()

0 commit comments

Comments
 (0)