f4exb / sdrangel

SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay and FunCube
GNU General Public License v3.0
2.72k stars 421 forks source link

Streamline the handling of configurations #2107

Open dforsi opened 1 month ago

dforsi commented 1 month ago

This issue is for describing the state as of commit 75afe418c184e87aca65dd683144cb80e74fc9ec of 2024/05/12 and modify the code, the online manual, or just have a place to document it.

Configuration file written twice when exiting sdrangel

The file ~/.config/f4exb/SDRangel.conf is written twice on Linux in a short time because MainSettings::save is called twice when quitting sdrangel when clicking the X button or pressing Ctrl+Q:

     
1 MainSettings::save mainsettings.cpp 173
2 MainWindow::closeEvent mainwindow.cpp 1745
     
     
1 MainSettings::save mainsettings.cpp 173
2 MainWindow::~MainWindow mainwindow.cpp 322

This is unnecessary and wasteful. Issue #379 might be related.

Preferences::resetToDefaults called multiple times

Preferences::resetToDefaults is called 3 times when there is no configuration file (such as when sdrangel is run for the first time) and 2 times when there is a configuration file.

When there is no configuration:

     
1 Preferences::resetToDefaults preferences.cpp 48
2 Preferences::Preferences preferences.cpp 25
3 MainSettings::MainSettings mainsettings.cpp 30
4 MainCore::MainCore maincore.cpp 76
5 Holder::Holder maincore.cpp 92
6 (anonymous namespace)::Q_QGS_mainCore::innerFunction maincore.cpp 92
7 QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::operator QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::Type * qglobalstatic.h 137
8 MainCore::instance maincore.cpp 95
9 MainWindow::MainWindow mainwindow.cpp 128
10 runQtApplication main.cpp 196
11 main main.cpp 248
     
     
1 Preferences::resetToDefaults preferences.cpp 48
2 Preferences::Preferences preferences.cpp 25
3 MainSettings::MainSettings mainsettings.cpp 30
4 MainCore::MainCore maincore.cpp 76
5 Holder::Holder maincore.cpp 92
6 (anonymous namespace)::Q_QGS_mainCore::innerFunction maincore.cpp 92
7 QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::operator QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::Type * qglobalstatic.h 137
8 MainCore::instance maincore.cpp 95
9 MainWindow::MainWindow mainwindow.cpp 128
10 runQtApplication main.cpp 196
11 main main.cpp 248
     
     
1 Preferences::resetToDefaults preferences.cpp 48
2 Preferences::Preferences preferences.cpp 25
3 MainSettings::MainSettings mainsettings.cpp 30
4 MainCore::MainCore maincore.cpp 76
5 Holder::Holder maincore.cpp 92
6 (anonymous namespace)::Q_QGS_mainCore::innerFunction maincore.cpp 92
7 QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::operator QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::Type * qglobalstatic.h 137
8 MainCore::instance maincore.cpp 95
9 MainWindow::MainWindow mainwindow.cpp 128
10 runQtApplication main.cpp 196
11 main main.cpp 248

When there is a configuration:

     
1 Preferences::resetToDefaults preferences.cpp 48
2 Preferences::Preferences preferences.cpp 25
3 MainSettings::MainSettings mainsettings.cpp 30
4 MainCore::MainCore maincore.cpp 76
5 Holder::Holder maincore.cpp 92
6 (anonymous namespace)::Q_QGS_mainCore::innerFunction maincore.cpp 92
7 QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::operator QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::Type * qglobalstatic.h 137
8 MainCore::instance maincore.cpp 95
9 MainWindow::MainWindow mainwindow.cpp 128
10 runQtApplication main.cpp 196
11 main main.cpp 248
     
     
1 Preferences::resetToDefaults preferences.cpp 48
2 MainSettings::resetToDefaults mainsettings.cpp 235
3 MainSettings::MainSettings mainsettings.cpp 32
4 MainCore::MainCore maincore.cpp 76
5 Holder::Holder maincore.cpp 92
6 (anonymous namespace)::Q_QGS_mainCore::innerFunction maincore.cpp 92
7 QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::operator QGlobalStatic<MainCore, (anonymous namespace)::Q_QGS_mainCore::innerFunction, (anonymous namespace)::Q_QGS_mainCore::guard>::Type * qglobalstatic.h 137
8 MainCore::instance maincore.cpp 95
9 MainWindow::MainWindow mainwindow.cpp 128
10 runQtApplication main.cpp 196
11 main main.cpp 248

Station Position changed unexpectedly

It may happen that the position saved in the configuration for a station that didn't move (such as as desktop PC without a GPS receiver and whose public IP didn't change, with the "geoclue2" provider) when the "Auto-update from GPS" option is selected. This is unnecessary and wasteful but it is outside of the control of sdrangel so possible fixes are:

The label of the checkbox and the tooltip of the button could also be changed to refer to a generic GNSS and to suggest that position could be:

Order of presets changed after second run

The configuration that is automatically created the first time that sdrangel is run, contains presets for NOAA 18 and NOAA 19 (in this order), but after subsequent runs, the order is unnecessarily swapped in the .conf file.

github-actions[bot] commented 1 week ago

This issue is going to be closed due to inactivity

dforsi commented 5 days ago

The method Preferences::resetToDefaults called multiple times called multiple times seems due to the fact that it is called also by m_audioDeviceManager(nullptr), on line 30 here, and the directly on line 32:

https://github.com/f4exb/sdrangel/blob/31c20df7bb47677a047ff5b614969cf2802476cc/sdrbase/settings/mainsettings.cpp#L29-L34