This is crap. Managed to get some other things included in this commit.

I'm going to clean this up and re-send.

//Anton


On 25 May, 2014 - Anton Lundin wrote:

> When removing o2 from a gas, eg setting it to "", air, this code would
> raise a nice fpe. Fix that by using gas_mod instead.
> 
> Signed-off-by: Anton Lundin <[email protected]>
> ---
>  qt-ui/downloadfromdivecomputer.cpp | 5 ++---
>  qt-ui/downloadfromdivecomputer.h   | 2 +-
>  qt-ui/models.cpp                   | 4 +++-
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/qt-ui/downloadfromdivecomputer.cpp 
> b/qt-ui/downloadfromdivecomputer.cpp
> index 681b0d2..71f428b 100644
> --- a/qt-ui/downloadfromdivecomputer.cpp
> +++ b/qt-ui/downloadfromdivecomputer.cpp
> @@ -72,7 +72,6 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent, 
> Qt::WindowFlags f) :
>               if (default_dive_computer_product)
>                       
> ui.product->setCurrentIndex(ui.product->findText(default_dive_computer_product));
>       }
> -     connect(ui.product, SIGNAL(currentIndexChanged(int)), this, 
> SLOT(on_product_currentIndexChanged()), Qt::UniqueConnection);
>       if (default_dive_computer_device)
>               ui.device->setEditText(default_dive_computer_device);
>  
> @@ -190,11 +189,11 @@ void 
> DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor)
>       //currentModel->deleteLater();
>  }
>  
> -void DownloadFromDCWidget::on_product_currentIndexChanged()
> +void DownloadFromDCWidget::on_product_currentIndexChanged(const QString 
> &product)
>  {
>       // Set up the DC descriptor
>       dc_descriptor_t *descriptor = NULL;
> -     descriptor = descriptorLookup[ui.vendor->currentText() + 
> ui.product->currentText()];
> +     descriptor = descriptorLookup[ui.vendor->currentText() + product];
>  
>       // call dc_descriptor_get_transport to see if the dc_transport_t is 
> DC_TRANSPORT_SERIAL
>       if (dc_descriptor_get_transport(descriptor) == DC_TRANSPORT_SERIAL) {
> diff --git a/qt-ui/downloadfromdivecomputer.h 
> b/qt-ui/downloadfromdivecomputer.h
> index 9553222..3de102b 100644
> --- a/qt-ui/downloadfromdivecomputer.h
> +++ b/qt-ui/downloadfromdivecomputer.h
> @@ -42,7 +42,7 @@ slots:
>       void on_cancel_clicked();
>       void on_search_clicked();
>       void on_vendor_currentIndexChanged(const QString &vendor);
> -     void on_product_currentIndexChanged();
> +     void on_product_currentIndexChanged(const QString &product);
>  
>       void onDownloadThreadFinished();
>       void updateProgressBar();
> diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
> index dc9a718..2bc690e 100644
> --- a/qt-ui/models.cpp
> +++ b/qt-ui/models.cpp
> @@ -253,7 +253,9 @@ bool CylindersModel::setData(const QModelIndex &index, 
> const QVariant &value, in
>       case O2:
>               if (CHANGED()) {
>                       cyl->gasmix.o2 = 
> string_to_fraction(vString.toUtf8().data());
> -                     cyl->depth.mm = 1600 * 1000 / cyl->gasmix.o2.permille * 
> 10 - 10000;
> +                     pressure_t modppO2;
> +                     modppO2.mbar = 1600;
> +                     cyl->depth = gas_mod(&cyl->gasmix, modppO2);
>                       changed = true;
>               }
>               break;
> -- 
> 1.9.1

-- 
Anton Lundin    +46702-161604
_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to