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

Mike Fenton mike at staikos.net
Tue Nov 13 15:28:25 CET 2007


SVN commit 736105 by fenton:

Add ScalarListSelector to ScalarSelector.
Update EquationDialog equation builder.


 M  +1 -1      libkstapp/csddialog.cpp  
 M  +2 -2      libkstapp/curvedialog.cpp  
 M  +20 -1     libkstapp/equationdialog.cpp  
 M  +2 -0      libkstapp/equationdialog.h  
 M  +0 -16     libkstapp/equationtab.ui  
 M  +1 -1      libkstapp/histogramdialog.cpp  
 M  +1 -1      libkstapp/powerspectrumdialog.cpp  
 A             widgets/scalarlistselector.cpp   [License: GPL (v2+)]
 A             widgets/scalarlistselector.h   [License: GPL (v2+)]
 A             widgets/scalarlistselector.ui  
 M  +20 -1     widgets/scalarselector.cpp  
 M  +6 -1      widgets/scalarselector.h  
 M  +1 -1      widgets/vectorselector.cpp  
 M  +1 -1      widgets/vectorselector.h  
 M  +3 -0      widgets/widgets.pro  


--- branches/work/kst/portto4/kst/src/libkstapp/csddialog.cpp #736104:736105
@@ -40,7 +40,7 @@
 
   setupUi(this);
   setTabTitle(tr("Cumulative Spectral Decay"));
