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:
denny
2016-04-01 08:23:49 -04:00
450 changed files with 19560 additions and 22805 deletions

View File

@@ -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
@@ -17,21 +17,29 @@
******************************************************************************/
package controller.channel.map;
import java.text.DecimalFormat;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement
@XmlType( name = "range" )
public class ChannelRange
{
private static final DecimalFormat FREQUENCY_FORMATTER = new DecimalFormat( "#.0000" );
private int mFirst = 1;
private int mLast = 1023;
private int mBase = 450000000;
private int mSize = 12500;
private boolean mOverlapping = false;
/* JAXB requirement - do not remove */
public ChannelRange() {}
public ChannelRange()
{
}
public ChannelRange( int first, int last, int base, int size )
{
@@ -46,11 +54,67 @@ public class ChannelRange
return new ChannelRange( mFirst, mLast, mBase, mSize );
}
public String getDescription()
{
StringBuilder sb = new StringBuilder();
if( isValid() )
{
sb.append( "First: " );
sb.append( mFirst + "=" );
long frequency = getFrequency( mFirst );
sb.append( FREQUENCY_FORMATTER.format( (double)frequency / 1E6D ) );
sb.append( " Last: " );
sb.append( mLast + "=" );
frequency = getFrequency( mLast );
sb.append( FREQUENCY_FORMATTER.format( (double)frequency / 1E6D ) );
sb.append( " MHz" );
}
else
{
sb.append( "First channel must be smaller than last channel" );
}
if( isOverlapping() )
{
if( sb.length() > 0 )
{
sb.append( ", " );
}
sb.append( "Overlap!" );
}
return sb.toString();
}
public boolean isValid()
{
return mFirst < mLast;
}
public boolean overlaps( ChannelRange other )
{
return ( mFirst <= other.mFirst && other.mFirst <= mLast ) ||
( mFirst <= other.mLast && other.mLast <= mLast ) ||
( mFirst <= other.mFirst && other.mLast <= mLast ) ||
( other.mFirst <= mFirst && mLast <= other.mLast );
}
@XmlTransient
public boolean isOverlapping()
{
return mOverlapping;
}
public void setOverlapping( boolean overlapping )
{
mOverlapping = overlapping;
}
public boolean hasChannel( int channel )
{
return mFirst <= channel && channel <= mLast;