[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Sat Sep 5 02:35:02 CEST 2009


SVN commit 1020002 by netterfield:

Delete old files stored here from the 1.x branch 
(if you want it, get it from the 1.x branch)

Remove dead code.

Fix the ascii read file bug.



 M  +0 -3      devel-docs/Kst2Specs/Bugs  
 M  +3 -0      devel-docs/Kst2Specs/FixedBugs  
 M  +1 -0      devel-docs/Kst2Specs/Wishlist  
 M  +1 -2      src/datasources/ascii/ascii.cpp  
 D             src/extensions (directory)  
 M  +0 -191    src/libkst/coredocument.cpp  
 M  +0 -20     src/libkst/datacollection.cpp  
 M  +0 -6      src/libkst/datacollection.h  
 M  +0 -11     src/libkst/object.h  
 M  +0 -112    src/libkst/objectlist.h  
 M  +0 -7      src/libkst/objectstore.h  
 M  +11 -0     src/libkst/sharedptr.h  
 M  +1 -0      src/libkstapp/legenditemdialog.cpp  
 M  +23 -25    src/libkstapp/libkstapp.pro  
 M  +1 -1      src/libkstapp/viewitem.h  
 D             src/old_libkstapp (directory)  
 D             src/old_plugins (directory)  
 D             src/old_widgets (directory)  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1020001:1020002
@@ -9,7 +9,4 @@
 
 Artifacts when resizing large arrowheads.
 
---------------------
 
-ASCII settings are ignored unless they are the global defaults.
-
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #1020001:1020002
@@ -1102,3 +1102,6 @@
 
 Rotated axis number label spacing is wrong
 
+--------------------
+
+ASCII settings are ignored unless they are the global defaults.
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1020001:1020002
@@ -36,6 +36,7 @@
 --------
 
 Edit multiple for all view objects.  The highest priority is legends.
+  -make an doc->item store which holds all items, like objects have.
 
 --------
 
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.cpp #1020001:1020002
@@ -72,7 +72,6 @@
       _readFields = cfg->value("Read Fields", false).toBool();
       _fieldsLine = cfg->value("Fields Line", 0).toInt();
       if (!fileName.isEmpty()) {
-        cfg->endGroup();
         cfg->beginGroup(fileName);
         _delimiters = cfg->value("Comment Delimiters", _delimiters).toString().toLatin1();
         _indexInterpretation = (Interpretation)cfg->value("Default INDEX Interpretation", (int)_indexInterpretation).toInt();
@@ -82,6 +81,7 @@
         _dataLine = cfg->value("Data Start", _dataLine).toInt();
         _readFields = cfg->value("Read Fields", _readFields).toBool();
         _fieldsLine = cfg->value("Fields Line", _fieldsLine).toInt();
+        cfg->endGroup();
       }
       _delimiters = QRegExp::escape(_delimiters).toLatin1();
       cfg->endGroup();
@@ -862,7 +862,6 @@
       Kst::SharedPtr<AsciiSource> src = Kst::kst_cast<AsciiSource>(_instance);
       if (src) {
         _cfg->beginGroup(src->fileName());
-
         _cfg->setValue("Default INDEX Interpretation", 1 + _ac->_indexType->currentIndex());
         _cfg->setValue("Comment Delimiters", _ac->_delimiters->text());
         AsciiSource::Config::ColumnType ct = AsciiSource::Config::Whitespace;
--- branches/work/kst/portto4/kst/src/libkst/coredocument.cpp #1020001:1020002
@@ -48,75 +48,6 @@
 
 bool CoreDocument::save(const QString& to) {
   Q_UNUSED(to);
-#if 0
-  // TODO:
-  // - KSaveFile-ish behavior
-  // - only save if changed
-  // - only setChanged(false) if save was successful
-  setChanged(false);
-
-  QString file = !to.isEmpty() ? to : _fileName;
-  QFile f(file);
-  if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
-    _lastError = QObject::tr("File could not be opened for writing.");
-    return false;
-  }
-
-  _fileName = file;
-
-  QXmlStreamWriter xml;
-  xml.setDevice(&f);
-  xml.setAutoFormatting(true);
-  xml.writeStartDocument();
-  xml.writeStartElement("kst");
-  xml.writeAttribute("version", "2.0");
-
-  xml.writeStartElement("data");
-  foreach (KstDataSourcePtr s, dataSourceList) {
-    s->saveSource(xml);
-  }
-  xml.writeEndElement();
-
-  xml.writeStartElement("variables");
-
-  foreach (VectorPtr s, vectorList.list()) {
-    s->save(xml);
-  }
-  foreach (KstMatrixPtr s, matrixList.list()) {
-    s->save(xml);
-  }
-  foreach (ScalarPtr s, scalarList.list()) {
-    s->save(xml);
-  }
-  foreach (KstStringPtr s, stringList.list()) {
-    s->save(xml);
-  }
-  xml.writeEndElement();
-
-  xml.writeStartElement("objects");
-  foreach (DataObjectPtr s, KST::dataObjectList) {
-    s->save(xml);
-  }
-  xml.writeEndElement();
-
-  xml.writeStartElement("relations");
-  foreach (KstRelationPtr s, KST::relationList) {
-    s->save(xml);
-  }
-  xml.writeEndElement();
-
-  xml.writeStartElement("graphics");
-  for (int i = 0; i < _win->tabWidget()->count(); ++i) {
-    View *v = qobject_cast<View*>(_win->tabWidget()->widget(i));
-    xml.writeStartElement("view");
-    xml.writeAttribute("name", _win->tabWidget()->tabText(i));
-    // TODO: save each item
-    xml.writeEndElement();
-  }
-  xml.writeEndElement();
-
-  xml.writeEndCoreDocument();
-#endif
   return true;
 }
 
@@ -124,129 +55,7 @@
 bool CoreDocument::open(const QString& file) {
   Q_UNUSED(file);
   _isOpen = false;
-#if 0
-  QFile f(file);
-  if (!f.open(QIODevice::ReadOnly)) {
-    _lastError = QObject::tr("File could not be opened for reading.");
-    return false;
-  }
 
-  _fileName = file;
-
-  View *currentView = 0;
-
-  QXmlStreamReader xml;
-  xml.setDevice(&f);
-
-  enum State { Unknown=0, Data, Variables, Objects, Relations, Graphics, View };
-  State state = Unknown;
-
-#define malformed()
-
-  while (!xml.atEnd()) {
-    if (xml.isStartElement()) {
-      QString n = xml.name().toString();
-      if (n == "kst") {
-      } else if (n == "data") {
-        if (state != Unknown)
-          malformed();
-        state = Data;
-      } else if (n == "variables") {
-        if (state != Unknown)
-          malformed();
-        state = Variables;
-      } else if (n == "objects") {
-        if (state != Unknown)
-          malformed();
-        state = Objects;
-      } else if (n == "relations") {
-        if (state != Unknown)
-          malformed();
-        state = Relations;
-      } else if (n == "graphics") {
-        if (state != Unknown)
-          malformed();
-        state = Graphics;
-      } else {
-        switch (state) {
-          case Objects:
-            {
-              DataObjectPtr object = ObjectFactory::parse(xml);
-              if (object)
-                KST::addDataObjectToList(object);
-              else
-                malformed();
-              break;
-            }
-          case Graphics:
-            {
-              if (n == "view") {
-                currentView = _win->tabWidget()->createView();
-                QXmlStreamAttributes attrs = xml.attributes();
-                QStringRef nm = attrs.value("name");
-                if (!nm.isNull()) {
-                  int idx = _win->tabWidget()->indexOf(currentView);
-                  _win->tabWidget()->setTabText(idx, nm.toString());
-                }
-                state = View;
-              } else {
-                malformed();
-              }
-            }
-            break;
-          case View:
-            {
-              ViewItem *i = GraphicsFactory::parse(xml, currentView);
-              if (i) {
-                currentView->scene()->addItem(i);
-              }
-            }
-            break;
-          case Data:
-            DataSourceFactory::parse(xml);
-            break;
-          case Variables:
-            PrimitiveFactory::parse(xml);
-            break;
-          case Relations:
-            RelationFactory::parse(xml);
-            break;
-          case Unknown:
-            malformed();
-            break;
-        }
-      }
-    } else if (xml.isEndElement()) {
-      QString n = xml.name().toString();
-      if (n == "kst") {
-        if (state != Unknown)
-          malformed();
-        break;
-      } else if (n == "view") {
-        state = Graphics;
-      } else if (n == "data") {
-        state = Unknown;
-      } else if (n == "objects") {
-        state = Unknown;
-      } else if (n == "variables") {
-        state = Unknown;
-      } else if (n == "relations") {
-        state = Unknown;
-      } else if (n == "graphics") {
-        state = Unknown;
-      }
-    }
-    xml.readNext();
-  }
-#undef malformed
-
-  if (xml.hasError()) {
-    _lastError = QObject::tr("File is malformed and encountered an error while reading.");
-    return false;
-  }
-
-#endif
-
   return _isOpen = true;
 }
 
--- branches/work/kst/portto4/kst/src/libkst/datacollection.cpp #1020001:1020002
@@ -94,26 +94,6 @@
   // meaningless in no GUI: no plots!
 }
 
