[Kst] kdeextragear-2/kst/kst/datasources/planck
George Staikos
staikos at kde.org
Thu Oct 30 05:15:51 CET 2003
CVS commit by staikos:
pio updates and fixes - almost working
M +22 -2 planck.cpp 1.4
M +10 -1 plancktoi.cpp 1.3
--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp #1.3:1.4
@@ -68,6 +68,14 @@ int PlanckSource::readField(double *v, c
}
+ if (!_valid || !_planckTOI || !_planckTOI->isValid()) {
+ kdDebug() << "tried to read from an invalid planck source" << endl;
+ kdDebug() << "plugin is valid? " << _valid << endl;
+ kdDebug() << "TOI object is non-null? " << (_planckTOI.data() != 0) << endl;
+ return -1;
+ }
+
QStringList split = QStringList::split(':', field);
if (split.count() != 2) {
+ kdDebug() << "invalid field" << endl;
return -1;
}
@@ -82,18 +90,30 @@ int PlanckSource::readField(double *v, c
if (!grp) {
+ kdDebug() << "couldn't find that group" << endl;
return -1;
}
if (!grp->objects().contains(split[1])) {
+ kdDebug() << "couldn't find that object" << endl;
return -1;
}
+ QSize sz = _planckTOI->range(split[0], split[1]);
- return -1;
+ if (n < 0) {
+ n = 1;
+ }
+
+ if (s + sz.width() >= sz.height() - 1) {
+ kdDebug() << "Nothing to read: (" << sz.width() << "," << sz.height() << ") " << s << endl;
+ return 0;
+ }
+
+ return _planckTOI->readObject(split[0], split[1], v, sz.width() + s, sz.width() + s + n - 1);
}
bool PlanckSource::isValidField(const QString& field) const {
- return field.lower() == "INDEX" || _fieldList.contains(field);
+ return field.lower() == "index" || _fieldList.contains(field);
}
--- kdeextragear-2/kst/kst/datasources/planck/plancktoi.cpp #1.2:1.3
@@ -90,4 +90,5 @@ bool TOI::setSource(const QString& src)
_source = src;
}
+ _isValid = true;
return true;
}
@@ -98,5 +99,5 @@ QStringList TOI::fields(const QString& g
#ifdef KST_HAVE_PLANCK
if (_isValid) {
- TOIGroup *tg = findGroup(group);
+ const TOIGroup *tg = findGroup(group);
if (tg) {
for (PIOINT i = 0; i < tg->objectListSize; ++i) {
@@ -128,4 +129,7 @@ QSize TOI::range(const QString& group, c
if (i == g->objectListSize) {
+#ifdef TOIDEBUG
+ kdDebug() << "Error finding object " << object << endl;
+#endif
return QSize(0, 0);
}
@@ -221,4 +225,9 @@ const TOIGroup *TOI::findGroup(const QSt
}
+#ifdef TOIDEBUG
+ if (!grp) {
+ kdDebug() << "Error finding group " << group << endl;
+ }
+#endif
return grp;
}
More information about the Kst
mailing list