mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Updates PlaylistManager to use faster jackson XML serialization.
Removes native xml.bind serialization for improved compatibility with Java 9. Global optimize imports on the entire project.
This commit is contained in:
@@ -1,190 +1,192 @@
|
||||
/*******************************************************************************
|
||||
* 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 io.github.dsheirer.settings;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@JsonSubTypes.Type(value = ColorSetting.class, name = "colorSetting")
|
||||
public class ColorSetting extends Setting
|
||||
{
|
||||
@SuppressWarnings( "unused" )
|
||||
private static final int NO_TRANSLUCENCY = 255;
|
||||
private static final int SPECTRUM_TRANSLUCENCY = 128;
|
||||
private static final int CONFIG_TRANSLUCENCY = 60;
|
||||
private static final int NO_TRANSLUCENCY = 255;
|
||||
private static final int SPECTRUM_TRANSLUCENCY = 128;
|
||||
private static final int CONFIG_TRANSLUCENCY = 60;
|
||||
|
||||
private String mRGB;
|
||||
private int mAlpha;
|
||||
private ColorSettingName mColorSettingName = ColorSettingName.UNKNOWN;
|
||||
|
||||
public ColorSetting()
|
||||
{
|
||||
setColor( mColorSettingName.getDefaultColor() );
|
||||
}
|
||||
|
||||
public ColorSetting( ColorSettingName name )
|
||||
{
|
||||
setColor( name.getDefaultColor() );
|
||||
setColorSettingName( name );
|
||||
}
|
||||
private String mRGB;
|
||||
private int mAlpha;
|
||||
private ColorSettingName mColorSettingName = ColorSettingName.UNKNOWN;
|
||||
|
||||
@XmlAttribute
|
||||
public ColorSettingName getColorSettingName()
|
||||
{
|
||||
return mColorSettingName;
|
||||
}
|
||||
|
||||
public void setColorSettingName( ColorSettingName name )
|
||||
{
|
||||
mColorSettingName = name;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public String getRgb()
|
||||
{
|
||||
return mRGB;
|
||||
}
|
||||
|
||||
public void setRgb( String value )
|
||||
{
|
||||
mRGB = value;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public int getAlpha()
|
||||
{
|
||||
return mAlpha;
|
||||
}
|
||||
|
||||
public void setAlpha( int value )
|
||||
{
|
||||
mAlpha = value;
|
||||
}
|
||||
public ColorSetting()
|
||||
{
|
||||
setColor(mColorSettingName.getDefaultColor());
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public Color getColor()
|
||||
{
|
||||
Color temp = Color.decode( mRGB );
|
||||
|
||||
return new Color( temp.getRed(),
|
||||
temp.getGreen(),
|
||||
temp.getBlue(),
|
||||
mAlpha );
|
||||
}
|
||||
|
||||
public void setColor( Color color )
|
||||
{
|
||||
mRGB = Integer.toHexString( color.getRGB() );
|
||||
mRGB = "#" + mRGB.substring( 2, mRGB.length() );
|
||||
mAlpha = color.getAlpha();
|
||||
}
|
||||
|
||||
public static Color getTranslucent( Color color, int translucency )
|
||||
{
|
||||
return new Color( color.getRed(),
|
||||
color.getGreen(),
|
||||
color.getBlue(),
|
||||
translucency );
|
||||
}
|
||||
|
||||
public enum ColorSettingName
|
||||
{
|
||||
CHANNEL_CONFIG( getTranslucent( Color.LIGHT_GRAY, CONFIG_TRANSLUCENCY ),
|
||||
"Channel", "Channel Color" ),
|
||||
CHANNEL_CONFIG_PROCESSING( getTranslucent( Color.GREEN, CONFIG_TRANSLUCENCY ),
|
||||
"Channel Processing", "Processing Channel Color" ),
|
||||
CHANNEL_CONFIG_SELECTED( getTranslucent( Color.BLUE, CONFIG_TRANSLUCENCY ),
|
||||
"Channel Selected", "Selected Channel Color" ),
|
||||
public ColorSetting(ColorSettingName name)
|
||||
{
|
||||
setColor(name.getDefaultColor());
|
||||
setColorSettingName(name);
|
||||
}
|
||||
|
||||
CHANNEL_STATE_BACKGROUND( Color.BLACK, "Background",
|
||||
"Channel State Background" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_CALL( Color.BLACK,
|
||||
"Call Gradient Top", "Channel Call State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_CALL( Color.BLUE,
|
||||
"Call Gradient Middle", "Channel Call State Gradient Middle" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_CONTROL( Color.BLACK,
|
||||
"Control Gradient Top", "Channel Control State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL( new Color( 0xC64F00 ),
|
||||
"Control Gradient Middle", "Channel Control State Gradient Middle" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_DATA( Color.BLACK,
|
||||
"Data Gradient Top", "Channel Data State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_DATA( new Color( 0xCC00CC ),
|
||||
"Data Gradient Middle", "Channel Data State Gradient Middle" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_FADE( Color.BLACK,
|
||||
"Fade Gradient Top", "Channel Fade State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_FADE( Color.DARK_GRAY,
|
||||
"Fade Gradient Middle", "Channel Fade State Gradient Middle" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_IDLE( Color.BLACK,
|
||||
"Idle Gradient Top", "Channel Idle State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_IDLE( Color.DARK_GRAY,
|
||||
"Idle Gradient Middle", "Channel Idle State Gradient Middle" ),
|
||||
CHANNEL_STATE_GRADIENT_TOP_NO_TUNER( Color.RED,
|
||||
"No Tuner Gradient Top", "Channel No Tuner State Gradient Top" ),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER( new Color( 0x990000 ),
|
||||
"No Tuner Gradient Middle", "Channel No Tuner State Gradient Middle" ),
|
||||
CHANNEL_STATE_LABEL_DETAILS( Color.LIGHT_GRAY,
|
||||
"Details", "Details Label Color" ),
|
||||
CHANNEL_STATE_LABEL_DECODER( Color.GREEN,
|
||||
"Decoder", "Decoder Label Color" ),
|
||||
CHANNEL_STATE_LABEL_AUX_DECODER( Color.YELLOW,
|
||||
"Aux Decoder", "Aux Decoder Label Color" ),
|
||||
CHANNEL_STATE_SELECTED_CHANNEL( Color.YELLOW,
|
||||
"Selected Channel Indicator", "Selected Channel Indicator Color" ),
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "colorSettingName")
|
||||
public ColorSettingName getColorSettingName()
|
||||
{
|
||||
return mColorSettingName;
|
||||
}
|
||||
|
||||
SPECTRUM_BACKGROUND( Color.BLACK,
|
||||
"Background", "Spectrum Background Color" ),
|
||||
SPECTRUM_CURSOR( Color.ORANGE,
|
||||
"Cursor", "Spectrum Cursor Color" ),
|
||||
SPECTRUM_GRADIENT_BOTTOM( getTranslucent( Color.GREEN, SPECTRUM_TRANSLUCENCY ),
|
||||
"Gradient Bottom", "Spectrum Gradient Bottom Color" ),
|
||||
SPECTRUM_GRADIENT_TOP( getTranslucent( Color.WHITE, SPECTRUM_TRANSLUCENCY ),
|
||||
"Gradient Top", "Spectrum Gradient Top Color" ),
|
||||
SPECTRUM_LINE( getTranslucent( Color.LIGHT_GRAY, SPECTRUM_TRANSLUCENCY ),
|
||||
"Line", "Spectrum Lines and Text Color" ),
|
||||
|
||||
UNKNOWN( Color.RED, "Unknown", "Unknown Setting Color" );
|
||||
public void setColorSettingName(ColorSettingName name)
|
||||
{
|
||||
mColorSettingName = name;
|
||||
}
|
||||
|
||||
private Color mDefaultColor;
|
||||
private String mLabel;
|
||||
private String mDialogTitle;
|
||||
|
||||
private ColorSettingName( Color defaultColor,
|
||||
String label,
|
||||
String dialogTitle )
|
||||
{
|
||||
mDefaultColor = defaultColor;
|
||||
mLabel = label;
|
||||
mDialogTitle = dialogTitle;
|
||||
}
|
||||
|
||||
public Color getDefaultColor()
|
||||
{
|
||||
return mDefaultColor;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String getDialogTitle()
|
||||
{
|
||||
return mDialogTitle;
|
||||
}
|
||||
}
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "rgb")
|
||||
public String getRgb()
|
||||
{
|
||||
return mRGB;
|
||||
}
|
||||
|
||||
public void setRgb(String value)
|
||||
{
|
||||
mRGB = value;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "alpha")
|
||||
public int getAlpha()
|
||||
{
|
||||
return mAlpha;
|
||||
}
|
||||
|
||||
public void setAlpha(int value)
|
||||
{
|
||||
mAlpha = value;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Color getColor()
|
||||
{
|
||||
Color temp = Color.decode(mRGB);
|
||||
|
||||
return new Color(temp.getRed(),
|
||||
temp.getGreen(),
|
||||
temp.getBlue(),
|
||||
mAlpha);
|
||||
}
|
||||
|
||||
public void setColor(Color color)
|
||||
{
|
||||
mRGB = Integer.toHexString(color.getRGB());
|
||||
mRGB = "#" + mRGB.substring(2, mRGB.length());
|
||||
mAlpha = color.getAlpha();
|
||||
}
|
||||
|
||||
public static Color getTranslucent(Color color, int translucency)
|
||||
{
|
||||
return new Color(color.getRed(),
|
||||
color.getGreen(),
|
||||
color.getBlue(),
|
||||
translucency);
|
||||
}
|
||||
|
||||
public enum ColorSettingName
|
||||
{
|
||||
CHANNEL_CONFIG(getTranslucent(Color.LIGHT_GRAY, CONFIG_TRANSLUCENCY),
|
||||
"Channel", "Channel Color"),
|
||||
CHANNEL_CONFIG_PROCESSING(getTranslucent(Color.GREEN, CONFIG_TRANSLUCENCY),
|
||||
"Channel Processing", "Processing Channel Color"),
|
||||
CHANNEL_CONFIG_SELECTED(getTranslucent(Color.BLUE, CONFIG_TRANSLUCENCY),
|
||||
"Channel Selected", "Selected Channel Color"),
|
||||
|
||||
CHANNEL_STATE_BACKGROUND(Color.BLACK, "Background",
|
||||
"Channel State Background"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_CALL(Color.BLACK,
|
||||
"Call Gradient Top", "Channel Call State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_CALL(Color.BLUE,
|
||||
"Call Gradient Middle", "Channel Call State Gradient Middle"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_CONTROL(Color.BLACK,
|
||||
"Control Gradient Top", "Channel Control State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_CONTROL(new Color(0xC64F00),
|
||||
"Control Gradient Middle", "Channel Control State Gradient Middle"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_DATA(Color.BLACK,
|
||||
"Data Gradient Top", "Channel Data State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_DATA(new Color(0xCC00CC),
|
||||
"Data Gradient Middle", "Channel Data State Gradient Middle"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_FADE(Color.BLACK,
|
||||
"Fade Gradient Top", "Channel Fade State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_FADE(Color.DARK_GRAY,
|
||||
"Fade Gradient Middle", "Channel Fade State Gradient Middle"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_IDLE(Color.BLACK,
|
||||
"Idle Gradient Top", "Channel Idle State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_IDLE(Color.DARK_GRAY,
|
||||
"Idle Gradient Middle", "Channel Idle State Gradient Middle"),
|
||||
CHANNEL_STATE_GRADIENT_TOP_NO_TUNER(Color.RED,
|
||||
"No Tuner Gradient Top", "Channel No Tuner State Gradient Top"),
|
||||
CHANNEL_STATE_GRADIENT_MIDDLE_NO_TUNER(new Color(0x990000),
|
||||
"No Tuner Gradient Middle", "Channel No Tuner State Gradient Middle"),
|
||||
CHANNEL_STATE_LABEL_DETAILS(Color.LIGHT_GRAY,
|
||||
"Details", "Details Label Color"),
|
||||
CHANNEL_STATE_LABEL_DECODER(Color.GREEN,
|
||||
"Decoder", "Decoder Label Color"),
|
||||
CHANNEL_STATE_LABEL_AUX_DECODER(Color.YELLOW,
|
||||
"Aux Decoder", "Aux Decoder Label Color"),
|
||||
CHANNEL_STATE_SELECTED_CHANNEL(Color.YELLOW,
|
||||
"Selected Channel Indicator", "Selected Channel Indicator Color"),
|
||||
|
||||
SPECTRUM_BACKGROUND(Color.BLACK,
|
||||
"Background", "Spectrum Background Color"),
|
||||
SPECTRUM_CURSOR(Color.ORANGE,
|
||||
"Cursor", "Spectrum Cursor Color"),
|
||||
SPECTRUM_GRADIENT_BOTTOM(getTranslucent(Color.GREEN, SPECTRUM_TRANSLUCENCY),
|
||||
"Gradient Bottom", "Spectrum Gradient Bottom Color"),
|
||||
SPECTRUM_GRADIENT_TOP(getTranslucent(Color.WHITE, SPECTRUM_TRANSLUCENCY),
|
||||
"Gradient Top", "Spectrum Gradient Top Color"),
|
||||
SPECTRUM_LINE(getTranslucent(Color.LIGHT_GRAY, SPECTRUM_TRANSLUCENCY),
|
||||
"Line", "Spectrum Lines and Text Color"),
|
||||
|
||||
UNKNOWN(Color.RED, "Unknown", "Unknown Setting Color");
|
||||
|
||||
private Color mDefaultColor;
|
||||
private String mLabel;
|
||||
private String mDialogTitle;
|
||||
|
||||
private ColorSettingName(Color defaultColor,
|
||||
String label,
|
||||
String dialogTitle)
|
||||
{
|
||||
mDefaultColor = defaultColor;
|
||||
mLabel = label;
|
||||
mDialogTitle = dialogTitle;
|
||||
}
|
||||
|
||||
public Color getDefaultColor()
|
||||
{
|
||||
return mDefaultColor;
|
||||
}
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return mLabel;
|
||||
}
|
||||
|
||||
public String getDialogTitle()
|
||||
{
|
||||
return mDialogTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* 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 io.github.dsheirer.settings;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
@JsonSubTypes.Type(value = FileSetting.class, name = "fileSetting")
|
||||
public class FileSetting extends Setting
|
||||
{
|
||||
private String mPath;
|
||||
|
||||
public FileSetting()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public FileSetting( String name, String path )
|
||||
{
|
||||
super( name );
|
||||
setPath( path );
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public void setPath( String value )
|
||||
{
|
||||
mPath = value;
|
||||
}
|
||||
|
||||
public File getFile()
|
||||
{
|
||||
return new File( mPath );
|
||||
}
|
||||
private String mPath;
|
||||
|
||||
public FileSetting()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public FileSetting(String name, String path)
|
||||
{
|
||||
super(name);
|
||||
setPath(path);
|
||||
}
|
||||
|
||||
public String getPath()
|
||||
{
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public void setPath(String value)
|
||||
{
|
||||
mPath = value;
|
||||
}
|
||||
|
||||
public File getFile()
|
||||
{
|
||||
return new File(mPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,80 @@
|
||||
package io.github.dsheirer.settings;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import org.jdesktop.swingx.mapviewer.GeoPosition;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@JsonSubTypes.Type(value = MapViewSetting.class, name = "mapViewSetting")
|
||||
public class MapViewSetting extends Setting
|
||||
{
|
||||
private double mLatitude;
|
||||
private double mLongitude;
|
||||
private int mZoom;
|
||||
|
||||
public MapViewSetting()
|
||||
{
|
||||
/* Empty constructor for JAXB */
|
||||
}
|
||||
|
||||
public MapViewSetting( String name, double latitude, double longitude, int zoom )
|
||||
{
|
||||
super( name );
|
||||
mLatitude = latitude;
|
||||
mLongitude = longitude;
|
||||
mZoom = zoom;
|
||||
}
|
||||
|
||||
public MapViewSetting( String name, GeoPosition position, int zoom )
|
||||
{
|
||||
super( name );
|
||||
mLatitude = position.getLatitude();
|
||||
mLongitude = position.getLongitude();
|
||||
mZoom = zoom;
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public double getLatitude()
|
||||
{
|
||||
return mLatitude;
|
||||
}
|
||||
|
||||
public void setLatitude( double latitude )
|
||||
{
|
||||
mLatitude = latitude;
|
||||
}
|
||||
private double mLatitude;
|
||||
private double mLongitude;
|
||||
private int mZoom;
|
||||
|
||||
@XmlAttribute
|
||||
public double getLongitude()
|
||||
{
|
||||
return mLongitude;
|
||||
}
|
||||
|
||||
public void setLongitude( double longitude )
|
||||
{
|
||||
mLongitude = longitude;
|
||||
}
|
||||
public MapViewSetting()
|
||||
{
|
||||
/* Empty constructor for JAXB */
|
||||
}
|
||||
|
||||
@XmlAttribute
|
||||
public int getZoom()
|
||||
{
|
||||
return mZoom;
|
||||
}
|
||||
|
||||
public void setZoom( int zoom )
|
||||
{
|
||||
mZoom = zoom;
|
||||
}
|
||||
public MapViewSetting(String name, double latitude, double longitude, int zoom)
|
||||
{
|
||||
super(name);
|
||||
mLatitude = latitude;
|
||||
mLongitude = longitude;
|
||||
mZoom = zoom;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public GeoPosition getGeoPosition()
|
||||
{
|
||||
return new GeoPosition( mLatitude, mLongitude );
|
||||
}
|
||||
|
||||
public void setGeoPosition( GeoPosition position )
|
||||
{
|
||||
mLatitude = position.getLatitude();
|
||||
mLongitude = position.getLongitude();
|
||||
}
|
||||
public MapViewSetting(String name, GeoPosition position, int zoom)
|
||||
{
|
||||
super(name);
|
||||
mLatitude = position.getLatitude();
|
||||
mLongitude = position.getLongitude();
|
||||
mZoom = zoom;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "latitude")
|
||||
public double getLatitude()
|
||||
{
|
||||
return mLatitude;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude)
|
||||
{
|
||||
mLatitude = latitude;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "longitude")
|
||||
public double getLongitude()
|
||||
{
|
||||
return mLongitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude)
|
||||
{
|
||||
mLongitude = longitude;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "zoom")
|
||||
public int getZoom()
|
||||
{
|
||||
return mZoom;
|
||||
}
|
||||
|
||||
public void setZoom(int zoom)
|
||||
{
|
||||
mZoom = zoom;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public GeoPosition getGeoPosition()
|
||||
{
|
||||
return new GeoPosition(mLatitude, mLongitude);
|
||||
}
|
||||
|
||||
public void setGeoPosition(GeoPosition position)
|
||||
{
|
||||
mLatitude = position.getLatitude();
|
||||
mLongitude = position.getLongitude();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* 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 io.github.dsheirer.settings;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "xsi:type")
|
||||
public class Setting
|
||||
{
|
||||
protected String mName;
|
||||
|
||||
public Setting()
|
||||
{
|
||||
}
|
||||
|
||||
public Setting( String name )
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
protected String mName;
|
||||
|
||||
@XmlAttribute
|
||||
public String getName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName( String name )
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
public Setting()
|
||||
{
|
||||
}
|
||||
|
||||
public Setting(String name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
|
||||
@JacksonXmlProperty(isAttribute = true, localName = "name")
|
||||
public String getName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
mName = name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,43 +17,18 @@
|
||||
******************************************************************************/
|
||||
package io.github.dsheirer.settings;
|
||||
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import io.github.dsheirer.map.DefaultIcon;
|
||||
import io.github.dsheirer.map.MapIcon;
|
||||
import io.github.dsheirer.settings.ColorSetting.ColorSettingName;
|
||||
import io.github.dsheirer.source.recording.RecordingConfiguration;
|
||||
import io.github.dsheirer.source.tuner.airspy.AirspyTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.configuration.TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.fcd.proV1.FCD1TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.fcd.proplusV2.FCD2TunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.hackrf.HackRFTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.e4k.E4KTunerConfiguration;
|
||||
import io.github.dsheirer.source.tuner.rtl.r820t.R820TTunerConfiguration;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Support for persisting via JAXB all configured SDRTrunk settings
|
||||
*/
|
||||
@XmlSeeAlso( { AirspyTunerConfiguration.class,
|
||||
ColorSetting.class,
|
||||
DefaultIcon.class,
|
||||
E4KTunerConfiguration.class,
|
||||
FCD1TunerConfiguration.class,
|
||||
FCD2TunerConfiguration.class,
|
||||
FileSetting.class,
|
||||
HackRFTunerConfiguration.class,
|
||||
MapViewSetting.class,
|
||||
MapIcon.class,
|
||||
R820TTunerConfiguration.class,
|
||||
RecordingConfiguration.class,
|
||||
Setting.class,
|
||||
TunerConfiguration.class } )
|
||||
|
||||
@XmlRootElement( name = "SDRTrunk_settings" )
|
||||
@JacksonXmlRootElement( localName = "SDRTrunk_settings" )
|
||||
public class Settings
|
||||
{
|
||||
private List<Setting> mSettings = new ArrayList<Setting>();
|
||||
@@ -68,7 +43,7 @@ public class Settings
|
||||
{
|
||||
}
|
||||
|
||||
@XmlElement( name="recording_configuration" )
|
||||
@JacksonXmlProperty(isAttribute = false, localName = "recording_configuration")
|
||||
public List<RecordingConfiguration> getRecordingConfigurations()
|
||||
{
|
||||
return mRecordingConfigurations;
|
||||
@@ -88,8 +63,8 @@ public class Settings
|
||||
{
|
||||
mRecordingConfigurations.remove( config );
|
||||
}
|
||||
|
||||
@XmlElement( name="tuner_configuration" )
|
||||
|
||||
@JacksonXmlProperty(isAttribute = false, localName = "tuner_configuration")
|
||||
public List<TunerConfiguration> getTunerConfigurations()
|
||||
{
|
||||
return mTunerConfiguration;
|
||||
@@ -99,8 +74,8 @@ public class Settings
|
||||
{
|
||||
mTunerConfiguration = configs;
|
||||
}
|
||||
|
||||
@XmlElement( name="setting" )
|
||||
|
||||
@JacksonXmlProperty(isAttribute = false, localName = "setting")
|
||||
public List<Setting> getSettings()
|
||||
{
|
||||
return mSettings;
|
||||
|
||||
Reference in New Issue
Block a user