mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 10:37:26 -05:00
#1635 Playlist Editor Add a special county agency to show all county freqs without an agency. Merge pull request #1724
This commit is contained in:
@@ -23,6 +23,7 @@ import io.github.dsheirer.playlist.PlaylistManager;
|
|||||||
import io.github.dsheirer.preference.UserPreferences;
|
import io.github.dsheirer.preference.UserPreferences;
|
||||||
import io.github.dsheirer.rrapi.type.Agency;
|
import io.github.dsheirer.rrapi.type.Agency;
|
||||||
import io.github.dsheirer.rrapi.type.AgencyInfo;
|
import io.github.dsheirer.rrapi.type.AgencyInfo;
|
||||||
|
import io.github.dsheirer.rrapi.type.CountyInfo;
|
||||||
import io.github.dsheirer.service.radioreference.RadioReference;
|
import io.github.dsheirer.service.radioreference.RadioReference;
|
||||||
import io.github.dsheirer.util.ThreadPool;
|
import io.github.dsheirer.util.ThreadPool;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
@@ -158,8 +159,13 @@ public class AgencyEditor extends VBox
|
|||||||
ThreadPool.CACHED.submit(() -> {
|
ThreadPool.CACHED.submit(() -> {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final AgencyInfo agencyInfo = mRadioReference.getService().getAgencyInfo(agency);
|
if (mLevel == Level.COUNTY && agency instanceof CountyAgency) {
|
||||||
Platform.runLater(() -> getAgencyFrequencyEditor().setCategories(agencyInfo.getCategories()));
|
final CountyInfo countyInfo = mRadioReference.getService().getCountyInfo(-agency.getAgencyId());
|
||||||
|
Platform.runLater(() -> getAgencyFrequencyEditor().setCategories(countyInfo.getCategories()));
|
||||||
|
} else {
|
||||||
|
final AgencyInfo agencyInfo = mRadioReference.getService().getAgencyInfo(agency);
|
||||||
|
Platform.runLater(() -> getAgencyFrequencyEditor().setCategories(agencyInfo.getCategories()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Throwable t)
|
catch(Throwable t)
|
||||||
{
|
{
|
||||||
@@ -196,11 +202,11 @@ public class AgencyEditor extends VBox
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(o1.getName() == null)
|
else if(o1.getName() == null || o2 instanceof CountyAgency)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if(o2.getName() == null)
|
else if(o2.getName() == null || o1 instanceof CountyAgency)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,9 +158,12 @@ public class AgencyFrequencyEditor extends GridPane
|
|||||||
|
|
||||||
if(categories != null && !categories.isEmpty())
|
if(categories != null && !categories.isEmpty())
|
||||||
{
|
{
|
||||||
getCategoryComboBox().getItems().add(ALL_CATEGORIES);
|
// Only allow the combined list of all categories if there aren't that many
|
||||||
|
if (categories.size() < 10) {
|
||||||
|
categories.add(0, ALL_CATEGORIES);
|
||||||
|
}
|
||||||
getCategoryComboBox().getItems().addAll(categories);
|
getCategoryComboBox().getItems().addAll(categories);
|
||||||
getCategoryComboBox().getSelectionModel().select(ALL_CATEGORIES);
|
getCategoryComboBox().getSelectionModel().select(categories.get(0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* *****************************************************************************
|
||||||
|
* Copyright (C) 2014-2022 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.gui.playlist.radioreference;
|
||||||
|
|
||||||
|
import io.github.dsheirer.rrapi.type.Agency;
|
||||||
|
import io.github.dsheirer.rrapi.type.CountyInfo;
|
||||||
|
|
||||||
|
public class CountyAgency extends Agency
|
||||||
|
{
|
||||||
|
public CountyAgency(CountyInfo countyInfo)
|
||||||
|
{
|
||||||
|
this.setAgencyId(-countyInfo.getCountyId());
|
||||||
|
this.setName(countyInfo.getName() + " County (All)");
|
||||||
|
this.setType(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ package io.github.dsheirer.gui.playlist.radioreference;
|
|||||||
import io.github.dsheirer.playlist.PlaylistManager;
|
import io.github.dsheirer.playlist.PlaylistManager;
|
||||||
import io.github.dsheirer.preference.UserPreferences;
|
import io.github.dsheirer.preference.UserPreferences;
|
||||||
import io.github.dsheirer.rrapi.RadioReferenceException;
|
import io.github.dsheirer.rrapi.RadioReferenceException;
|
||||||
|
import io.github.dsheirer.rrapi.type.Agency;
|
||||||
import io.github.dsheirer.rrapi.type.AuthorizationInformation;
|
import io.github.dsheirer.rrapi.type.AuthorizationInformation;
|
||||||
import io.github.dsheirer.rrapi.type.Country;
|
import io.github.dsheirer.rrapi.type.Country;
|
||||||
import io.github.dsheirer.rrapi.type.CountryInfo;
|
import io.github.dsheirer.rrapi.type.CountryInfo;
|
||||||
@@ -55,6 +56,7 @@ import jiconfont.javafx.IconNode;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@@ -689,7 +691,12 @@ public class RadioReferenceEditor extends BorderPane implements Consumer<Authori
|
|||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
getCountySystemEditor().setSystems(countyInfo.getSystems());
|
getCountySystemEditor().setSystems(countyInfo.getSystems());
|
||||||
getCountyAgencyEditor().setAgencies(countyInfo.getAgencies());
|
|
||||||
|
// Make a new list so we don't add our CountyAgency to the original list of agencies
|
||||||
|
List<Agency> countyAgencies = new ArrayList<Agency>();
|
||||||
|
countyAgencies.add(new CountyAgency(countyInfo));
|
||||||
|
countyAgencies.addAll(countyInfo.getAgencies());
|
||||||
|
getCountyAgencyEditor().setAgencies(countyAgencies);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch(RadioReferenceException rre)
|
catch(RadioReferenceException rre)
|
||||||
|
|||||||
Reference in New Issue
Block a user