-
-#if 0
-int Data::vectorToFile(VectorPtr v, QFile *f) {
-  Q_UNUSED(v)
-  Q_UNUSED(f)
-  // FIXME: implement me (non-gui)
-  return 0;
-}
-
-
-int Data::vectorsToFile(const VectorList& l, QFile *f, bool interpolate) {
-  Q_UNUSED(l)
-  Q_UNUSED(f)
-  Q_UNUSED(interpolate)
-  // FIXME: implement me (non-gui)
-  return 0;
-}
-#endif
-
-
 QList<PlotItemInterface*> Data::plotList() const {
   return QList<PlotItemInterface*>();
 }
--- branches/work/kst/portto4/kst/src/libkst/datacollection.h #1020001:1020002
@@ -44,12 +44,6 @@
 
     virtual void removeCurveFromPlots(Relation *c); // no sharedptr here
 
-#if 0
-    /** Save a vector to a file */
-    virtual int vectorToFile(VectorPtr v, QFile *f);
-    virtual int vectorsToFile(const VectorList& l, QFile *f, bool interpolate);
-#endif
-
     /** The list of plots for the current view. */
     virtual QList<PlotItemInterface*> plotList() const;
 
--- branches/work/kst/portto4/kst/src/libkst/object.h #1020001:1020002
@@ -73,19 +73,8 @@
 } KST_EXPORT;
 
 
-
-template <typename T, typename U>
-inline SharedPtr<T> kst_cast(SharedPtr<U> object) {
-  return qobject_cast<T*>(object.data());
 }
-// FIXME: make this safe
-template <typename T>
-inline SharedPtr<T> kst_cast(QObject *object) {
-  return qobject_cast<T*>(object);
-}
 
-}
-
 Q_DECLARE_METATYPE(Kst::Object*)
 
 #endif
--- branches/work/kst/portto4/kst/src/libkst/objectlist.h #1020001:1020002
@@ -24,118 +24,6 @@
 };
 
 }
-
-#if 0
-template<class T>
-class ObjectList : public QList<T> {
-  public:
-    ObjectList() : QList<T>() {}
-    ObjectList(const ObjectList<T>& x) : QList<T>(x) {}
-    virtual ~ObjectList() { }
-
-    ObjectList& operator=(const ObjectList& l) {
-      this->QList<T>::operator=(l);
-      return *this;
-    }
-
-    virtual QStringList tagNames() {
-      QStringList rc;
-      for (typename QList<T>::ConstIterator it = QList<T>::begin(); it != QList<T>::end(); ++it) {
-        rc << (*it)->tagName();
-      }
-      return rc;
-    }
-
-    // @since 1.1.0
-    QStringList tagNames() const {
-      QStringList rc;
-      for (typename QList<T>::ConstIterator it = QList<T>::begin(); it != QList<T>::end(); ++it) {
-        rc << (*it)->tagName();
-      }
-      return rc;
-    }
-
-    virtual typename QList<T>::Iterator findTag(const QString& x) {
-      for (typename QList<T>::Iterator it = QList<T>::begin(); it != QList<T>::end(); ++it) {
-        if (*(*it) == x) {
-          return it;
-        }
-      }
-      return QList<T>::end();
-    }
-
-    virtual typename QList<T>::ConstIterator findTag(const QString& x) const {
-      for (typename QList<T>::ConstIterator it = QList<T>::begin(); it != QList<T>::end(); ++it) {
-        if (*(*it) == x) {
-          return it;
-        }
-      }
-      return QList<T>::end();
-    }
-
-    virtual int findIndexTag(const QString& x) const {
-      int i = 0;
-      for (typename QList<T>::ConstIterator it = QList<T>::begin(); it != QList<T>::end(); ++it) {
-        if (*(*it) == x) {
-          return i;
-        }
-        i++;
-      }
-      return -1;
-    }
-
-    virtual typename QList<T>::Iterator removeTag(const QString& x) {
-      typename QList<T>::Iterator it = findTag(x);
-      if (it != QList<T>::end()) {
-        return QList<T>::erase(it);
-      }
-      return it;
-    }
-
-    KstRWLock& lock() const { return _lock; }
-
-  private:
-    mutable KstRWLock _lock;
-};
-
-/* Does locking for you automatically. */
-template<class T, class S>
-ObjectList<SharedPtr<S> > kstObjectSubList(ObjectList<SharedPtr<T> >& list) {
-  list.lock().readLock();
-  ObjectList<SharedPtr<S> > rc;
-  typename ObjectList<SharedPtr<T> >::Iterator it;
-
-  for (it = list.begin(); it != list.end(); ++it) {
-    S *x = dynamic_cast<S*>((*it).data());
-    if (x != 0L) {
-      rc.append(x);
-    }
-  }
-
-  list.lock().unlock();
-  return rc;
-}
-
-
-/* Does locking for you automatically. */
-template<class T, class S>
-void kstObjectSplitList(ObjectList<SharedPtr<T> >& list, ObjectList<SharedPtr<S> >& inclusive, ObjectList<SharedPtr<T> >& exclusive) {
-  list.lock().readLock();
-  typename ObjectList<SharedPtr<T> >::Iterator it;
-
-  for (it = list.begin(); it != list.end(); ++it) {
-    S *x = dynamic_cast<S*>((*it).data());
-    if (x != 0L) {
-      inclusive.append(x);
-    } else {
-      exclusive.append(*it);
-    }
-  }
-
-  list.lock().unlock();
-}
-
 #endif
