summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-23 18:16:27 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:15 -0700
commitcc6c385f3309417727f61b55550d6d47bef004dd (patch)
tree2b86c64b388ad7005cbf952bc3c93ef9abcbb1d3 /qt-ui
parent8aa7fddb22cd6ab4d533082598be04649bb1ff21 (diff)
downloadsubsurface-cc6c385f3309417727f61b55550d6d47bef004dd.tar.gz
Start Work on Firmware Update
This patch implements the first step towards OSTC 3 firmware update. Its not much, just file selection, but I will build up on it from there. Implements a thread to initiate firmware updates. Currently, this is for the OSTC 3. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp25
-rw-r--r--qt-ui/configuredivecomputerdialog.h2
-rw-r--r--qt-ui/configuredivecomputerdialog.ui11
3 files changed, 31 insertions, 7 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 81d8f0326..733d64a4f 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -38,12 +38,12 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
deviceDetails = new DeviceDetails(this);
config = new ConfigureDiveComputer(this);
- connect (config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
- connect (config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
- connect (config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
- connect (config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
+ connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
+ connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
+ connect(config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
+ connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
this, SLOT(deviceDetailsReceived(DeviceDetails*)));
- connect (ui->retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
+ connect(ui->retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
memset(&device_data, 0, sizeof(device_data));
fill_computer_list();
@@ -451,3 +451,18 @@ void ConfigureDiveComputerDialog::on_tabWidget_currentChanged(int index)
dcType = DC_TYPE_UEMIS;
fill_device_list(dcType);
}
+
+void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
+{
+ QString filename = existing_filename ?: prefs.default_filename;
+ QFileInfo fi(filename);
+ filename = fi.absolutePath();
+ QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
+ filename, tr("All files (*.*)")
+ );
+ if (!firmwarePath.isEmpty()) {
+ getDeviceData();
+ QString errText;
+ config->startFirmwareUpdate(firmwarePath, &device_data, errText);
+ }
+}
diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h
index de068c609..71266c471 100644
--- a/qt-ui/configuredivecomputerdialog.h
+++ b/qt-ui/configuredivecomputerdialog.h
@@ -33,6 +33,8 @@ private slots:
void on_tabWidget_currentChanged(int index);
+ void on_updateFirmwareButton_clicked();
+
private:
Ui::ConfigureDiveComputerDialog *ui;
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
index 4274a3abe..d0dd91155 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>787</width>
- <height>672</height>
+ <width>785</width>
+ <height>670</height>
</rect>
</property>
<property name="windowTitle">
@@ -89,6 +89,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="updateFirmwareButton">
+ <property name="text">
+ <string>Update Firmware</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>