[Kst] extragear/graphics/kst/src/libkstapp
George Staikos
staikos at kde.org
Tue May 30 16:11:42 CEST 2006
SVN commit 546593 by staikos:
Add a dialog that shows metadata for datasources from the data manager. It's
low impact here. I haven't really tested displaying any data since I don't have
any datasource that has metadata right now. If any source plugin wants to put
it into variables, it can do it itself. Nothing ever precluded this. I'm not
going to put anything inline in the data manager because it's just too much data
and the horizontal scroll bar will be quite large. Also we'd have to strip out
many characters (and newlines).
FEATURE: 120749, 120773
M +1 -0 Makefile.am
A datasourcemetadatadialog.ui
A datasourcemetadatadialog.ui.h [License: no copyright]
M +36 -2 kstdatamanager_i.cpp
M +1 -0 kstdatamanager_i.h
--- trunk/extragear/graphics/kst/src/libkstapp/Makefile.am #546592:546593
@@ -70,6 +70,7 @@
kstfilterdialog_i.cpp \
extensionmgr.cpp \
ksteditviewobjectdialog_i.cpp \
+ datasourcemetadatadialog.ui \
kstdatamanager_i.cpp \
kstviewmanager_i.cpp \
kstvectordialog_i.cpp \
--- trunk/extragear/graphics/kst/src/libkstapp/kstdatamanager_i.cpp #546592:546593
@@ -27,6 +27,7 @@
#include <kstandarddirs.h>
// application specific includes
+#include "datasourcemetadatadialog.h"
#include "kst2dplot.h"
#include "kstcurvedialog_i.h"
#include "kstcsddialog_i.h"
@@ -473,14 +474,44 @@
}
+void KstObjectItem::showMetadata() {
+ if (_rtti == RTTI_OBJ_DATA_VECTOR) {
+ DataSourceMetaDataDialog *dlg = new DataSourceMetaDataDialog(_dm, 0, false, WDestructiveClose);
+ KstReadLocker vl(&KST::vectorList.lock());
+ KstVectorList::Iterator m = KST::vectorList.findTag(_name);
+ KstRVectorPtr r = kst_cast<KstRVector>(*m);
+ KstDataSourcePtr dsp;
+ if (r) {
+ r->readLock();
+ dsp = r->dataSource();
+ r->readUnlock();
+ }
+ dlg->setDataSource(dsp);
+ dlg->show();
+ } else if (_rtti == RTTI_OBJ_DATA_MATRIX) {
+ DataSourceMetaDataDialog *dlg = new DataSourceMetaDataDialog(_dm, 0, false, WDestructiveClose);
+ KstReadLocker ml(&KST::matrixList.lock());
+ KstMatrixList::Iterator m = KST::matrixList.findTag(_name);
+ KstRMatrixPtr r = kst_cast<KstRMatrix>(*m);
+ KstDataSourcePtr dsp;
+ if (r) {
+ r->readLock();
+ dsp = r->dataSource();
+ r->readUnlock();
+ }
+ dlg->setDataSource(dsp);
+ dlg->show();
+ }
+}
+
+
void KstObjectItem::activateHint(int id) {
KstDataObjectPtr d = dataObject();
const KstCurveHintList* hints = d->curveHints();
int cnt = 0;
for (KstCurveHintList::ConstIterator i = hints->begin(); i != hints->end(); ++i) {
if (cnt == id) {
- KstBaseCurvePtr c = (*i)->makeCurve(KST::suggestCurveName(d->tagName(), false),
- KstColorSequence::next());
+ KstBaseCurvePtr c = (*i)->makeCurve(KST::suggestCurveName(d->tagName(), false), KstColorSequence::next());
if (c) {
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(c.data());
@@ -917,6 +948,7 @@
id = m->insertItem(i18n("Make Cumulative &Spectral Decay..."), koi, SLOT(makeCSD()));
id = m->insertItem(i18n("Make &Histogram..."), koi, SLOT(makeHistogram()));
id = m->insertItem(i18n("&Reload"), koi, SLOT(reload()));
+ id = m->insertItem(i18n("Meta &Data"), koi, SLOT(showMetadata()));
} else if (koi->rtti() == RTTI_OBJ_VECTOR) {
id = m->insertItem(i18n("&Make Curve..."), koi, SLOT(makeCurve()));
id = m->insertItem(i18n("Make &Power Spectrum..."), koi, SLOT(makePSD()));
@@ -925,6 +957,7 @@
} else if (koi->rtti() == RTTI_OBJ_DATA_MATRIX) {
id = m->insertItem(i18n("Make &Image..."), koi, SLOT(makeImage()));
id = m->insertItem(i18n("&Reload"), koi, SLOT(reload()));
+ id = m->insertItem(i18n("Meta &Data"), koi, SLOT(showMetadata()));
} else if (koi->rtti() == RTTI_OBJ_MATRIX || koi->rtti() == RTTI_OBJ_STATIC_MATRIX) {
id = m->insertItem(i18n("Make &Image..."), koi, SLOT(makeImage()));
} else if ((c = kst_cast<KstBaseCurve>(koi->dataObject()))) {
@@ -986,5 +1019,6 @@
}
}
+
#include "kstdatamanager_i.moc"
// vim: ts=2 sw=2 et
--- trunk/extragear/graphics/kst/src/libkstapp/kstdatamanager_i.h #546592:546593
@@ -92,6 +92,7 @@
void makePSD();
void makeImage();
void reload();
+ void showMetadata();
signals:
void updated();
More information about the Kst
mailing list