[Launcher] Added arg/setting to disable update check.
This commit is contained in:
parent
b6d5547453
commit
7b8beeb57b
23
src/main.cpp
23
src/main.cpp
|
@ -52,6 +52,7 @@ catchUnixSignals(std::initializer_list<int> quitSignals)
|
|||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
#ifdef DISABLE_MpvPlayerBackend
|
||||
Enums::Backends backend = Enums::Backends::DirectMpvBackend;
|
||||
#else
|
||||
|
@ -63,12 +64,28 @@ main(int argc, char* argv[])
|
|||
catchUnixSignals({ SIGQUIT, SIGINT, SIGTERM, SIGHUP });
|
||||
#endif
|
||||
|
||||
app.setOrganizationName("KittehPlayer");
|
||||
app.setOrganizationDomain("namedkitten.pw");
|
||||
app.setApplicationName("KittehPlayer");
|
||||
|
||||
QSettings settings;
|
||||
|
||||
#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);
|
||||
qDebug() << "Current Version: " << current_version;
|
||||
|
||||
QNetworkRequest request(QUrl("https://api.github.com/repos/NamedKitten/"
|
||||
"KittehPlayer/releases/tags/continuous"));
|
||||
|
||||
QNetworkAccessManager nam;
|
||||
QNetworkReply* reply = nam.get(request);
|
||||
|
||||
|
@ -93,13 +110,9 @@ main(int argc, char* argv[])
|
|||
} else {
|
||||
qDebug() << "Couldn't check for new version.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
app.setOrganizationName("KittehPlayer");
|
||||
app.setOrganizationDomain("namedkitten.pw");
|
||||
app.setApplicationName("KittehPlayer");
|
||||
|
||||
QSettings settings;
|
||||
QString backendSetting = settings.value("Backend/backend", "").toString();
|
||||
if (backendSetting.length() == 0) {
|
||||
#ifndef DISABLE_MpvPlayerBackend
|
||||
|
|
|
@ -38,6 +38,7 @@ Window {
|
|||
id: backendSettings
|
||||
category: "Backend"
|
||||
property string backend: "mpv"
|
||||
property bool checkForUpdatesOnLaunch: true
|
||||
}
|
||||
|
||||
Settings {
|
||||
|
|
Loading…
Reference in a new issue