Changeset 31854f5 in subsurface


Ignore:
Timestamp:
Dec 27, 2013, 11:04:35 AM (4 years ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
Mtest, android_test, dcDownload, foratdotde, gitMerge, gitdebug, gitpictures, ios, master, mergeKirigamiPort, pictimeshift, resolutionIndependence, spinner, testTomaz, testing, v4.0-branch, v4.0.3-branch, v4.2-branch, v4.4-branch, v4.5-branch
Children:
a35a28a
Parents:
55da333
git-author:
Benjamin <nystire@…> (12/27/13 02:50:13)
git-committer:
Dirk Hohndel <dirk@…> (12/27/13 11:04:35)
Message:

Disable DC device node if it is not needed

This patch disables/enables the DC device node based on what type of
transport the selected DC uses. The only time the device node field is
used is if the selected DC uses a serial transport type. IrDA and USB type
transports do not use the device node.

Signed-off-by: Benjamin Fogel <nystire@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Location:
qt-ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qt-ui/downloadfromdivecomputer.cpp

    r5fca06c9 r31854f5  
    7171                        ui.product->setCurrentIndex(ui.product->findText(default_dive_computer_product));
    7272        }
     73        connect(ui.product, SIGNAL(currentIndexChanged(int)), this, SLOT(on_product_currentIndexChanged()), Qt::UniqueConnection);
    7374        if (default_dive_computer_device)
    7475                ui.device->setEditText(default_dive_computer_device);
     
    167168        // Memleak - but deleting gives me a crash.
    168169        //currentModel->deleteLater();
     170}
     171
     172void DownloadFromDCWidget::on_product_currentIndexChanged()
     173{
     174        // Set up the DC descriptor
     175        dc_descriptor_t *descriptor = NULL;
     176        descriptor = descriptorLookup[ui.vendor->currentText() + ui.product->currentText()];
     177
     178        // call dc_descriptor_get_transport to see if the dc_transport_t is DC_TRANSPORT_SERIAL
     179        if (dc_descriptor_get_transport(descriptor) == DC_TRANSPORT_SERIAL) {
     180                // if the dc_transport_t is DC_TRANSPORT_SERIAL, then enable the device node box.
     181                ui.device->setEnabled(true);
     182        } else {
     183                // otherwise disable the device node box
     184                ui.device->setEnabled(false);
     185        }
    169186}
    170187
  • qt-ui/downloadfromdivecomputer.h

    r5fca06c9 r31854f5  
    4141        void on_cancel_clicked();
    4242        void on_vendor_currentIndexChanged(const QString& vendor);
     43        void on_product_currentIndexChanged();
    4344
    4445        void onDownloadThreadFinished();
Note: See TracChangeset for help on using the changeset viewer.