[Kst] kdeextragear-2/kst/kst/datasources/planck
George Staikos
staikos at kde.org
Fri Apr 15 05:36:26 CEST 2005
CVS commit by staikos:
implement reset for planck (tested)
M +20 -1 planck.cpp 1.38
M +3 -0 planck.h 1.15
--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp #1.37:1.38
@@ -28,4 +28,5 @@
PlanckSource::PlanckSource(KConfig *cfg, const QString& filename)
: KstDataSource(cfg, filename, "PLANCK I/O") {
+ _filename = filename;
_planckObject = new Planck::Object;
@@ -36,5 +37,5 @@ PlanckSource::PlanckSource(KConfig *cfg,
if (_planckObject && _planckObject->isValid()) {
_fieldList = _planckObject->fields();
- _fieldList.append("INDEX");
+ _fieldList.prepend("INDEX");
update();
_valid = true;
@@ -49,4 +50,22 @@ PlanckSource::~PlanckSource() {
+bool PlanckSource::reset() {
+ _valid = false;
+ _planckObject = new Planck::Object; // kshared - deletes the old one
+ if (!_planckObject->setGroup(_filename)) {
+ _planckObject = 0L; // deref
+ }
+
+ _fieldList.clear();
+ if (_planckObject && _planckObject->isValid()) {
+ _fieldList = _planckObject->fields();
+ _fieldList.prepend("INDEX");
+ update();
+ _valid = true;
+ }
+ return _valid;
+}
+
+
KstObject::UpdateType PlanckSource::update(int u) {
if (KstObject::checkUpdateCounter(u)) {
--- kdeextragear-2/kst/kst/datasources/planck/planck.h #1.14:1.15
@@ -59,6 +59,9 @@ class PlanckSource : public KstDataSourc
int relativeTimeForSample(int sample, bool *ok = 0L);
+ bool reset();
+
private:
KstSharedPtr<Planck::Object> _planckObject;
+ QString _filename;
};
More information about the Kst
mailing list