diff --git a/plotjuggler_app/main.cpp b/plotjuggler_app/main.cpp index de92a3d94..c732cfe4e 100644 --- a/plotjuggler_app/main.cpp +++ b/plotjuggler_app/main.cpp @@ -58,8 +58,10 @@ void OpenNewReleaseDialog(QNetworkReply* reply) { if (reply->error()) { + qDebug() << "reply error"; return; } + QString answer = reply->readAll(); QJsonDocument document = QJsonDocument::fromJson(answer.toUtf8()); QJsonObject data = document.object(); @@ -74,14 +76,18 @@ void OpenNewReleaseDialog(QNetworkReply* reply) int current_number = GetVersionNumber(VERSION_STRING); bool rr = settings.value("NewRelease/rickrolled", false).toBool(); - if(rr) { - url = "https://plotjuggler-update.carrd.co/"; + if(!rr) { + url = "https://bit.ly/plotjuggler-update"; } - if (online_number > current_number && online_number > dontshow_number) + if (online_number >= current_number && online_number >= dontshow_number) { NewReleaseDialog* dialog = new NewReleaseDialog(nullptr, tag_name, name, url); dialog->exec(); + if(dialog->link_opened) + { + settings.setValue("NewRelease/rickrolled", true); + } } } @@ -358,11 +364,8 @@ int main(int argc, char* argv[]) QObject::connect(&manager, &QNetworkAccessManager::finished, OpenNewReleaseDialog); QNetworkRequest request; + request.setUrl(QUrl("https://api.github.com/repos/facontidavide/PlotJuggler/releases/latest")); - QString uuid = settings.value("UUID", QUuid::createUuid().toString()).toString(); - settings.setValue("UUID", uuid); - - request.setUrl(QUrl(QString("https://l4g9l4.deta.dev/check_updates/%1").arg(uuid))); manager.get(request); MainWindow* w = nullptr; diff --git a/plotjuggler_app/new_release_dialog.cpp b/plotjuggler_app/new_release_dialog.cpp index 58e76c35d..cc217f03b 100644 --- a/plotjuggler_app/new_release_dialog.cpp +++ b/plotjuggler_app/new_release_dialog.cpp @@ -20,8 +20,7 @@ NewReleaseDialog::NewReleaseDialog(QWidget* parent, QString release, QString tit connect(ui->pushButtonWeb, &QPushButton::clicked, this, [=] { QDesktopServices::openUrl(QUrl(url)); - QSettings settings; - settings.setValue("NewRelease/rickrolled", true); + link_opened = true; }); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, [=] { @@ -32,7 +31,6 @@ NewReleaseDialog::NewReleaseDialog(QWidget* parent, QString release, QString tit } }); - ui->labelRelease->setText(release); ui->labelTitle->setText(title); } diff --git a/plotjuggler_app/new_release_dialog.h b/plotjuggler_app/new_release_dialog.h index a065fdae2..9a07ca666 100644 --- a/plotjuggler_app/new_release_dialog.h +++ b/plotjuggler_app/new_release_dialog.h @@ -22,6 +22,7 @@ class NewReleaseDialog : public QDialog NewReleaseDialog(QWidget* parent, QString release, QString title, QString url); ~NewReleaseDialog(); + bool link_opened = false; private: Ui::NewReleaseDialog* ui; }; diff --git a/plotjuggler_app/new_release_dialog.ui b/plotjuggler_app/new_release_dialog.ui index 3b9b14781..680ceaa92 100644 --- a/plotjuggler_app/new_release_dialog.ui +++ b/plotjuggler_app/new_release_dialog.ui @@ -6,7 +6,7 @@ 0 0 - 725 + 825 400 @@ -18,13 +18,13 @@ - 725 + 825 400 - 729 + 841 400 @@ -74,7 +74,7 @@ - 350 + 450 0 @@ -99,61 +99,26 @@ - - - 12 + + + + true + - - 12 + + New release: - - 5 + + + + + + title - - - - - true - - - - Release: - - - - - - - TextLabel - - - true - - - - - - - - true - - - - Title: - - - - - - - TextLabel - - - true - - - - + + true + +