diff --git a/README.md b/README.md index 94413ef..7df9ad9 100644 --- a/README.md +++ b/README.md @@ -128,18 +128,18 @@ The download counts are retained for 90 days and the last 1,500 requests to the On Windows, you can opt out of telemetry by disabling it in the Registry: ``` -reg add "HKCU\Software\Raspberry Pi\Imager\General" /v telemetry /t REG_DWORD /d 0 +reg add "HKCU\Software\Raspberry Pi\Imager" /v telemetry /t REG_DWORD /d 0 ``` -On Linux, add the following to `~/.config/Raspberry Pi/Imager.conf`: +On Linux, run `rpi-imager --disable-telemetry` or add the following to `~/.config/Raspberry Pi/Imager.conf`: ```ini -[%General] -telemetry=0 +[General] +telemetry=false ``` On macOS, disable it by editing the property list for the application: ``` -defaults write org.raspberrypi.Imager.plist General.telemetry -bool NO +defaults write org.raspberrypi.Imager.plist telemetry -bool NO ``` diff --git a/imagewriter.cpp b/imagewriter.cpp index 6ac32ed..a6513f9 100644 --- a/imagewriter.cpp +++ b/imagewriter.cpp @@ -431,7 +431,7 @@ void ImageWriter::openFileDialog() { #ifndef QT_NO_WIDGETS QSettings settings; - QString path = settings.value("General/lastpath").toString(); + QString path = settings.value("lastpath").toString(); QFileInfo fi(path); if (path.isEmpty() || !fi.exists() || !fi.isReadable() ) @@ -466,9 +466,9 @@ void ImageWriter::onFileSelected(QString filename) if (fi.isFile()) { QString path = fi.path(); - if (path != settings.value("General/lastpath")) + if (path != settings.value("lastpath")) { - settings.setValue("General/lastpath", path); + settings.setValue("lastpath", path); settings.sync(); } diff --git a/main.cpp b/main.cpp index 204bfed..3563e5a 100644 --- a/main.cpp +++ b/main.cpp @@ -61,6 +61,7 @@ int main(int argc, char *argv[]) QQmlApplicationEngine engine; QTranslator translator; QString customQm; + QSettings settings; /* Parse commandline arguments (if any) */ QString customRepo; @@ -144,7 +145,7 @@ int main(int argc, char *argv[]) } else if (args[i] == "--help") { - cerr << args[0] << " [--debug] [--version] [--repo ] [--qm ] []" << endl; + cerr << args[0] << " [--debug] [--version] [--repo ] [--qm ] [--disable-telemetry] []" << endl; return 0; } else if (args[i] == "--version") @@ -153,6 +154,18 @@ int main(int argc, char *argv[]) cerr << "Repository: " << imageWriter.constantOsListUrl().toString() << endl; return 0; } + else if (args[i] == "--disable-telemetry") + { + cerr << "Disabled telemetry" << endl; + settings.setValue("telemetry", false); + settings.sync(); + } + else if (args[i] == "--enable-telemetry") + { + cerr << "Using default telemetry setting" << endl; + settings.remove("telemetry"); + settings.sync(); + } else { cerr << "Ignoring unknown argument: " << args[i] << endl; @@ -193,12 +206,10 @@ int main(int argc, char *argv[]) qmlwindow->connect(&imageWriter, SIGNAL(networkOnline()), qmlwindow, SLOT(fetchOSlist())); #ifndef QT_NO_WIDGETS - QSettings settings; - /* Set window position */ auto screensize = app.primaryScreen()->geometry(); - int x = settings.value("General/x", -1).toInt(); - int y = settings.value("General/y", -1).toInt(); + int x = settings.value("x", -1).toInt(); + int y = settings.value("y", -1).toInt(); int w = qmlwindow->property("width").toInt(); int h = qmlwindow->property("height").toInt(); @@ -228,8 +239,8 @@ int main(int argc, char *argv[]) int newY = qmlwindow->property("y").toInt(); if (x != newX || y != newY) { - settings.setValue("General/x", newX); - settings.setValue("General/y", newY); + settings.setValue("x", newX); + settings.setValue("y", newY); settings.sync(); } #endif