-#endif
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkst/objectstore.h #1020001:1020002
@@ -29,13 +29,6 @@
 
 namespace Kst {
 
-// Forward Declarations
-//class Matrix;
-//class Scalar;
-//class KstString;
-//class Vector;
-//class DataSource;
-
 class ObjectNameIndex;
 
 
--- branches/work/kst/portto4/kst/src/libkst/sharedptr.h #1020001:1020002
@@ -172,5 +172,16 @@
   T* ptr;
 };
 
+
+template <typename T, typename U>
+inline SharedPtr<T> kst_cast(SharedPtr<U> object) {
+  return qobject_cast<T*>(object.data());
 }
+// FIXME: make this safe
+template <typename T>
+inline SharedPtr<T> kst_cast(QObject *object) {
+  return qobject_cast<T*>(object);
+}
+
+}
 #endif
--- branches/work/kst/portto4/kst/src/libkstapp/legenditemdialog.cpp #1020001:1020002
@@ -41,6 +41,7 @@
   addDialogPage(page);
 
   setupLegend();
+
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/libkstapp.pro #1020001:1020002
@@ -1,30 +1,33 @@
 include($$PWD/../../kst.pri)
-
-QT += gui network svg opengl
-
+QT += gui \
+    network \
+    svg \
+    opengl
 TEMPLATE = lib
 TARGET = kstapp
 DESTDIR = $$OUTPUT_DIR/lib
 win32:CONFIG += staticlib
