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

Barth Netterfield netterfield at astro.utoronto.ca
Sat Jun 7 08:49:59 CEST 2008


SVN commit 817945 by netterfield:

-add description tip to vector selector and scalar selector
-add the tip to a number of data objects.



 M  +1 -1      libkst/datavector.cpp  
 M  +1 -1      libkst/datavector.h  
 M  +1 -1      libkst/editablevector.cpp  
 M  +1 -1      libkst/editablevector.h  
 M  +1 -1      libkst/generatedvector.cpp  
 M  +1 -1      libkst/generatedvector.h  
 M  +3 -3      libkst/namedobject.cpp  
 M  +1 -1      libkst/namedobject.h  
 M  +1 -1      libkst/objectstore.cpp  
 M  +2 -2      libkst/vector.cpp  
 M  +1 -1      libkst/vector.h  
 M  +45 -5     libkstmath/curve.cpp  
 M  +1 -0      libkstmath/curve.h  
 M  +8 -0      libkstmath/equation.cpp  
 M  +2 -0      libkstmath/equation.h  
 M  +14 -0     libkstmath/histogram.cpp  
 M  +1 -0      libkstmath/histogram.h  
 M  +14 -0     libkstmath/psd.cpp  
 M  +2 -0      libkstmath/psd.h  
 M  +9 -0      widgets/scalarselector.cpp  
 M  +1 -1      widgets/scalarselector.h  
 M  +7 -3      widgets/vectorselector.cpp  
 M  +1 -0      widgets/vectorselector.h  


--- branches/work/kst/portto4/kst/src/libkst/datavector.cpp #817944:817945
@@ -787,7 +787,7 @@
   return field();
 }
 
-QString DataVector::description() {
+QString DataVector::descriptionTip() const {
   QString IDstring;
   QString range_string;
 
--- branches/work/kst/portto4/kst/src/libkst/datavector.h #817944:817945
@@ -111,7 +111,7 @@
     /** the data source */
     DataSourcePtr dataSource() const;
 
-    virtual QString description();
+    virtual QString descriptionTip() const;
 
   public Q_SLOTS:
     void sourceUpdated(ObjectPtr object);
--- branches/work/kst/portto4/kst/src/libkst/editablevector.cpp #817944:817945
@@ -98,7 +98,7 @@
   return name;
 }
 
-QString EditableVector::description() {
+QString EditableVector::descriptionTip() const {
     return i18n("Editable Vector: %1\n"
       "  %2 values").arg(Name()).arg(length());
 
--- branches/work/kst/portto4/kst/src/libkst/editablevector.h #817944:817945
@@ -35,7 +35,7 @@
 
     void setSaveData(bool save);
 
-    virtual QString description();
+    virtual QString descriptionTip() const;
 
   protected:
     KST_EXPORT EditableVector(ObjectStore *store, const QByteArray& data);
--- branches/work/kst/portto4/kst/src/libkst/generatedvector.cpp #817944:817945
@@ -108,7 +108,7 @@
   return QString::number(_v[0])+".."+QString::number(_v[length()-1]);
 }
 
-QString GeneratedVector::description() {
+QString GeneratedVector::descriptionTip() const {
   return i18n("Generated Vector: %1\n"
       "  %2 values from %3 to %4").arg(Name()).arg(length()).arg(_v[0]).arg(_v[length()-1]);
 }
--- branches/work/kst/portto4/kst/src/libkst/generatedvector.h #817944:817945
@@ -39,7 +39,7 @@
     Object::UpdateType update();
     void setSaveData(bool save);
 
-    QString description();
+    virtual QString descriptionTip() const;
   protected:
     GeneratedVector(ObjectStore *store, double x0=0, double x1=0, int n=0);
     GeneratedVector(ObjectStore *store, const QByteArray &data, double x0, double x1, int n);
--- branches/work/kst/portto4/kst/src/libkst/namedobject.cpp #817944:817945
@@ -40,7 +40,7 @@
 
 // new Name system
 QString NamedObject::Name() const {
-  return descriptiveName()+":"+shortName();
+  return descriptiveName()+" ("+shortName()+")";
 }
 
 
@@ -152,8 +152,8 @@
     _mnum = R.toString().toInt();
 }
 
-QString NamedObject::description() {
-  return descriptiveName();
+QString NamedObject::descriptionTip() const {
+  return Name();
 }
 
 }
\ No newline at end of file
--- branches/work/kst/portto4/kst/src/libkst/namedobject.h #817944:817945
@@ -74,7 +74,7 @@
     QString Name() const; // eg GYRO1:V1
     QString descriptiveName() const; // eg GYRO1: automatic or manual
     QString shortName() const; // eg V1: always automatically generated
-    virtual QString description(); // description for tooltips
+    virtual QString descriptionTip() const; // description for tooltips
     void setDescriptiveName(QString new_name); // auto if new_name.isEmpty()
     bool descriptiveNameIsManual() const;
     static void processShortNameIndexAttributes(QXmlStreamAttributes &attrs);
--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #817944:817945
@@ -92,7 +92,7 @@
   }
   // 2) search for short names
   for (int i = 0; i < _list.size(); ++i) {
-    if (":"+_list.at(i)->shortName()==name) 
+    if (_list.at(i)->shortName()==name) 
       return _list.at(i);
   }
   // 3) search for descriptive names: must be unique
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #817944:817945
@@ -661,8 +661,8 @@
   }
 }
 
