From 6bfab050e345e6b74fecfd38364d11a6beddcac8 Mon Sep 17 00:00:00 2001 From: Guido Ranzuglia granzuglia Date: Thu, 13 Dec 2012 17:44:01 +0000 Subject: [PATCH] - added plugin file name to the filters tooltips - added ctrl+l shortcut for layer dialog (apply filter changed to ctrl+p) --- src/common/pluginmanager.cpp | 9 ++++++++- src/common/pluginmanager.h | 3 ++- src/meshlab/mainwindow.h | 1 + src/meshlab/mainwindow_Init.cpp | 14 ++++++++++---- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/common/pluginmanager.cpp b/src/common/pluginmanager.cpp index 33cb491db..7dd4f8bf1 100644 --- a/src/common/pluginmanager.cpp +++ b/src/common/pluginmanager.cpp @@ -108,6 +108,7 @@ void PluginManager::loadPlugins(RichParameterSet& defaultGlobal) meshFilterPlug.push_back(iFilter); foreach(QAction *filterAction, iFilter->actions()) { + filterAction->setData(QVariant(fileName)); actionFilterMap.insert(filterAction->text(),filterAction); stringFilterMap.insert(filterAction->text(),iFilter); iFilter->initGlobalParameterSet(filterAction,defaultGlobal); @@ -170,6 +171,11 @@ QMap PluginManager::generateFilterParameterMap() return FPM; } +QString PluginManager::osDependentFileBaseName(const QString &plname) +{ + return (DLLFileNamePreamble() + plname + "."+DLLExtension()); +} + QString PluginManager::getBaseDirPath() { QDir baseDir(qApp->applicationDirPath()); @@ -280,7 +286,7 @@ void PluginManager::loadXMLPlugin( const QString& fileName ) if (fin.suffix() == "xml") { - QString dllfile = DLLFileNamePreamble() + fin.completeBaseName() + "."+DLLExtension(); + QString dllfile = osDependentFileBaseName(fin.completeBaseName()); MeshLabXMLFilterContainer fc; //fc.filterInterface = NULL; @@ -330,6 +336,7 @@ void PluginManager::loadXMLPlugin( const QString& fileName ) { QString completename = plugnamespace; fc.act = new QAction(filter,par); + fc.act->setData(QVariant(dllfile)); stringXMLFilterMap.insert(filter,fc); QString filterFunction = pluginfo->filterScriptCode(filter); if (filterFunction == "") diff --git a/src/common/pluginmanager.h b/src/common/pluginmanager.h index eab130b61..d66449423 100644 --- a/src/common/pluginmanager.h +++ b/src/common/pluginmanager.h @@ -89,9 +89,10 @@ public: QStringList pluginsLoaded; + static QString osDependentFileBaseName(const QString& plname); static QString osIndependentPluginName(const QString& plname); static QString pluginNameSpace(); - //highlight and autocomplete + //highlight and autocomplete /*QStringList pluginnamespaces; QStringList filterscriptnames;*/ QList libinfolist; diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index 9cb09bb9c..b69af682a 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -470,6 +470,7 @@ private: QAction *onscreenHelpAct; QAction *checkUpdatesAct; //////////////////////////////////////////////////// + static QString getDecoratedFileName(const QString& name); }; /// Event filter that is installed to intercept the open events sent directly by the Operative System diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index 552c2ae3a..70022af0b 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -312,6 +312,7 @@ void MainWindow::createActions() showLayerDlgAct = new QAction (QIcon(":/images/layers.png"),tr("Show Layer Dialog"), this); showLayerDlgAct->setCheckable(true); showLayerDlgAct->setChecked(true); + showLayerDlgAct->setShortcut(Qt::CTRL+Qt::Key_L); connect(showLayerDlgAct, SIGNAL(triggered(bool)), this, SLOT(showLayerDlg(bool))); @@ -392,7 +393,7 @@ void MainWindow::createActions() //////////////Action Menu Filters ///////////////////////////////////////////////////////////////////// lastFilterAct = new QAction(tr("Apply filter"),this); lastFilterAct->setShortcutContext(Qt::ApplicationShortcut); - lastFilterAct->setShortcut(Qt::CTRL+Qt::Key_L); + lastFilterAct->setShortcut(Qt::CTRL+Qt::Key_P); lastFilterAct->setEnabled(false); connect(lastFilterAct, SIGNAL(triggered()), this, SLOT(applyLastFilter())); @@ -691,6 +692,11 @@ void MainWindow::initItemForSearching(QAction* act) wama.addWordsPerAction(*act,tx); } +QString MainWindow::getDecoratedFileName(const QString& name) +{ + return QString("
(") + name + ")"; +} + void MainWindow::fillFilterMenu() { filterMenu->clear(); @@ -737,8 +743,8 @@ void MainWindow::fillFilterMenu() for(msi = PM.stringFilterMap.begin(); msi != PM.stringFilterMap.end();++msi) { MeshFilterInterface * iFilter= msi.value(); - QAction *filterAction = iFilter->AC((msi.key())); - filterAction->setToolTip(iFilter->filterInfo(filterAction)); + QAction *filterAction = iFilter->AC((msi.key())); + filterAction->setToolTip(iFilter->filterInfo(filterAction) + "
" + getDecoratedFileName(filterAction->data().toString())); connect(filterAction,SIGNAL(triggered()),this,SLOT(startFilter())); int filterClass = iFilter->getClass(filterAction); @@ -832,7 +838,7 @@ void MainWindow::fillFilterMenu() try { QString help = info->filterHelp(filterName); - filterAction->setToolTip(help); + filterAction->setToolTip(help + getDecoratedFileName(filterAction->data().toString())); connect(filterAction,SIGNAL(triggered()),this,SLOT(startFilter())); QString filterClasses = info->filterAttribute(filterName,MLXMLElNames::filterClass);