1
0
Fork 0

[Launcher] Added arg/setting to disable update check.

This commit is contained in:
NamedKitten 2018-12-06 10:36:13 +00:00
parent b6d5547453
commit 7b8beeb57b
2 changed files with 46 additions and 32 deletions

View file

@ -52,6 +52,7 @@ catchUnixSignals(std::initializer_list<int> quitSignals)
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
#ifdef DISABLE_MpvPlayerBackend #ifdef DISABLE_MpvPlayerBackend
Enums::Backends backend = Enums::Backends::DirectMpvBackend; Enums::Backends backend = Enums::Backends::DirectMpvBackend;
#else #else
@ -63,12 +64,28 @@ main(int argc, char* argv[])
catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP }); catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP });
#endif #endif
app.setOrganizationName("KittehPlayer");
app.setOrganizationDomain("namedkitten.pw");
app.setApplicationName("KittehPlayer");
QSettings settings;
#ifdef GIT_COMMIT_HASH #ifdef GIT_COMMIT_HASH
bool checkForUpdates =
settings.value("Backend/checkForUpdatesOnLaunch", false).toBool();
for (int i = 1; i < argc; ++i) {
if (!qstrcmp(argv[i], "--no-update-check")) {
checkForUpdates = false;
}
}
if (checkForUpdates) {
QString current_version = QString(GIT_COMMIT_HASH); QString current_version = QString(GIT_COMMIT_HASH);
qDebug() << "Current Version: " << current_version; qDebug() << "Current Version: " << current_version;
QNetworkRequest request(QUrl("https://api.github.com/repos/NamedKitten/" QNetworkRequest request(QUrl("https://api.github.com/repos/NamedKitten/"
"KittehPlayer/releases/tags/continuous")); "KittehPlayer/releases/tags/continuous"));
QNetworkAccessManager nam; QNetworkAccessManager nam;
QNetworkReply* reply = nam.get(request); QNetworkReply* reply = nam.get(request);
@ -93,13 +110,9 @@ main(int argc, char* argv[])
} else { } else {
qDebug() << "Couldn't check for new version."; qDebug() << "Couldn't check for new version.";
} }
}
#endif #endif
app.setOrganizationName("KittehPlayer");
app.setOrganizationDomain("namedkitten.pw");
app.setApplicationName("KittehPlayer");
QSettings settings;
QString backendSetting = settings.value("Backend/backend", "").toString(); QString backendSetting = settings.value("Backend/backend", "").toString();
if (backendSetting.length() == 0) { if (backendSetting.length() == 0) {
#ifndef DISABLE_MpvPlayerBackend #ifndef DISABLE_MpvPlayerBackend

View file

@ -38,6 +38,7 @@ Window {
id: backendSettings id: backendSettings
category: "Backend" category: "Backend"
property string backend: "mpv" property string backend: "mpv"
property bool checkForUpdatesOnLaunch: true
} }
Settings { Settings {