-QString Vector::description() {
-  return i18n("Vector: %1\n  %2 samples\n%3").arg(Name()).arg(length()).arg(_provider->description());
+QString Vector::descriptionTip() const {
+  return i18n("Vector: %1\n  %2 samples\n%3").arg(Name()).arg(length()).arg(_provider->descriptionTip());
 }
 
 #undef ZERO_MEMORY
--- branches/work/kst/portto4/kst/src/libkst/vector.h #817944:817945
@@ -153,7 +153,7 @@
 
     void triggerUpdateSignal(ObjectPtr object);
 
-    QString description();
+    virtual QString descriptionTip() const;
   Q_SIGNALS:
     void vectorUpdated(ObjectPtr object);
 
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #817944:817945
@@ -1335,26 +1335,26 @@
         p->setPen(QPen(color(), width, style));
       }
 
-      if (!exv) {        
+      if (!exv) {
         // determine the bar position width. NOTE: This is done
         //  only if xv->isRising() as in this case the calculation
         //  is simple...
         drX = (maxX() - minX())/double(sampleCount());
-        if (xv->isRising()) {       
+        if (xv->isRising()) {
           double oldX = 0.0;
 
           for (i_pt = i0; i_pt <= iN; i_pt++) {
             rX = xv->interpolate(i_pt, NS);
-            if (i_pt > i0) {                      
+            if (i_pt > i0) {
               if (rX - oldX < drX) {
-                drX = rX - oldX;                      
+                drX = rX - oldX;
               }
             }
             oldX = rX; 
           }
         }
       }
-      
+
       for (i_pt = i0; i_pt <= iN; i_pt++) {
         visible = has_bot = has_top = has_left = has_right = true;
 
@@ -1841,5 +1841,45 @@
   return i18n("%1 vs %2").arg(yVector()->descriptiveName()).arg(xVector()->descriptiveName());
 }
 
+QString Curve::descriptionTip() const {
+  QString tip;
+
+  tip = i18n("Curve: %1\nX: %2\nY: %3").arg(Name()).arg(xVector()->descriptionTip()).arg(yVector()->descriptionTip());
+
+  VectorPtr ev = xErrorVector();
+  if (ev) {
+    tip += i18n("\nX+ Error: %1").arg(ev->Name());
+  }
+
+  ev = xMinusErrorVector();
+  if (ev) {
+    tip += i18n("\nX- Error: %1").arg(ev->Name());
+  }
+
+  ev = yErrorVector();
+  if (ev) {
+    tip += i18n("\nY+ Error: %1").arg(ev->Name());
+  }
+
+  ev = yMinusErrorVector();
+  if (ev) {
+    tip += i18n("\nY- Error: %1").arg(ev->Name());
+  }
+
+  if (hasLines()) {
+    tip += i18n("\nLines: Width %1 and Style %2").arg(lineWidth()).arg(lineStyle());
+  }
+
+  if (hasPoints()) {
+    tip += i18n("\nPoints: Style %1").arg(pointType());
+  }
+
+  if (hasBars()) {
+    tip += i18n("\nBars");
+  }
+
+  return tip;
 }
+
+}
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/curve.h #817944:817945
@@ -145,6 +145,7 @@
     // see KstRelation::providerDataObject
     virtual DataObjectPtr providerDataObject() const;
 
+    virtual QString descriptionTip() const;
   public Q_SLOTS:
     void vectorUpdated(ObjectPtr object);
 
--- branches/work/kst/portto4/kst/src/libkstmath/equation.cpp #817944:817945
@@ -583,5 +583,13 @@
   return equation();
 }
 
+QString Equation::descriptionTip() const {
+  QString tip;
+
+  tip = i18n("Equation: %1\n  %2\nX: %3").arg(Name()).arg(equation()).arg(vXIn()->descriptionTip());
+  
+  return tip;
 }
+
+}
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/equation.h #817944:817945
@@ -78,6 +78,8 @@
 
     bool uses(ObjectPtr p) const;
 
