Commit dce24997 authored by Isaak Lim's avatar Isaak Lim

- load and save filters from file plugins can now contain several file formats seperated by ";;"

(for example: "Alias/Wavefront ( *.obj );;AutoCAD DXF ( *.dxf )")

- adjusted openFunctions accordingly

refs #1274

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16748 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b5f0bedf
......@@ -2185,17 +2185,34 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
if ( filePlugin ){
supported = supported + "File ";
QStringList loadFilters = filePlugin->getLoadFilters().split(";;");
QStringList saveFilters = filePlugin->getSaveFilters().split(";;");
// Collect supported Data from file plugin
fileTypes ft;
ft.name = basePlugin->name();
ft.type = filePlugin->supportedType();
ft.loadFilters = filePlugin->getLoadFilters();
ft.saveFilters = filePlugin->getSaveFilters();
ft.plugin = filePlugin;
ft.object = plugin;
ft.saveMultipleObjects = checkSlot(plugin,"saveObjects(IdList,QString)");
supportedTypes().push_back(ft);
for (int i = 0; i < loadFilters.size(); ++i) {
fileTypes ft;
ft.name = basePlugin->name();
ft.type = filePlugin->supportedType();
ft.loadFilters = loadFilters[i];
ft.saveFilters = "";
ft.plugin = filePlugin;
ft.object = plugin;
ft.saveMultipleObjects = checkSlot(plugin,"saveObjects(IdList,QString)");
supportedTypes().push_back(ft);
}
for (int i = 0; i < saveFilters.size(); ++i) {
fileTypes ft;
ft.name = basePlugin->name();
ft.type = filePlugin->supportedType();
ft.loadFilters = "";
ft.saveFilters = saveFilters[i];
ft.plugin = filePlugin;
ft.object = plugin;
ft.saveMultipleObjects = checkSlot(plugin,"saveObjects(IdList,QString)");
supportedTypes().push_back(ft);
}
if ( checkSignal(plugin,"openedFile(int)" ) )
......
......@@ -223,7 +223,7 @@ int Core::loadObject ( QString _filename ) {
for (int i=0; i < (int)supportedTypes().size(); i++){
QString filters = supportedTypes()[i].plugin->getLoadFilters();
QString filters = supportedTypes()[i].loadFilters;
// Only take the parts inside the brackets
filters = filters.section("(",1).section(")",0,0);
......@@ -313,7 +313,7 @@ int Core::loadObject( DataType _type, QString _filename) {
for (int i=0; i < (int)supportedTypes().size(); i++) {
if (supportedTypes()[i].type & _type || supportedTypes()[i].type == _type) {
QString filters = supportedTypes()[i].plugin->getLoadFilters();
QString filters = supportedTypes()[i].loadFilters;
// Only take the parts inside the brackets
filters = filters.section("(",1).section(")",0,0);
......@@ -352,7 +352,9 @@ int Core::loadObject( DataType _type, QString _filename) {
if ( OpenFlipper::Options::gui() ) {
QStringList items;
for (int j = 0; j < nPlugins; ++j) {
items << supportedTypes()[typeIds[j]].name;
// only add the plugin name if it does not already exist in the itemlist
if (items.indexOf(supportedTypes()[typeIds[j]].name) == -1)
items << supportedTypes()[typeIds[j]].name;
}
bool ok;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment