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

Mike Fenton mike at staikos.net
Wed Dec 5 20:26:41 CET 2007


SVN commit 745221 by fenton:

Add Apply button to DataDialog for editing and enable on Curve, Matrix and Vector Dialogs.


 M  +4 -0      curvedialog.cpp  
 M  +27 -4     datadialog.cpp  
 M  +5 -1      datadialog.h  
 M  +31 -13    matrixdialog.cpp  
 M  +7 -7      matrixtab.ui  
 M  +9 -8      vectordialog.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #745220:745221
@@ -62,6 +62,9 @@
   connect(_xMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
   connect(_yMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
   connect(_curveAppearance, SIGNAL(modified()), this, SIGNAL(modified()));
+  connect(_ignoreAutoScale, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
+  connect(_xMinusSameAsPlus, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
+  connect(_yMinusSameAsPlus, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));
 }
 
 
@@ -259,6 +262,7 @@
   connect(_curveTab, SIGNAL(vectorsChanged()), this, SLOT(updateButtons()));
   connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode()));
   connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode()));
+  connect(_curveTab, SIGNAL(modified()), this, SLOT(modified()));
   updateButtons();
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #745220:745221
@@ -30,7 +30,7 @@
 namespace Kst {
 
 DataDialog::DataDialog(Kst::ObjectPtr dataObject, QWidget *parent)
-  : Dialog(parent), _defaultTagString("<Auto Name>"), _dataObject(dataObject) {
+  : Dialog(parent), _defaultTagString("<Auto Name>"), _dataObject(dataObject), _modified(false) {
 
   if (_dataObject)
     _mode = Edit;
@@ -54,9 +54,12 @@
 
 void DataDialog::createGui() {
 
-  buttonBox()->button(QDialogButtonBox::Apply)->setVisible(false);
+  if (_mode == New) {
+    buttonBox()->button(QDialogButtonBox::Apply)->setVisible(false);
+  }
 
-  connect(this, SIGNAL(ok()), this, SLOT(slotOk()));
+  connect(this, SIGNAL(ok()), this, SLOT(slotApply()));
+  connect(this, SIGNAL(apply()), this, SLOT(slotApply()));
 
   QWidget *extension = extensionWidget();
 
@@ -116,16 +119,35 @@
   addDialogPage(page);
 }
 
-void DataDialog::slotOk() {
+
+void DataDialog::slotApply() {
   Kst::ObjectPtr ptr;
   if (!dataObject())
     ptr = createNewDataObject();
   else
     ptr = editExistingDataObject();
   setDataObject(ptr);
+  clearModified();
 }
 
 
+void DataDialog::modified() {
+  _modified = true;
+  updateApplyButton();
+}
+
+
+void DataDialog::clearModified() {
+  _modified = false;
+  updateApplyButton();
+}
+
+
+void DataDialog::updateApplyButton() {
+  _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(_modified);
+}
+
+
 void DataDialog::slotEditMultiple() {
   int currentWidth = width();
   int extensionWidth = 400;
@@ -142,6 +164,7 @@
     _mode = EditMultiple;
     emit editMultipleMode();
   }
+  clearModified();
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.h #745220:745221
@@ -51,8 +51,10 @@
     EditMultipleWidget *_editMultipleWidget;
 
   private Q_SLOTS:
-    void slotOk();
+    void slotApply();
     void slotEditMultiple();
+    void modified();
+    void clearModified();
 
   Q_SIGNALS:
     void editMultipleMode();
@@ -60,12 +62,14 @@
 
   private:
     void createGui();
+    void updateApplyButton();
 
   private:
     QString _defaultTagString;
     QLineEdit *_tagString;
     ObjectPtr _dataObject;
     EditMode _mode;
+    bool _modified;
 };
 
 }
--- branches/work/kst/portto4/kst/src/libkstapp/matrixdialog.cpp #745220:745221
@@ -36,12 +36,9 @@
   setupUi(this);
   setTabTitle(tr("Matrix"));
 
-  connect(_readFromSource, SIGNAL(toggled(bool)),
-          this, SLOT(readFromSourceChanged()));
-  connect(_fileName, SIGNAL(changed(const QString &)),
-          this, SLOT(fileNameChanged(const QString &)));
-  connect(_configure, SIGNAL(clicked()),
-          this, SLOT(showConfigWidget()));
+  connect(_readFromSource, SIGNAL(toggled(bool)), this, SLOT(readFromSourceChanged()));
+  connect(_fileName, SIGNAL(changed(const QString &)), this, SLOT(fileNameChanged(const QString &)));
+  connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget()));
 
   connect(_xStartCountFromEnd, SIGNAL(clicked()), this, SLOT(xStartCountFromEndClicked()));
   connect(_yStartCountFromEnd, SIGNAL(clicked()), this, SLOT(yStartCountFromEndClicked()));
@@ -52,10 +49,30 @@
   connect(_generateGradient, SIGNAL(clicked()), this, SLOT(updateEnables()));
   connect(_doSkip, SIGNAL(clicked()), this, SLOT(updateEnables()));
 
+  connect(_xStart, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_yStart, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_xNumSteps, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_yNumSteps, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_skip, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_nX, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_nY, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_gradientZAtMin, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_gradientZAtMax, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_minX, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_minX, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_xStep, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_yStep, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_xStartCountFromEnd, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_yStartCountFromEnd, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_xNumStepsReadToEnd, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_yNumStepsReadToEnd, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_doSkip, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_doAverage, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_gradientX, SIGNAL(clicked()), this, SIGNAL(modified()));
+  connect(_gradientY, SIGNAL(clicked()), this, SIGNAL(modified()));
+
   _fileName->setFile(QDir::currentPath());
