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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Nov 14 16:59:01 CET 2007


SVN commit 736708 by netterfield:

Add default settings for the vector file name.
Before I go and install things everywhere, I have a couple questions:
  -I added a new VectorDialog::configureNewTab because I couldn't see a 
   place where new tab stuff got filled.  Should it have gone in
   configureTab (which takes a vectorptr) instead?
  -Should there be a 'storeVectorDefaults(dataVector)' routine somewhere? if so,
   where?



 M  +1 -1      libkst/dialogdefaults.h  
 M  +9 -1      libkstapp/vectordialog.cpp  
 M  +1 -0      libkstapp/vectordialog.h  


--- branches/work/kst/portto4/kst/src/libkst/dialogdefaults.h #736707:736708
@@ -29,4 +29,4 @@
 // Dialog defaults are stored and retreived from the Kst::dialogDefaults.
 // As you add defaults, add them here!
 // Name                   Type    Where used
-// 
+// vector/datasource      QString vectordialog
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #736707:736708
@@ -213,6 +213,8 @@
 
   if (editMode() == Edit) {
     configureTab(dataObject);
+  } else {
+    configureNewTab();
   }
 
   connect(_vectorTab, SIGNAL(sourceChanged()), this, SLOT(updateButtons()));
@@ -250,9 +252,11 @@
   _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(_vectorTab->vectorMode() == VectorTab::GeneratedVector || !_vectorTab->field().isEmpty());
 }
 
+void VectorDialog::configureNewTab() {
+  _vectorTab->setFile(QString(Kst::dialogDefaults->value("vector/datasource",_vectorTab->file()).toString()));
+}
 
 void VectorDialog::configureTab(ObjectPtr vector) {
-  printf("in configureTab\n");
   if (DataVectorPtr dataVector = kst_cast<DataVector>(vector)) {
     _vectorTab->setVectorMode(VectorTab::DataVector);
     _vectorTab->setFile(dataVector->dataSource()->fileName());
@@ -323,6 +327,7 @@
       dataRange->doSkip(),
       dataRange->doFilter());
 
+  Kst::dialogDefaults->setValue("vector/datasource", _vectorTab->file());
 
 #if 0
   DataVectorPtr vector = new DataVector(
@@ -384,6 +389,9 @@
       dataRange->doFilter());
     dataVector->update(0);
     dataVector->unlock();
+
+    Kst::dialogDefaults->setValue("vector/datasource", _vectorTab->file());
+
   } else if (GeneratedVectorPtr generatedVector = kst_cast<GeneratedVector>(dataObject())) {
     const qreal from = _vectorTab->from();
     const qreal to = _vectorTab->to();
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #736707:736708
@@ -95,6 +95,7 @@
     ObjectPtr createNewDataVector() const;
     ObjectPtr createNewGeneratedVector() const;
     void configureTab(ObjectPtr vector);
+    void configureNewTab();
 
   private Q_SLOTS:
     void updateButtons();


More information about the Kst mailing list