mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Save state of plugins in ~/.qt/qtrc file (in progress). State is saved, just need to implement code to load plugins marked as active during application startup.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@990 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
29f4276a7a
commit
5f99301b55
@ -1,8 +1,13 @@
|
||||
QGIS Change Log
|
||||
ChangeLog,v 1.30 2004/03/06 03:37:11 timlinux Exp
|
||||
ChangeLog,v 1.31 2004/03/06 11:58:19 timlinux Exp
|
||||
------------------------------------------------------------------------------
|
||||
Version 0.2 'Pumpkin' .... development version
|
||||
|
||||
2004-03-06 [ts] 0.1.0devel6
|
||||
** Save state of plugins in ~/.qt/qtrc file (in progress). State is saved,
|
||||
just need to implement code to load plugins marked as active during
|
||||
application startup.
|
||||
|
||||
2004-03-06 [ts] 0.1.0devel6
|
||||
** Added QgsRasterLayer::filterLayer which gets called near the end of each of
|
||||
the 8 renderers. This is the place to inline filters. Note that eventually filters
|
||||
|
@ -1825,14 +1825,12 @@ void QgisApp::actionPluginManager_activated()
|
||||
loadPlugin(plugin.name(), plugin.description(), plugin.fullPath());
|
||||
it++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void QgisApp::loadPlugin(QString name, QString description, QString fullPath)
|
||||
{
|
||||
QSettings settings;
|
||||
// first check to see if its already loaded
|
||||
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
|
||||
QString lib = pRegistry->library(name);
|
||||
@ -1860,29 +1858,36 @@ void QgisApp::loadPlugin(QString name, QString description, QString fullPath)
|
||||
switch (pType())
|
||||
{
|
||||
case QgisPlugin::UI:
|
||||
{
|
||||
// UI only -- doesn't use mapcanvas
|
||||
create_ui *cf = (create_ui *) myLib->resolve("classFactory");
|
||||
if (cf)
|
||||
{
|
||||
// UI only -- doesn't use mapcanvas
|
||||
create_ui *cf = (create_ui *) myLib->resolve("classFactory");
|
||||
if (cf)
|
||||
{
|
||||
QgisPlugin *pl = cf(this, qgisInterface);
|
||||
if (pl)
|
||||
{
|
||||
pl->initGui();
|
||||
// add it to the plugin registry
|
||||
pRegistry->addPlugin(myLib->library(), name, pl);
|
||||
} else
|
||||
{
|
||||
// something went wrong
|
||||
QMessageBox::warning(this, tr("Error Loading Plugin"), tr("There was an error loading %1."));
|
||||
}
|
||||
} else
|
||||
{
|
||||
pl->initGui();
|
||||
// add it to the plugin registry
|
||||
pRegistry->addPlugin(myLib->library(), name, pl);
|
||||
//add it to the qsettings file [ts]
|
||||
settings.writeEntry("/qgis/Plugins/" + name, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// something went wrong
|
||||
QMessageBox::warning(this, tr("Error Loading Plugin"), tr("There was an error loading %1."));
|
||||
//disable it to the qsettings file [ts]
|
||||
settings.writeEntry("/qgis/Plugins/" + name, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "Unable to find the class factory for " << fullPath << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case QgisPlugin::MAPLAYER:
|
||||
{
|
||||
@ -1896,11 +1901,15 @@ void QgisApp::loadPlugin(QString name, QString description, QString fullPath)
|
||||
// set the main window pointer for the plugin
|
||||
pl->setQgisMainWindow(this);
|
||||
pl->initGui();
|
||||
//add it to the qsettings file [ts]
|
||||
settings.writeEntry("/qgis/Plugins/" + name, true);
|
||||
|
||||
} else
|
||||
{
|
||||
// something went wrong
|
||||
QMessageBox::warning(this, tr("Error Loading Plugin"), tr("There was an error loading %1."));
|
||||
//add it to the qsettings file [ts]
|
||||
settings.writeEntry("/qgis/Plugins/" + name, false);
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <qlistview.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qlibrary.h>
|
||||
#include <qsettings.h>
|
||||
#include "../plugins/qgisplugin.h"
|
||||
#include "qgspluginmanager.h"
|
||||
#include "qgspluginitem.h"
|
||||
@ -141,6 +142,7 @@ void QgsPluginManager::apply()
|
||||
|
||||
void QgsPluginManager::unload()
|
||||
{
|
||||
QSettings settings;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "Checking for plugins to unload" << std::endl;
|
||||
#endif
|
||||
@ -156,11 +158,13 @@ void QgsPluginManager::unload()
|
||||
#endif
|
||||
QgisPlugin *plugin = pRegistry->plugin(lvi->text(0));
|
||||
if (plugin)
|
||||
{
|
||||
plugin->unload();
|
||||
// remove the plugin from the registry
|
||||
pRegistry->removePlugin(lvi->text(0));
|
||||
}
|
||||
{
|
||||
plugin->unload();
|
||||
// remove the plugin from the registry
|
||||
pRegistry->removePlugin(lvi->text(0));
|
||||
//disable it to the qsettings file [ts]
|
||||
settings.writeEntry("/qgis/Plugins/" + lvi->text(0), false);
|
||||
}
|
||||
}
|
||||
lvi = (QCheckListItem *) lvi->nextSibling();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user