-//  _fileName->setFile(matrixDefaults.dataSource());  // huh?
 
-  //FIXME need a solution for replacing kio for this...
   _connect->setVisible(false);
 }
 
@@ -99,7 +116,7 @@
 
   if (_dataRangeGroup->isEnabled()) {
     _skip->setEnabled(_doSkip->isChecked());
-    _doAve->setEnabled(_doSkip->isChecked());
+    _doAverage->setEnabled(_doSkip->isChecked());
     xStartCountFromEndClicked();
     xNumStepsReadToEndClicked();
     yStartCountFromEndClicked();
@@ -367,17 +384,17 @@
 
 
 bool MatrixTab::doAverage() const {
-  return _doAve->isChecked();
+  return _doAverage->isChecked();
 }
 
 
 bool MatrixTab::doAverageDirty() const {
-  return _doAve->checkState() == Qt::PartiallyChecked;
+  return _doAverage->checkState() == Qt::PartiallyChecked;
 }
 
 
 void MatrixTab::setDoAverage(bool doAverage) {
-  _doAve->setChecked(doAverage);
+  _doAverage->setChecked(doAverage);
 }
 
 
@@ -521,7 +538,7 @@
   _xNumStepsReadToEnd->setCheckState(Qt::PartiallyChecked);
   _yNumStepsReadToEnd->setCheckState(Qt::PartiallyChecked);
   _doSkip->setCheckState(Qt::PartiallyChecked);
-  _doAve->setCheckState(Qt::PartiallyChecked);
+  _doAverage->setCheckState(Qt::PartiallyChecked);
   _gradientZAtMin->clear();
   _gradientZAtMax->clear();
   _nX->clear();
@@ -560,6 +577,7 @@
   connect(_matrixTab, SIGNAL(sourceChanged()), this, SLOT(updateButtons()));
   connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode()));
   connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode()));
+  connect(_matrixTab, SIGNAL(modified()), this, SLOT(modified()));
   updateButtons();
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/matrixtab.ui #745220:745221
@@ -732,7 +732,7 @@
          </widget>
         </item>
         <item row="0" column="2" >
-         <widget class="QCheckBox" name="_doAve" >
+         <widget class="QCheckBox" name="_doAverage" >
           <property name="enabled" >
            <bool>false</bool>
           </property>
@@ -937,15 +937,15 @@
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <customwidgets>
   <customwidget>
+   <class>Kst::FileRequester</class>
+   <extends>QWidget</extends>
+   <header>filerequester.h</header>
+  </customwidget>
+  <customwidget>
    <class>Kst::ComboBox</class>
    <extends>QComboBox</extends>
    <header>combobox.h</header>
   </customwidget>
-  <customwidget>
-   <class>Kst::FileRequester</class>
-   <extends>QWidget</extends>
-   <header>filerequester.h</header>
-  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>_readFromSource</tabstop>
@@ -963,7 +963,7 @@
   <tabstop>_yNumStepsReadToEnd</tabstop>
   <tabstop>_doSkip</tabstop>
   <tabstop>_skip</tabstop>
-  <tabstop>_doAve</tabstop>
+  <tabstop>_doAverage</tabstop>
   <tabstop>_gradientX</tabstop>
   <tabstop>_gradientY</tabstop>
   <tabstop>_gradientZAtMin</tabstop>
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #745220:745221
@@ -36,17 +36,16 @@
   setupUi(this);
   setTabTitle(tr("Vector"));
 
-  connect(_readFromSource, SIGNAL(toggled(bool)),
-          this, SLOT(readFromSourceChanged()));
-  connect(_fileName, SIGNAL(changed(const QString &)),
-          this, SLOT(fileNameChanged(const QString &)));
-  connect(_configure, SIGNAL(clicked()),
-          this, SLOT(showConfigWidget()));
+  connect(_readFromSource, SIGNAL(toggled(bool)), this, SLOT(readFromSourceChanged()));
+  connect(_fileName, SIGNAL(changed(const QString &)), this, SLOT(fileNameChanged(const QString &)));
+  connect(_configure, SIGNAL(clicked()), this, SLOT(showConfigWidget()));
 
+  connect(_dataRange, SIGNAL(modified()), this, SIGNAL(modified()));
+  connect(_numberOfSamples, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+  connect(_from, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
+  connect(_to, SIGNAL(textChanged(const QString&)), this, SIGNAL(modified()));
   _fileName->setFile(QDir::currentPath());
-  //_fileName->setFile(vectorDefaults.dataSource());
 
-  //FIXME need a solution for replacing kio for this...
   _connect->setVisible(false);
 }
 
@@ -250,6 +249,8 @@
   connect(_vectorTab, SIGNAL(sourceChanged()), this, SLOT(updateButtons()));
   connect(this, SIGNAL(editMultipleMode()), this, SLOT(editMultipleMode()));
   connect(this, SIGNAL(editSingleMode()), this, SLOT(editSingleMode()));
+
+  connect(_vectorTab, SIGNAL(modified()), this, SLOT(modified()));
   updateButtons();
 }
 


More information about the Kst mailing list