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

Mike mike at staikos.net
Wed Nov 14 17:42:22 CET 2007


Hi Barth,

I saw the commit and thought I could help out a little.  The current 
default values are stored in the .ui file for the fields / qt defaults 
(ie, first item for ComboBoxes).  I think using configureTab is the way 
to go for overriding those values with runtime appropriate values.

Two ways that could make the configureTab a little more clear are.

#1 Make configureTab not require VectorPtr all the time.  Just add = 0 
to the define in the .h and then as part of configureTab do
if (vector) {
    // Load settings from Vector
} else {
    // Load settings from QSettings.
}

#2 overload configureTab.  You can do the same in a separate function 
naming it configureTab still. 

Could you elaborate on what you mean by storeVectorDefaults(dataVector) 
?  Ie.  Will the defaults be based on the last vector created? Or at 
least the last DataVector?  If so, there is a function 
createNewDataVector which would be the logical spot to put it right 
before the vector is returned.

Let me know if I can help with anything else,
Mike

Barth Netterfield wrote:
> 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();
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>   



More information about the Kst mailing list