Updated to remove PluginInfo, to use new MeshEditInterface, and to use new factory way of creating edit tools

This commit is contained in:
Paolo Cignoni cignoni 2008-10-13 10:08:59 +00:00
parent 539adfbff6
commit 437afddfa9
2 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,57 @@
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005-2008 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#include "edit_pickpoints_factory.h"
#include "editpickpoints.h"
EditPickPointsFactory::EditPickPointsFactory()
{
editPickPoints = new QAction(QIcon(":/images/pickpoints.png"), "PickPoints", this);
actionList << editPickPoints;
foreach(QAction *editAction, actionList)
editAction->setCheckable(true);
}
//gets a list of actions available from this plugin
QList<QAction *> EditPickPointsFactory::actions() const
{
return actionList;
}
//get the edit tool for the given action
MeshEditInterface* EditPickPointsFactory::getMeshEditInterface(QAction *action)
{
if(action == editPickPoints)
{
return new EditPickPointsPlugin();
} else assert(0); //should never be asked for an action that isnt here
}
const QString EditPickPointsFactory::getEditToolDescription(QAction *)
{
return EditPickPointsPlugin::Info();
}
Q_EXPORT_PLUGIN(EditPickPointsFactory)

View File

@ -0,0 +1,56 @@
/****************************************************************************
* MeshLab o o *
* A versatile mesh processing toolbox o o *
* _ O _ *
* Copyright(C) 2005-2008 \/)\/ *
* Visual Computing Lab /\/| *
* ISTI - Italian National Research Council | *
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
#ifndef EditPickPointsFactoryPLUGIN_H
#define EditPickPointsFactoryPLUGIN_H
#include <meshlab/interfaces.h>
#include <QObject>
#include <QList>
class EditPickPointsFactory : public QObject, public MeshEditInterfaceFactory
{
Q_OBJECT
Q_INTERFACES(MeshEditInterfaceFactory)
public:
EditPickPointsFactory();
virtual ~EditPickPointsFactory() { delete editPickPoints; }
//gets a list of actions available from this plugin
virtual QList<QAction *> actions() const;
//get the edit tool for the given action
virtual MeshEditInterface* getMeshEditInterface(QAction *);
//get the description for the given action
virtual const QString getEditToolDescription(QAction *);
private:
QList <QAction *> actionList;
QAction *editPickPoints;
};
#endif