mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-16 09:34:36 +00:00
set a plugin to be deleted when starting next session
This commit is contained in:
parent
19a8919e12
commit
cd36d7db88
@ -28,6 +28,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include <common/plugins/interfaces/filter_plugin.h>
|
||||
#include <common/plugins/interfaces/iomesh_plugin.h>
|
||||
@ -91,11 +92,15 @@ void PluginInfoDialog::uninstallPluginPushButtonClicked()
|
||||
pm.unloadPlugin(fpi);
|
||||
bool res = QFile::remove(fdel.absoluteFilePath());
|
||||
if (!res){
|
||||
QSettings settings;
|
||||
QStringList toDeletePlugins = settings.value("ToDeletePlugins").value<QStringList>();
|
||||
toDeletePlugins.append(fdel.absoluteFilePath());
|
||||
settings.setValue("ToDeletePlugins", toDeletePlugins);
|
||||
//pm.loadPlugin(fdel.absoluteFilePath());
|
||||
QMessageBox::warning(
|
||||
this, "Error while deleting plugin.",
|
||||
"Impossible to delete the plugin. Please delete manually the following file (or disable the plugin):\n"
|
||||
+ fdel.absoluteFilePath());
|
||||
//QMessageBox::warning(
|
||||
// this, "Error while deleting plugin.",
|
||||
// "Impossible to delete the plugin. Please delete manually the following file (or disable the plugin):\n"
|
||||
// + fdel.absoluteFilePath());
|
||||
}
|
||||
ui->treeWidget->clear();
|
||||
populateTreeWidget();
|
||||
|
||||
@ -54,6 +54,21 @@ MainWindow::MainWindow():
|
||||
PM(meshlab::pluginManagerInstance()),
|
||||
_currviewcontainer(NULL)
|
||||
{
|
||||
QSettings settings;
|
||||
//toDelete plugins, flagged in the last session
|
||||
//this is needed on windows, since it refuses to delete dll plugins while meshlab is
|
||||
//running. Therefore, in these cases plugins that are going to be deleted are
|
||||
//saved in this list, and the files are removed in the next meshlab session,
|
||||
//BEFORE they will be loaded. Therefore, these lines need to be executed
|
||||
//before the PM.loadPlugins call.
|
||||
QStringList toDeletePlugins = settings.value("ToDeletePlugins").value<QStringList>();
|
||||
if (!toDeletePlugins.isEmpty()){
|
||||
for (const QString& file : toDeletePlugins){
|
||||
QFile::remove(file);
|
||||
}
|
||||
}
|
||||
settings.remove("ToDeletePlugins");
|
||||
|
||||
setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
//workspace = new QWorkspace(this);
|
||||
@ -70,7 +85,6 @@ MainWindow::MainWindow():
|
||||
catch (const MLException& e) {
|
||||
QMessageBox::warning(this, "Error while loading plugins.", e.what());
|
||||
}
|
||||
QSettings settings;
|
||||
|
||||
//disable previously disabled plugins
|
||||
QStringList disabledPlugins = settings.value("DisabledPlugins").value<QStringList>();
|
||||
@ -78,7 +92,6 @@ MainWindow::MainWindow():
|
||||
if (disabledPlugins.contains(fp->pluginName()))
|
||||
PM.disablePlugin(fp);
|
||||
}
|
||||
|
||||
|
||||
//setCentralWidget(workspace);
|
||||
setCentralWidget(mdiarea);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user