-  connect(_vector, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+  connect(_vector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #736104:736105
@@ -46,8 +46,8 @@
 
   _curvePlacement->setExistingPlots(Data::self()->plotList());
 
-  connect(_xVector, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
-  connect(_yVector, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+  connect(_xVector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
+  connect(_yVector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.cpp #736104:736105
@@ -37,8 +37,11 @@
 
   _curvePlacement->setExistingPlots(Data::self()->plotList());
 
-  connect(_xVectors, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+  connect(_xVectors, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
   connect(_equation, SIGNAL(textChanged(const QString &)), this, SLOT(selectionChanged()));
+  connect(Operators, SIGNAL(activated(QString)), this, SLOT(equationOperatorUpdate(const QString&)));
+  connect(_vectors, SIGNAL(selectionChanged(QString)), this, SLOT(equationUpdate(const QString&)));
+  connect(_scalars, SIGNAL(selectionChanged(QString)), this, SLOT(equationUpdate(const QString&)));
 }
 
 
@@ -51,6 +54,20 @@
 }
 
 
+void EquationTab::equationUpdate(const QString& string) {
+  QString equation = _equation->text();
+  equation += "[" + string + "]";
+  _equation->setText(equation); 
+}
+
+
+void EquationTab::equationOperatorUpdate(const QString& string) {
+  QString equation = _equation->text();
+  equation += string;
+  _equation->setText(equation); 
+}
+
+
 void EquationTab::populateFunctionList() {
   Operators->clear();
   Operators->addItem("+");
@@ -155,6 +172,8 @@
 
   connect(_equationTab, SIGNAL(optionsChanged()), this, SLOT(updateButtons()));
   updateButtons();
+
+  _equationTab->setEquation("");
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.h #736104:736105
@@ -47,6 +47,8 @@
 
   private Q_SLOTS:
     void selectionChanged();
+    void equationUpdate(const QString& string);
+    void equationOperatorUpdate(const QString& string);
 
   private:
     void populateFunctionList();
--- branches/work/kst/portto4/kst/src/libkstapp/equationtab.ui #736104:736105
@@ -208,22 +208,6 @@
    <sender>Operators</sender>
    <signal>activated(QString)</signal>
    <receiver>_equation</receiver>
-   <slot>setText(QString)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>20</x>
-     <y>20</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>20</x>
-     <y>20</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>Operators</sender>
-   <signal>activated(QString)</signal>
-   <receiver>_equation</receiver>
    <slot>setFocus()</slot>
    <hints>
     <hint type="sourcelabel" >
--- branches/work/kst/portto4/kst/src/libkstapp/histogramdialog.cpp #736104:736105
@@ -39,7 +39,7 @@
 
   connect(AutoBin, SIGNAL(clicked()), this, SLOT(generateAutoBin()));
   connect(_realTimeAutoBin, SIGNAL(clicked()), this, SLOT(updateButtons()));
-  connect(_vector, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+  connect(_vector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
 
   _curvePlacement->setExistingPlots(Data::self()->plotList());
   _curveAppearance->setShowLines(false);
--- branches/work/kst/portto4/kst/src/libkstapp/powerspectrumdialog.cpp #736104:736105
@@ -39,7 +39,7 @@
   setupUi(this);
   setTabTitle(tr("Power Spectrum"));
 
-  connect(_vector, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+  connect(_vector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
 }
 
 
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.cpp #736104:736105
@@ -31,11 +31,14 @@
   _editScalar->setFixedSize(size + 8, size + 8);
   _selectScalar->setFixedSize(size + 8, size + 8);
 
+  _scalarListSelector = new ScalarListSelector(this);
+
   fillScalars();
 
   connect(_newScalar, SIGNAL(pressed()), this, SLOT(newScalar()));
   connect(_editScalar, SIGNAL(pressed()), this, SLOT(editScalar()));
-
+  connect(_selectScalar, SIGNAL(pressed()), this, SLOT(selectScalar()));
+  connect(_scalar, SIGNAL(currentIndexChanged(int)), this, SLOT(emitSelectionChanged()));
 }
 
 
@@ -49,6 +52,11 @@
 }
 
 
+void ScalarSelector::emitSelectionChanged() {
+  emit selectionChanged(_scalar->currentText());
+}
+
+
 ScalarPtr ScalarSelector::selectedScalar() const {
   return qVariantValue<Scalar*>(_scalar->itemData(_scalar->currentIndex()));
 }
@@ -70,6 +78,13 @@
 }
 
 
+void ScalarSelector::selectScalar() {
+  if (_scalarListSelector->exec() == QDialog::Accepted) {
+    _scalar->setCurrentIndex(_scalar->findText(_scalarListSelector->selectedScalar()));
+  }
+}
+
+
 void ScalarSelector::fillScalars() {
   if (!_store) {
     return;
@@ -100,10 +115,14 @@
     _scalar->addItem(string, qVariantFromValue(v.data()));
   }
 
+  _scalarListSelector->clear();
+  _scalarListSelector->fillScalars(list);
+
   if (current)
     setSelectedScalar(current);
 
   _editScalar->setEnabled(_scalar->count() > 0);
+  _selectScalar->setEnabled(_scalar->count() > 0);
 }
 
 }
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.h #736104:736105
@@ -15,6 +15,8 @@
 #include <QWidget>
 #include "ui_scalarselector.h"
 
+#include "scalarlistselector.h"
+
 #include <scalar.h>
 
 #include "kst_export.h"
@@ -35,15 +37,18 @@
     void setSelectedScalar(ScalarPtr selectedScalar);
 
   Q_SIGNALS:
-    void selectionChanged();
+    void selectionChanged(const QString&);
 
   private Q_SLOTS:
     void newScalar();
     void editScalar();
+    void selectScalar();
+    void emitSelectionChanged();
 
   private:
     void fillScalars();
 
+    ScalarListSelector* _scalarListSelector;
     ObjectStore *_store;
 };
 
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #736104:736105
@@ -51,7 +51,7 @@
 
 
 void VectorSelector::emitSelectionChanged() {
-  emit selectionChanged();
+  emit selectionChanged(_vector->currentText());
 }
 
 VectorPtr VectorSelector::selectedVector() const {
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.h #736104:736105
@@ -38,7 +38,7 @@
     void setAllowEmptySelection(bool allowEmptySelection);
 
   Q_SIGNALS:
-    void selectionChanged();
+    void selectionChanged(const QString&);
 
   private Q_SLOTS:
     void newVector();
--- branches/work/kst/portto4/kst/src/widgets/widgets.pro #736104:736105
@@ -33,6 +33,7 @@
     filerequester.cpp \
     gradienteditor.cpp \
     matrixselector.cpp \
+    scalarlistselector.cpp \
     scalarselector.cpp \
     stringselector.cpp \
     vectorselector.cpp \
@@ -50,6 +51,7 @@
     gradienteditor.h \
     matrixselector.h \
     scalarselector.h \
+    scalarlistselector.h \
     stringselector.h \
     vectorselector.h \
     widgets.h
@@ -61,6 +63,7 @@
     datarange.ui \
     fftoptions.ui \
     matrixselector.ui \
+    scalarlistselector.ui \
     scalarselector.ui \
     stringselector.ui \
     vectorselector.ui


More information about the Kst mailing list