mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-19 19:14:42 +00:00
Added samples for core-plugin calls
This commit is contained in:
parent
986b007294
commit
5269e26dfb
@ -97,8 +97,7 @@ private:
|
||||
void loadPlugins();
|
||||
void updateRecentFileActions();
|
||||
void setCurrentFile(const QString &fileName);
|
||||
void addToMenu(QObject *plugin, const QStringList &texts, QMenu *menu,
|
||||
const char *member, QActionGroup *actionGroup = 0,bool chackable = false);
|
||||
void addToMenu(QList<QAction *>, QMenu *menu, const char *slot);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.4 2005/12/03 16:07:14 glvertex
|
||||
Added samples for core-plugin calls
|
||||
|
||||
Revision 1.3 2005/12/02 17:39:07 glvertex
|
||||
modified plugin import code. old plugins have been disabled cause of new interface.
|
||||
|
||||
@ -330,6 +333,7 @@ void MainWindow::createActions()
|
||||
|
||||
showLogAct= new QAction (tr("Show &Infos"), this);
|
||||
showLogAct->setCheckable(true);
|
||||
showLogAct->setChecked(true);
|
||||
connect(showLogAct, SIGNAL(triggered()), this, SLOT(showLog()));
|
||||
|
||||
showInfoPaneAct= new QAction (tr("Show Info &Pane"), this);
|
||||
@ -495,9 +499,7 @@ void MainWindow::loadPlugins()
|
||||
// NEW VERSION
|
||||
MeshRenderInterface *iDummy = qobject_cast<MeshRenderInterface *>(plugin);
|
||||
if(iDummy)
|
||||
renderMenu->addActions(iDummy->actions());
|
||||
|
||||
|
||||
addToMenu(iDummy->actions(),renderMenu,SLOT(applyRenderMode()));
|
||||
|
||||
pluginFileNames += fileName;
|
||||
}
|
||||
@ -505,21 +507,24 @@ void MainWindow::loadPlugins()
|
||||
filterMenu->setEnabled(!filterMenu->actions().isEmpty() && workspace->activeWindow());
|
||||
}
|
||||
|
||||
void MainWindow::addToMenu(QObject *plugin, const QStringList &texts,QMenu *menu, const char *member,
|
||||
QActionGroup *actionGroup,bool chackable)
|
||||
void MainWindow::addToMenu(QList<QAction *> actionList, QMenu *menu, const char *slot)
|
||||
{
|
||||
foreach (QString text, texts) {
|
||||
QAction *action = new QAction(text, plugin);
|
||||
TotalRenderList.push_back(action);
|
||||
connect(action, SIGNAL(triggered()), this, member);
|
||||
action->setCheckable(chackable);
|
||||
menu->addAction(action);
|
||||
|
||||
if (actionGroup) {
|
||||
action->setCheckable(true);
|
||||
actionGroup->addAction(action);
|
||||
}
|
||||
foreach (QAction *a, actionList)
|
||||
{
|
||||
connect(a,SIGNAL(triggered()),this,slot);
|
||||
menu->addAction(a);
|
||||
}
|
||||
// OLD LOOP CORE
|
||||
// QAction *action = new QAction(text, plugin);
|
||||
// TotalRenderList.push_back(action);
|
||||
// connect(action, SIGNAL(triggered()), this, member);
|
||||
// action->setCheckable(chackable);
|
||||
// menu->addAction(action);
|
||||
//
|
||||
// if (actionGroup) {
|
||||
// action->setCheckable(true);
|
||||
// actionGroup->addAction(action);
|
||||
// }
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentFile(const QString &fileName)
|
||||
|
||||
@ -24,6 +24,9 @@
|
||||
History
|
||||
|
||||
$Log$
|
||||
Revision 1.6 2005/12/03 16:07:14 glvertex
|
||||
Added samples for core-plugin calls
|
||||
|
||||
Revision 1.5 2005/12/02 17:39:07 glvertex
|
||||
modified plugin import code. old plugins have been disabled cause of new interface.
|
||||
|
||||
@ -321,27 +324,37 @@ void MainWindow::applyFilter()
|
||||
|
||||
void MainWindow::applyRenderMode()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
// NEW VERSION
|
||||
QAction *action = qobject_cast<QAction *>(sender()); // find the action which has sent the signal
|
||||
|
||||
// Make the call to the plugin core
|
||||
MeshRenderInterface *iRenderTemp = qobject_cast<MeshRenderInterface *>(action->parent());
|
||||
if(GLA()->iRendersList==0){
|
||||
GLA()->iRendersList= new list<pair<QAction *,MeshRenderInterface *> >;
|
||||
GLA()->iRendersList->push_back(make_pair(action,iRenderTemp));
|
||||
GLA()->log.Log(GLLogStream::Info,"Enable Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
}else{
|
||||
bool found=false;
|
||||
pair<QAction *,MeshRenderInterface *> p;
|
||||
foreach(p,*GLA()->iRendersList){
|
||||
if(iRenderTemp==p.second && p.first->text()==action->text()){
|
||||
GLA()->iRendersList->remove(p);
|
||||
GLA()->log.Log(0,"Disabled Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
found=true;
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
GLA()->iRendersList->push_back(make_pair(action,iRenderTemp));
|
||||
GLA()->log.Log(GLLogStream::Info,"Enable Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
}
|
||||
}
|
||||
iRenderTemp->Render(action,*(GLA()->mm),GLA()->getCurrentRenderMode(),GLA());
|
||||
|
||||
GLA()->log.Log(GLLogStream::Info,"%s",action->text().toLocal8Bit().constData()); // Prints out action name
|
||||
|
||||
// OLD VERSION
|
||||
//QAction *action = qobject_cast<QAction *>(sender());
|
||||
//MeshRenderInterface *iRenderTemp = qobject_cast<MeshRenderInterface *>(action->parent());
|
||||
//if(GLA()->iRendersList==0){
|
||||
// GLA()->iRendersList= new list<pair<QAction *,MeshRenderInterface *> >;
|
||||
// GLA()->iRendersList->push_back(make_pair(action,iRenderTemp));
|
||||
// GLA()->log.Log(GLLogStream::Info,"Enable Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
//}else{
|
||||
// bool found=false;
|
||||
// pair<QAction *,MeshRenderInterface *> p;
|
||||
// foreach(p,*GLA()->iRendersList){
|
||||
// if(iRenderTemp==p.second && p.first->text()==action->text()){
|
||||
// GLA()->iRendersList->remove(p);
|
||||
// GLA()->log.Log(0,"Disabled Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
// found=true;
|
||||
// }
|
||||
// }
|
||||
// if(!found){
|
||||
// GLA()->iRendersList->push_back(make_pair(action,iRenderTemp));
|
||||
// GLA()->log.Log(GLLogStream::Info,"Enable Render mode %s",action->text().toLocal8Bit().constData());// .data());
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user