-
-! isEmpty(INSTALL_PREFIX) {
-  target.path = $$INSTALL_PREFIX/$$INSTALL_LIBDIR
-  INSTALLS += target
+!isEmpty(INSTALL_PREFIX) { 
+    target.path = $$INSTALL_PREFIX/$$INSTALL_LIBDIR
+    INSTALLS += target
 }
-
-INCLUDEPATH += \
-    tmp \
+INCLUDEPATH += tmp \
     $$TOPLEVELDIR/src/libkst \
     $$TOPLEVELDIR/src/libkstmath \
     $$TOPLEVELDIR/src/widgets \
     $$OUTPUT_DIR/src/widgets \
     $$OUTPUT_DIR/src/libkstapp/tmp
-
-win32:LIBS += -L$$OUTPUT_DIR/lib -L$$OUTPUT_DIR/plugin -lkstwidgets -lkstmath -lkst
-!win32:LIBS += -L$$OUTPUT_DIR/lib -L$$OUTPUT_DIR/plugin -lkst -lkstmath -lkstwidgets
-
-SOURCES += \
-    aboutdialog.cpp \
+win32:LIBS += -L$$OUTPUT_DIR/lib \
+    -L$$OUTPUT_DIR/plugin \
+    -lkstwidgets \
+    -lkstmath \
+    -lkst
+!win32:LIBS += -L$$OUTPUT_DIR/lib \
+    -L$$OUTPUT_DIR/plugin \
+    -lkst \
+    -lkstmath \
+    -lkstwidgets
+SOURCES += aboutdialog.cpp \
     application.cpp \
     applicationsettings.cpp \
     applicationsettingsdialog.cpp \
@@ -129,7 +132,6 @@
     viewmatrixdialog.cpp \
     viewprimitivedialog.cpp \
     viewvectordialog.cpp
-
 HEADERS += \
     aboutdialog.h \
     application.h \
@@ -150,7 +152,7 @@
     childviewoptionstab.h \
     choosecolordialog.h \
     circleitem.h \
-    commandlineparser.h\
+    commandlineparser.h \
     contenttab.h \
     csddialog.h \
     curvedialog.h \
@@ -237,9 +239,7 @@
     viewmatrixdialog.h \
     viewprimitivedialog.h \
     viewvectordialog.h
-
-FORMS += \
-    aboutdialog.ui \
+FORMS += aboutdialog.ui \
     arrowpropertiestab.ui \
     axistab.ui \
     basicplugintab.ui \
@@ -289,7 +289,5 @@
     viewmanager.ui \
     viewmatrixdialog.ui \
     viewprimitivedialog.ui \
-    viewvectordialog.ui
-
-RESOURCES += \
-    $$TOPLEVELDIR/src/images/images.qrc
+    viewvectordialog.ui 
+RESOURCES += $$TOPLEVELDIR/src/images/images.qrc
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1020001:1020002
@@ -20,7 +20,7 @@
 
 #include "kst_export.h"
 #include "viewcommand.h"
-#include "view.h" //forward declare, but enums??
+#include "view.h"
 #include "curveplacement.h"
 
 namespace Kst {


More information about the Kst mailing list