summaryrefslogtreecommitdiffstats
path: root/qt-ui/configuredivecomputerdialog.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-27 09:16:39 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-28 06:39:30 -0800
commit2461a731fc4c485c3d54f4cd5def37aaaf6cb829 (patch)
tree2e607f2825cb372dc5688b44eac599d8790295c9 /qt-ui/configuredivecomputerdialog.cpp
parenta0d36e2061d4f831e51bc3a87552d58a80c4cf6c (diff)
downloadsubsurface-2461a731fc4c485c3d54f4cd5def37aaaf6cb829.tar.gz
Progress towards automatic OSTC firmware updates
Better parsing of the website data, a simpe dialog that informs the user that they should upgrade their firmware. Still doen't call the right code path to DO the upgrade. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/configuredivecomputerdialog.cpp')
-rw-r--r--qt-ui/configuredivecomputerdialog.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 546032e63..8ebfa317b 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -199,19 +199,32 @@ void OstcFirmwareCheck::parseOstcFwVersion()
{
QWebElement parse = hwVersionPage.mainFrame()->documentElement();
QWebElement result = parse.findFirst("div[id=content_firmware_headline_typ0]");
- latestFirmwareAvailable = result.toPlainText().trimmed();
+ latestFirmwareAvailable = result.toPlainText().trimmed().replace("stable", "");
qDebug() << "Latest OSTC 3 Version" << latestFirmwareAvailable;
}
-void OstcFirmwareCheck::checkLatest(uint32_t firmwareOnDevice)
+void OstcFirmwareCheck::checkLatest(QWidget *parent, uint32_t firmwareOnDevice)
{
// for now libdivecomputer gives us the firmware on device undecoded as integer
// for the OSTC that means highbyte.lowbyte is the version number
QString firmware;
firmware = QString("%1.%2").arg(firmwareOnDevice / 256). arg(firmwareOnDevice % 256);
if (!latestFirmwareAvailable.isEmpty() && latestFirmwareAvailable != firmware) {
- qDebug() << "you should update your firmware: you have" << firmware <<
- "but the latest stable version is" << latestFirmwareAvailable;
+ QMessageBox response(parent);
+ QString message = tr("You should update the firmware on your dive computer: you have version %1 but the latest stable version is %2")
+ .arg(firmware).arg(latestFirmwareAvailable);
+ response.addButton(tr("Not now"), QMessageBox::RejectRole);
+ response.addButton(tr("Update firmware"), QMessageBox::AcceptRole);
+ response.setText(message);
+ response.setWindowTitle(tr("Firmware upgrade notice"));
+ response.setIcon(QMessageBox::Question);
+ response.setWindowModality(Qt::WindowModal);
+ int ret = response.exec();
+ if (ret == QMessageBox::Accepted) {
+ qDebug() << "go to firmware upgrade";
+ } else {
+ qDebug() << "no upgrade";
+ }
}
}