Merge pull request #1974 from ZeldaZach/fix_updater
fix updater from bintray api issue
This commit is contained in:
commit
e3fb308ea1
4 changed files with 14 additions and 22 deletions
|
@ -85,6 +85,7 @@ void DlgUpdate::gotoDownloadPage() {
|
|||
|
||||
void DlgUpdate::downloadUpdate() {
|
||||
setLabel("Downloading update...");
|
||||
enableOkButton(false);
|
||||
enableUpdateButton(false);
|
||||
uDownloader->beginDownload(updateUrl);
|
||||
}
|
||||
|
@ -127,7 +128,8 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, QVaria
|
|||
if (reply == QMessageBox::Yes)
|
||||
downloadUpdate();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, "Cockatrice Update",
|
||||
tr("Your version of Cockatrice is out of date, but there are no packages"
|
||||
" available for your operating system. You may have to use a developer build or build from source"
|
||||
|
@ -146,6 +148,10 @@ void DlgUpdate::enableUpdateButton(bool enable) {
|
|||
manualDownload->setEnabled(enable);
|
||||
}
|
||||
|
||||
void DlgUpdate::enableOkButton(bool enable) {
|
||||
ok->setEnabled(enable);
|
||||
}
|
||||
|
||||
void DlgUpdate::setLabel(QString newText) {
|
||||
text->setText(newText);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ private slots:
|
|||
private:
|
||||
QUrl updateUrl;
|
||||
void enableUpdateButton(bool enable);
|
||||
void enableOkButton(bool enable);
|
||||
void beginUpdateCheck();
|
||||
void setLabel(QString text);
|
||||
QLabel *text;
|
||||
|
|
|
@ -43,24 +43,14 @@ bool UpdateChecker::downloadMatchesCurrentOS(QVariant build)
|
|||
.contains("osx");
|
||||
}
|
||||
#elif defined(Q_OS_WIN)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
bool UpdateChecker::downloadMatchesCurrentOS(QVariant build)
|
||||
{
|
||||
return build
|
||||
.toMap()["name"]
|
||||
.toString()
|
||||
.contains("qt5.exe");
|
||||
.contains("exe");
|
||||
}
|
||||
#else
|
||||
bool UpdateChecker::downloadMatchesCurrentOS(QVariant build)
|
||||
{
|
||||
return build
|
||||
.toMap()["name"]
|
||||
.toString()
|
||||
.contains("qt4.exe");
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
||||
bool UpdateChecker::downloadMatchesCurrentOS(QVariant)
|
||||
{
|
||||
|
@ -73,7 +63,7 @@ bool UpdateChecker::downloadMatchesCurrentOS(QVariant)
|
|||
QDate UpdateChecker::dateFromBuild(QVariant build)
|
||||
{
|
||||
QString formatString = "yyyy-MM-dd";
|
||||
QString dateString = build.toMap()["date"].toString();
|
||||
QString dateString = build.toMap()["created"].toString();
|
||||
dateString = dateString.remove(formatString.length(), dateString.length());
|
||||
|
||||
return QDate::fromString(dateString, formatString);
|
||||
|
|
|
@ -7,20 +7,15 @@ UpdateDownloader::UpdateDownloader(QObject *parent) : QObject(parent) {
|
|||
}
|
||||
|
||||
void UpdateDownloader::beginDownload(QUrl downloadUrl) {
|
||||
|
||||
//Save the original URL because we need it for the filename
|
||||
if (originalUrl.isEmpty())
|
||||
originalUrl = downloadUrl;
|
||||
|
||||
response = netMan->get(QNetworkRequest(downloadUrl));
|
||||
connect(response, SIGNAL(finished()),
|
||||
this, SLOT(fileFinished()));
|
||||
connect(response, SIGNAL(readyRead()),
|
||||
this, SLOT(fileReadyRead()));
|
||||
connect(response, SIGNAL(downloadProgress(qint64, qint64)),
|
||||
this, SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(response, SIGNAL(error(QNetworkReply::NetworkError)),
|
||||
this, SLOT(downloadError(QNetworkReply::NetworkError)));
|
||||
connect(response, SIGNAL(finished()), this, SLOT(fileFinished()));
|
||||
connect(response, SIGNAL(readyRead()), this, SLOT(fileReadyRead()));
|
||||
connect(response, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
|
||||
connect(response, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
|
||||
}
|
||||
|
||||
void UpdateDownloader::downloadError(QNetworkReply::NetworkError) {
|
||||
|
|
Loading…
Reference in a new issue