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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Jun 19 05:26:19 CEST 2008


SVN commit 822084 by netterfield:

Add tooltips to curves in the plot content tab



 M  +1 -9      libkst/objectstore.cpp  
 M  +3 -0      libkst/scalar.cpp  
 M  +2 -0      libkst/scalar.h  
 M  +11 -4     libkstapp/contenttab.cpp  
 M  +7 -2      libkstapp/contenttab.h  
 M  +10 -2     libkstapp/plotitemdialog.cpp  
 M  +8 -12     libkstmath/curve.cpp  
 M  +0 -5      libkstmath/equation.cpp  


--- branches/work/kst/portto4/kst/src/libkst/objectstore.cpp #822083:822084
@@ -87,18 +87,10 @@
 
   QString shortName;
   QRegExp rx("(\\(|^)([A-Z]\\d+)(\\)$|$)");
-  //QRegExp rx("\\(([A-Z]\\d+)\\)$|^(\\d+)$");
   rx.indexIn(name);
   shortName = rx.cap(2);
 
-qDebug() << "---- short name retrieved: " << shortName << "from" << name;
-
-  // 1) search for exact names
-/*  for (int i = 0; i < _list.size(); ++i) {
-    if (_list.at(i)->Name()==name)
-      return _list.at(i);
-  }*/
-  // 2) search for short names
+  // 1) search for short names
   for (int i = 0; i < _list.size(); ++i) {
     if (_list.at(i)->shortName()==shortName) 
       return _list.at(i);
--- branches/work/kst/portto4/kst/src/libkst/scalar.cpp #822083:822084
@@ -159,6 +159,9 @@
   emit scalarUpdated(object);
 }
 
+QString Scalar::descriptionTip() const {
+  return i18n("Scalar: %1 = %2\n%3").arg(Name()).arg(value()).arg(_provider->descriptionTip());
+}
 
 }
 // vim: et ts=2 sw=2
--- branches/work/kst/portto4/kst/src/libkst/scalar.h #822083:822084
@@ -63,6 +63,8 @@
 
     void triggerUpdateSignal(ObjectPtr object);
 
+    virtual QString descriptionTip() const;
+
   public slots:
     double value() const;
 
--- branches/work/kst/portto4/kst/src/libkstapp/contenttab.cpp #822083:822084
@@ -10,7 +10,10 @@
  ***************************************************************************/
 
 #include "contenttab.h"
+#include "objectstore.h"
 
+#include <qdebug.h>
+
 namespace Kst {
 
 ContentTab::ContentTab(QWidget *parent)
@@ -109,15 +112,21 @@
 }
 
 
