diff --git a/src/source/mixer/MixerManager.java b/src/source/mixer/MixerManager.java index d7af001a..2026e6c6 100644 --- a/src/source/mixer/MixerManager.java +++ b/src/source/mixer/MixerManager.java @@ -19,6 +19,7 @@ package source.mixer; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.List; @@ -168,7 +169,14 @@ public class MixerManager public Collection getMixerTunerDataLines() { - return mMixerTuners.values(); + if( mMixerTuners.isEmpty() ) + { + return Collections.emptyList(); + } + else + { + return mMixerTuners.values(); + } } private void loadMixers() diff --git a/src/source/tuner/TunerEditor.java b/src/source/tuner/TunerEditor.java index 9489f84f..667a51d3 100644 --- a/src/source/tuner/TunerEditor.java +++ b/src/source/tuner/TunerEditor.java @@ -1,3 +1,21 @@ +/******************************************************************************* + * SDR Trunk + * Copyright (C) 2014-2016 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 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 + ******************************************************************************/ + package source.tuner; import gui.control.JFrequencyControl; diff --git a/src/source/tuner/TunerManager.java b/src/source/tuner/TunerManager.java index d423d860..926044b3 100644 --- a/src/source/tuner/TunerManager.java +++ b/src/source/tuner/TunerManager.java @@ -54,6 +54,7 @@ public class TunerManager TunerModel tunerModel, ThreadPoolManager threadPoolManager ) { + mMixerManager = mixerManager; mTunerModel = tunerModel; mThreadPoolManager = threadPoolManager; diff --git a/src/source/tuner/TunerViewPanel.java b/src/source/tuner/TunerViewPanel.java index b6ab262a..306f2adb 100644 --- a/src/source/tuner/TunerViewPanel.java +++ b/src/source/tuner/TunerViewPanel.java @@ -1,3 +1,21 @@ +/******************************************************************************* + * SDR Trunk + * Copyright (C) 2014-2016 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 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 + ******************************************************************************/ + package source.tuner; import java.awt.Color; diff --git a/src/source/tuner/configuration/TunerConfigurationFactory.java b/src/source/tuner/configuration/TunerConfigurationFactory.java index 1851bec7..2ac7501e 100644 --- a/src/source/tuner/configuration/TunerConfigurationFactory.java +++ b/src/source/tuner/configuration/TunerConfigurationFactory.java @@ -1,3 +1,21 @@ +/******************************************************************************* + * SDR Trunk + * Copyright (C) 2014-2016 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 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 + ******************************************************************************/ + package source.tuner.configuration; import gui.editor.Editor; @@ -7,8 +25,10 @@ import source.tuner.TunerType; import source.tuner.airspy.AirspyTuner; import source.tuner.airspy.AirspyTunerConfiguration; import source.tuner.airspy.AirspyTunerEditor; +import source.tuner.fcd.FCDTuner; import source.tuner.fcd.proV1.FCD1TunerConfiguration; import source.tuner.fcd.proplusV2.FCD2TunerConfiguration; +import source.tuner.fcd.proplusV2.FCD2TunerEditor; import source.tuner.hackrf.HackRFTuner; import source.tuner.hackrf.HackRFTunerConfiguration; import source.tuner.hackrf.HackRFTunerEditor; @@ -62,7 +82,7 @@ public class TunerConfigurationFactory case FUNCUBE_DONGLE_PRO: return new EmptyEditor( "a tuner" ); case FUNCUBE_DONGLE_PRO_PLUS: - return new EmptyEditor( "a tuner" ); + return new FCD2TunerEditor( model, (FCDTuner)tuner ); case HACKRF: return new HackRFTunerEditor( model, (HackRFTuner)tuner ); case RAFAELMICRO_R820T: diff --git a/src/source/tuner/configuration/TunerConfigurationModel.java b/src/source/tuner/configuration/TunerConfigurationModel.java index 9b0e1c1d..717e1790 100644 --- a/src/source/tuner/configuration/TunerConfigurationModel.java +++ b/src/source/tuner/configuration/TunerConfigurationModel.java @@ -1,3 +1,21 @@ +/******************************************************************************* + * SDR Trunk + * Copyright (C) 2014-2016 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 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 + ******************************************************************************/ + package source.tuner.configuration; import java.util.ArrayList; diff --git a/src/source/tuner/fcd/FCDTunerController.java b/src/source/tuner/fcd/FCDTunerController.java index b0d8416d..7deb268c 100644 --- a/src/source/tuner/fcd/FCDTunerController.java +++ b/src/source/tuner/fcd/FCDTunerController.java @@ -147,23 +147,10 @@ public abstract class FCDTunerController extends TunerController */ public abstract TunerType getTunerType(); - /** - * Editor panel (GUI) component. - */ - public abstract JPanel getEditor( FCDTuner tuner, - SettingsManager settingsManager ); - /** * Applies the settings in the tuner configuration */ - public abstract void apply( TunerConfiguration config ) - throws SourceException; - - /** - * Returns the currently applied tuner configuration or null if one hasn't - * yet been applied - */ - public abstract TunerConfiguration getTunerConfiguration(); + public abstract void apply( TunerConfiguration config ) throws SourceException; /** * USB address (bus/port) diff --git a/src/source/tuner/fcd/proV1/FCD1TunerController.java b/src/source/tuner/fcd/proV1/FCD1TunerController.java index 27354fc0..adac5c37 100644 --- a/src/source/tuner/fcd/proV1/FCD1TunerController.java +++ b/src/source/tuner/fcd/proV1/FCD1TunerController.java @@ -149,17 +149,6 @@ public class FCD1TunerController extends FCDTunerController } } - @Override - public JPanel getEditor( FCDTuner tuner, SettingsManager settingsManager ) - { - if( mEditor == null ) - { - mEditor = new FCD1TunerEditorPanel( tuner, settingsManager ); - } - - return mEditor; - } - /** * Gets the current LNA Gain value from the controller and stores it */ diff --git a/src/source/tuner/fcd/proplusV2/FCD2TunerController.java b/src/source/tuner/fcd/proplusV2/FCD2TunerController.java index df579ae4..7a27c286 100644 --- a/src/source/tuner/fcd/proplusV2/FCD2TunerController.java +++ b/src/source/tuner/fcd/proplusV2/FCD2TunerController.java @@ -1,6 +1,6 @@ /******************************************************************************* * SDR Trunk - * Copyright (C) 2014 Dennis Sheirer + * Copyright (C) 2014-2016 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 @@ -20,49 +20,39 @@ package source.tuner.fcd.proplusV2; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import javax.swing.JPanel; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.usb4java.Device; import org.usb4java.DeviceDescriptor; -import settings.SettingsManager; import source.SourceException; import source.tuner.MixerTunerType; import source.tuner.TunerClass; import source.tuner.TunerType; import source.tuner.configuration.TunerConfiguration; import source.tuner.fcd.FCDCommand; -import source.tuner.fcd.FCDTuner; import source.tuner.fcd.FCDTunerController; public class FCD2TunerController extends FCDTunerController { - private final static Logger mLog = - LoggerFactory.getLogger( FCD2TunerController.class ); + private final static Logger mLog = LoggerFactory.getLogger( FCD2TunerController.class ); - public static final int sMINIMUM_TUNABLE_FREQUENCY = 150000; - public static final int sMAXIMUM_TUNABLE_FREQUENCY = 2050000000; - public static final int sSAMPLE_RATE = 192000; - - private FCD2TunerConfiguration mTunerConfiguration; - private FCD2TunerEditorPanel mEditor; + public static final int MINIMUM_TUNABLE_FREQUENCY = 150000; + public static final int MAXIMUM_TUNABLE_FREQUENCY = 2050000000; + public static final int SAMPLE_RATE = 192000; public FCD2TunerController( Device device, DeviceDescriptor descriptor ) { - super( device, - descriptor, + super( device, descriptor, (int)MixerTunerType.FUNCUBE_DONGLE_PRO_PLUS.getAudioFormat().getSampleRate(), - sMINIMUM_TUNABLE_FREQUENCY, - sMAXIMUM_TUNABLE_FREQUENCY ); + MINIMUM_TUNABLE_FREQUENCY, MAXIMUM_TUNABLE_FREQUENCY ); } public void init() throws SourceException { super.init(); - mFrequencyController.setSampleRate( sSAMPLE_RATE ); + mFrequencyController.setSampleRate( SAMPLE_RATE ); try { @@ -76,7 +66,7 @@ public class FCD2TunerController extends FCDTunerController public int getCurrentSampleRate() { - return sSAMPLE_RATE; + return SAMPLE_RATE; } @Override @@ -90,71 +80,44 @@ public class FCD2TunerController extends FCDTunerController { return TunerType.FUNCUBE_DONGLE_PRO_PLUS; } - - public JPanel getEditor( FCDTuner tuner, SettingsManager settingsManager ) - { - if( mEditor == null ) - { - mEditor = new FCD2TunerEditorPanel( tuner, settingsManager ); - } - - return mEditor; - } + public void setLNAGain( boolean enabled ) throws SourceException + { + try + { + send( FCDCommand.APP_SET_LNA_GAIN, enabled ? 1 : 0 ); + } + catch ( Exception e ) + { + throw new SourceException( "error while setting LNA Gain", e ); + } + } + + public void setMixerGain( boolean enabled ) throws SourceException + { + try + { + send( FCDCommand.APP_SET_MIXER_GAIN, enabled ? 1 : 0 ); + } + catch ( Exception e ) + { + throw new SourceException( "error while setting Mixer Gain", e ); + } + } + @Override public void apply( TunerConfiguration config ) throws SourceException { if( config instanceof FCD2TunerConfiguration ) { - FCD2TunerConfiguration plusConfig = - (FCD2TunerConfiguration)config; + FCD2TunerConfiguration fcd2 = (FCD2TunerConfiguration)config; - setFrequencyCorrection( plusConfig.getFrequencyCorrection() ); - - try - { - if( plusConfig.getGainLNA() ) - { - send( FCDCommand.APP_SET_LNA_GAIN, 1 ); - - } - else - { - send( FCDCommand.APP_SET_LNA_GAIN, 0 ); - } - } - catch ( Exception e ) - { - throw new SourceException( "error while setting LNA Gain", e ); - } - - try - { - if( plusConfig.getGainMixer() ) - { - send( FCDCommand.APP_SET_MIXER_GAIN, 1 ); - - } - else - { - send( FCDCommand.APP_SET_MIXER_GAIN, 0 ); - } - } - catch ( Exception e ) - { - throw new SourceException( "error while setting Mixer Gain", e ); - } - - mTunerConfiguration = plusConfig; + setFrequencyCorrection( fcd2.getFrequencyCorrection() ); + setLNAGain( fcd2.getGainLNA() ); + setMixerGain( fcd2.getGainMixer() ); } } - @Override - public TunerConfiguration getTunerConfiguration() - { - return mTunerConfiguration; - } - public int getDCCorrection() { int dcCorrection = -999; diff --git a/src/source/tuner/fcd/proplusV2/FCD2TunerEditor.java b/src/source/tuner/fcd/proplusV2/FCD2TunerEditor.java new file mode 100644 index 00000000..d358c46f --- /dev/null +++ b/src/source/tuner/fcd/proplusV2/FCD2TunerEditor.java @@ -0,0 +1,327 @@ +/******************************************************************************* + * SDR Trunk + * Copyright (C) 2014-2016 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 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 + ******************************************************************************/ +package source.tuner.fcd.proplusV2; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.text.DecimalFormat; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.JTextField; +import javax.swing.SpinnerModel; +import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.miginfocom.swing.MigLayout; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import source.SourceException; +import source.tuner.configuration.TunerConfiguration; +import source.tuner.configuration.TunerConfigurationEditor; +import source.tuner.configuration.TunerConfigurationEvent; +import source.tuner.configuration.TunerConfigurationEvent.Event; +import source.tuner.configuration.TunerConfigurationModel; +import source.tuner.fcd.FCDTuner; + +public class FCD2TunerEditor extends TunerConfigurationEditor +{ + private final static Logger mLog = LoggerFactory.getLogger( FCD2TunerEditor.class ); + private static final long serialVersionUID = 1L; + + private JTextField mConfigurationName; + private JButton mTunerInfo; + private JSpinner mFrequencyCorrection; + private JCheckBox mLNAGain; + private JCheckBox mMixerGain; + private boolean mLoading; + + private FCD2TunerController mController; + + public FCD2TunerEditor( TunerConfigurationModel tunerConfigurationModel, FCDTuner tuner ) + { + super( tunerConfigurationModel ); + mController = (FCD2TunerController)tuner.getController(); + + init(); + } + + private FCD2TunerConfiguration getConfiguration() + { + if( hasItem() ) + { + return (FCD2TunerConfiguration)getItem(); + } + + return null; + } + + private void init() + { + setLayout( new MigLayout( "fill,wrap 4", "[right][grow,fill][right][grow,fill]", + "[][][][][][grow]" ) ); + + add( new JLabel( "FCD Pro+ Tuner Configuration" ), "span,align center" ); + + mConfigurationName = new JTextField(); + mConfigurationName.setEnabled( false ); + mConfigurationName.addFocusListener( new FocusListener() + { + @Override + public void focusLost( FocusEvent e ) + { + save(); + } + @Override + public void focusGained( FocusEvent e ) {} + } ); + + add( new JLabel( "Name:" ) ); + add( mConfigurationName, "span 2" ); + + mTunerInfo = new JButton( "Tuner Info" ); + mTunerInfo.setEnabled( false ); + mTunerInfo.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent e ) + { + JOptionPane.showMessageDialog( FCD2TunerEditor.this, getTunerInfo(), + "Tuner Info", JOptionPane.INFORMATION_MESSAGE ); + } + } ); + add( mTunerInfo ); + + SpinnerModel model = new SpinnerNumberModel( 0.0, //initial value + -1000.0, //min + 1000.0, //max + 0.1 ); //step + + mFrequencyCorrection = new JSpinner( model ); + mFrequencyCorrection.setEnabled( false ); + JSpinner.NumberEditor editor = + (JSpinner.NumberEditor)mFrequencyCorrection.getEditor(); + + DecimalFormat format = editor.getFormat(); + format.setMinimumFractionDigits( 1 ); + editor.getTextField().setHorizontalAlignment( SwingConstants.CENTER ); + + mFrequencyCorrection.addChangeListener( new ChangeListener() + { + @Override + public void stateChanged( ChangeEvent e ) + { + double value = ((SpinnerNumberModel)mFrequencyCorrection + .getModel()).getNumber().doubleValue(); + + try + { + mController.setFrequencyCorrection( value ); + save(); + } + catch ( SourceException e1 ) + { + JOptionPane.showMessageDialog( FCD2TunerEditor.this, "FCD Pro Plus Tuner " + + "Controller - couldn't apply frequency correction value: " + value + + e1.getLocalizedMessage() ); + + mLog.error( "FuncubeDongleProPlus Controller - couldn't apply " + + "frequency correction value: " + value, e1 ); + } + } + } ); + + add( new JLabel( "PPM:" ) ); + add( mFrequencyCorrection, "wrap" ); + + add( new JSeparator( JSeparator.HORIZONTAL ), "span,grow" ); + + mLNAGain = new JCheckBox( "LNA Gain" ); + mLNAGain.setEnabled( false ); + mLNAGain.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent event ) + { + try + { + mController.setLNAGain( mLNAGain.isSelected() ); + save(); + } + catch( SourceException e ) + { + mLog.error( "Couldn't set LNA gain for FCD2", e ); + } + } + } ); + + add( new JLabel( "" ) ); + add( mLNAGain ); + + /** + * Mixer Gain + */ + mMixerGain = new JCheckBox( "Mixer Gain" ); + + mMixerGain.addActionListener( new ActionListener() + { + @Override + public void actionPerformed( ActionEvent event ) + { + try + { + mController.setMixerGain( mMixerGain.isSelected() ); + save(); + } + catch( SourceException e ) + { + mLog.error( "Couldn't set mixer gain for FCD2", e ); + } + } + } ); + + add( new JLabel( "" ) ); + add( mMixerGain ); + } + + /** + * Sets each of the tuner configuration controls to the enabled argument state + */ + private void setControlsEnabled( boolean enabled ) + { + if( mConfigurationName.isEnabled() != enabled ) + { + mConfigurationName.setEnabled( enabled ); + } + + if( mTunerInfo.isEnabled() != enabled ) + { + mTunerInfo.setEnabled( enabled ); + } + + if( mFrequencyCorrection.isEnabled() != enabled ) + { + mFrequencyCorrection.setEnabled( enabled ); + } + + if( mLNAGain.isEnabled() != enabled ) + { + mLNAGain.setEnabled( enabled ); + } + + if( mMixerGain.isEnabled() != enabled ) + { + mMixerGain.setEnabled( enabled ); + } + } + + private String getTunerInfo() + { + StringBuilder sb = new StringBuilder(); + + sb.append( "

Funcube Dongle Pro Plus Tuner

" ); + + sb.append( "USB ID: " ); + sb.append( mController.getUSBID() ); + sb.append( "
" ); + + sb.append( "USB Address: " ); + sb.append( mController.getUSBAddress() ); + sb.append( "
" ); + + sb.append( "USB Speed: " ); + sb.append( mController.getUSBSpeed() ); + sb.append( "
" ); + + sb.append( "Cellular Band: " ); + sb.append( mController.getConfiguration().getBandBlocking() ); + sb.append( "
" ); + + sb.append( "Firmware: " ); + sb.append( mController.getConfiguration().getFirmware() ); + sb.append( "
" ); + + return sb.toString(); + } + + @Override + public void save() + { + if( hasItem() && !mLoading ) + { + FCD2TunerConfiguration config = getConfiguration(); + + config.setName( mConfigurationName.getText() ); + + double value = ((SpinnerNumberModel)mFrequencyCorrection + .getModel()).getNumber().doubleValue(); + config.setFrequencyCorrection( value ); + + config.setGainLNA( mLNAGain.isSelected() ); + config.setGainMixer( mMixerGain.isSelected() ); + + getTunerConfigurationModel().broadcast( + new TunerConfigurationEvent( getConfiguration(), Event.CHANGE ) ); + } + } + + @Override + public void setItem( TunerConfiguration tunerConfiguration ) + { + super.setItem( tunerConfiguration ); + + if( hasItem() ) + { + FCD2TunerConfiguration config = getConfiguration(); + + //Toggle loading so that we don't fire a change event and schedule a settings file save + mLoading = true; + + if( tunerConfiguration.isAssigned() ) + { + setControlsEnabled( true ); + mConfigurationName.setText( config.getName() ); + mFrequencyCorrection.setValue( config.getFrequencyCorrection() ); + mLNAGain.setSelected( config.getGainLNA() ); + mMixerGain.setSelected( config.getGainMixer() ); + } + else + { + setControlsEnabled( false ); + mConfigurationName.setText( config.getName() ); + } + + mLoading = false; + } + else + { + setControlsEnabled( false ); + mConfigurationName.setText( "" ); + } + } +} diff --git a/src/source/tuner/fcd/proplusV2/FCD2TunerEditorPanel.java b/src/source/tuner/fcd/proplusV2/FCD2TunerEditorPanel.java deleted file mode 100644 index 8bda26c0..00000000 --- a/src/source/tuner/fcd/proplusV2/FCD2TunerEditorPanel.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * SDR Trunk - * Copyright (C) 2014 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 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 - ******************************************************************************/ -package source.tuner.fcd.proplusV2; - -import gui.control.JFrequencyControl; - -import java.awt.Color; - -import javax.swing.JLabel; -import javax.swing.JPanel; - -import net.miginfocom.swing.MigLayout; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import settings.SettingsManager; -import source.SourceException; -import source.tuner.fcd.FCDTuner; -import source.tuner.fcd.FCDTunerDetailsPanel; -import source.tuner.frequency.FrequencyChangeEvent; -import source.tuner.frequency.FrequencyChangeEvent.Event; -import source.tuner.frequency.IFrequencyChangeProcessor; - -import com.jidesoft.swing.JideTabbedPane; - -public class FCD2TunerEditorPanel extends JPanel implements IFrequencyChangeProcessor -{ - private final static Logger mLog = - LoggerFactory.getLogger( FCD2TunerEditorPanel.class ); - private static final long serialVersionUID = 1L; - - private FCDTuner mTuner; - private FCD2TunerController mController; - private SettingsManager mSettingsManager; - - private JFrequencyControl mFrequencyControl; - - public FCD2TunerEditorPanel( FCDTuner tuner, SettingsManager settingsManager ) - { - mTuner = tuner; - mController = (FCD2TunerController)mTuner.getController(); - mSettingsManager = settingsManager; - - initGUI(); - } - - private void initGUI() - { - setLayout( new MigLayout( "fill,wrap 2", "[right,grow][grow]", "[][][grow]" ) ); - - add( new JLabel( "Funcube Dongle Pro Plus Tuner" ), "span,align center" ); - - mFrequencyControl = new JFrequencyControl(); - - mFrequencyControl.addListener( this ); - - /* Add frequency control as frequency change listener. This creates a - * feedback loop, so the control does not rebroadcast the event */ - mTuner.getController().addListener( mFrequencyControl ); - - mFrequencyControl.setFrequency( mController.getFrequency(), false ); - - add( mFrequencyControl, "span,align center" ); - - JideTabbedPane tabs = new JideTabbedPane(); - tabs.setFont( this.getFont() ); - tabs.setForeground( Color.BLACK ); - - tabs.add( "Configuration", new FCD2TunerConfigurationPanel( - mSettingsManager, mController ) ); - - tabs.add( "Info", new FCDTunerDetailsPanel( mController ) ); - - add( tabs, "span,grow,push" ); - } - - @Override - public void frequencyChanged( FrequencyChangeEvent event ) - { - if( event.getEvent() == Event.NOTIFICATION_FREQUENCY_CHANGE ) - { - //Disregard the bandwidth, which shouldn't be changing - try - { - mController.setFrequency( event.getValue().longValue() ); - } - catch ( SourceException e ) - { - mLog.error( "FCDProController - error setting frequency [" + - event.getValue().longValue() + "]", e ); - } - } - } -}