Skip to content

Commit

Permalink
[fix] main: fix error message when no network
Browse files Browse the repository at this point in the history
  • Loading branch information
bgallois committed Nov 10, 2020
1 parent 552b808 commit 041df78
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),

QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, &QNetworkAccessManager::finished, [this](QNetworkReply *reply) {
if (reply->error() != QNetworkReply::NoError) {
return;
}

QByteArray downloadedData = reply->readAll();
reply->deleteLater();

Expand Down Expand Up @@ -85,7 +89,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
}
});

manager->get(QNetworkRequest(QUrl("http://www.fasttrack.sh/download/FastTrack/platforms.txt")));
manager->get(QNetworkRequest(QUrl("https://www.fasttrack.sh/download/FastTrack/platforms.txt")));

QMessageBox *consent = new QMessageBox(this);
consent->setWindowTitle("Consent");
Expand All @@ -95,7 +99,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
QTimer::singleShot(5000, consent, &QMessageBox::close);
if (consent->exec() == QMessageBox::Yes) {
QWebEngineView *view = new QWebEngineView(this);
view->setUrl(QUrl("http://www.fasttrack.sh/soft.html"));
view->setUrl(QUrl("https://www.fasttrack.sh/soft.html"));
connect(view->page(), &QWebEnginePage::loadFinished, [this, view]() {
delete view;
});
Expand Down

0 comments on commit 041df78

Please sign in to comment.