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

Adam Treat treat at kde.org
Wed Oct 10 21:04:59 CEST 2007


SVN commit 723808 by treat:

* Some whitespace cleanups.
* Superfluous datasource methods.
* Cleanup a bit.


 M  +16 -26    scalardialog.cpp  
 M  +0 -9      scalardialog.h  


--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.cpp #723807:723808
@@ -26,16 +26,6 @@
 }
 
 
-DataSourcePtr ScalarTab::dataSource() const {
-  return _dataSource;
-}
-
-
-void ScalarTab::setDataSource(DataSourcePtr dataSource) {
-  _dataSource = dataSource;
-}
-
-
 QString ScalarTab::value() const {
   return _scalarValue->text();
 }
@@ -56,11 +46,11 @@
 
   _scalarTab = new ScalarTab(this);
   addDataTab(_scalarTab);
-
 }
 
 
-ScalarDialog::~ScalarDialog() {}
+ScalarDialog::~ScalarDialog() {
+}
 
 
 QString ScalarDialog::tagName() const {
@@ -69,34 +59,33 @@
 
 
 ObjectPtr ScalarDialog::createNewDataObject() const {
-  const DataSourcePtr dataSource = _scalarTab->dataSource();
-
   bool ok = false;
   QString tagName = DataDialog::tagName();
-  double value = _scalarTab->value().toFloat(&ok);
+  double value = _scalarTab->value().toDouble(&ok);
   if (!ok) {
     value = Equations::interpret(_scalarTab->value().toLatin1(), &ok);
   }
 
+  if (!ok) {
+    return 0; //invalid
+  }
+
 //   qDebug() << "Creating new scalar  ===>"
 //            << "\n\ttag:" << DataDialog::tagName()
 //            << "\n\tvalue:" << value
 //            << endl;
 
-    if (ok) {
-      ScalarPtr scalar = new Scalar(ObjectTag(DataDialog::tagName(), ObjectTag::globalTagContext), 0L, value);
+  ScalarPtr scalar = new Scalar(ObjectTag(DataDialog::tagName(),
+                                ObjectTag::globalTagContext), 0L, value);
 
-      scalar->setOrphan(true);
-      scalar->setEditable(true);
+  scalar->setOrphan(true);
+  scalar->setEditable(true);
 
-      scalar->writeLock();
-      scalar->update(0);
-      scalar->unlock();
+  scalar->writeLock();
+  scalar->update(0);
+  scalar->unlock();
 
-      return static_cast<ObjectPtr>(scalar);
-  }
-
-  return 0;
+  return static_cast<ObjectPtr>(scalar);
 }
 
 
@@ -106,4 +95,5 @@
 }
 
 }
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/scalardialog.h #723807:723808
@@ -22,7 +22,6 @@
 
 #include "kst_export.h"
 
-
 namespace Kst {
 
 class KST_EXPORT ScalarTab : public DataTab, Ui::ScalarTab {
@@ -31,18 +30,10 @@
     ScalarTab(QWidget *parent = 0);
     virtual ~ScalarTab();
 
-    //DataVector mode methods...
-    DataSourcePtr dataSource() const;
-    void setDataSource(DataSourcePtr dataSource);
-
     QString value() const;
     void setValue(const QString &value);
-
-  private:
-    DataSourcePtr _dataSource;
 };
 
-
 class KST_EXPORT ScalarDialog : public DataDialog {
   Q_OBJECT
   public:


More information about the Kst mailing list