From 41f97075e0e060ea59f250586ec475acf3a359c5 Mon Sep 17 00:00:00 2001 From: Emre ATAKLI Date: Tue, 5 Apr 2022 03:54:31 +0300 Subject: [PATCH] update --- fetchtimes.cpp | 1 + updatecontroller.cpp | 15 +++++++++------ updatecontroller.h | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fetchtimes.cpp b/fetchtimes.cpp index b67e78e..989ac27 100644 --- a/fetchtimes.cpp +++ b/fetchtimes.cpp @@ -53,6 +53,7 @@ void HttpWindow::downloadSynchronous(QString fileName, QString urlSpec) QString directory; if(fileName == "") { +// return; newVersion = true; directory = QFileDialog::getExistingDirectory(this, tr("Yeni sürümü indireceğiniz klasörü seçin")); if(directory == "") diff --git a/updatecontroller.cpp b/updatecontroller.cpp index ca66466..5b21045 100644 --- a/updatecontroller.cpp +++ b/updatecontroller.cpp @@ -1,12 +1,11 @@ #include "updatecontroller.h" #include +#include #include -UpdateController::UpdateController() -{ - -} +UpdateController::UpdateController() {} +//UpdateController::~UpdateController() {} QString dosyayiAc(QString fileName, QIODevice::OpenModeFlag flag=QIODevice::ReadOnly) { QFile file(fileName); @@ -51,7 +50,6 @@ bool UpdateController::compareTagVersion(QString tag, QString currentTag) void UpdateController::isNewVersionAvailable() { -// QString apiPath1 = applicationDirPath + "/api1.json"; QString apiPath = applicationDirPath + "/api.json"; QString newUrl = "https://api.github.com/repos/atakli/PrayerReminder-Desktop/releases/latest"; fetchTimes.downloadSynchronous(apiPath, newUrl); @@ -71,7 +69,12 @@ void UpdateController::isNewVersionAvailable() QString tag = loadDoc["tag_name"].toString(); if(compareTagVersion(tag, currentTag)) { - fetchTimes.downloadSynchronous("", "https://github.com/atakli/PrayerReminder-Desktop/releases/latest/download/PrayerReminder.zip"); +// if (QMessageBox::question(this, tr("Yeni sürüm bulundu"), tr("İndirilelim mi?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) +// { +// return; +// } +// fetchTimes.downloadSynchronous("", "https://github.com/atakli/PrayerReminder-Desktop/releases/latest/download/PrayerReminder.zip"); + fetchTimes.downloadSynchronous("", loadDoc["assets"][0]["browser_download_url"].toString()); // ismi PrayerReminder.zip'dan başka bişey olursa diye break; } ++index; diff --git a/updatecontroller.h b/updatecontroller.h index 52532b4..85a82a3 100644 --- a/updatecontroller.h +++ b/updatecontroller.h @@ -3,13 +3,15 @@ #include "fetchtimes.h" +#include #include class UpdateController : public QObject { Q_OBJECT public: - UpdateController(); + UpdateController(); +// ~UpdateController(); void isNewVersionAvailable(); // void checkNewVersionNow(); bool isChecked;