mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
Add compile time options for telemetry and updates
This commit is contained in:
parent
0a07169a8a
commit
5d971375f6
4 changed files with 18 additions and 2 deletions
|
@ -6,6 +6,9 @@ if (APPLE)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
OPTION (ENABLE_CHECK_VERSION "Check for version updates" ON)
|
||||||
|
OPTION (ENABLE_TELEMETRY "Enable sending telemetry" ON)
|
||||||
|
|
||||||
project(rpi-imager LANGUAGES CXX C)
|
project(rpi-imager LANGUAGES CXX C)
|
||||||
set(IMAGER_VERSION_MAJOR 1)
|
set(IMAGER_VERSION_MAJOR 1)
|
||||||
set(IMAGER_VERSION_MINOR 7)
|
set(IMAGER_VERSION_MINOR 7)
|
||||||
|
@ -107,6 +110,18 @@ else()
|
||||||
message(STATUS "LTO not supported: <${ipoerror}>")
|
message(STATUS "LTO not supported: <${ipoerror}>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_TELEMETRY)
|
||||||
|
add_definitions(-DTELEMETRY_ENABLED_DEFAULT=true)
|
||||||
|
else()
|
||||||
|
add_definitions(-DTELEMETRY_ENABLED_DEFAULT=false)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_CHECK_VERSION)
|
||||||
|
add_definitions(-DCHECK_VERSION_DEFAULT=true)
|
||||||
|
else()
|
||||||
|
add_definitions(-DCHECK_VERSION_DEFAULT=false)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Because dependencies are typically not available by default on Windows, build bundled code
|
# Because dependencies are typically not available by default on Windows, build bundled code
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Target Windows 7 (needed for drivelist module)
|
# Target Windows 7 (needed for drivelist module)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
/* Phone home the name of images downloaded for image popularity ranking */
|
/* Phone home the name of images downloaded for image popularity ranking */
|
||||||
#define TELEMETRY_URL "https://rpi-imager-stats.raspberrypi.com/downloads"
|
#define TELEMETRY_URL "https://rpi-imager-stats.raspberrypi.com/downloads"
|
||||||
#define TELEMETRY_ENABLED_DEFAULT true
|
|
||||||
|
|
||||||
/* Hash algorithm for verifying (uncompressed image) checksum */
|
/* Hash algorithm for verifying (uncompressed image) checksum */
|
||||||
#define OSLIST_HASH_ALGORITHM QCryptographicHash::Sha256
|
#define OSLIST_HASH_ALGORITHM QCryptographicHash::Sha256
|
||||||
|
|
|
@ -1006,6 +1006,8 @@ bool ImageWriter::getBoolSetting(const QString &key)
|
||||||
return _settings.value(key, TELEMETRY_ENABLED_DEFAULT).toBool();
|
return _settings.value(key, TELEMETRY_ENABLED_DEFAULT).toBool();
|
||||||
else if (key == "eject")
|
else if (key == "eject")
|
||||||
return _settings.value(key, true).toBool();
|
return _settings.value(key, true).toBool();
|
||||||
|
else if (key == "check_version")
|
||||||
|
return _settings.value(key, CHECK_VERSION_DEFAULT).toBool();
|
||||||
else
|
else
|
||||||
return _settings.value(key).toBool();
|
return _settings.value(key).toBool();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1143,7 +1143,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
if ("imager" in o) {
|
if ("imager" in o) {
|
||||||
var imager = o["imager"]
|
var imager = o["imager"]
|
||||||
if ("latest_version" in imager && "url" in imager) {
|
if (imageWriter.getBoolSetting("check_version") && "latest_version" in imager && "url" in imager) {
|
||||||
if (!imageWriter.isEmbeddedMode() && imageWriter.isVersionNewer(imager["latest_version"])) {
|
if (!imageWriter.isEmbeddedMode() && imageWriter.isVersionNewer(imager["latest_version"])) {
|
||||||
updatepopup.url = imager["url"]
|
updatepopup.url = imager["url"]
|
||||||
updatepopup.openPopup()
|
updatepopup.openPopup()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue