[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Thu Oct 9 17:27:44 CEST 2008
SVN commit 869640 by fenton:
Add Error Display for BasicPluginDialog.
Add DataManager entry for Plugins.
M +15 -1 basicplugindialog.cpp
M +6 -1 datamanager.cpp
M +1 -0 datamanager.h
--- branches/work/kst/portto4/kst/src/libkstapp/basicplugindialog.cpp #869639:869640
@@ -13,10 +13,13 @@
#include "dialogpage.h"
+#include "objectstore.h"
#include "datacollection.h"
#include "document.h"
#include "basicplugin.h"
+#include <QMessageBox>
+
namespace Kst {
BasicPluginTab::BasicPluginTab(QString& pluginName, QWidget *parent)
@@ -71,8 +74,19 @@
ObjectPtr BasicPluginDialog::createNewDataObject() {
- DataObjectPtr dataObject = DataObject::createPlugin(_pluginName, _document->objectStore(), _basicPluginTab->configWidget());
+ BasicPluginPtr dataObject = kst_cast<BasicPlugin>(DataObject::createPlugin(_pluginName, _document->objectStore(), _basicPluginTab->configWidget()));
+
_basicPluginTab->configWidget()->save();
+
+ if (!dataObject->isValid()) {
+ _document->objectStore()->removeObject(dataObject);
+ QString msg(tr("Unable to create Plugin Object using provided parameters.\n\n"));
+ msg += dataObject->errorMessage();
+ QMessageBox::warning(this, tr("Kst"), msg);
+
+ return 0;
+ }
+
return dataObject;
}
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #869639:869640
@@ -62,6 +62,10 @@
_dataObjects->setOrientation(Qt::Vertical);
_dataObjects->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ _plugins = new QToolBar(_objects);
+ _plugins->setOrientation(Qt::Vertical);
+ _plugins->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+
_fits = new QToolBar(_objects);
_fits->setOrientation(Qt::Vertical);
_fits->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
@@ -72,6 +76,7 @@
_objects->addItem(_primitives, tr("Create Primitive"));
_objects->addItem(_dataObjects, tr("Create Data Object"));
+ _objects->addItem(_plugins, tr("Create Plugin"));
_objects->addItem(_fits, tr("Create Fit"));
_objects->addItem(_filters, tr("Create Filter"));
@@ -124,7 +129,7 @@
foreach (QString pluginName, DataObject::dataObjectPluginList()) {
action = new DataButtonAction(tr(pluginName));
connect(action, SIGNAL(triggered(QString&)), this, SLOT(showPluginDialog(QString&)));
- _dataObjects->addAction(action);
+ _plugins->addAction(action);
}
foreach (QString pluginName, DataObject::fitsPluginList()) {
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.h #869639:869640
@@ -63,6 +63,7 @@
QToolBar *_primitives;
QToolBar *_dataObjects;
+ QToolBar *_plugins;
QToolBar *_fits;
QToolBar *_filters;
More information about the Kst
mailing list