mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 21:15:45 -05:00
#90 [WIP] Adds ability to show streaming status on main application window using menu (View > Show Streaming Status). Resolves a number of issues with the SystemProperties class.
This commit is contained in:
@@ -118,12 +118,11 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||
|
||||
try
|
||||
{
|
||||
setMixerChannelConfiguration(configuration);
|
||||
setMixerChannelConfiguration(configuration, false);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
mLog.error("Couldn't set stored audio mixer/channel configuration"
|
||||
+ " - using default", e);
|
||||
mLog.error("Couldn't set stored audio mixer/channel configuration - using default", e);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -131,8 +130,7 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||
}
|
||||
catch(Exception e2)
|
||||
{
|
||||
mLog.error("Couldn't set default audio mixer/channel "
|
||||
+ "configuration - no audio will be available", e2);
|
||||
mLog.error("Couldn't set default audio mixer/channel configuration - no audio will be available", e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,8 +215,12 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||
@Override
|
||||
public void setMixerChannelConfiguration(MixerChannelConfiguration entry) throws AudioException
|
||||
{
|
||||
if(entry != null &&
|
||||
(entry.getMixerChannel() == MixerChannel.MONO || entry.getMixerChannel() == MixerChannel.STEREO))
|
||||
setMixerChannelConfiguration(entry, true);
|
||||
}
|
||||
|
||||
public void setMixerChannelConfiguration(MixerChannelConfiguration entry, boolean saveSettings) throws AudioException
|
||||
{
|
||||
if(entry != null && (entry.getMixerChannel() == MixerChannel.MONO || entry.getMixerChannel() == MixerChannel.STEREO))
|
||||
{
|
||||
mControllerBroadcaster.broadcast(CONFIGURATION_CHANGE_STARTED);
|
||||
|
||||
@@ -260,11 +262,12 @@ public class AudioManager implements Listener<AudioPacket>, IAudioController
|
||||
|
||||
mControllerBroadcaster.broadcast(CONFIGURATION_CHANGE_COMPLETE);
|
||||
|
||||
if(saveSettings)
|
||||
{
|
||||
SystemProperties properties = SystemProperties.getInstance();
|
||||
|
||||
properties.set(AUDIO_MIXER_PROPERTY, entry.getMixer().getMixerInfo().getName());
|
||||
properties.set(AUDIO_CHANNELS_PROPERTY, entry.getMixerChannel().name());
|
||||
properties.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Audio
|
||||
switch(column)
|
||||
{
|
||||
case COLUMN_SERVER_ICON:
|
||||
return null;
|
||||
return "Streaming";
|
||||
case COLUMN_STREAM_NAME:
|
||||
return "Name";
|
||||
case COLUMN_BROADCASTER_STATUS:
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
||||
private AliasModel mAliasModel;
|
||||
private IconManager mIconManager;
|
||||
|
||||
private JTable mBroadcastConfigurationTable;
|
||||
private BroadcastStatusPanel mBroadcastStatusPanel;
|
||||
private JideSplitPane mSplitPane;
|
||||
private Editor<BroadcastConfiguration> mEmptyEditor = new EmptyEditor<>("Configuration:");
|
||||
private Editor<BroadcastConfiguration> mEditor;
|
||||
@@ -72,17 +72,11 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
||||
{
|
||||
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
|
||||
|
||||
mBroadcastConfigurationTable = new JTable(mBroadcastModel);
|
||||
mBroadcastConfigurationTable.setAutoCreateRowSorter(true);
|
||||
mBroadcastConfigurationTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
mBroadcastConfigurationTable.getSelectionModel().addListSelectionListener(BroadcastPanel.this);
|
||||
mBroadcastStatusPanel = new BroadcastStatusPanel(mBroadcastModel);
|
||||
|
||||
mBroadcastConfigurationTable.getColumnModel().getColumn(BroadcastModel.COLUMN_SERVER_ICON).setPreferredWidth(1);
|
||||
mBroadcastConfigurationTable.getColumnModel().getColumn(BroadcastModel.COLUMN_STREAM_NAME).setPreferredWidth(25);
|
||||
mBroadcastConfigurationTable.getColumnModel().getColumn(BroadcastModel.COLUMN_BROADCASTER_STATUS)
|
||||
.setCellRenderer(new StatusCellRenderer());
|
||||
|
||||
JScrollPane scroller = new JScrollPane(mBroadcastConfigurationTable);
|
||||
mBroadcastStatusPanel.getTable().setAutoCreateRowSorter(true);
|
||||
mBroadcastStatusPanel.getTable().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
mBroadcastStatusPanel.getTable().getSelectionModel().addListSelectionListener(BroadcastPanel.this);
|
||||
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
buttonsPanel.setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill][grow,fill][grow,fill]", "[]"));
|
||||
@@ -122,7 +116,7 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
||||
|
||||
listAndButtonsPanel.setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill][]"));
|
||||
|
||||
listAndButtonsPanel.add(scroller, "wrap");
|
||||
listAndButtonsPanel.add(mBroadcastStatusPanel, "wrap");
|
||||
listAndButtonsPanel.add(buttonsPanel);
|
||||
|
||||
mSplitPane = new JideSplitPane(JideSplitPane.HORIZONTAL_SPLIT);
|
||||
@@ -168,11 +162,11 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
||||
*/
|
||||
private BroadcastConfiguration getSelectedBroadcastConfiguration()
|
||||
{
|
||||
int viewRow = mBroadcastConfigurationTable.getSelectedRow();
|
||||
int viewRow = mBroadcastStatusPanel.getTable().getSelectedRow();
|
||||
|
||||
if(viewRow >= 0)
|
||||
{
|
||||
int modelRow = mBroadcastConfigurationTable.convertRowIndexToModel(viewRow);
|
||||
int modelRow = mBroadcastStatusPanel.getTable().convertRowIndexToModel(viewRow);
|
||||
|
||||
if(modelRow >= 0)
|
||||
{
|
||||
@@ -255,75 +249,12 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
||||
mBroadcastModel.addBroadcastConfiguration(configuration);
|
||||
|
||||
int modelRow = mBroadcastModel.getRowForConfiguration(configuration);
|
||||
int tableRow = mBroadcastConfigurationTable.convertRowIndexToView(modelRow);
|
||||
mBroadcastConfigurationTable.changeSelection(tableRow, 0, false, false);
|
||||
int tableRow = mBroadcastStatusPanel.getTable().convertRowIndexToView(modelRow);
|
||||
mBroadcastStatusPanel.getTable().changeSelection(tableRow, 0, false, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom cell renderer for the broadcast state column.
|
||||
*/
|
||||
public class StatusCellRenderer extends DefaultTableCellRenderer
|
||||
{
|
||||
public StatusCellRenderer()
|
||||
{
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
boolean hasFocus, int row, int column)
|
||||
{
|
||||
JLabel component = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
if(isSelected)
|
||||
{
|
||||
setBackground(table.getSelectionBackground());
|
||||
setForeground(table.getSelectionForeground());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(value instanceof BroadcastState)
|
||||
{
|
||||
BroadcastState state = (BroadcastState)value;
|
||||
|
||||
if(state == BroadcastState.CONNECTED)
|
||||
{
|
||||
setBackground(Color.GREEN);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else if(state == BroadcastState.DISABLED)
|
||||
{
|
||||
setBackground(table.getBackground());
|
||||
setForeground(Color.LIGHT_GRAY);
|
||||
}
|
||||
else if(state == BroadcastState.INVALID_SETTINGS)
|
||||
{
|
||||
setBackground(Color.YELLOW);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else if(state.isErrorState())
|
||||
{
|
||||
setBackground(Color.RED);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else
|
||||
{
|
||||
setBackground(table.getBackground());
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setForeground(table.getForeground());
|
||||
setBackground(table.getBackground());
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
125
src/audio/broadcast/BroadcastStatusPanel.java
Normal file
125
src/audio/broadcast/BroadcastStatusPanel.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*******************************************************************************
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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 audio.broadcast;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import java.awt.*;
|
||||
|
||||
public class BroadcastStatusPanel extends JPanel
|
||||
{
|
||||
private JTable mTable;
|
||||
private JScrollPane mScrollPane;
|
||||
private BroadcastModel mBroadcastModel;
|
||||
|
||||
public BroadcastStatusPanel(BroadcastModel broadcastModel)
|
||||
{
|
||||
mBroadcastModel = broadcastModel;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public JTable getTable()
|
||||
{
|
||||
return mTable;
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
|
||||
|
||||
mTable = new JTable(mBroadcastModel);
|
||||
|
||||
DefaultTableCellRenderer renderer = (DefaultTableCellRenderer)mTable.getDefaultRenderer(String.class);
|
||||
renderer.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
mTable.getColumnModel().getColumn(BroadcastModel.COLUMN_BROADCASTER_STATUS).setCellRenderer(new StatusCellRenderer());
|
||||
|
||||
mScrollPane = new JScrollPane(mTable);
|
||||
|
||||
add(mScrollPane);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom cell renderer for the broadcast state column.
|
||||
*/
|
||||
public class StatusCellRenderer extends DefaultTableCellRenderer
|
||||
{
|
||||
public StatusCellRenderer()
|
||||
{
|
||||
setOpaque(true);
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
|
||||
boolean hasFocus, int row, int column)
|
||||
{
|
||||
JLabel component = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
|
||||
if(isSelected)
|
||||
{
|
||||
setBackground(table.getSelectionBackground());
|
||||
setForeground(table.getSelectionForeground());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(value instanceof BroadcastState)
|
||||
{
|
||||
BroadcastState state = (BroadcastState)value;
|
||||
|
||||
if(state == BroadcastState.CONNECTED)
|
||||
{
|
||||
setBackground(Color.GREEN);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else if(state == BroadcastState.DISABLED)
|
||||
{
|
||||
setBackground(table.getBackground());
|
||||
setForeground(Color.LIGHT_GRAY);
|
||||
}
|
||||
else if(state == BroadcastState.INVALID_SETTINGS)
|
||||
{
|
||||
setBackground(Color.YELLOW);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else if(state.isErrorState())
|
||||
{
|
||||
setBackground(Color.RED);
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
else
|
||||
{
|
||||
setBackground(table.getBackground());
|
||||
setForeground(table.getForeground());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setForeground(table.getForeground());
|
||||
setBackground(table.getBackground());
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import audio.AudioManager;
|
||||
import audio.AudioPanel;
|
||||
import audio.broadcast.BroadcastModel;
|
||||
import audio.broadcast.BroadcastPanel;
|
||||
import audio.broadcast.BroadcastStatusPanel;
|
||||
import channel.metadata.ChannelMetadataViewer;
|
||||
import com.jidesoft.swing.JideTabbedPane;
|
||||
import controller.channel.ChannelController;
|
||||
@@ -34,6 +35,7 @@ import icon.IconManager;
|
||||
import map.MapPanel;
|
||||
import map.MapService;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import properties.SystemProperties;
|
||||
import settings.SettingsManager;
|
||||
import source.SourceManager;
|
||||
import source.tuner.TunerModel;
|
||||
@@ -54,6 +56,7 @@ public class ControllerPanel extends JPanel
|
||||
private ChannelModel mChannelModel;
|
||||
private MapPanel mMapPanel;
|
||||
private TunerViewPanel mTunerManagerPanel;
|
||||
private BroadcastModel mBroadcastModel;
|
||||
|
||||
private JideTabbedPane mTabbedPane;
|
||||
protected JTable mChannelActivityTable = new JTable();
|
||||
@@ -70,6 +73,7 @@ public class ControllerPanel extends JPanel
|
||||
SourceManager sourceManager,
|
||||
TunerModel tunerModel)
|
||||
{
|
||||
mBroadcastModel = broadcastModel;
|
||||
mChannelModel = channelModel;
|
||||
|
||||
mAudioPanel = new AudioPanel(iconManager, settingsManager, sourceManager, audioManager);
|
||||
@@ -91,7 +95,7 @@ public class ControllerPanel extends JPanel
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[]0[grow,fill]"));
|
||||
setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[]0[grow,fill]0[]"));
|
||||
|
||||
add(mAudioPanel, "wrap");
|
||||
|
||||
@@ -109,6 +113,6 @@ public class ControllerPanel extends JPanel
|
||||
//Set preferred size to influence the split between these panels
|
||||
mTabbedPane.setPreferredSize(new Dimension(880, 500));
|
||||
|
||||
add(mTabbedPane);
|
||||
add(mTabbedPane,"wrap");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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
|
||||
@@ -14,20 +14,20 @@
|
||||
*
|
||||
* 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 controller.channel;
|
||||
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
import module.decode.DecoderType;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import module.decode.DecoderType;
|
||||
import controller.channel.Channel.ChannelType;
|
||||
import controller.channel.ChannelEvent.Event;
|
||||
|
||||
/**
|
||||
* Channel Model
|
||||
*/
|
||||
@@ -35,6 +35,17 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final int COLUMN_ENABLED = 0;
|
||||
public static final int COLUMN_SYSTEM = 1;
|
||||
public static final int COLUMN_SITE = 2;
|
||||
public static final int COLUMN_NAME = 3;
|
||||
public static final int COLUMN_ALIAS_LIST = 4;
|
||||
public static final int COLUMN_SOURCE = 5;
|
||||
public static final int COLUMN_DECODER = 6;
|
||||
|
||||
private static final String[] COLUMN_NAMES = new String[] {"Enabled", "System", "Site", "Name", "Alias List",
|
||||
"Source", "Decoder"};
|
||||
|
||||
private List<Channel> mChannels = new CopyOnWriteArrayList<>();
|
||||
private List<Channel> mTrafficChannels = new CopyOnWriteArrayList<>();
|
||||
private List<ChannelEventListener> mListeners = new CopyOnWriteArrayList<>();
|
||||
@@ -53,7 +64,7 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
|
||||
public Channel getChannelAtIndex(int row)
|
||||
{
|
||||
if( mChannels.size() >= row )
|
||||
if(row < mChannels.size())
|
||||
{
|
||||
return mChannels.get(row);
|
||||
}
|
||||
@@ -222,7 +233,6 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
*
|
||||
* @param start frequency of the range
|
||||
* @param stop frequency of the range
|
||||
*
|
||||
* @return list of channels or an empty list if none fall within the range
|
||||
*/
|
||||
public List<Channel> getChannelsInFrequencyRange(long start, long stop)
|
||||
@@ -268,26 +278,15 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return 6;
|
||||
return COLUMN_NAMES.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex)
|
||||
{
|
||||
switch( columnIndex )
|
||||
if(columnIndex < COLUMN_NAMES.length)
|
||||
{
|
||||
case 0:
|
||||
return "System";
|
||||
case 1:
|
||||
return "Site";
|
||||
case 2:
|
||||
return "Name";
|
||||
case 3:
|
||||
return "Alias List";
|
||||
case 4:
|
||||
return "Source";
|
||||
case 5:
|
||||
return "Decoder";
|
||||
return COLUMN_NAMES[columnIndex];
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -312,19 +311,20 @@ public class ChannelModel extends AbstractTableModel implements IChannelEventBro
|
||||
|
||||
switch(columnIndex)
|
||||
{
|
||||
case 0:
|
||||
case COLUMN_ENABLED:
|
||||
return channel.getEnabled() ? "Enabled" : null;
|
||||
case COLUMN_SYSTEM:
|
||||
return channel.getSystem();
|
||||
case 1:
|
||||
case COLUMN_SITE:
|
||||
return channel.getSite();
|
||||
case 2:
|
||||
case COLUMN_NAME:
|
||||
return channel.getName();
|
||||
case 3:
|
||||
case COLUMN_ALIAS_LIST:
|
||||
return channel.getAliasListName();
|
||||
case 4:
|
||||
case COLUMN_SOURCE:
|
||||
return channel.getSourceConfiguration().getDescription();
|
||||
case 5:
|
||||
return channel.getDecodeConfiguration()
|
||||
.getDecoderType().getShortDisplayString();
|
||||
case COLUMN_DECODER:
|
||||
return channel.getDecodeConfiguration().getDecoderType().getShortDisplayString();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -21,6 +21,7 @@ import alias.AliasModel;
|
||||
import alias.action.AliasActionManager;
|
||||
import audio.AudioManager;
|
||||
import audio.broadcast.BroadcastModel;
|
||||
import audio.broadcast.BroadcastStatusPanel;
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
import controller.ControllerPanel;
|
||||
import controller.ThreadPoolManager;
|
||||
@@ -65,12 +66,17 @@ import java.util.concurrent.TimeUnit;
|
||||
public class SDRTrunk implements Listener<TunerEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(SDRTrunk.class);
|
||||
private static final String PROPERTY_BROADCAST_STATUS_VISIBLE = "main.broadcast.status.visible";
|
||||
private boolean mBroadcastStatusVisible;
|
||||
|
||||
private IconManager mIconManager;
|
||||
private BroadcastStatusPanel mBroadcastStatusPanel;
|
||||
private BroadcastModel mBroadcastModel;
|
||||
private ControllerPanel mControllerPanel;
|
||||
private SettingsManager mSettingsManager;
|
||||
private SpectralDisplayPanel mSpectralPanel;
|
||||
private JFrame mMainGui = new JFrame();
|
||||
private JideSplitPane mSplitPane;
|
||||
|
||||
private String mTitle;
|
||||
|
||||
@@ -139,14 +145,14 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
AudioManager audioManager = new AudioManager(threadPoolManager, sourceManager.getMixerManager());
|
||||
channelProcessingManager.addAudioPacketListener(audioManager);
|
||||
|
||||
BroadcastModel broadcastModel = new BroadcastModel(threadPoolManager, mIconManager);
|
||||
mBroadcastModel = new BroadcastModel(threadPoolManager, mIconManager);
|
||||
|
||||
channelProcessingManager.addAudioPacketListener(broadcastModel);
|
||||
channelProcessingManager.addAudioPacketListener(mBroadcastModel);
|
||||
|
||||
MapService mapService = new MapService(mIconManager);
|
||||
channelProcessingManager.addMessageListener(mapService);
|
||||
|
||||
mControllerPanel = new ControllerPanel(audioManager, aliasModel, broadcastModel,
|
||||
mControllerPanel = new ControllerPanel(audioManager, aliasModel, mBroadcastModel,
|
||||
channelModel, channelMapModel, channelProcessingManager, mIconManager,
|
||||
mapService, mSettingsManager, sourceManager, tunerModel);
|
||||
|
||||
@@ -160,7 +166,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
tunerModel.addListener(this);
|
||||
|
||||
PlaylistManager playlistManager = new PlaylistManager(threadPoolManager,
|
||||
aliasModel, broadcastModel, channelModel, channelMapModel);
|
||||
aliasModel, mBroadcastModel, channelModel, channelMapModel);
|
||||
|
||||
playlistManager.init();
|
||||
|
||||
@@ -209,9 +215,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
*/
|
||||
private void initGUI()
|
||||
{
|
||||
mMainGui.setLayout(new MigLayout("insets 0 0 0 0 ",
|
||||
"[grow,fill]",
|
||||
"[grow,fill]"));
|
||||
mMainGui.setLayout(new MigLayout("insets 0 0 0 0 ", "[grow,fill]", "[grow,fill]"));
|
||||
|
||||
/**
|
||||
* Setup main JFrame window
|
||||
@@ -225,12 +229,20 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
mSpectralPanel.setPreferredSize(new Dimension(1280, 300));
|
||||
mControllerPanel.setPreferredSize(new Dimension(1280, 500));
|
||||
|
||||
JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
||||
splitPane.setDividerSize(5);
|
||||
splitPane.add(mSpectralPanel);
|
||||
splitPane.add(mControllerPanel);
|
||||
mSplitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT);
|
||||
mSplitPane.setDividerSize(5);
|
||||
mSplitPane.add(mSpectralPanel);
|
||||
mSplitPane.add(mControllerPanel);
|
||||
|
||||
mMainGui.add(splitPane, "cell 0 0,span,grow");
|
||||
mBroadcastStatusVisible = SystemProperties.getInstance().get(PROPERTY_BROADCAST_STATUS_VISIBLE, false);
|
||||
|
||||
//Show broadcast status panel when user requests - disabled by default
|
||||
if(mBroadcastStatusVisible)
|
||||
{
|
||||
mSplitPane.add(getBroadcastStatusPanel());
|
||||
}
|
||||
|
||||
mMainGui.add(mSplitPane, "cell 0 0,span,grow");
|
||||
|
||||
/**
|
||||
* Menu items
|
||||
@@ -291,6 +303,12 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
|
||||
fileMenu.add(exitMenu);
|
||||
|
||||
JMenu viewMenu = new JMenu("View");
|
||||
|
||||
viewMenu.add(new BroadcastStatusVisibleMenuItem(mControllerPanel));
|
||||
|
||||
menuBar.add(viewMenu);
|
||||
|
||||
JMenuItem screenCaptureItem = new JMenuItem("Screen Capture");
|
||||
|
||||
screenCaptureItem.setMnemonic(KeyEvent.VK_C);
|
||||
@@ -360,6 +378,50 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
menuBar.add(screenCaptureItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lazy constructor for broadcast status panel
|
||||
*/
|
||||
private BroadcastStatusPanel getBroadcastStatusPanel()
|
||||
{
|
||||
if(mBroadcastStatusPanel == null)
|
||||
{
|
||||
mBroadcastStatusPanel = new BroadcastStatusPanel(mBroadcastModel);
|
||||
mBroadcastStatusPanel.setPreferredSize(new Dimension(880, 100));
|
||||
mBroadcastStatusPanel.getTable().setEnabled(false);
|
||||
}
|
||||
|
||||
return mBroadcastStatusPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles visibility of the broadcast channels status panel at the bottom of the controller panel
|
||||
*/
|
||||
private void toggleBroadcastStatusPanelVisibility()
|
||||
{
|
||||
mBroadcastStatusVisible = !mBroadcastStatusVisible;
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(mBroadcastStatusVisible)
|
||||
{
|
||||
mSplitPane.add(getBroadcastStatusPanel());
|
||||
}
|
||||
else
|
||||
{
|
||||
mSplitPane.remove(getBroadcastStatusPanel());
|
||||
}
|
||||
|
||||
mMainGui.revalidate();
|
||||
}
|
||||
});
|
||||
|
||||
SystemProperties.getInstance().set(PROPERTY_BROADCAST_STATUS_VISIBLE, mBroadcastStatusVisible);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads the application properties file from the user's home directory,
|
||||
* creating the properties file for the first-time, if necessary
|
||||
@@ -435,4 +497,28 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
mMainGui.setTitle(mTitle + " - " + event.getTuner().getName());
|
||||
}
|
||||
}
|
||||
|
||||
public class BroadcastStatusVisibleMenuItem extends JCheckBoxMenuItem
|
||||
{
|
||||
private ControllerPanel mControllerPanel;
|
||||
|
||||
public BroadcastStatusVisibleMenuItem(ControllerPanel controllerPanel)
|
||||
{
|
||||
super("Show Streaming Status");
|
||||
|
||||
mControllerPanel = controllerPanel;
|
||||
|
||||
setSelected(mBroadcastStatusPanel != null);
|
||||
|
||||
addActionListener(new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
toggleBroadcastStatusPanelVisibility();
|
||||
setSelected(mBroadcastStatusVisible);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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
|
||||
@@ -14,6 +14,7 @@
|
||||
*
|
||||
* 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 properties;
|
||||
|
||||
@@ -33,24 +34,27 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* SystemProperties - provides an isolated instance of properties for the
|
||||
* application
|
||||
* SystemProperties - provides an isolated instance of properties for the application
|
||||
*/
|
||||
|
||||
public class SystemProperties
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger(SystemProperties.class);
|
||||
private final static Logger mLog = LoggerFactory.getLogger(SystemProperties.class);
|
||||
|
||||
private static String sDEFAULT_APP_ROOT = "SDRTrunk";
|
||||
private static String sPROPERTIES_FILENAME = "SDRTrunk.properties";
|
||||
private static String DEFAULT_APP_ROOT = "SDRTrunk";
|
||||
private static String PROPERTIES_FILENAME = "SDRTrunk.properties";
|
||||
|
||||
private static SystemProperties mInstance;
|
||||
private static SystemProperties INSTANCE;
|
||||
private static Properties mProperties;
|
||||
private Path mPropertiesPath;
|
||||
private String mApplicationName;
|
||||
private AtomicBoolean mSavePending = new AtomicBoolean();
|
||||
private ScheduledExecutorService mScheduledExecutorService;
|
||||
|
||||
private SystemProperties()
|
||||
{
|
||||
@@ -64,50 +68,27 @@ public class SystemProperties
|
||||
*/
|
||||
public static SystemProperties getInstance()
|
||||
{
|
||||
if(mInstance == null)
|
||||
if(INSTANCE == null)
|
||||
{
|
||||
mInstance = new SystemProperties();
|
||||
INSTANCE = new SystemProperties();
|
||||
}
|
||||
|
||||
return mInstance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves any currently changed settings to the application properties file
|
||||
*/
|
||||
public void save()
|
||||
private void save()
|
||||
{
|
||||
Path propsPath =
|
||||
getApplicationRootPath().resolve(sPROPERTIES_FILENAME);
|
||||
if(mSavePending.compareAndSet(false, true))
|
||||
{
|
||||
if(mScheduledExecutorService == null)
|
||||
{
|
||||
mScheduledExecutorService = Executors.newScheduledThreadPool(1);
|
||||
}
|
||||
|
||||
OutputStream out = null;
|
||||
|
||||
try
|
||||
{
|
||||
out = new FileOutputStream(propsPath.toString());
|
||||
|
||||
String comments =
|
||||
"SDRTrunk - SDR Trunking Decoder Application Settings";
|
||||
|
||||
mProperties.store(out, comments);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
mLog.error("SystemProperties - exception while saving " +
|
||||
"application properties", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(out != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
mScheduledExecutorService.schedule(new SavePropertiesTask(), 2, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,12 +101,12 @@ public class SystemProperties
|
||||
{
|
||||
Path retVal = null;
|
||||
|
||||
String root = get("root.directory", sDEFAULT_APP_ROOT);
|
||||
String root = get("root.directory", DEFAULT_APP_ROOT);
|
||||
|
||||
if(root.equalsIgnoreCase(sDEFAULT_APP_ROOT))
|
||||
if(root.equalsIgnoreCase(DEFAULT_APP_ROOT))
|
||||
{
|
||||
retVal = Paths.get(
|
||||
System.getProperty("user.home"), sDEFAULT_APP_ROOT);
|
||||
System.getProperty("user.home"), DEFAULT_APP_ROOT);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -147,8 +128,7 @@ public class SystemProperties
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
mLog.error("SystemProperties - exception while creating " +
|
||||
"app folder [" + folder + "]", e);
|
||||
mLog.error("SystemProperties - exception while creating app folder [" + folder + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +149,6 @@ public class SystemProperties
|
||||
|
||||
/**
|
||||
* Loads the properties file into this properties set
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
public void load(Path propertiesPath)
|
||||
{
|
||||
@@ -178,44 +156,20 @@ public class SystemProperties
|
||||
{
|
||||
mPropertiesPath = propertiesPath;
|
||||
|
||||
InputStream in = null;
|
||||
|
||||
try
|
||||
if(Files.exists(mPropertiesPath))
|
||||
{
|
||||
in = new FileInputStream(propertiesPath.toString());
|
||||
}
|
||||
catch(FileNotFoundException e)
|
||||
{
|
||||
mLog.error("SDRTrunk - exception while opening inputstream on " +
|
||||
"application properties file", e);
|
||||
}
|
||||
|
||||
if(in != null)
|
||||
{
|
||||
try
|
||||
try(InputStream in = new FileInputStream(propertiesPath.toString()))
|
||||
{
|
||||
mProperties.load(in);
|
||||
}
|
||||
catch(IOException e)
|
||||
catch(IOException ioe)
|
||||
{
|
||||
mLog.error("SDRTrunk - exception while loading properties " +
|
||||
"inputstream into SystemProperties", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
}
|
||||
mLog.error("Error loading system properties file", ioe.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mLog.info("SystemProperties - loaded [" +
|
||||
propertiesPath.toString() + "]");
|
||||
mLog.info("SystemProperties - loaded [" + propertiesPath.toString() + "]");
|
||||
}
|
||||
|
||||
public String getApplicationName()
|
||||
@@ -339,6 +293,22 @@ public class SystemProperties
|
||||
save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (overrides) the property key with the new boolean value
|
||||
*/
|
||||
public void set(String key, boolean value)
|
||||
{
|
||||
set(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (overrides) the property key with the new integer value
|
||||
*/
|
||||
public void set(String key, int value)
|
||||
{
|
||||
set(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the named color property, storing the default value in properties file if it doesn't exist.
|
||||
*
|
||||
@@ -362,4 +332,25 @@ public class SystemProperties
|
||||
return new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha);
|
||||
}
|
||||
|
||||
public class SavePropertiesTask implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(mSavePending.compareAndSet(true, false))
|
||||
{
|
||||
Path propsPath = getApplicationRootPath().resolve(PROPERTIES_FILENAME);
|
||||
|
||||
try(OutputStream out = new FileOutputStream(propsPath.toString()))
|
||||
{
|
||||
String comments = "SDRTrunk - SDR Trunking Decoder Application Settings";
|
||||
mProperties.store(out, comments);
|
||||
}
|
||||
catch(IOException ioe)
|
||||
{
|
||||
mLog.error("Error saving system properties file [" + propsPath.toString() + "]", ioe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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
|
||||
@@ -14,9 +14,25 @@
|
||||
*
|
||||
* 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 spectrum;
|
||||
|
||||
import controller.NamingThreadFactory;
|
||||
import dsp.filter.Window;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import org.jtransforms.fft.FloatFFT_1D;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import properties.SystemProperties;
|
||||
import sample.Buffer;
|
||||
import sample.Listener;
|
||||
import sample.SampleType;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
import spectrum.converter.DFTResultsConverter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
@@ -27,35 +43,15 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.jtransforms.fft.FloatFFT_1D;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import properties.SystemProperties;
|
||||
import sample.Buffer;
|
||||
import sample.Listener;
|
||||
import sample.SampleType;
|
||||
import sample.complex.ComplexBuffer;
|
||||
import source.tuner.frequency.FrequencyChangeEvent;
|
||||
import source.tuner.frequency.IFrequencyChangeProcessor;
|
||||
import spectrum.converter.DFTResultsConverter;
|
||||
import controller.NamingThreadFactory;
|
||||
import dsp.filter.Window;
|
||||
import dsp.filter.Window.WindowType;
|
||||
|
||||
/**
|
||||
* Processes both complex samples or float samples and dispatches a float array
|
||||
* of DFT results, using configurable fft size and output dispatch timelines.
|
||||
*/
|
||||
public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
IFrequencyChangeProcessor,
|
||||
IDFTWidthChangeProcessor
|
||||
public class DFTProcessor implements Listener<ComplexBuffer>, IFrequencyChangeProcessor, IDFTWidthChangeProcessor
|
||||
{
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( DFTProcessor.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(DFTProcessor.class);
|
||||
|
||||
private CopyOnWriteArrayList<DFTResultsConverter> mListeners =
|
||||
new CopyOnWriteArrayList<DFTResultsConverter>();
|
||||
private CopyOnWriteArrayList<DFTResultsConverter> mListeners = new CopyOnWriteArrayList<DFTResultsConverter>();
|
||||
|
||||
//Fixed size sample queue. We set the size at 12 based on the highest
|
||||
//sample rate tuner (10 MHz) producing 153 frames per second and the lowest
|
||||
@@ -65,7 +61,7 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
private BlockingQueue<ComplexBuffer> mQueue = new ArrayBlockingQueue<>(12);
|
||||
|
||||
private ScheduledExecutorService mScheduler = Executors
|
||||
.newScheduledThreadPool( 1, new NamingThreadFactory( "spectrum dft" ) );
|
||||
.newScheduledThreadPool(1, new NamingThreadFactory("spectrum dft processor"));
|
||||
|
||||
public static final String FRAME_RATE_PROPERTY = "spectral.display.frame.rate";
|
||||
|
||||
@@ -97,16 +93,9 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
public DFTProcessor(SampleType sampleType)
|
||||
{
|
||||
setSampleType(sampleType);
|
||||
setFrameRate( 20 );
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
private void loadSettings()
|
||||
{
|
||||
int frameRate = SystemProperties.getInstance().get( FRAME_RATE_PROPERTY, 20 );
|
||||
|
||||
setFrameRate( frameRate );
|
||||
mFrameRate = SystemProperties.getInstance().get(FRAME_RATE_PROPERTY, 20);
|
||||
calculateConsumptionRate();
|
||||
start();
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -130,13 +119,11 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
|
||||
if(mSampleType == SampleType.COMPLEX)
|
||||
{
|
||||
mWindow = Window.getWindow( mWindowType,
|
||||
mDFTSize.getSize() * 2 );
|
||||
mWindow = Window.getWindow(mWindowType, mDFTSize.getSize() * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
mWindow = Window.getWindow( mWindowType,
|
||||
mDFTSize.getSize() );
|
||||
mWindow = Window.getWindow(mWindowType, mDFTSize.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,9 +175,7 @@ public class DFTProcessor implements Listener<ComplexBuffer>,
|
||||
|
||||
mFrameRate = framesPerSecond;
|
||||
|
||||
SystemProperties properties = SystemProperties.getInstance();
|
||||
|
||||
properties.set( FRAME_RATE_PROPERTY, String.valueOf( mFrameRate ) );
|
||||
SystemProperties.getInstance().set(FRAME_RATE_PROPERTY, mFrameRate);
|
||||
|
||||
calculateConsumptionRate();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*******************************************************************************
|
||||
* SDR Trunk
|
||||
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||
* sdrtrunk
|
||||
* Copyright (C) 2014-2017 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
|
||||
@@ -14,45 +14,21 @@
|
||||
*
|
||||
* 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 spectrum;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.ChannelUtils;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.smoothing.SmoothingFilter.SmoothingType;
|
||||
import module.decode.DecoderType;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import properties.SystemProperties;
|
||||
import sample.Listener;
|
||||
import sample.SampleType;
|
||||
@@ -74,24 +50,26 @@ import spectrum.menu.FrameRateItem;
|
||||
import spectrum.menu.SmoothingItem;
|
||||
import spectrum.menu.SmoothingTypeItem;
|
||||
|
||||
import com.jidesoft.swing.JideSplitPane;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.MouseInputAdapter;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import controller.channel.Channel;
|
||||
import controller.channel.ChannelModel;
|
||||
import controller.channel.ChannelProcessingManager;
|
||||
import controller.channel.ChannelUtils;
|
||||
import dsp.filter.Window.WindowType;
|
||||
import dsp.filter.smoothing.SmoothingFilter.SmoothingType;
|
||||
|
||||
public class SpectralDisplayPanel extends JPanel
|
||||
implements Listener<ComplexBuffer>,
|
||||
IFrequencyChangeProcessor,
|
||||
IDFTWidthChangeProcessor
|
||||
public class SpectralDisplayPanel extends JPanel implements Listener<ComplexBuffer>, IFrequencyChangeProcessor, IDFTWidthChangeProcessor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger mLog =
|
||||
LoggerFactory.getLogger( SpectralDisplayPanel.class );
|
||||
private final static Logger mLog = LoggerFactory.getLogger(SpectralDisplayPanel.class);
|
||||
|
||||
private static DecimalFormat sCURSOR_FORMAT = new DecimalFormat("000.00000");
|
||||
|
||||
@@ -169,7 +147,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
size = DFTSize.FFT04096;
|
||||
}
|
||||
|
||||
setDFTSize( size );
|
||||
setDFTSize(size, false);
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -202,19 +180,25 @@ public class SpectralDisplayPanel extends JPanel
|
||||
* Queues an FFT size change request. The scheduled executor will apply
|
||||
* the change when it runs.
|
||||
*/
|
||||
public void setDFTSize( DFTSize size )
|
||||
public void setDFTSize(DFTSize size, boolean save)
|
||||
{
|
||||
mDFTProcessor.setDFTSize(size);
|
||||
mOverlayPanel.setDFTSize(size);
|
||||
mDFTSize = size;
|
||||
|
||||
SystemProperties properties = SystemProperties.getInstance();
|
||||
|
||||
properties.set( FFT_SIZE_PROPERTY, size.name() );
|
||||
if(save)
|
||||
{
|
||||
SystemProperties.getInstance().set(FFT_SIZE_PROPERTY, size.name());
|
||||
}
|
||||
|
||||
setZoom(0, 0, 0);
|
||||
}
|
||||
|
||||
public void setDFTSize(DFTSize size)
|
||||
{
|
||||
setDFTSize(size, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DFTSize getDFTSize()
|
||||
{
|
||||
@@ -316,6 +300,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
/**
|
||||
* Calculates the overall offset of the frequency from the current minimum
|
||||
* frequency in terms of total FFT width
|
||||
*
|
||||
* @param frequency
|
||||
* @return
|
||||
*/
|
||||
@@ -488,11 +473,19 @@ public class SpectralDisplayPanel extends JPanel
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden( ComponentEvent arg0 ) {}
|
||||
public void componentHidden(ComponentEvent arg0)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved( ComponentEvent arg0 ) {}
|
||||
public void componentMoved(ComponentEvent arg0)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown( ComponentEvent arg0 ) {}
|
||||
public void componentShown(ComponentEvent arg0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,6 +544,7 @@ public class SpectralDisplayPanel extends JPanel
|
||||
|
||||
setZoomWindowOffset(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user