#1190 Tuner management redesign. Updates all tuners with direct threaded support. Incorporates USB Hotplug support. Adds black/white listing of tuners. Updates all tuner editors to have a common look and feel. Changes location of tuner configuration file and changes format to JSON. (#1208)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-04-18 07:30:58 -04:00
committed by GitHub
parent 0fb148d31e
commit 96d3996bec
259 changed files with 11974 additions and 12454 deletions

View File

@@ -1,18 +1,20 @@
/*
* *********************************************************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 Dennis Sheirer
* *****************************************************************************
* Copyright (C) 2014-2022 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
* *********************************************************************************************************************
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ****************************************************************************
*/
package io.github.dsheirer.settings;
@@ -22,15 +24,13 @@ import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import io.github.dsheirer.properties.SystemProperties;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.source.recording.RecordingConfiguration;
import io.github.dsheirer.source.tuner.configuration.TunerConfigurationEvent;
import io.github.dsheirer.source.tuner.configuration.TunerConfigurationModel;
import io.github.dsheirer.util.ThreadPool;
import org.jdesktop.swingx.mapviewer.GeoPosition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*;
import java.awt.Color;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -48,21 +48,15 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
private Settings mSettings = new Settings();
private List<SettingChangeListener> mListeners = new ArrayList<>();
private TunerConfigurationModel mTunerConfigurationModel;
private boolean mLoadingSettings = false;
private AtomicBoolean mSettingsSavePending = new AtomicBoolean();
public SettingsManager(TunerConfigurationModel tunerConfigurationModel)
public SettingsManager()
{
//TODO: move settings into a SettingsModel
//and update this class to only provide loading, saving, and model
//change detection producing a save.
mTunerConfigurationModel = tunerConfigurationModel;
//Register for tuner config events so that we can save the settings
mTunerConfigurationModel.addListener(this);
init();
}
@@ -203,23 +197,6 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
broadcastSettingChange(setting);
}
public List<RecordingConfiguration> getRecordingConfigurations()
{
return mSettings.getRecordingConfigurations();
}
public void addRecordingConfiguration(RecordingConfiguration config)
{
mSettings.addRecordingConfiguration(config);
scheduleSettingsSave();
}
public void removeRecordingConfiguration(RecordingConfiguration config)
{
mSettings.removeRecordingConfiguration(config);
scheduleSettingsSave();
}
public MapViewSetting getMapViewSetting(String name, GeoPosition position, int zoom)
{
MapViewSetting loc = mSettings.getMapViewSetting(name);
@@ -250,8 +227,6 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
private void save()
{
saveTunerConfigurationModel();
SystemProperties props = SystemProperties.getInstance();
Path settingsFolder = props.getApplicationFolder("settings");
@@ -319,31 +294,9 @@ public class SettingsManager implements Listener<TunerConfigurationEvent>
mSettings = new Settings();
}
loadTunerConfigurationModel();
mLoadingSettings = false;
}
private void loadTunerConfigurationModel()
{
if(mSettings != null)
{
mTunerConfigurationModel.clear();
mTunerConfigurationModel.addTunerConfigurations(
mSettings.getTunerConfigurations());
}
}
private void saveTunerConfigurationModel()
{
if(mSettings != null)
{
mSettings.setTunerConfigurations(
mTunerConfigurationModel.getTunerConfigurations());
}
}
public void broadcastSettingChange(Setting setting)
{
Iterator<SettingChangeListener> it = mListeners.iterator();