Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Emre ATAKLI committed Apr 5, 2022
1 parent 44d2bc4 commit 41f9707
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions fetchtimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "")
Expand Down
15 changes: 9 additions & 6 deletions updatecontroller.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "updatecontroller.h"

#include <QJsonDocument>
#include <QMessageBox>
#include <QFile>

UpdateController::UpdateController()
{

}
UpdateController::UpdateController() {}
//UpdateController::~UpdateController() {}
QString dosyayiAc(QString fileName, QIODevice::OpenModeFlag flag=QIODevice::ReadOnly)
{
QFile file(fileName);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion updatecontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

#include "fetchtimes.h"

#include <QWidget>
#include <QObject>

class UpdateController : public QObject
{
Q_OBJECT
public:
UpdateController();
UpdateController();
// ~UpdateController();
void isNewVersionAvailable();
// void checkNewVersionNow();
bool isChecked;
Expand Down

0 comments on commit 41f9707

Please sign in to comment.