From 82a0cdd0cf13f6f86a0269b06ab09a1a66cd631a Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sun, 31 Mar 2019 13:39:10 -0400 Subject: [PATCH] Added basic version check stub --- mainwindow.cpp | 16 +++++++++++++++- mainwindow.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index d0ebc64..11d7e65 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1116,7 +1116,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, //splashTimer.setSingleShot (true); //splashTimer.start (20 * 1000); - // TODO: jsherer - need to remove this eventually... QTimer::singleShot (0, this, SLOT (checkStartupWarnings ())); if(!ui->cbMenus->isChecked()) { @@ -1639,8 +1638,23 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; } +void MainWindow::checkVersion(){ + auto m = new QNetworkAccessManager(this); + connect(m, &QNetworkAccessManager::finished, this, [this](QNetworkReply * reply){ + if(reply->error()) return; + + QString content = reply->readAll(); + qDebug() << "version" << content; + }); + + QUrl url("http://files.js8call.com/version.txt"); + QNetworkRequest r(url); + m->get(r); +} + void MainWindow::checkStartupWarnings () { + checkVersion(); ensureCallsignSet(false); } diff --git a/mainwindow.h b/mainwindow.h index c32357c..b24c390 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -413,6 +413,7 @@ private slots: void on_cbCQTx_toggled(bool b); void splash_done (); void on_measure_check_box_stateChanged (int); + void checkVersion(); void checkStartupWarnings (); void clearCallsignSelected(); void refreshTextDisplay();