From d4b70a77034937ee4eaddcef5b819d6d2f185b28 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 24 Apr 2019 10:35:45 +0200 Subject: [PATCH] Add a mechanism to specify default loaders when loading, not just for saving. Make the off plugin the default loader for .off files so that lcc_plugin doesn't come first in the list. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 7 ++++++- Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp | 7 +++++++ Polyhedron/demo/Polyhedron/Plugins/IO/lcc_io_plugin.cpp | 3 +-- .../CGAL/Three/Polyhedron_demo_io_plugin_interface.h | 7 ++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 4f72f81635a..a590a65b27e 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1107,7 +1107,12 @@ void MainWindow::open(QString filename) if ( !io_plugin->canLoad() ) continue; all_items << io_plugin->name(); if ( file_matches_filter(io_plugin->loadNameFilters(), filename.toLower()) ) - selected_items << io_plugin->name(); + { + if(io_plugin->isDefaultLoader(fileinfo.completeSuffix())) + selected_items.prepend(io_plugin->name()); + else + selected_items << io_plugin->name(); + } } } else diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp index b3034e06bfd..ea5a214f28c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/OFF_io_plugin.cpp @@ -32,6 +32,13 @@ public: return true; return false; } + bool isDefaultLoader(const QString& name) const + { + qDebug()<