mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Merges #34 Major redesign of Tuner, Channel and Alias management.
Changes to model, view and controller components and updates all gui editors. Removes the configuration panel and tree and replaces with 3 new panels. Updates playlist.xml to a new playlist_v2.xml format.
This commit is contained in:
@@ -58,6 +58,5 @@ public class CallEventLogger extends EventLogger implements ICallEventListener,
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +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 <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import module.log.config.EventLogConfiguration;
|
||||
import controller.channel.AbstractChannelEditor;
|
||||
import controller.channel.ChannelNode;
|
||||
|
||||
public class EventLogComponentEditor extends AbstractChannelEditor
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JCheckBox mBinaryLogger = new JCheckBox( "Binary Messages" );
|
||||
private JCheckBox mDecodedLogger = new JCheckBox( "Decoded Messages" );
|
||||
private JCheckBox mCallEventLogger = new JCheckBox( "Call Events" );
|
||||
|
||||
public EventLogComponentEditor( ChannelNode channelNode )
|
||||
{
|
||||
super( channelNode );
|
||||
|
||||
add( mBinaryLogger, "span" );
|
||||
add( mDecodedLogger, "span" );
|
||||
add( mCallEventLogger, "span" );
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the combo box to the type stored in the config object, causing the
|
||||
* editor panel to reset with the stored config
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
final List<EventLogType> mLoggers = mChannelNode.getChannel()
|
||||
.getEventLogConfiguration().getLoggers();
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mBinaryLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.BINARY_MESSAGE ) );
|
||||
mDecodedLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.DECODED_MESSAGE ) );
|
||||
mCallEventLogger.setSelected(
|
||||
mLoggers.contains( EventLogType.CALL_EVENT ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current configuration as the stored configuration
|
||||
*/
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
EventLogConfiguration config = mChannelNode.getChannel()
|
||||
.getEventLogConfiguration();
|
||||
|
||||
config.clear();
|
||||
|
||||
if( mBinaryLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.BINARY_MESSAGE );
|
||||
}
|
||||
|
||||
if( mDecodedLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.DECODED_MESSAGE );
|
||||
}
|
||||
if( mCallEventLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.CALL_EVENT );
|
||||
}
|
||||
}
|
||||
}
|
||||
152
src/module/log/EventLogConfigurationEditor.java
Normal file
152
src/module/log/EventLogConfigurationEditor.java
Normal file
@@ -0,0 +1,152 @@
|
||||
/*******************************************************************************
|
||||
* 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 <http://www.gnu.org/licenses/>
|
||||
******************************************************************************/
|
||||
package module.log;
|
||||
|
||||
import gui.editor.Editor;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
import module.log.config.EventLogConfiguration;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import controller.channel.Channel;
|
||||
|
||||
public class EventLogConfigurationEditor extends Editor<Channel>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private JCheckBox mBinaryLogger;
|
||||
private JCheckBox mDecodedLogger;
|
||||
private JCheckBox mCallEventLogger;
|
||||
|
||||
public EventLogConfigurationEditor()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
setLayout( new MigLayout( "fill,wrap 4", "", "[][grow]" ) );
|
||||
|
||||
mBinaryLogger = new JCheckBox( "Binary Messages" );
|
||||
mBinaryLogger.setEnabled( false );
|
||||
mBinaryLogger.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
add( mBinaryLogger );
|
||||
|
||||
mDecodedLogger = new JCheckBox( "Decoded Messages" );
|
||||
mDecodedLogger.setEnabled( false );
|
||||
mDecodedLogger.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
add( mDecodedLogger );
|
||||
|
||||
mCallEventLogger = new JCheckBox( "Call Events" );
|
||||
mCallEventLogger.setEnabled( false );
|
||||
mCallEventLogger.addActionListener( new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
setModified( true );
|
||||
}
|
||||
} );
|
||||
add( mCallEventLogger );
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the current configuration as the stored configuration
|
||||
*/
|
||||
@Override
|
||||
public void save()
|
||||
{
|
||||
if( hasItem() )
|
||||
{
|
||||
EventLogConfiguration config = getItem().getEventLogConfiguration();
|
||||
|
||||
config.clear();
|
||||
|
||||
if( mBinaryLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.BINARY_MESSAGE );
|
||||
}
|
||||
if( mDecodedLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.DECODED_MESSAGE );
|
||||
}
|
||||
if( mCallEventLogger.isSelected() )
|
||||
{
|
||||
config.addLogger( EventLogType.CALL_EVENT );
|
||||
}
|
||||
}
|
||||
|
||||
setModified( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem( Channel channel )
|
||||
{
|
||||
super.setItem( channel );
|
||||
|
||||
if( hasItem() )
|
||||
{
|
||||
setControlsEnabled( true );
|
||||
|
||||
List<EventLogType> loggers = getItem().getEventLogConfiguration().getLoggers();
|
||||
mBinaryLogger.setSelected( loggers.contains( EventLogType.BINARY_MESSAGE ) );
|
||||
mDecodedLogger.setSelected( loggers.contains( EventLogType.DECODED_MESSAGE ) );
|
||||
mCallEventLogger.setSelected( loggers.contains( EventLogType.CALL_EVENT ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
setControlsEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
private void setControlsEnabled( boolean enabled )
|
||||
{
|
||||
if( mBinaryLogger.isEnabled() != enabled )
|
||||
{
|
||||
mBinaryLogger.setEnabled( enabled );
|
||||
}
|
||||
|
||||
if( mDecodedLogger.isEnabled() != enabled )
|
||||
{
|
||||
mDecodedLogger.setEnabled( enabled );
|
||||
}
|
||||
|
||||
if( mCallEventLogger.isEnabled() != enabled )
|
||||
{
|
||||
mCallEventLogger.setEnabled( enabled );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,16 +24,10 @@ import java.util.List;
|
||||
import module.Module;
|
||||
import module.log.MessageEventLogger.Type;
|
||||
import module.log.config.EventLogConfiguration;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import properties.SystemProperties;
|
||||
|
||||
public class EventLogManager
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger( EventLogManager.class );
|
||||
|
||||
private Path mDirectory;
|
||||
|
||||
public EventLogManager()
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import module.Module;
|
||||
|
||||
@@ -67,7 +68,8 @@ public abstract class EventLogger extends Module
|
||||
|
||||
public abstract String getHeader();
|
||||
|
||||
public void start()
|
||||
@Override
|
||||
public void start( ScheduledExecutorService executor )
|
||||
{
|
||||
if( mLogFile == null )
|
||||
{
|
||||
|
||||
@@ -58,7 +58,6 @@ public class MessageEventLogger extends EventLogger implements
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user