mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Work in progress.
-Started work on new channel editor channel viewer/controller -Removed a number of unused buffer package classes -Moved automatic frequency control to be a module and removed special handling -Added IUnfilteredRealBufferListener & Provider interfaces -Completely removed the ResourceManager class
This commit is contained in:
@@ -4,21 +4,20 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
|
||||
import settings.SettingsManager;
|
||||
import source.SourceException;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelProvider;
|
||||
import source.tuner.ITunerChannelProvider;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.FrequencyChangeListener;
|
||||
import source.tuner.frequency.FrequencyChangeEvent.Event;
|
||||
import controller.ResourceManager;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
import controller.ThreadPoolManager;
|
||||
|
||||
public class Recording implements Comparable<Recording>,
|
||||
FrequencyChangeListener,
|
||||
TunerChannelProvider
|
||||
IFrequencyChangeProcessor,
|
||||
ITunerChannelProvider
|
||||
{
|
||||
private ResourceManager mResourceManager;
|
||||
private RecordingConfiguration mConfiguration;
|
||||
|
||||
private ArrayList<TunerChannelSource> mTunerChannels =
|
||||
@@ -26,10 +25,12 @@ public class Recording implements Comparable<Recording>,
|
||||
|
||||
private long mCenterFrequency;
|
||||
|
||||
public Recording( ResourceManager resourceManager,
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public Recording( SettingsManager settingsManager,
|
||||
RecordingConfiguration configuration )
|
||||
{
|
||||
mResourceManager = resourceManager;
|
||||
mSettingsManager = settingsManager;
|
||||
mConfiguration = configuration;
|
||||
mCenterFrequency = mConfiguration.getCenterFrequency();
|
||||
}
|
||||
@@ -37,7 +38,7 @@ public class Recording implements Comparable<Recording>,
|
||||
public void setAlias( String alias )
|
||||
{
|
||||
mConfiguration.setAlias( alias );
|
||||
mResourceManager.getSettingsManager().save();
|
||||
mSettingsManager.save();
|
||||
}
|
||||
|
||||
public void setRecordingFile( File file ) throws SourceException
|
||||
@@ -50,7 +51,7 @@ public class Recording implements Comparable<Recording>,
|
||||
}
|
||||
|
||||
mConfiguration.setFilePath( file.getAbsolutePath() );
|
||||
mResourceManager.getSettingsManager().save();
|
||||
mSettingsManager.save();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,13 +91,13 @@ public class Recording implements Comparable<Recording>,
|
||||
@Override
|
||||
public void frequencyChanged( FrequencyChangeEvent event )
|
||||
{
|
||||
if( event.getEvent() == Event.FREQUENCY_CHANGE_NOTIFICATION )
|
||||
if( event.getEvent() == Event.NOTIFICATION_FREQUENCY_CHANGE )
|
||||
{
|
||||
long frequency = event.getValue().longValue();
|
||||
|
||||
mConfiguration.setCenterFrequency( frequency );
|
||||
|
||||
mResourceManager.getSettingsManager().save();
|
||||
mSettingsManager.save();
|
||||
|
||||
mCenterFrequency = frequency;
|
||||
|
||||
|
||||
@@ -26,11 +26,13 @@ import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ConfigurationValidationException;
|
||||
import source.SourceEditor;
|
||||
import source.SourceManager;
|
||||
import source.config.SourceConfigRecording;
|
||||
import source.config.SourceConfigTuner;
|
||||
import source.config.SourceConfiguration;
|
||||
import controller.ResourceManager;
|
||||
|
||||
public class RecordingEditor extends SourceEditor
|
||||
{
|
||||
@@ -38,10 +40,9 @@ public class RecordingEditor extends SourceEditor
|
||||
private JComboBox<Recording> mComboRecordings;
|
||||
private JFrequencyControl mFrequencyControl;
|
||||
|
||||
public RecordingEditor( ResourceManager resourceManager,
|
||||
SourceConfiguration config )
|
||||
public RecordingEditor( SourceManager sourceManager, SourceConfiguration config )
|
||||
{
|
||||
super( resourceManager, config );
|
||||
super( sourceManager, config );
|
||||
|
||||
initGUI();
|
||||
}
|
||||
@@ -92,7 +93,7 @@ public class RecordingEditor extends SourceEditor
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
List<Recording> recordings = getResourceManager()
|
||||
List<Recording> recordings = getSourceManager()
|
||||
.getRecordingSourceManager().getRecordings();
|
||||
|
||||
mComboRecordings.setModel(
|
||||
@@ -105,7 +106,7 @@ public class RecordingEditor extends SourceEditor
|
||||
|
||||
if( recordingAlias != null )
|
||||
{
|
||||
Recording selected = mResourceManager
|
||||
Recording selected = mSourceManager
|
||||
.getRecordingSourceManager()
|
||||
.getRecordingFromAlias( recordingAlias );
|
||||
|
||||
@@ -117,4 +118,18 @@ public class RecordingEditor extends SourceEditor
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfiguration( Channel channel )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateConfiguration() throws ConfigurationValidationException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,17 +24,28 @@ import java.util.List;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
import controller.BaseNode;
|
||||
|
||||
public class RecordingGroupNode extends BaseNode
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RecordingGroupNode()
|
||||
|
||||
private SettingsManager mSettingsManager;
|
||||
|
||||
public RecordingGroupNode( SourceManager sourceManager, SettingsManager settingsManager )
|
||||
{
|
||||
super( null );
|
||||
super( sourceManager );
|
||||
|
||||
mSettingsManager = settingsManager;
|
||||
}
|
||||
|
||||
private SourceManager getSourceManager()
|
||||
{
|
||||
return (SourceManager)getUserObject();
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Recordings [" + this.getChildCount() + "]";
|
||||
@@ -53,13 +64,12 @@ public class RecordingGroupNode extends BaseNode
|
||||
{
|
||||
RecordingConfiguration config = new RecordingConfiguration();
|
||||
|
||||
getModel().getResourceManager().getSettingsManager()
|
||||
.addRecordingConfiguration( config );
|
||||
mSettingsManager.addRecordingConfiguration( config );
|
||||
|
||||
Recording recording = getModel().getResourceManager()
|
||||
Recording recording = getSourceManager()
|
||||
.getRecordingSourceManager().addRecording( config );
|
||||
|
||||
RecordingNode node = new RecordingNode( recording );
|
||||
RecordingNode node = new RecordingNode( getSourceManager(), recording );
|
||||
|
||||
getModel().addNode( node, RecordingGroupNode.this, 0 );
|
||||
|
||||
@@ -76,12 +86,12 @@ public class RecordingGroupNode extends BaseNode
|
||||
|
||||
public void loadRecordings()
|
||||
{
|
||||
List<Recording> recordings = getModel().getResourceManager()
|
||||
List<Recording> recordings = getSourceManager()
|
||||
.getRecordingSourceManager().getRecordings();
|
||||
|
||||
for( Recording recording: recordings )
|
||||
{
|
||||
RecordingNode node = new RecordingNode( recording );
|
||||
RecordingNode node = new RecordingNode( getSourceManager(), recording );
|
||||
|
||||
getModel().addNode( node, this, 0 );
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
import source.SourceManager;
|
||||
import controller.BaseNode;
|
||||
|
||||
public class RecordingNode extends BaseNode
|
||||
@@ -15,8 +16,10 @@ public class RecordingNode extends BaseNode
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JPanel mEditor;
|
||||
|
||||
private SourceManager mSourceManager;
|
||||
|
||||
public RecordingNode( Recording recording )
|
||||
public RecordingNode( SourceManager sourceManager, Recording recording )
|
||||
{
|
||||
super( recording );
|
||||
}
|
||||
@@ -64,7 +67,7 @@ public class RecordingNode extends BaseNode
|
||||
}
|
||||
else
|
||||
{
|
||||
getModel().getResourceManager().getRecordingSourceManager()
|
||||
mSourceManager.getRecordingSourceManager()
|
||||
.removeRecording( getRecording() );
|
||||
|
||||
getModel().removeNodeFromParent( RecordingNode.this );
|
||||
|
||||
@@ -31,21 +31,23 @@ import source.config.SourceConfigRecording;
|
||||
import source.config.SourceConfiguration;
|
||||
import source.tuner.TunerChannel;
|
||||
import source.tuner.TunerChannelSource;
|
||||
import controller.ResourceManager;
|
||||
import controller.ThreadPoolManager;
|
||||
|
||||
public class RecordingSourceManager
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( RecordingSourceManager.class );
|
||||
|
||||
private ResourceManager mResourceManager;
|
||||
|
||||
private ArrayList<Recording> mRecordings = new ArrayList<Recording>();
|
||||
|
||||
public RecordingSourceManager( ResourceManager resourceManager )
|
||||
private SettingsManager mSettingsManager;
|
||||
private ThreadPoolManager mThreadPoolManager;
|
||||
|
||||
public RecordingSourceManager( SettingsManager settingsManager,
|
||||
ThreadPoolManager threadPoolManager )
|
||||
{
|
||||
mResourceManager = resourceManager;
|
||||
|
||||
mSettingsManager = settingsManager;
|
||||
mThreadPoolManager = threadPoolManager;
|
||||
loadRecordings();
|
||||
}
|
||||
|
||||
@@ -71,9 +73,7 @@ public class RecordingSourceManager
|
||||
|
||||
if( recording != null )
|
||||
{
|
||||
retVal = recording.getChannel(
|
||||
mResourceManager.getThreadPoolManager(),
|
||||
tunerChannel );
|
||||
retVal = recording.getChannel( mThreadPoolManager, tunerChannel );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class RecordingSourceManager
|
||||
|
||||
public Recording addRecording( RecordingConfiguration config )
|
||||
{
|
||||
Recording recording = new Recording( mResourceManager, config );
|
||||
Recording recording = new Recording( mSettingsManager, config );
|
||||
|
||||
mRecordings.add( recording );
|
||||
|
||||
@@ -126,7 +126,7 @@ public class RecordingSourceManager
|
||||
public void removeRecording( Recording recording )
|
||||
{
|
||||
/* Remove the config from the settings manager */
|
||||
mResourceManager.getSettingsManager().removeRecordingConfiguration(
|
||||
mSettingsManager.removeRecordingConfiguration(
|
||||
recording.getRecordingConfiguration() );
|
||||
|
||||
mRecordings.remove( recording );
|
||||
@@ -134,24 +134,17 @@ public class RecordingSourceManager
|
||||
|
||||
private void loadRecordings()
|
||||
{
|
||||
if( mResourceManager != null )
|
||||
{
|
||||
SettingsManager settingsManager = mResourceManager.getSettingsManager();
|
||||
|
||||
if( settingsManager != null )
|
||||
{
|
||||
ArrayList<RecordingConfiguration> recordingConfigurations =
|
||||
settingsManager.getRecordingConfigurations();
|
||||
ArrayList<RecordingConfiguration> recordingConfigurations =
|
||||
mSettingsManager.getRecordingConfigurations();
|
||||
|
||||
mLog.info( "discovered [" + recordingConfigurations.size() + "] recording configurations" );
|
||||
|
||||
for( RecordingConfiguration config: recordingConfigurations )
|
||||
{
|
||||
Recording recording = new Recording( mResourceManager, config );
|
||||
|
||||
mRecordings.add( recording );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mLog.info( "RecordingSourceManager - discovered [" +
|
||||
recordingConfigurations.size() + "] recording configurations" );
|
||||
|
||||
for( RecordingConfiguration config: recordingConfigurations )
|
||||
{
|
||||
Recording recording = new Recording( mSettingsManager, config );
|
||||
|
||||
mRecordings.add( recording );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user