+    virtual QString descriptionTip() const;
+
   protected:
     Equation(ObjectStore *store, const QString& equation, double x0, double x1, int nx);
     Equation(ObjectStore *store, const QString& equation = QString::null, VectorPtr xvector = 0L, bool do_interp = false);
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.cpp #817944:817945
@@ -472,5 +472,19 @@
   return (_inputVectors[RAWVECTOR]->descriptiveName());
 }
 
+QString Histogram::descriptionTip() const {
+  QString tip;
+
+  tip = i18n("Histogram: %1").arg(Name());
+  if (realTimeAutoBin()) {
+    tip+= i18n("\n  Auto-bin");
+  } else {
+    tip += i18n("\n  %1 bins from %2 to %3").arg(numberOfBins()).arg(xMin()).arg(xMax());
+  }
+  tip += i18n("\nInput: %1").arg(_inputVectors[RAWVECTOR]->descriptionTip());
+
+  return tip;
 }
+
+}
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.h #817944:817945
@@ -89,6 +89,7 @@
 
     virtual DataObjectPtr makeDuplicate();
 
+    virtual QString descriptionTip() const;
   protected:
     Histogram(ObjectStore *store);
     Histogram(ObjectStore *store, VectorPtr in_V,
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #817944:817945
@@ -529,5 +529,19 @@
   return vector()->descriptiveName();
 }
 
+QString PSD::descriptionTip() const {
+  QString tip;
+
+  tip = i18n("Spectrum: %1\n  FFT Length: 2^%2").arg(Name()).arg(length());
+
+  if (average() || apodize() || removeMean()) {
+    tip += "\n  ";
+    if (average()) tip += i18n("Average; ");
+    if (apodize()) tip += i18n("Apodize; ");
+    if (removeMean()) tip += i18n("Remove Mean;");
+  }
+  tip += i18n("\nInput: %1").arg(_inputVectors[INVECTOR]->descriptionTip());
+  return tip;
 }
+}
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/psd.h #817944:817945
@@ -91,6 +91,8 @@
 
     virtual DataObjectPtr makeDuplicate();
 
+    virtual QString descriptionTip() const;
+
   protected:
     PSD(ObjectStore *store);
     PSD(ObjectStore *store, VectorPtr in_V, double freq,
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.cpp #817944:817945
@@ -39,6 +39,7 @@
   connect(_editScalar, SIGNAL(pressed()), this, SLOT(editScalar()));
   connect(_selectScalar, SIGNAL(pressed()), this, SLOT(selectScalar()));
   connect(_scalar, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSelectionChanged()));
+  connect(_scalar, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDescriptionTip()));
 }
 
 
@@ -51,7 +52,15 @@
   fillScalars();
 }
 
+void ScalarSelector::updateDescriptionTip() {
+  if (selectedScalar()) {
+    setToolTip(selectedScalar()->descriptionTip());
+  } else {
+    setToolTip(QString());
+  }
+}
 
+
 void ScalarSelector::emitSelectionChanged() {
   emit selectionChanged(_scalar->currentText());
 }
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.h #817944:817945
@@ -35,7 +35,6 @@
 
     ScalarPtr selectedScalar() const;
     void setSelectedScalar(ScalarPtr selectedScalar);
-
   Q_SIGNALS:
     void selectionChanged(const QString&);
 
@@ -44,6 +43,7 @@
     void editScalar();
     void selectScalar();
     void emitSelectionChanged();
+    void updateDescriptionTip();
 
   private:
     void fillScalars();
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #817944:817945
@@ -35,6 +35,7 @@
   connect(_newVector, SIGNAL(pressed()), this, SLOT(newVector()));
   connect(_editVector, SIGNAL(pressed()), this, SLOT(editVector()));
   connect(_vector, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSelectionChanged()));
+  connect(_vector, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDescriptionTip()));
 
   //FIXME need to find a way to call fillVectors when the vectorList changes
 }
@@ -49,13 +50,16 @@
   fillVectors();
 }
 
-
-void VectorSelector::emitSelectionChanged() {
+void VectorSelector::updateDescriptionTip() {
   if (selectedVector()) {
-    setToolTip(selectedVector()->description());
+    setToolTip(selectedVector()->descriptionTip());
   } else {
     setToolTip(QString());
   }
+}
+
+
+void VectorSelector::emitSelectionChanged() {
   emit selectionChanged(_vector->currentText());
 }
 
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.h #817944:817945
@@ -47,6 +47,7 @@
     void newVector();
     void editVector();
     void emitSelectionChanged();
+    void updateDescriptionTip();
 
   private:
     void fillVectors();


More information about the Kst mailing list