Bug 111405

Summary: Change Data Samples shouldn't clear vector list when apply is pressed.
Product: [Applications] kst Reporter: Matthew Truch <matt>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Matthew Truch 2005-08-24 06:37:04 UTC
Version:           1.2.0_devel (using KDE KDE 3.4.0)
OS:                Linux

Often when you change the data samples range, you do so several times in a row (to get exactly where you want).  Therefore, it would be nice if the vectors selected to change didn't clear each time Apply is pressed.  

Furthermore, it would be even better if the the vectors that were (and weren't) selected remained so after a close of the Change Data Samples and then opening it again (only on the same running instance of kst).
Comment 1 Matthew Truch 2005-08-24 17:27:38 UTC
On Wed, Aug 24, 2005 at 10:27:20AM +0200, Marc-Antoine Miville-Deschenes wrote:
> I would add on that one that when you first change the samples range 
> and then select some vectors
> nothing happens (well at least on the KST version we have here). You 
> really need to select
> the vector first and then change the sample range.


Either I don't understand what you mean or I am unable to reproduce this
with a current version.  Which version of kst are you using?
Comment 2 Netterfield 2005-09-04 06:22:54 UTC
SVN commit 456904 by netterfield:

BUG: 111405

Change pts dialog now remembers what vectors are selected.


 M  +16 -4     kstchangenptsdialog_i.cpp  
 M  +1 -1      kstchangenptsdialog_i.h  


--- trunk/extragear/graphics/kst/kst/kstchangenptsdialog_i.cpp #456903:456904
@@ -21,6 +21,7 @@
 #include <qspinbox.h>
 
 #include <knuminput.h>
+#include <stdio.h>
 
 #include "datarangewidget.h"
 #include "kstchangenptsdialog_i.h"
@@ -49,22 +50,33 @@
   CurveList->selectAll(true);
 }
 
-void KstChangeNptsDialogI::updateChangeNptsDialog() {
+bool KstChangeNptsDialogI::updateChangeNptsDialog() {
+  QStringList qsl;
+  
+  for (uint i_vector = 0; i_vector < CurveList->count(); i_vector++) {
+    if (CurveList->isSelected(i_vector)) {
+      qsl.append(CurveList->text(i_vector));
+    }
+  }
   CurveList->clear();
-
   KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
   /* insert vectors into ChangeNptsCurveList */
   for (uint i = 0; i < rvl.count(); i++) {
     rvl[i]->readLock();
     CurveList->insertItem(rvl[i]->tagName(), -1);
+    if (qsl.contains(rvl[i]->tagName())) {
+      CurveList->setSelected(i, true);
+    }
     rvl[i]->readUnlock();
   }
+  return qsl.count()>0;
 }
 
 void KstChangeNptsDialogI::showChangeNptsDialog() {
-  updateChangeNptsDialog();
+  bool some_slected = updateChangeNptsDialog();
   updateDefaults(0);
-  CurveList->selectAll(true);
+  if (!some_slected) 
+    CurveList->selectAll(true);
   show();
   raise();
 }
--- trunk/extragear/graphics/kst/kst/kstchangenptsdialog_i.h #456903:456904
@@ -31,7 +31,7 @@
 
 public slots:
   /** update the entries in changenptsDialog to represent current vectors */
-  void updateChangeNptsDialog();
+  bool updateChangeNptsDialog();
 
   /** calls updateChangeNptsDialog(), then shows and raises changeNptsDialog */
   void showChangeNptsDialog();