summarylogtreecommitdiffstats
path: root/disable-update-check.patch
blob: 0147f16877ea71dd64201389d79a516ec0497b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52b98a3..bf41488 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,14 @@ project(JellyfinMediaPlayer CXX C)
 # we want this to be able to run clang-tidy
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE)
 
+option(CHECK_FOR_UPDATES "Enable checking for new versions of Jellyfin Media Player" ON)
 option(OPENELEC "Make an OpenELEC build" OFF)
 option(LINUX_X11POWER "Enable non D-Bus screensaver management" OFF)
 
+if (NOT CHECK_FOR_UPDATES)
+    add_definitions(-DDISABLE_UPDATE_CHECK)
+endif()
+
 if((NOT LINUX_X11POWER) AND (UNIX AND (NOT APPLE)))
   set(LINUX_DBUS ON)
 endif()
diff --git a/src/settings/SettingsComponent.cpp b/src/settings/SettingsComponent.cpp
index 9beb844..8de385c 100644
--- a/src/settings/SettingsComponent.cpp
+++ b/src/settings/SettingsComponent.cpp
@@ -305,6 +305,10 @@ void SettingsComponent::loadConf(const QString& path, bool storage)
       getSection(SETTINGS_SECTION_MAIN)->setValue("autodetectCertBundle", "true");
     }
   }
+
+#ifdef DISABLE_UPDATE_CHECK
+    getSection(SETTINGS_SECTION_MAIN)->setValueHidden("checkForUpdates", "true");
+#endif
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/system/SystemComponent.cpp b/src/system/SystemComponent.cpp
index fa58fee..970c545 100644
--- a/src/system/SystemComponent.cpp
+++ b/src/system/SystemComponent.cpp
@@ -360,6 +360,7 @@ QString SystemComponent::getNativeShellScript()
 /////////////////////////////////////////////////////////////////////////////////////////
 void SystemComponent::checkForUpdates()
 {
+#ifndef DISABLE_UPDATE_CHECK
   if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "checkForUpdates").toBool()) {
 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
     QNetworkAccessManager *manager = new QNetworkAccessManager(this);
@@ -374,6 +375,7 @@ void SystemComponent::checkForUpdates()
     emit updateInfoEmitted("SSL_UNAVAILABLE");
 #endif
   }
+#endif
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////