From 230ba7ace8fe274f0130a9b25fa532ceb39ecbdd Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 26 Dec 2014 22:39:53 +0100 Subject: Read current version from H&W web page This is only partial. It prints the current version string (to be processed by a regex) via qDebug(). Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-ui/configuredivecomputerdialog.cpp | 14 ++++++++++++++ qt-ui/configuredivecomputerdialog.h | 5 +++++ 2 files changed, 19 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index ce25d0ee3..67f79a778 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include + struct product { const char *product; dc_descriptor_t *descriptor; @@ -183,6 +187,16 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : } settings.endGroup(); settings.endGroup(); + + hwVersionPage.mainFrame()->load(QUrl("http://www.heinrichsweikamp.com/?id=162")); + connect(&hwVersionPage, SIGNAL(loadFinished(bool)), this, SLOT(findVersion())); +} + +void ConfigureDiveComputerDialog::findVersion() +{ + QWebElement parse = hwVersionPage.mainFrame()->documentElement(); + QWebElement result = parse.findFirst("div[id=content_firmware_headline_typ0]"); + qDebug() << "Version" << result.toPlainText(); } ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog() diff --git a/qt-ui/configuredivecomputerdialog.h b/qt-ui/configuredivecomputerdialog.h index 2f7fc296f..99f1e9c32 100644 --- a/qt-ui/configuredivecomputerdialog.h +++ b/qt-ui/configuredivecomputerdialog.h @@ -7,6 +7,7 @@ #include "../libdivecomputer.h" #include "configuredivecomputer.h" #include +#include class GasSpinBoxItemDelegate : public QStyledItemDelegate { @@ -73,6 +74,8 @@ private slots: void on_updateFirmwareButton_clicked(); void on_DiveComputerList_currentRowChanged(int currentRow); + void findVersion(); + private: Ui::ConfigureDiveComputerDialog ui; @@ -99,6 +102,8 @@ private: QString selected_vendor; QString selected_product; + QWebPage hwVersionPage; + }; #endif // CONFIGUREDIVECOMPUTERDIALOG_H -- cgit v1.2.3-70-g09d2