mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Adds an AM Demodulator to the list of available decoders.
This commit is contained in:
136
src/decode/am/AMPanel.java
Normal file
136
src/decode/am/AMPanel.java
Normal file
@@ -0,0 +1,136 @@
|
||||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package decode.am;
|
||||
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import settings.ColorSetting;
|
||||
import settings.Setting;
|
||||
import controller.channel.Channel;
|
||||
import controller.state.ChannelState.ChangedAttribute;
|
||||
import controller.state.ChannelStatePanel;
|
||||
|
||||
public class AMPanel extends ChannelStatePanel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JLabel mStateLabel;
|
||||
private JLabel mSourceLabel;
|
||||
private JLabel mChannelLabel;
|
||||
|
||||
private JLabel mProtocol = new JLabel( "AM" );
|
||||
|
||||
public AMPanel( Channel channel )
|
||||
{
|
||||
super( channel );
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
mStateLabel = new JLabel( mChannel.getProcessingChain().
|
||||
getChannelState().getState().getDisplayValue() );
|
||||
mStateLabel.setFont( mFontDecoder );
|
||||
mStateLabel.setForeground( mColorLabelDecoder );
|
||||
|
||||
mSourceLabel = new JLabel( mChannel.getSourceConfiguration().getDescription() );
|
||||
mSourceLabel.setFont( mFontDetails );
|
||||
mSourceLabel.setForeground( mColorLabelDetails );
|
||||
|
||||
mChannelLabel = new JLabel( mChannel.getChannelDisplayName() );
|
||||
mChannelLabel.setFont( mFontDetails );
|
||||
mChannelLabel.setForeground( mColorLabelDetails );
|
||||
|
||||
mProtocol.setFont( mFontDecoder );
|
||||
mProtocol.setForeground( mColorLabelDecoder );
|
||||
|
||||
add( mStateLabel );
|
||||
add( mSourceLabel );
|
||||
add( mChannelLabel, "wrap" );
|
||||
|
||||
add( mProtocol, "wrap" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receive( final ChangedAttribute changedAttribute )
|
||||
{
|
||||
EventQueue.invokeLater( new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
switch( changedAttribute )
|
||||
{
|
||||
case CHANNEL_STATE:
|
||||
mStateLabel.setText( mChannel.getProcessingChain().
|
||||
getChannelState().getState().getDisplayValue() );
|
||||
break;
|
||||
case SOURCE:
|
||||
mSourceLabel.setText( mChannel.getSourceConfiguration()
|
||||
.getDescription() );
|
||||
break;
|
||||
case CHANNEL_NAME:
|
||||
case SITE_NAME:
|
||||
case SYSTEM_NAME:
|
||||
mChannelLabel.setText( mChannel.getChannelDisplayName() );
|
||||
break;
|
||||
}
|
||||
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingChanged( Setting setting )
|
||||
{
|
||||
super.settingChanged( setting );
|
||||
|
||||
if( setting instanceof ColorSetting )
|
||||
{
|
||||
ColorSetting colorSetting = (ColorSetting)setting;
|
||||
|
||||
switch( colorSetting.getColorSettingName() )
|
||||
{
|
||||
case CHANNEL_STATE_LABEL_DECODER:
|
||||
if( mStateLabel != null )
|
||||
{
|
||||
mStateLabel.setForeground( mColorLabelDecoder );
|
||||
}
|
||||
if( mProtocol != null )
|
||||
{
|
||||
mProtocol.setForeground( mColorLabelDecoder );
|
||||
}
|
||||
break;
|
||||
case CHANNEL_STATE_LABEL_DETAILS:
|
||||
if( mSourceLabel != null )
|
||||
{
|
||||
mSourceLabel.setForeground( mColorLabelDetails );
|
||||
}
|
||||
if( mChannelLabel != null )
|
||||
{
|
||||
mChannelLabel.setForeground( mColorLabelDetails );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user