-void ContentTab::setDisplayedRelations(QStringList displayedRelations) {
+void ContentTab::setDisplayedRelations(QStringList displayedRelations, QStringList displayedRelationTips) {
   _displayedRelationList->clear();
   _displayedRelationList->addItems(displayedRelations);
+  for (int i=0; i<_displayedRelationList->count(); i++) {
+    _displayedRelationList->item(i)->setToolTip(displayedRelationTips.at(i));
+  }
 }
 
 
-void ContentTab::setAvailableRelations(QStringList availableRelations) {
+void ContentTab::setAvailableRelations(QStringList availableRelations, QStringList availableRelationTips) {
   _availableRelationList->clear();
   _availableRelationList->addItems(availableRelations);
+  for (int i=0; i<_availableRelationList->count(); i++) {
+    _availableRelationList->item(i)->setToolTip(availableRelationTips.at(i));
+  }
 }
 
 
@@ -129,8 +138,6 @@
   return relations;
 }
 
-
-
 }
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/contenttab.h #822083:822084
@@ -19,17 +19,22 @@
 
 namespace Kst {
 
+class ObjectStore;
+
 class KST_EXPORT ContentTab : public DialogTab, Ui::ContentTab {
   Q_OBJECT
   public:
     ContentTab(QWidget *parent = 0);
     virtual ~ContentTab();
 
-    void setDisplayedRelations(QStringList displayedRelations);
-    void setAvailableRelations(QStringList availableRelations);
+    void setDisplayedRelations(QStringList displayedRelations, QStringList displayedRelationTips);
+    void setAvailableRelations(QStringList availableRelations, QStringList availableRelationTips);
 
     QStringList displayedRelations();
 
+  private:
+    ObjectStore* _store;
+
   private Q_SLOTS:
     void updateButtons();
     void addButtonClicked();
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemdialog.cpp #822083:822084
@@ -166,30 +166,38 @@
   QStringList displayedRelations;
   QStringList availableRelations;
   QStringList allRelations;
+  QStringList displayedRelationTips;
+  QStringList availableRelationTips;
+  QStringList allRelationTips;
 
   CurveList curves = _store->getObjects<Curve>();
   ImageList images = _store->getObjects<Image>();
 
   foreach (RelationPtr relation, _plotItem->renderItem(PlotRenderItem::Cartesian)->relationList()) {
     displayedRelations.append(relation->Name());
+    displayedRelationTips.append(relation->descriptionTip());
   }
 
   foreach (CurvePtr curve, curves) {
     allRelations.append(curve->Name());
+    allRelationTips.append(curve->descriptionTip());
     if (!displayedRelations.contains(curve->Name())) {
       availableRelations.append(curve->Name());
+      availableRelationTips.append(curve->descriptionTip());
     }
   }
 
   foreach (ImagePtr image, images) {
     allRelations.append(image->Name());
+    allRelationTips.append(image->descriptionTip());
     if (!displayedRelations.contains(image->Name())) {
       availableRelations.append(image->Name());
+      availableRelationTips.append(image->descriptionTip());
     }
   }
 
-  _contentTab->setDisplayedRelations(displayedRelations);
-  _contentTab->setAvailableRelations(availableRelations);
+  _contentTab->setDisplayedRelations(displayedRelations, displayedRelationTips);
+  _contentTab->setAvailableRelations(availableRelations, availableRelationTips);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #822083:822084
@@ -1752,24 +1752,20 @@
 
   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());
+  if (hasXError()) {
+    tip += i18n("\nX+ Error: %1").arg(xErrorVector()->Name());
   }
 
-  ev = xMinusErrorVector();
-  if (ev) {
-    tip += i18n("\nX- Error: %1").arg(ev->Name());
+  if (hasXMinusError()) {
+    tip += i18n("\nX- Error: %1").arg(xMinusErrorVector()->Name());
   }
 
-  ev = yErrorVector();
-  if (ev) {
-    tip += i18n("\nY+ Error: %1").arg(ev->Name());
+  if (hasYError()) {
+    tip += i18n("\nY+ Error: %1").arg(yErrorVector()->Name());
   }
 
-  ev = yMinusErrorVector();
-  if (ev) {
-    tip += i18n("\nY- Error: %1").arg(ev->Name());
+  if (hasYMinusError()) {
+    tip += i18n("\nY- Error: %1").arg(yMinusErrorVector()->Name());
   }
 
   if (hasLines()) {
--- branches/work/kst/portto4/kst/src/libkstmath/equation.cpp #822083:822084
@@ -183,7 +183,6 @@
 const QString Equation::reparsedEquation() const {
   QString etext;
 
-  qDebug() << "Equation: " << _equation << "\n";
   if (!_equation.isEmpty()) {
     if (!Equations::mutex().tryLock()) {
       qDebug() << "Don't reparse equation while it is being reparsed...";
@@ -204,7 +203,6 @@
     ParsedEquation = 0L;
     Equations::mutex().unlock();
   }
-  qDebug() << "reparsed Equation: " << etext << "\n";
   return (etext);
 }
 
@@ -240,7 +238,6 @@
 
 
 void Equation::setEquation(const QString& in_fn) {
-  qDebug() << "Enter setEquation\n";
   // assert(*_xVector); - ugly, we have to allow this here due to
   // document loading with vector lazy-loading
   setDirty();
@@ -298,8 +295,6 @@
       connect(scalar, SIGNAL(scalarUpdated(ObjectPtr)), this, SLOT(inputObjectUpdated(ObjectPtr)));
     }
   }
-    qDebug() << "leave setEquation\n";
-
 }
 
 


More information about the Kst mailing list