Implement compile-time flag to disable automatic update checks. (#4854)

Usage: `cmake -DCHATTERINO_UPDATER=OFF ..`

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
Patrick Klein
2023-10-02 10:43:20 +01:00
committed by GitHub
parent bc218b4261
commit 5b17ae3f7e
4 changed files with 17 additions and 6 deletions
+8 -6
View File
@@ -250,6 +250,7 @@ void Updates::installUpdates()
void Updates::checkForUpdates()
{
#ifndef CHATTERINO_DISABLE_UPDATER
auto version = Version::instance();
if (!version.isSupportedOS())
@@ -291,7 +292,7 @@ void Updates::checkForUpdates()
return Failure;
}
#if defined Q_OS_WIN || defined Q_OS_MACOS
# if defined Q_OS_WIN || defined Q_OS_MACOS
/// Downloads an installer for the new version
auto updateExeUrl = object["updateexe"];
if (!updateExeUrl.isString())
@@ -303,7 +304,7 @@ void Updates::checkForUpdates()
}
this->updateExe_ = updateExeUrl.toString();
# ifdef Q_OS_WIN
# ifdef Q_OS_WIN
/// Windows portable
auto portableUrl = object["portable_download"];
if (!portableUrl.isString())
@@ -315,17 +316,17 @@ void Updates::checkForUpdates()
return Failure;
}
this->updatePortable_ = portableUrl.toString();
# endif
# endif
#elif defined Q_OS_LINUX
# elif defined Q_OS_LINUX
QJsonValue updateGuide = object.value("updateguide");
if (updateGuide.isString())
{
this->updateGuideLink_ = updateGuide.toString();
}
#else
# else
return Failure;
#endif
# endif
/// Current version
this->onlineVersion_ = version.toString();
@@ -345,6 +346,7 @@ void Updates::checkForUpdates()
})
.execute();
this->setStatus_(Searching);
#endif
}
Updates::Status Updates::getStatus() const