mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 09:34:36 +00:00
list of supported formats from plugin manager
This commit is contained in:
parent
92a6d4e0b1
commit
0e5d261b40
@ -205,11 +205,6 @@ void PluginManager::loadPlugins(RichParameterList& defaultGlobal, const QDir& pl
|
||||
fillKnownIOFormats();
|
||||
}
|
||||
|
||||
int PluginManager::numberIOPlugins() const
|
||||
{
|
||||
return ioMeshPlugins.size();
|
||||
}
|
||||
|
||||
unsigned int PluginManager::size() const
|
||||
{
|
||||
return allPlugins.size();
|
||||
@ -259,19 +254,49 @@ IORasterPluginInterface* PluginManager::inputRasterPlugin(const QString inputFor
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::inputMeshFormatList() const
|
||||
bool PluginManager::isInputMeshFormatSupported(const QString inputFormat) const
|
||||
{
|
||||
return allInputMeshFormats;
|
||||
return inputMeshFormatToPluginMap.find(inputFormat.toLower()) != inputMeshFormatToPluginMap.end();
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::outputMeshFormatList() const
|
||||
bool PluginManager::isOutputMeshFormatSupported(const QString outputFormat) const
|
||||
{
|
||||
return allOutputMeshFormats;
|
||||
return outputMeshFormatToPluginMap.find(outputFormat.toLower()) != outputMeshFormatToPluginMap.end();
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::inputRasterFormatList() const
|
||||
bool PluginManager::isInputRasterFormatSupported(const QString inputFormat) const
|
||||
{
|
||||
return allInputRasterFormats;
|
||||
return inputRasterFormatToPluginMap.find(inputFormat.toLower()) != inputRasterFormatToPluginMap.end();
|
||||
}
|
||||
|
||||
QStringList PluginManager::inputMeshFormatList() const
|
||||
{
|
||||
return inputMeshFormatToPluginMap.keys();
|
||||
}
|
||||
|
||||
QStringList PluginManager::outputMeshFormatList() const
|
||||
{
|
||||
return outputMeshFormatToPluginMap.keys();
|
||||
}
|
||||
|
||||
QStringList PluginManager::inputRasterFormatList() const
|
||||
{
|
||||
return inputRasterFormatToPluginMap.keys();
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::inputMeshFormatListDialog() const
|
||||
{
|
||||
return inputMeshFormatsDialogStringList;
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::outputMeshFormatListDialog() const
|
||||
{
|
||||
return outputMeshFormatsDialogStringList;
|
||||
}
|
||||
|
||||
const QStringList& PluginManager::inputRasterFormatListDialog() const
|
||||
{
|
||||
return inputRasterFormatsDialogStringList;
|
||||
}
|
||||
|
||||
PluginManager::NamePluginPairRangeIterator PluginManager::namePluginPairIterator() const
|
||||
@ -313,23 +338,23 @@ void PluginManager::fillKnownIOFormats()
|
||||
{
|
||||
QString allKnownFormatsFilter = QObject::tr("All known formats (");
|
||||
for (IOMeshPluginInterface* pMeshIOPlugin: ioMeshPlugins) {
|
||||
allKnownFormatsFilter += addPluginMeshFormats(inputMeshFormatToPluginMap, allInputMeshFormats, pMeshIOPlugin, pMeshIOPlugin->importFormats());
|
||||
allKnownFormatsFilter += addPluginMeshFormats(inputMeshFormatToPluginMap, inputMeshFormatsDialogStringList, pMeshIOPlugin, pMeshIOPlugin->importFormats());
|
||||
}
|
||||
allKnownFormatsFilter.append(')');
|
||||
allInputMeshFormats.push_front(allKnownFormatsFilter);
|
||||
inputMeshFormatsDialogStringList.push_front(allKnownFormatsFilter);
|
||||
|
||||
for (IOMeshPluginInterface* pMeshIOPlugin: ioMeshPlugins) {
|
||||
addPluginMeshFormats(outputMeshFormatToPluginMap, allOutputMeshFormats, pMeshIOPlugin, pMeshIOPlugin->exportFormats());
|
||||
addPluginMeshFormats(outputMeshFormatToPluginMap, outputMeshFormatsDialogStringList, pMeshIOPlugin, pMeshIOPlugin->exportFormats());
|
||||
}
|
||||
|
||||
allKnownFormatsFilter = QObject::tr("All known formats (");
|
||||
|
||||
for (IORasterPluginInterface* pRasterIOPlugin : ioRasterPlugins){
|
||||
allKnownFormatsFilter += addPluginRasterFormats(inputRasterFormatToPluginMap, allInputRasterFormats, pRasterIOPlugin, pRasterIOPlugin->importFormats());
|
||||
allKnownFormatsFilter += addPluginRasterFormats(inputRasterFormatToPluginMap, inputRasterFormatsDialogStringList, pRasterIOPlugin, pRasterIOPlugin->importFormats());
|
||||
}
|
||||
|
||||
allKnownFormatsFilter.append(')');
|
||||
allInputRasterFormats.push_front(allKnownFormatsFilter);
|
||||
inputRasterFormatsDialogStringList.push_front(allKnownFormatsFilter);
|
||||
}
|
||||
|
||||
QString PluginManager::addPluginRasterFormats(
|
||||
|
||||
@ -50,18 +50,24 @@ public:
|
||||
void loadPlugins(RichParameterList& defaultGlobal, const QDir& pluginsDirectory, bool verbose = false);
|
||||
QString pluginsCode() const;
|
||||
|
||||
int numberIOPlugins() const;
|
||||
unsigned int size() const;
|
||||
|
||||
DecoratePluginInterface* getDecoratePlugin(const QString& name);
|
||||
|
||||
QAction* filterAction(const QString& name);
|
||||
|
||||
IOMeshPluginInterface* inputMeshPlugin(const QString& inputFormat) const;
|
||||
IOMeshPluginInterface* outputMeshPlugin(const QString& outputFormat) const;
|
||||
IORasterPluginInterface* inputRasterPlugin(const QString inputFormat) const;
|
||||
const QStringList& inputMeshFormatList() const;
|
||||
const QStringList& outputMeshFormatList() const;
|
||||
const QStringList& inputRasterFormatList() const;
|
||||
bool isInputMeshFormatSupported(const QString inputFormat) const;
|
||||
bool isOutputMeshFormatSupported(const QString outputFormat) const;
|
||||
bool isInputRasterFormatSupported(const QString inputFormat) const;
|
||||
QStringList inputMeshFormatList() const;
|
||||
QStringList outputMeshFormatList() const;
|
||||
QStringList inputRasterFormatList() const;
|
||||
const QStringList& inputMeshFormatListDialog() const;
|
||||
const QStringList& outputMeshFormatListDialog() const;
|
||||
const QStringList& inputRasterFormatListDialog() const;
|
||||
|
||||
class NamePluginPairRangeIterator
|
||||
{
|
||||
@ -164,13 +170,13 @@ private:
|
||||
QVector<IOMeshPluginInterface*> ioMeshPlugins;
|
||||
QMap<QString,IOMeshPluginInterface*> inputMeshFormatToPluginMap;
|
||||
QMap<QString,IOMeshPluginInterface*> outputMeshFormatToPluginMap;
|
||||
QStringList allInputMeshFormats;
|
||||
QStringList allOutputMeshFormats;
|
||||
QStringList inputMeshFormatsDialogStringList; //todo: remove this
|
||||
QStringList outputMeshFormatsDialogStringList; //todo: remove this
|
||||
|
||||
//IORasterPlugins
|
||||
QVector<IORasterPluginInterface*> ioRasterPlugins;
|
||||
QMap<QString, IORasterPluginInterface*> inputRasterFormatToPluginMap;
|
||||
QStringList allInputRasterFormats;
|
||||
QStringList inputRasterFormatsDialogStringList;
|
||||
|
||||
//Filter Plugins
|
||||
QVector<FilterPluginInterface*> filterPlugins;
|
||||
|
||||
@ -2003,7 +2003,7 @@ bool MainWindow::importRaster(const QString& fileImg)
|
||||
|
||||
QStringList fileNameList;
|
||||
if (fileImg.isEmpty())
|
||||
fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inputRasterFormatList().join(";;"));
|
||||
fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inputRasterFormatListDialog().join(";;"));
|
||||
else
|
||||
fileNameList.push_back(fileImg);
|
||||
|
||||
@ -2258,7 +2258,7 @@ bool MainWindow::importMesh(QString fileName,bool isareload)
|
||||
//PM.LoadFormats(suffixList, allKnownFormats,PluginManager::IMPORT);
|
||||
QStringList fileNameList;
|
||||
if (fileName.isEmpty())
|
||||
fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inputMeshFormatList().join(";;"));
|
||||
fileNameList = QFileDialog::getOpenFileNames(this,tr("Import Mesh"), lastUsedDirectory.path(), PM.inputMeshFormatListDialog().join(";;"));
|
||||
else
|
||||
fileNameList.push_back(fileName);
|
||||
|
||||
@ -2446,7 +2446,7 @@ void MainWindow::reload()
|
||||
|
||||
bool MainWindow::exportMesh(QString fileName,MeshModel* mod,const bool saveAllPossibleAttributes)
|
||||
{
|
||||
const QStringList& suffixList = PM.outputMeshFormatList();
|
||||
const QStringList& suffixList = PM.outputMeshFormatListDialog();
|
||||
|
||||
//QHash<QString, MeshIOInterface*> allKnownFormats;
|
||||
QFileInfo fi(fileName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user