mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 01:27:34 -05:00
Compare commits
8 Commits
v0.4.0-alp
...
v0.4.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
139227e46d | ||
|
|
2394d51a51 | ||
|
|
d9fa2bea5b | ||
|
|
0cb360eeed | ||
|
|
ea472f873f | ||
|
|
8cbdbd527e | ||
|
|
ff0d893bd9 | ||
|
|
7b924d0486 |
129
build.gradle
129
build.gradle
@@ -1,37 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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/>
|
|
||||||
* *****************************************************************************
|
|
||||||
*/
|
*/
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
jcenter()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'org.openjfx.javafxplugin' version '0.0.6'
|
id 'org.openjfx.javafxplugin' version '0.0.6'
|
||||||
id 'org.beryx.runtime' version '1.1.2'
|
id 'org.beryx.runtime' version '1.1.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -39,7 +32,7 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
version = '0.4.0-alpha.8'
|
version = '0.4.0-alpha.9'
|
||||||
sourceCompatibility = '11'
|
sourceCompatibility = '11'
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -61,10 +54,9 @@ dependencies {
|
|||||||
compile 'com.google.guava:guava:27.0.1-jre'
|
compile 'com.google.guava:guava:27.0.1-jre'
|
||||||
compile 'com.jidesoft:jide-oss:3.6.18'
|
compile 'com.jidesoft:jide-oss:3.6.18'
|
||||||
compile 'com.miglayout:miglayout-swing:5.2'
|
compile 'com.miglayout:miglayout-swing:5.2'
|
||||||
|
compile 'io.github.dsheirer:radio-reference-api:15.0.1'
|
||||||
compile 'javax.usb:usb-api:1.0.2'
|
compile 'javax.usb:usb-api:1.0.2'
|
||||||
compile 'net.coderazzi:tablefilter-swing:5.4.0'
|
compile 'net.coderazzi:tablefilter-swing:5.4.0'
|
||||||
compile 'org.apache.axis:axis:1.4'
|
|
||||||
compile 'org.apache.axis:axis-jaxrpc:1.4'
|
|
||||||
compile 'org.apache.commons:commons-lang3:3.8.1'
|
compile 'org.apache.commons:commons-lang3:3.8.1'
|
||||||
compile 'org.apache.commons:commons-io:1.3.2'
|
compile 'org.apache.commons:commons-io:1.3.2'
|
||||||
compile 'org.apache.mina:mina-core:2.0.19'
|
compile 'org.apache.mina:mina-core:2.0.19'
|
||||||
@@ -103,15 +95,6 @@ javafx {
|
|||||||
modules = ['javafx.base', 'javafx.controls', 'javafx.graphics', 'javafx.swing']
|
modules = ['javafx.base', 'javafx.controls', 'javafx.graphics', 'javafx.swing']
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime {
|
|
||||||
targetPlatform('linux-x64', '/media/denny/WD250GB/java/linux/jdk-11.0.1')
|
|
||||||
targetPlatform('osx-x64', '/media/denny/WD250GB/java/osx/jdk-11.0.1.jdk/Contents/Home')
|
|
||||||
targetPlatform('windows-x64', '/media/denny/WD250GB/java/windows/jdk-11.0.1')
|
|
||||||
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
|
||||||
modules = ['java.desktop', 'java.naming', 'jdk.unsupported', 'jdk.unsupported.desktop']
|
|
||||||
imageZip = file("$buildDir/image/sdr-trunk-" + version + ".zip")
|
|
||||||
}
|
|
||||||
|
|
||||||
task buildSdr(type: Jar) {
|
task buildSdr(type: Jar) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Implementation-Title': 'SdrTrunk project',
|
attributes 'Implementation-Title': 'SdrTrunk project',
|
||||||
@@ -123,3 +106,77 @@ task buildSdr(type: Jar) {
|
|||||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
with jar
|
with jar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Java Development Kit (JDK) locations. These paths must point to the 'bin' directory
|
||||||
|
* within a JDK for each of the specified architectures. These JDKs are used by the
|
||||||
|
* runtime and runtimeZip tasks to produce platform-specific builds
|
||||||
|
*/
|
||||||
|
def jdkLinux_aarch64 = '/media/denny/WD250GB/java/bellsoft/linux-aarch64/jdk-11.0.2'
|
||||||
|
def jdkLinux_x64 = '/media/denny/WD250GB/java/bellsoft/linux-x64/jdk-11.0.2'
|
||||||
|
def jdkOsx_x64 = '/media/denny/WD250GB/java/bellsoft/osx-x64/jdk-11.0.2.jdk'
|
||||||
|
def jdkWindows_x64 = '/media/denny/WD250GB/java/bellsoft/windows-x64/jdk-11.0.2'
|
||||||
|
|
||||||
|
runtime {
|
||||||
|
targetPlatform('linux-aarch64', jdkLinux_aarch64)
|
||||||
|
targetPlatform('linux-x64', jdkLinux_x64)
|
||||||
|
targetPlatform('osx-x64', jdkOsx_x64)
|
||||||
|
targetPlatform('windows-x64', jdkWindows_x64)
|
||||||
|
|
||||||
|
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
|
||||||
|
modules = ['java.desktop', 'java.naming', 'jdk.unsupported', 'jdk.unsupported.desktop']
|
||||||
|
imageZip = file("$buildDir/image/sdr-trunk-" + version + ".zip")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for existence of JDK folders for each supported platform before creating runtime images
|
||||||
|
*/
|
||||||
|
tasks.runtime.doFirst {
|
||||||
|
def linux_aarch64 = new File(jdkLinux_aarch64)
|
||||||
|
|
||||||
|
if(!linux_aarch64.exists())
|
||||||
|
{
|
||||||
|
println("Linux aarch64 JDK was not found at " + jdkLinux_aarch64)
|
||||||
|
throw new GradleException("Cannot find Java Development Kit (JDK) for linux-aarch64 architecture. " +
|
||||||
|
"Please update the build.gradle script to provide the correct path")
|
||||||
|
}
|
||||||
|
|
||||||
|
def linux_x64 = new File(jdkLinux_x64)
|
||||||
|
|
||||||
|
if(!linux_x64.exists())
|
||||||
|
{
|
||||||
|
println("Linux x64 JDK was not found at " + jdkLinux_x64)
|
||||||
|
throw new GradleException("Cannot find Java Development Kit (JDK) for linux-x64 architecture. " +
|
||||||
|
"Please update the build.gradle script to provide the correct path")
|
||||||
|
}
|
||||||
|
|
||||||
|
def osx_x64 = new File(jdkOsx_x64)
|
||||||
|
|
||||||
|
if(!osx_x64.exists())
|
||||||
|
{
|
||||||
|
println("OSX x64 JDK was not found at " + jdkOsx_x64);
|
||||||
|
throw new GradleException("Cannot find Java Development Kit (JDK) for osx-x64 architecture. " +
|
||||||
|
"Please update the build.gradle script to provide the correct path")
|
||||||
|
}
|
||||||
|
|
||||||
|
def windows_x64 = new File(jdkWindows_x64)
|
||||||
|
|
||||||
|
if(!windows_x64.exists())
|
||||||
|
{
|
||||||
|
println("Windows x64 JDK was not found at " + jdkWindows_x64)
|
||||||
|
throw new GradleException("Cannot find Java Development Kit (JDK) for windows-x64 architecture. " +
|
||||||
|
"Please update the build.gradle script to provide the correct path")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since we have to list each of the platform-specific JavaFX libraries as dependencies,
|
||||||
|
* remove them from each build image
|
||||||
|
*/
|
||||||
|
tasks.runtime.doLast {
|
||||||
|
delete(fileTree('build/image/sdr-trunk-linux-aarch64/lib').include { it.name ==~ /javafx.*-(win|mac)\.jar/ })
|
||||||
|
delete(fileTree('build/image/sdr-trunk-linux-x64/lib').include { it.name ==~ /javafx.*-(win|mac)\.jar/ })
|
||||||
|
delete(fileTree('build/image/sdr-trunk-osx-x64/lib').include { it.name ==~ /javafx.*-(win|linux)\.jar/ })
|
||||||
|
delete(fileTree('build/image/sdr-trunk-windows-x64/lib').include { it.name ==~ /javafx.*-(linux|mac)\.jar/ })
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -193,6 +193,11 @@ public class TalkgroupEditor extends DocumentListenerEditor<AliasID>
|
|||||||
{
|
{
|
||||||
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
|
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
|
||||||
|
|
||||||
|
if(protocol == null)
|
||||||
|
{
|
||||||
|
protocol = Protocol.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
int value = -1;
|
int value = -1;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ public enum TalkgroupFormat
|
|||||||
return mMaximumValue;
|
return mMaximumValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the value is valid for the protocol
|
||||||
|
*/
|
||||||
|
public boolean isValid(int value)
|
||||||
|
{
|
||||||
|
return getMinimumValidValue() <= value && value <= getMaximumValidValue();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description of the valid value range
|
* Short description of the valid value range
|
||||||
*/
|
*/
|
||||||
@@ -99,9 +107,14 @@ public enum TalkgroupFormat
|
|||||||
return mValidRangeHelpText;
|
return mValidRangeHelpText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TalkgroupFormat get(Protocol prococol)
|
public static TalkgroupFormat get(Protocol protocol)
|
||||||
{
|
{
|
||||||
switch(prococol)
|
if(protocol == null)
|
||||||
|
{
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(protocol)
|
||||||
{
|
{
|
||||||
case APCO25:
|
case APCO25:
|
||||||
return APCO25;
|
return APCO25;
|
||||||
|
|||||||
@@ -174,6 +174,8 @@ public class TalkgroupRangeEditor extends DocumentListenerEditor<AliasID>
|
|||||||
|
|
||||||
TalkgroupRange talkgroupRange = getTalkgroupRange();
|
TalkgroupRange talkgroupRange = getTalkgroupRange();
|
||||||
|
|
||||||
|
updateEditor(talkgroupRange.getProtocol());
|
||||||
|
|
||||||
if(talkgroupRange != null)
|
if(talkgroupRange != null)
|
||||||
{
|
{
|
||||||
mComboProtocol.getModel().setSelectedItem(talkgroupRange.getProtocol());
|
mComboProtocol.getModel().setSelectedItem(talkgroupRange.getProtocol());
|
||||||
@@ -202,6 +204,12 @@ public class TalkgroupRangeEditor extends DocumentListenerEditor<AliasID>
|
|||||||
if(talkgroupRange != null)
|
if(talkgroupRange != null)
|
||||||
{
|
{
|
||||||
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
|
Protocol protocol = mComboProtocol.getItemAt(mComboProtocol.getSelectedIndex());
|
||||||
|
|
||||||
|
if(protocol == null)
|
||||||
|
{
|
||||||
|
protocol = Protocol.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
talkgroupRange.setProtocol(protocol);
|
talkgroupRange.setProtocol(protocol);
|
||||||
|
|
||||||
int minValue = -1;
|
int minValue = -1;
|
||||||
|
|||||||
@@ -1,21 +1,24 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
* sdrtrunk
|
|
||||||
* 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast;
|
package io.github.dsheirer.audio.broadcast;
|
||||||
|
|
||||||
import io.github.dsheirer.alias.AliasModel;
|
import io.github.dsheirer.alias.AliasModel;
|
||||||
@@ -40,6 +43,7 @@ import io.github.dsheirer.audio.convert.MP3SilenceGenerator;
|
|||||||
import io.github.dsheirer.gui.editor.Editor;
|
import io.github.dsheirer.gui.editor.Editor;
|
||||||
import io.github.dsheirer.gui.editor.EmptyEditor;
|
import io.github.dsheirer.gui.editor.EmptyEditor;
|
||||||
import io.github.dsheirer.icon.IconManager;
|
import io.github.dsheirer.icon.IconManager;
|
||||||
|
import io.github.dsheirer.preference.UserPreferences;
|
||||||
import io.github.dsheirer.record.AudioRecorder;
|
import io.github.dsheirer.record.AudioRecorder;
|
||||||
import io.github.dsheirer.record.mp3.MP3Recorder;
|
import io.github.dsheirer.record.mp3.MP3Recorder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -147,7 +151,8 @@ public class BroadcastFactory
|
|||||||
* @param broadcastModel model for broadcastAudio configurations
|
* @param broadcastModel model for broadcastAudio configurations
|
||||||
* @return an editor for the specified broadcastAudio configuration
|
* @return an editor for the specified broadcastAudio configuration
|
||||||
*/
|
*/
|
||||||
public static Editor<BroadcastConfiguration> getEditor(BroadcastConfiguration configuration,
|
public static Editor<BroadcastConfiguration> getEditor(UserPreferences userPreferences,
|
||||||
|
BroadcastConfiguration configuration,
|
||||||
BroadcastModel broadcastModel,
|
BroadcastModel broadcastModel,
|
||||||
AliasModel aliasModel,
|
AliasModel aliasModel,
|
||||||
IconManager iconManager)
|
IconManager iconManager)
|
||||||
@@ -157,7 +162,7 @@ public class BroadcastFactory
|
|||||||
switch(configuration.getBroadcastServerType())
|
switch(configuration.getBroadcastServerType())
|
||||||
{
|
{
|
||||||
case BROADCASTIFY:
|
case BROADCASTIFY:
|
||||||
editor = new BroadcastifyConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
editor = new BroadcastifyConfigurationEditor(userPreferences, broadcastModel, aliasModel, iconManager);
|
||||||
break;
|
break;
|
||||||
case ICECAST_TCP:
|
case ICECAST_TCP:
|
||||||
editor = new IcecastTCPConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
editor = new IcecastTCPConfigurationEditor(broadcastModel, aliasModel, iconManager);
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2018 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast;
|
package io.github.dsheirer.audio.broadcast;
|
||||||
|
|
||||||
@@ -586,12 +588,20 @@ public class BroadcastModel extends AbstractTableModel implements Listener<Reusa
|
|||||||
@Override
|
@Override
|
||||||
public Class<?> getColumnClass(int columnIndex)
|
public Class<?> getColumnClass(int columnIndex)
|
||||||
{
|
{
|
||||||
if(columnIndex == COLUMN_SERVER_ICON)
|
switch(columnIndex)
|
||||||
{
|
{
|
||||||
return ImageIcon.class;
|
case COLUMN_BROADCASTER_STATUS:
|
||||||
|
return BroadcastState.class;
|
||||||
|
case COLUMN_BROADCASTER_AGED_OFF_COUNT:
|
||||||
|
case COLUMN_BROADCASTER_QUEUE_SIZE:
|
||||||
|
case COLUMN_BROADCASTER_STREAMED_COUNT:
|
||||||
|
return Integer.class;
|
||||||
|
case COLUMN_SERVER_ICON:
|
||||||
|
return ImageIcon.class;
|
||||||
|
case COLUMN_STREAM_NAME:
|
||||||
|
default:
|
||||||
|
return String.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.class;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast;
|
package io.github.dsheirer.audio.broadcast;
|
||||||
|
|
||||||
@@ -216,8 +218,8 @@ public class BroadcastPanel extends JPanel implements ActionListener, ListSelect
|
|||||||
|
|
||||||
if (selectedConfiguration != null)
|
if (selectedConfiguration != null)
|
||||||
{
|
{
|
||||||
mEditor = BroadcastFactory.getEditor(selectedConfiguration, mBroadcastModel, mAliasModel,
|
mEditor = BroadcastFactory.getEditor(mUserPreferences, selectedConfiguration, mBroadcastModel,
|
||||||
mIconManager);
|
mAliasModel, mIconManager);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
* sdrtrunk
|
|
||||||
* 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast.broadcastify;
|
package io.github.dsheirer.audio.broadcast.broadcastify;
|
||||||
|
|
||||||
import com.radioreference.api.soap2.UserFeedBroadcast;
|
|
||||||
import io.github.dsheirer.alias.AliasModel;
|
import io.github.dsheirer.alias.AliasModel;
|
||||||
import io.github.dsheirer.audio.broadcast.BroadcastConfiguration;
|
import io.github.dsheirer.audio.broadcast.BroadcastConfiguration;
|
||||||
import io.github.dsheirer.audio.broadcast.BroadcastConfigurationEditor;
|
import io.github.dsheirer.audio.broadcast.BroadcastConfigurationEditor;
|
||||||
@@ -26,6 +28,8 @@ import io.github.dsheirer.audio.broadcast.BroadcastEvent;
|
|||||||
import io.github.dsheirer.audio.broadcast.BroadcastModel;
|
import io.github.dsheirer.audio.broadcast.BroadcastModel;
|
||||||
import io.github.dsheirer.audio.broadcast.BroadcastServerType;
|
import io.github.dsheirer.audio.broadcast.BroadcastServerType;
|
||||||
import io.github.dsheirer.icon.IconManager;
|
import io.github.dsheirer.icon.IconManager;
|
||||||
|
import io.github.dsheirer.preference.UserPreferences;
|
||||||
|
import io.github.dsheirer.rrapi.type.UserFeedBroadcast;
|
||||||
import io.github.dsheirer.sample.Listener;
|
import io.github.dsheirer.sample.Listener;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -64,10 +68,13 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
private JCheckBox mEnabled;
|
private JCheckBox mEnabled;
|
||||||
private JButton mSaveButton;
|
private JButton mSaveButton;
|
||||||
private JButton mResetButton;
|
private JButton mResetButton;
|
||||||
|
private UserPreferences mUserPreferences;
|
||||||
|
|
||||||
public BroadcastifyConfigurationEditor(BroadcastModel broadcastModel, AliasModel aliasModel, IconManager iconManager)
|
public BroadcastifyConfigurationEditor(UserPreferences userPreferences, BroadcastModel broadcastModel,
|
||||||
|
AliasModel aliasModel, IconManager iconManager)
|
||||||
{
|
{
|
||||||
super(broadcastModel, aliasModel, iconManager);
|
super(broadcastModel, aliasModel, iconManager);
|
||||||
|
mUserPreferences = userPreferences;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -91,7 +98,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
final UserFeedSelectionDialog dialog = new UserFeedSelectionDialog(BroadcastifyConfigurationEditor.this);
|
final UserFeedSelectionDialog dialog = new UserFeedSelectionDialog(mUserPreferences,BroadcastifyConfigurationEditor.this);
|
||||||
|
|
||||||
EventQueue.invokeLater(new Runnable()
|
EventQueue.invokeLater(new Runnable()
|
||||||
{
|
{
|
||||||
@@ -391,7 +398,7 @@ public class BroadcastifyConfigurationEditor extends BroadcastConfigurationEdito
|
|||||||
@Override
|
@Override
|
||||||
public void receive(UserFeedBroadcast userFeedBroadcast)
|
public void receive(UserFeedBroadcast userFeedBroadcast)
|
||||||
{
|
{
|
||||||
mName.setText(userFeedBroadcast.getDescr());
|
mName.setText(userFeedBroadcast.getDescription());
|
||||||
mServer.setText(userFeedBroadcast.getHostname());
|
mServer.setText(userFeedBroadcast.getHostname());
|
||||||
mPort.setText(userFeedBroadcast.getPort());
|
mPort.setText(userFeedBroadcast.getPort());
|
||||||
mMountPoint.setText(userFeedBroadcast.getMount());
|
mMountPoint.setText(userFeedBroadcast.getMount());
|
||||||
|
|||||||
@@ -1,78 +1,155 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
* sdrtrunk
|
|
||||||
* 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast.broadcastify;
|
package io.github.dsheirer.audio.broadcast.broadcastify;
|
||||||
|
|
||||||
import com.radioreference.api.soap2.UserFeedBroadcast;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import io.github.dsheirer.radioreference.RadioReferenceService;
|
import io.github.dsheirer.eventbus.MyEventBus;
|
||||||
|
import io.github.dsheirer.preference.PreferenceType;
|
||||||
|
import io.github.dsheirer.preference.UserPreferences;
|
||||||
|
import io.github.dsheirer.rrapi.RadioReferenceException;
|
||||||
|
import io.github.dsheirer.rrapi.RadioReferenceService;
|
||||||
|
import io.github.dsheirer.rrapi.type.AuthorizationInformation;
|
||||||
|
import io.github.dsheirer.rrapi.type.UserFeedBroadcast;
|
||||||
|
import io.github.dsheirer.rrapi.type.UserInfo;
|
||||||
import io.github.dsheirer.sample.Listener;
|
import io.github.dsheirer.sample.Listener;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.ListCellRenderer;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.xml.rpc.ServiceException;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.*;
|
import java.awt.Component;
|
||||||
|
import java.awt.EventQueue;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.net.UnknownHostException;
|
import java.util.List;
|
||||||
import java.rmi.RemoteException;
|
|
||||||
|
|
||||||
public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( UserFeedSelectionDialog.class );
|
private final static Logger mLog = LoggerFactory.getLogger( UserFeedSelectionDialog.class );
|
||||||
|
|
||||||
|
public static final String SDRTRUNK_APP_KEY = "88969092";
|
||||||
|
|
||||||
private Listener<UserFeedBroadcast> mListener;
|
private Listener<UserFeedBroadcast> mListener;
|
||||||
|
private UserPreferences mUserPreferences;
|
||||||
private JTextField mUserNameText;
|
private JTextField mUserNameText;
|
||||||
private JTextField mPasswordText;
|
private JTextField mPasswordText;
|
||||||
|
private JCheckBox mSaveCredentialsCheckBox;
|
||||||
|
private JButton mClearStoredCredentialsButton;
|
||||||
private JButton mLookupButton;
|
private JButton mLookupButton;
|
||||||
private JList mUserFeedBroadcastList;
|
private JList mUserFeedBroadcastList;
|
||||||
private JButton mOKButton;
|
private JButton mOKButton;
|
||||||
|
|
||||||
public UserFeedSelectionDialog(Listener<UserFeedBroadcast> listener)
|
public UserFeedSelectionDialog(UserPreferences userPreferences, Listener<UserFeedBroadcast> listener)
|
||||||
{
|
{
|
||||||
|
mUserPreferences = userPreferences;
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
|
|
||||||
|
//Register to receive radio reference preferences updates
|
||||||
|
MyEventBus.getEventBus().register(this);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel();
|
||||||
panel.setLayout(new MigLayout("","[align right,grow,fill][align left,grow,fill][]","[][][][][grow][]"));
|
panel.setLayout(new MigLayout("","[align right,grow,fill][align left,grow,fill][]","[][][][][][grow][]"));
|
||||||
|
|
||||||
panel.add(new JLabel("Please enter your credentials"), "align left,span");
|
panel.add(new JLabel("Please enter your credentials"), "align left,span");
|
||||||
|
|
||||||
panel.add(new JLabel("User Name:"));
|
panel.add(new JLabel("User Name:"));
|
||||||
mUserNameText = new JTextField();
|
mUserNameText = new JTextField();
|
||||||
|
String storedUserName = mUserPreferences.getRadioReferencePreference().getUserName();
|
||||||
|
if(storedUserName != null)
|
||||||
|
{
|
||||||
|
mUserNameText.setText(storedUserName);
|
||||||
|
}
|
||||||
mUserNameText.getDocument().addDocumentListener(this);
|
mUserNameText.getDocument().addDocumentListener(this);
|
||||||
panel.add(mUserNameText, "wrap");
|
panel.add(mUserNameText, "wrap");
|
||||||
|
|
||||||
panel.add(new JLabel("Password:"));
|
panel.add(new JLabel("Password:"));
|
||||||
mPasswordText = new JTextField();
|
mPasswordText = new JTextField();
|
||||||
|
String storedPassword = mUserPreferences.getRadioReferencePreference().getPassword();
|
||||||
|
if(storedPassword != null)
|
||||||
|
{
|
||||||
|
mPasswordText.setText(storedPassword);
|
||||||
|
}
|
||||||
mPasswordText.getDocument().addDocumentListener(this);
|
mPasswordText.getDocument().addDocumentListener(this);
|
||||||
panel.add(mPasswordText, "wrap");
|
panel.add(mPasswordText, "wrap");
|
||||||
|
|
||||||
|
mSaveCredentialsCheckBox = new JCheckBox("Store Credentials");
|
||||||
|
mSaveCredentialsCheckBox.setSelected(mUserPreferences.getRadioReferencePreference().isStoreCredentials());
|
||||||
|
mSaveCredentialsCheckBox.addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
//If user unchecks box and there are stored credentials, prompt to clear them
|
||||||
|
if(!mSaveCredentialsCheckBox.isSelected() && mUserPreferences.getRadioReferencePreference().hasStoredCredentials())
|
||||||
|
{
|
||||||
|
int choice = JOptionPane.showOptionDialog(UserFeedSelectionDialog.this,
|
||||||
|
"Would you like to remove previously stored credentials from this computer?",
|
||||||
|
"Clear Stored Credentials?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,
|
||||||
|
null, null, 0);
|
||||||
|
|
||||||
|
if(choice == JOptionPane.YES_OPTION)
|
||||||
|
{
|
||||||
|
mUserPreferences.getRadioReferencePreference().removeStoreCredentials();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(mSaveCredentialsCheckBox);
|
||||||
|
|
||||||
|
mClearStoredCredentialsButton = new JButton("Remove");
|
||||||
|
mClearStoredCredentialsButton.setToolTipText("Clear stored credentials");
|
||||||
|
mClearStoredCredentialsButton.setEnabled(mUserPreferences.getRadioReferencePreference().hasStoredCredentials());
|
||||||
|
mClearStoredCredentialsButton.addActionListener(new ActionListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
mUserPreferences.getRadioReferencePreference().removeStoreCredentials();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(mClearStoredCredentialsButton, "wrap");
|
||||||
|
|
||||||
mLookupButton = new JButton("Get Feeds");
|
mLookupButton = new JButton("Get Feeds");
|
||||||
mLookupButton.setEnabled(false);
|
mLookupButton.setEnabled(storedPassword != null && storedPassword != null);
|
||||||
mLookupButton.addActionListener(new ActionListener()
|
mLookupButton.addActionListener(new ActionListener()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -87,45 +164,25 @@ public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RadioReferenceService service =
|
AuthorizationInformation authorizationInformation = new AuthorizationInformation(SDRTRUNK_APP_KEY,
|
||||||
new RadioReferenceService(mUserNameText.getText(), mPasswordText.getText());
|
mUserNameText.getText(), mPasswordText.getText());
|
||||||
|
|
||||||
UserFeedBroadcast[] feeds = service.getUserFeedBroadcasts();
|
mLog.debug("User:" + authorizationInformation.getUserName() + " Pass:" + authorizationInformation.getPassword() + " Key:" + authorizationInformation.getApplicationKey());
|
||||||
|
|
||||||
mUserFeedBroadcastList.setListData(feeds);
|
RadioReferenceService service = new RadioReferenceService(authorizationInformation);
|
||||||
|
UserInfo userInfo = service.getUserInfo();
|
||||||
|
mLog.info("RR User:" + userInfo.getUserName() + " Expiration Date:" + userInfo.getExpirationDate());
|
||||||
|
List<UserFeedBroadcast> feeds = service.getUserFeeds();
|
||||||
|
|
||||||
|
mUserFeedBroadcastList.setListData(feeds.toArray(new UserFeedBroadcast[feeds.size()]));
|
||||||
}
|
}
|
||||||
catch(ServiceException se)
|
catch(RadioReferenceException rre)
|
||||||
{
|
{
|
||||||
JOptionPane.showMessageDialog(UserFeedSelectionDialog.this,
|
JOptionPane.showMessageDialog(UserFeedSelectionDialog.this,
|
||||||
"Unable to create radio reference web service client. See log file.",
|
"Unable to create radio reference web service client. See log file.",
|
||||||
"Error", JOptionPane.ERROR_MESSAGE);
|
"Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
|
||||||
mLog.error("Error creating the radio reference web service client", se);
|
mLog.error("Error creating the radio reference web service client", rre);
|
||||||
}
|
|
||||||
catch(RemoteException re)
|
|
||||||
{
|
|
||||||
Throwable cause = re.getCause();
|
|
||||||
|
|
||||||
if(cause == null)
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog(UserFeedSelectionDialog.this,
|
|
||||||
re.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
else if(cause instanceof UnknownHostException)
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog(UserFeedSelectionDialog.this,
|
|
||||||
"Broadcastify server is unavailable", "No Server",
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog(UserFeedSelectionDialog.this,
|
|
||||||
"An unknown error has occurred. Please see log file.", "" +
|
|
||||||
"Unknown Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
|
|
||||||
mLog.error("Error retrieving user broadcast feed configurations from radio reference " +
|
|
||||||
"service: ", re);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mLookupButton.setEnabled(true);
|
mLookupButton.setEnabled(true);
|
||||||
@@ -160,6 +217,7 @@ public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
|||||||
{
|
{
|
||||||
if(mListener != null)
|
if(mListener != null)
|
||||||
{
|
{
|
||||||
|
storeCredentials();
|
||||||
mListener.receive((UserFeedBroadcast)mUserFeedBroadcastList.getSelectedValue());
|
mListener.receive((UserFeedBroadcast)mUserFeedBroadcastList.getSelectedValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,11 +240,37 @@ public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
|||||||
setTitle("Broadcastify Feed Lookup");
|
setTitle("Broadcastify Feed Lookup");
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
add(panel, BorderLayout.CENTER);
|
add(panel, BorderLayout.CENTER);
|
||||||
setSize(300,250);
|
setSize(400,450);
|
||||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||||
setModalityType(ModalityType.APPLICATION_MODAL);
|
setModalityType(ModalityType.APPLICATION_MODAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores login credentials in the user preferences
|
||||||
|
*/
|
||||||
|
private void storeCredentials()
|
||||||
|
{
|
||||||
|
boolean store = mSaveCredentialsCheckBox.isSelected();
|
||||||
|
mUserPreferences.getRadioReferencePreference().setStoreCredentials(store);
|
||||||
|
|
||||||
|
if(store)
|
||||||
|
{
|
||||||
|
String userName = mUserNameText.getText();
|
||||||
|
|
||||||
|
if(userName != null)
|
||||||
|
{
|
||||||
|
mUserPreferences.getRadioReferencePreference().setUserName(userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String password = mPasswordText.getText();
|
||||||
|
|
||||||
|
if(password != null)
|
||||||
|
{
|
||||||
|
mUserPreferences.getRadioReferencePreference().setPassword(password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateButtons()
|
private void updateButtons()
|
||||||
{
|
{
|
||||||
String username = mUserNameText.getText();
|
String username = mUserNameText.getText();
|
||||||
@@ -240,8 +324,20 @@ public class UserFeedSelectionDialog extends JDialog implements DocumentListener
|
|||||||
setForeground(list.getForeground());
|
setForeground(list.getForeground());
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(value.getDescr());
|
setText(value.getDescription());
|
||||||
|
|
||||||
return this; }
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void preferenceUpdated(PreferenceType preferenceType)
|
||||||
|
{
|
||||||
|
if(preferenceType == PreferenceType.RADIO_REFERENCE)
|
||||||
|
{
|
||||||
|
//Update the store-credentials checkbox only, so we don't change the username or password currently displayed
|
||||||
|
mSaveCredentialsCheckBox.setSelected(mUserPreferences.getRadioReferencePreference().isStoreCredentials());
|
||||||
|
mClearStoredCredentialsButton.setEnabled(mUserPreferences.getRadioReferencePreference().hasStoredCredentials());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.audio.broadcast.icecast;
|
package io.github.dsheirer.audio.broadcast.icecast;
|
||||||
|
|
||||||
@@ -146,12 +148,12 @@ public class IcecastHTTPAudioBroadcaster extends IcecastAudioBroadcaster
|
|||||||
}
|
}
|
||||||
else if(throwableCause != null)
|
else if(throwableCause != null)
|
||||||
{
|
{
|
||||||
setBroadcastState(BroadcastState.ERROR);
|
setBroadcastState(BroadcastState.DISCONNECTED);
|
||||||
mLog.debug("Failed to connect", rie);
|
mLog.debug("Failed to connect", rie);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setBroadcastState(BroadcastState.ERROR);
|
setBroadcastState(BroadcastState.DISCONNECTED);
|
||||||
mLog.debug("Failed to connect - no exception is available");
|
mLog.debug("Failed to connect - no exception is available");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,14 +284,14 @@ public class IcecastHTTPAudioBroadcaster extends IcecastAudioBroadcaster
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.error("HTTP protocol decoder error", throwable);
|
mLog.error("HTTP protocol decoder error", throwable);
|
||||||
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
setBroadcastState(BroadcastState.DISCONNECTED);
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.error("Broadcast error", throwable);
|
mLog.error("Broadcast error", throwable);
|
||||||
setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR);
|
setBroadcastState(BroadcastState.DISCONNECTED);
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ public class AudioChannelPanel extends JPanel implements Listener<AudioEvent>, S
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mLog.warn("Multiple To Identifiers in Collection: " + Joiner.on(",").join(toIds));
|
|
||||||
mIdentifier = toIds.get(0);
|
mIdentifier = toIds.get(0);
|
||||||
AliasList aliasList = mAliasModel.getAliasList(identifierCollection);
|
AliasList aliasList = mAliasModel.getAliasList(identifierCollection);
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.gui;
|
package io.github.dsheirer.gui;
|
||||||
|
|
||||||
@@ -395,9 +397,9 @@ public class SDRTrunk implements Listener<TunerEvent>
|
|||||||
viewMenu.add(new BroadcastStatusVisibleMenuItem(mControllerPanel));
|
viewMenu.add(new BroadcastStatusVisibleMenuItem(mControllerPanel));
|
||||||
viewMenu.add(new JSeparator());
|
viewMenu.add(new JSeparator());
|
||||||
|
|
||||||
for(Tuner tuner: mSourceManager.getTunerModel().getTuners())
|
for(Tuner tuner : mSourceManager.getTunerModel().getTuners())
|
||||||
{
|
{
|
||||||
viewMenu.add(new ShowTunerMenuItem(mSpectralPanel, tuner));
|
viewMenu.add(new ShowTunerMenuItem(mSourceManager.getTunerModel(), tuner));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewMenu.add(new JSeparator());
|
viewMenu.add(new JSeparator());
|
||||||
@@ -406,7 +408,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
|||||||
viewMenu.add(new JSeparator());
|
viewMenu.add(new JSeparator());
|
||||||
JMenuItem preferencesItem = new JMenuItem("Preferences");
|
JMenuItem preferencesItem = new JMenuItem("Preferences");
|
||||||
preferencesItem.addActionListener(e -> MyEventBus.getEventBus()
|
preferencesItem.addActionListener(e -> MyEventBus.getEventBus()
|
||||||
.post(new PreferenceEditorViewRequest(PreferenceEditorType.CHANNEL_EVENT)));
|
.post(new PreferenceEditorViewRequest(PreferenceEditorType.CHANNEL_EVENT)));
|
||||||
viewMenu.add(preferencesItem);
|
viewMenu.add(preferencesItem);
|
||||||
|
|
||||||
menuBar.add(viewMenu);
|
menuBar.add(viewMenu);
|
||||||
|
|||||||
@@ -371,8 +371,8 @@ public class P25NetworkConfigurationMonitor
|
|||||||
}
|
}
|
||||||
else if(mLCSystemServiceBroadcast != null)
|
else if(mLCSystemServiceBroadcast != null)
|
||||||
{
|
{
|
||||||
sb.append(" AVAILABLE SERVICES:").append(mTSBKSystemServiceBroadcast.getAvailableServices());
|
sb.append(" AVAILABLE SERVICES:").append(mLCSystemServiceBroadcast.getAvailableServices());
|
||||||
sb.append(" SUPPORTED SERVICES:").append(mTSBKSystemServiceBroadcast.getSupportedServices());
|
sb.append(" SUPPORTED SERVICES:").append(mLCSystemServiceBroadcast.getSupportedServices());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.preference;
|
package io.github.dsheirer.preference;
|
||||||
@@ -26,9 +28,10 @@ package io.github.dsheirer.preference;
|
|||||||
public enum PreferenceType
|
public enum PreferenceType
|
||||||
{
|
{
|
||||||
DECODE_EVENT,
|
DECODE_EVENT,
|
||||||
JMBE_LIBRARY,
|
|
||||||
DIRECTORY,
|
DIRECTORY,
|
||||||
IDENTIFIER,
|
IDENTIFIER,
|
||||||
|
JMBE_LIBRARY,
|
||||||
MULTI_FREQUENCY,
|
MULTI_FREQUENCY,
|
||||||
|
RADIO_REFERENCE,
|
||||||
TUNER;
|
TUNER;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.preference;
|
package io.github.dsheirer.preference;
|
||||||
@@ -26,6 +28,7 @@ import io.github.dsheirer.preference.directory.DirectoryPreference;
|
|||||||
import io.github.dsheirer.preference.event.DecodeEventPreference;
|
import io.github.dsheirer.preference.event.DecodeEventPreference;
|
||||||
import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
|
import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
|
||||||
import io.github.dsheirer.preference.playlist.PlaylistPreference;
|
import io.github.dsheirer.preference.playlist.PlaylistPreference;
|
||||||
|
import io.github.dsheirer.preference.radioreference.RadioReferencePreference;
|
||||||
import io.github.dsheirer.preference.source.ChannelMultiFrequencyPreference;
|
import io.github.dsheirer.preference.source.ChannelMultiFrequencyPreference;
|
||||||
import io.github.dsheirer.preference.source.TunerPreference;
|
import io.github.dsheirer.preference.source.TunerPreference;
|
||||||
import io.github.dsheirer.preference.swing.SwingPreference;
|
import io.github.dsheirer.preference.swing.SwingPreference;
|
||||||
@@ -54,6 +57,7 @@ public class UserPreferences implements Listener<PreferenceType>
|
|||||||
private DirectoryPreference mDirectoryPreference;
|
private DirectoryPreference mDirectoryPreference;
|
||||||
private ChannelMultiFrequencyPreference mChannelMultiFrequencyPreference;
|
private ChannelMultiFrequencyPreference mChannelMultiFrequencyPreference;
|
||||||
private PlaylistPreference mPlaylistPreference;
|
private PlaylistPreference mPlaylistPreference;
|
||||||
|
private RadioReferencePreference mRadioReferencePreference;
|
||||||
private TalkgroupFormatPreference mTalkgroupFormatPreference;
|
private TalkgroupFormatPreference mTalkgroupFormatPreference;
|
||||||
private TunerPreference mTunerPreference;
|
private TunerPreference mTunerPreference;
|
||||||
private SwingPreference mSwingPreference = new SwingPreference();
|
private SwingPreference mSwingPreference = new SwingPreference();
|
||||||
@@ -106,6 +110,14 @@ public class UserPreferences implements Listener<PreferenceType>
|
|||||||
return mPlaylistPreference;
|
return mPlaylistPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Radio reference web services preferences
|
||||||
|
*/
|
||||||
|
public RadioReferencePreference getRadioReferencePreference()
|
||||||
|
{
|
||||||
|
return mRadioReferencePreference;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier preferences
|
* Identifier preferences
|
||||||
*/
|
*/
|
||||||
@@ -141,6 +153,7 @@ public class UserPreferences implements Listener<PreferenceType>
|
|||||||
mDirectoryPreference = new DirectoryPreference(this::receive);
|
mDirectoryPreference = new DirectoryPreference(this::receive);
|
||||||
mChannelMultiFrequencyPreference = new ChannelMultiFrequencyPreference(this::receive);
|
mChannelMultiFrequencyPreference = new ChannelMultiFrequencyPreference(this::receive);
|
||||||
mPlaylistPreference = new PlaylistPreference(this::receive, mDirectoryPreference);
|
mPlaylistPreference = new PlaylistPreference(this::receive, mDirectoryPreference);
|
||||||
|
mRadioReferencePreference = new RadioReferencePreference(this::receive);
|
||||||
mTalkgroupFormatPreference = new TalkgroupFormatPreference(this::receive);
|
mTalkgroupFormatPreference = new TalkgroupFormatPreference(this::receive);
|
||||||
mTunerPreference = new TunerPreference(this::receive);
|
mTunerPreference = new TunerPreference(this::receive);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* * ******************************************************************************
|
||||||
|
* * Copyright (C) 2014-2019 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.preference.radioreference;
|
||||||
|
|
||||||
|
import io.github.dsheirer.preference.Preference;
|
||||||
|
import io.github.dsheirer.preference.PreferenceType;
|
||||||
|
import io.github.dsheirer.sample.Listener;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User preferences for the display of channel decode events
|
||||||
|
*/
|
||||||
|
public class RadioReferencePreference extends Preference
|
||||||
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(RadioReferencePreference.class);
|
||||||
|
private Preferences mPreferences = Preferences.userNodeForPackage(RadioReferencePreference.class);
|
||||||
|
private static final String STORE_CREDENTIALS = "store.credentials";
|
||||||
|
private static final String USER_NAME = "user.name";
|
||||||
|
private static final String PASSWORD = "user.authorization";
|
||||||
|
|
||||||
|
private String mUserName;
|
||||||
|
private String mPassword;
|
||||||
|
private Boolean mStoreCredentials;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an instance.
|
||||||
|
* @param updateListener to receive notifications when preferences are updated.
|
||||||
|
*/
|
||||||
|
public RadioReferencePreference(Listener<PreferenceType> updateListener)
|
||||||
|
{
|
||||||
|
super(updateListener);
|
||||||
|
loadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PreferenceType getPreferenceType()
|
||||||
|
{
|
||||||
|
return PreferenceType.RADIO_REFERENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadSettings()
|
||||||
|
{
|
||||||
|
mStoreCredentials = mPreferences.getBoolean(STORE_CREDENTIALS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears user credentials and resets username and password to null
|
||||||
|
*/
|
||||||
|
public void removeStoreCredentials()
|
||||||
|
{
|
||||||
|
setStoreCredentials(false);
|
||||||
|
setUserName(null);
|
||||||
|
setPassword(null);
|
||||||
|
notifyPreferenceUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if there are any non-null values stored for user name or password
|
||||||
|
* @return true if there are values stored
|
||||||
|
*/
|
||||||
|
public boolean hasStoredCredentials()
|
||||||
|
{
|
||||||
|
return mPreferences.get(USER_NAME, null) != null || mPreferences.get(PASSWORD, null) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User name
|
||||||
|
*/
|
||||||
|
public String getUserName()
|
||||||
|
{
|
||||||
|
if(mUserName == null)
|
||||||
|
{
|
||||||
|
mUserName = mPreferences.get(USER_NAME, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets user name
|
||||||
|
* @param username to store or null to remove any stored value
|
||||||
|
*/
|
||||||
|
public void setUserName(String username)
|
||||||
|
{
|
||||||
|
mUserName = username;
|
||||||
|
|
||||||
|
if(mUserName == null)
|
||||||
|
{
|
||||||
|
mPreferences.remove(USER_NAME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPreferences.put(USER_NAME, mUserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyPreferenceUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Password
|
||||||
|
* @return password
|
||||||
|
*/
|
||||||
|
public String getPassword()
|
||||||
|
{
|
||||||
|
if(mPassword == null)
|
||||||
|
{
|
||||||
|
mPassword = mPreferences.get(PASSWORD, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the preferences persisted password.
|
||||||
|
* @param password to store or null to remove any stored value
|
||||||
|
*/
|
||||||
|
public void setPassword(String password)
|
||||||
|
{
|
||||||
|
mPassword = password;
|
||||||
|
|
||||||
|
if(mPassword == null)
|
||||||
|
{
|
||||||
|
mPreferences.remove(PASSWORD);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPreferences.put(PASSWORD, mPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyPreferenceUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the credentials should be persisted in the preferences store.
|
||||||
|
*
|
||||||
|
* @return true if credentials should be stored.
|
||||||
|
*/
|
||||||
|
public boolean isStoreCredentials()
|
||||||
|
{
|
||||||
|
if(mStoreCredentials == null)
|
||||||
|
{
|
||||||
|
mStoreCredentials = mPreferences.getBoolean(STORE_CREDENTIALS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mStoreCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the store credentials option
|
||||||
|
* @param store true to store credentials
|
||||||
|
*/
|
||||||
|
public void setStoreCredentials(boolean store)
|
||||||
|
{
|
||||||
|
mStoreCredentials = store;
|
||||||
|
mPreferences.putBoolean(STORE_CREDENTIALS, store);
|
||||||
|
notifyPreferenceUpdated();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* 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 io.github.dsheirer.radioreference;
|
|
||||||
|
|
||||||
import com.radioreference.api.soap2.AuthInfo;
|
|
||||||
import com.radioreference.api.soap2.RRWsdlLocator;
|
|
||||||
import com.radioreference.api.soap2.RRWsdlPortType;
|
|
||||||
import com.radioreference.api.soap2.UserFeedBroadcast;
|
|
||||||
import com.radioreference.api.soap2.UserInfo;
|
|
||||||
import org.apache.axis.AxisFault;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import javax.xml.rpc.ServiceException;
|
|
||||||
import java.rmi.RemoteException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
public class RadioReferenceService
|
|
||||||
{
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( RadioReferenceService.class );
|
|
||||||
private final SimpleDateFormat SDF = new SimpleDateFormat("MM-dd-yyyy");
|
|
||||||
|
|
||||||
public static final String SDRTRUNK_APP_KEY = "88969092";
|
|
||||||
public static final String RADIO_REFERENCE_API_VERSION = "14";
|
|
||||||
public static final String SOAP_RPC_RESPONSE_STYLE = "rpc";
|
|
||||||
|
|
||||||
private RRWsdlLocator mService = new RRWsdlLocator();
|
|
||||||
private RRWsdlPortType mClient;
|
|
||||||
private Long mAccountExpiration;
|
|
||||||
|
|
||||||
private AuthInfo mUserAuthorization;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a SOAP web service client for interaction with the radioreference.com server.
|
|
||||||
*
|
|
||||||
* @param username for a premium subscriber
|
|
||||||
* @param password for a premium subscriber
|
|
||||||
* @throws ServiceException if the client can't be created
|
|
||||||
* @throws IllegalArgumentException if either the username or password is null or empty
|
|
||||||
*/
|
|
||||||
public RadioReferenceService(String username, String password) throws ServiceException
|
|
||||||
{
|
|
||||||
mClient = mService.getRRWsdlPort();
|
|
||||||
|
|
||||||
setAuthorizationInformation(username, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets new premium subscriber user credentials to authenticate to the server.
|
|
||||||
* @param username for a premium subscriber on radioreference.com
|
|
||||||
* @param password for a premium subscriber
|
|
||||||
*/
|
|
||||||
public void setAuthorizationInformation(String username, String password) throws IllegalArgumentException
|
|
||||||
{
|
|
||||||
if(username == null || username.isEmpty() || password == null || password.isEmpty())
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Username [" + username + "] and/or password [" + password +
|
|
||||||
"] cannot be null or empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
mUserAuthorization = new AuthInfo(username, password, SDRTRUNK_APP_KEY, RADIO_REFERENCE_API_VERSION,
|
|
||||||
SOAP_RPC_RESPONSE_STYLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the service has a non-null user authorization
|
|
||||||
*/
|
|
||||||
public void checkCredentials() throws IllegalArgumentException
|
|
||||||
{
|
|
||||||
if(mUserAuthorization == null)
|
|
||||||
{
|
|
||||||
throw new IllegalStateException("Authorization information (username/password) required");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Account expiration date
|
|
||||||
*
|
|
||||||
* @return expiration date in millis since epoch
|
|
||||||
* @throws AxisFault for remote server errors
|
|
||||||
* @throws IllegalStateException for null or empty login credentials
|
|
||||||
* @throws RemoteException for web service client errors
|
|
||||||
*/
|
|
||||||
public long getAccountExpirationDate() throws IllegalStateException, RemoteException
|
|
||||||
{
|
|
||||||
checkCredentials();
|
|
||||||
|
|
||||||
if(mAccountExpiration == null)
|
|
||||||
{
|
|
||||||
UserInfo userInfo = mClient.getUserData(mUserAuthorization);
|
|
||||||
|
|
||||||
if(userInfo != null)
|
|
||||||
{
|
|
||||||
String expiration = userInfo.getSubExpireDate();
|
|
||||||
|
|
||||||
if(expiration != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mAccountExpiration = SDF.parse(expiration).getTime();
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
mLog.error("Couldn't parse account expiration date from web service response: " + expiration, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mAccountExpiration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the radio reference user account is active (ie not expired)
|
|
||||||
*
|
|
||||||
* @throws IllegalStateException for null or empty login credentials
|
|
||||||
* @throws RemoteException for web service client errors
|
|
||||||
*/
|
|
||||||
public boolean isAccountActive() throws IllegalStateException, RemoteException
|
|
||||||
{
|
|
||||||
Long expiration = getAccountExpirationDate();
|
|
||||||
|
|
||||||
if(expiration != null)
|
|
||||||
{
|
|
||||||
return System.currentTimeMillis() < expiration;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserFeedBroadcast[] getUserFeedBroadcasts() throws IllegalArgumentException, RemoteException
|
|
||||||
{
|
|
||||||
checkCredentials();
|
|
||||||
|
|
||||||
return mClient.getUserFeedBroadcasts(mUserAuthorization);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,30 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
* sdr-trunk
|
|
||||||
* Copyright (C) 2014-2018 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* later version.
|
* *
|
||||||
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.spectrum;
|
package io.github.dsheirer.spectrum;
|
||||||
|
|
||||||
import io.github.dsheirer.properties.SystemProperties;
|
import io.github.dsheirer.properties.SystemProperties;
|
||||||
import io.github.dsheirer.source.tuner.Tuner;
|
import io.github.dsheirer.source.tuner.Tuner;
|
||||||
|
import io.github.dsheirer.source.tuner.TunerEvent;
|
||||||
|
import io.github.dsheirer.source.tuner.TunerModel;
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
@@ -25,13 +33,13 @@ import java.awt.event.ActionListener;
|
|||||||
|
|
||||||
public class ShowTunerMenuItem extends JMenuItem
|
public class ShowTunerMenuItem extends JMenuItem
|
||||||
{
|
{
|
||||||
private SpectralDisplayPanel mSpectralDisplayPanel;
|
private TunerModel mTunerModel;
|
||||||
private Tuner mTuner;
|
private Tuner mTuner;
|
||||||
|
|
||||||
public ShowTunerMenuItem(SpectralDisplayPanel spectralDisplayPanel, Tuner tuner)
|
public ShowTunerMenuItem(TunerModel tunerModel, Tuner tuner)
|
||||||
{
|
{
|
||||||
super(tuner != null ? "Show: " + tuner.getName() : "(empty)");
|
super(tuner != null ? "Show: " + tuner.getName() : "(empty)");
|
||||||
mSpectralDisplayPanel = spectralDisplayPanel;
|
mTunerModel = tunerModel;
|
||||||
mTuner = tuner;
|
mTuner = tuner;
|
||||||
|
|
||||||
addActionListener(new ActionListener()
|
addActionListener(new ActionListener()
|
||||||
@@ -44,7 +52,7 @@ public class ShowTunerMenuItem extends JMenuItem
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
mSpectralDisplayPanel.showTuner(mTuner);
|
mTunerModel.broadcast(new TunerEvent(mTuner, TunerEvent.Event.REQUEST_MAIN_SPECTRAL_DISPLAY));
|
||||||
SystemProperties properties = SystemProperties.getInstance();
|
SystemProperties properties = SystemProperties.getInstance();
|
||||||
properties.set(SpectralDisplayPanel.SPECTRAL_DISPLAY_ENABLED, true);
|
properties.set(SpectralDisplayPanel.SPECTRAL_DISPLAY_ENABLED, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ******************************************************************************
|
|
||||||
* sdrtrunk
|
|
||||||
* Copyright (C) 2014-2019 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
|
* * Copyright (C) 2014-2019 Dennis Sheirer
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* * 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/>
|
||||||
|
* * *****************************************************************************
|
||||||
*
|
*
|
||||||
* 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.spectrum;
|
package io.github.dsheirer.spectrum;
|
||||||
|
|
||||||
@@ -806,7 +808,7 @@ public class SpectralDisplayPanel extends JPanel implements Listener<ReusableCom
|
|||||||
separatorAdded = true;
|
separatorAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenu.add(new ShowTunerMenuItem(SpectralDisplayPanel.this, tuner));
|
contextMenu.add(new ShowTunerMenuItem(mTunerModel, tuner));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user