mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2021 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 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
|
||||
@@ -19,15 +19,6 @@
|
||||
|
||||
package io.github.dsheirer.gui.playlist.alias;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.github.dsheirer.alias.Alias;
|
||||
import io.github.dsheirer.alias.AliasFactory;
|
||||
import io.github.dsheirer.alias.AliasList;
|
||||
@@ -37,6 +28,10 @@ import io.github.dsheirer.gui.playlist.Editor;
|
||||
import io.github.dsheirer.icon.Icon;
|
||||
import io.github.dsheirer.playlist.PlaylistManager;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -74,6 +69,9 @@ import javafx.util.Callback;
|
||||
import jiconfont.IconCode;
|
||||
import jiconfont.icons.font_awesome.FontAwesome;
|
||||
import jiconfont.javafx.IconNode;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Editor for aliases
|
||||
@@ -532,11 +530,10 @@ public class AliasConfigurationEditor extends SplitPane
|
||||
mDeleteAliasButton.setMaxWidth(Double.MAX_VALUE);
|
||||
mDeleteAliasButton.setOnAction(event ->
|
||||
{
|
||||
|
||||
boolean multiple = getAliasTableView().getSelectionModel().getSelectedItems().size() > 1;
|
||||
int count = getAliasTableView().getSelectionModel().getSelectedItems().size();
|
||||
|
||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION,
|
||||
"Do you want to delete the selected alias" + (multiple ? "es?" : "?"),
|
||||
"Do you want to delete [" + count + "] selected alias" + ((count > 1) ? "es?" : "?"),
|
||||
ButtonType.NO, ButtonType.YES);
|
||||
alert.setTitle("Delete Alias");
|
||||
alert.setHeaderText("Are you sure?");
|
||||
@@ -547,11 +544,7 @@ public class AliasConfigurationEditor extends SplitPane
|
||||
if(result.get() == ButtonType.YES)
|
||||
{
|
||||
List<Alias> selectedAliases = new ArrayList<>(getAliasTableView().getSelectionModel().getSelectedItems());
|
||||
|
||||
for(Alias selected : selectedAliases)
|
||||
{
|
||||
mPlaylistManager.getAliasModel().removeAlias(selected);
|
||||
}
|
||||
mPlaylistManager.getAliasModel().removeAliases(selectedAliases);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2020 Dennis Sheirer
|
||||
* Copyright (C) 2014-2023 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
|
||||
@@ -34,6 +34,12 @@ import io.github.dsheirer.protocol.Protocol;
|
||||
import io.github.dsheirer.rrapi.type.System;
|
||||
import io.github.dsheirer.rrapi.type.Talkgroup;
|
||||
import io.github.dsheirer.rrapi.type.TalkgroupCategory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import javafx.animation.RotateTransition;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
@@ -71,12 +77,6 @@ import org.controlsfx.control.textfield.TextFields;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class SystemTalkgroupSelectionEditor extends GridPane
|
||||
{
|
||||
private static final Logger mLog = LoggerFactory.getLogger(SystemTalkgroupSelectionEditor.class);
|
||||
@@ -323,13 +323,20 @@ public class SystemTalkgroupSelectionEditor extends GridPane
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Talkgroup> aliasesToCreate = new ArrayList<>();
|
||||
|
||||
for(AliasedTalkgroup aliasedTalkgroup : mTalkgroupFilteredList)
|
||||
{
|
||||
if(!aliasedTalkgroup.hasAlias())
|
||||
{
|
||||
createAlias(aliasedTalkgroup.getTalkgroup());
|
||||
aliasesToCreate.add(aliasedTalkgroup.getTalkgroup());
|
||||
}
|
||||
}
|
||||
|
||||
if(!aliasesToCreate.isEmpty())
|
||||
{
|
||||
createAliases(aliasesToCreate);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -338,24 +345,31 @@ public class SystemTalkgroupSelectionEditor extends GridPane
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an alias for the specified talkgroup and adds it to the currently selected alias list
|
||||
* @param talkgroup to alias
|
||||
* Creates an alias for each of the specified talkgroups and adds it to the currently selected alias list
|
||||
* @param talkgroups to alias
|
||||
*/
|
||||
public void createAlias(Talkgroup talkgroup)
|
||||
public void createAliases(List<Talkgroup> talkgroups)
|
||||
{
|
||||
TalkgroupCategory talkgroupCategory = getTalkgroupCategory(talkgroup);
|
||||
String group = (talkgroupCategory != null ? talkgroupCategory.getName() : null);
|
||||
Alias alias = getRadioReferenceDecoder().createAlias(talkgroup, getCurrentSystem(),
|
||||
getAliasListNameComboBox().getSelectionModel().getSelectedItem(), group);
|
||||
List<Alias> createdAliases = new ArrayList<>();
|
||||
|
||||
if(getEncryptedAsDoNotMonitorCheckBox().selectedProperty().get() &&
|
||||
TalkgroupEncryption.lookup(talkgroup.getEncryptionState()) == TalkgroupEncryption.FULL)
|
||||
for(Talkgroup talkgroup: talkgroups)
|
||||
{
|
||||
int priority = io.github.dsheirer.alias.id.priority.Priority.DO_NOT_MONITOR;
|
||||
alias.addAliasID(new io.github.dsheirer.alias.id.priority.Priority(priority));
|
||||
TalkgroupCategory talkgroupCategory = getTalkgroupCategory(talkgroup);
|
||||
String group = (talkgroupCategory != null ? talkgroupCategory.getName() : null);
|
||||
Alias alias = getRadioReferenceDecoder().createAlias(talkgroup, getCurrentSystem(),
|
||||
getAliasListNameComboBox().getSelectionModel().getSelectedItem(), group);
|
||||
|
||||
if(getEncryptedAsDoNotMonitorCheckBox().selectedProperty().get() &&
|
||||
TalkgroupEncryption.lookup(talkgroup.getEncryptionState()) == TalkgroupEncryption.FULL)
|
||||
{
|
||||
int priority = io.github.dsheirer.alias.id.priority.Priority.DO_NOT_MONITOR;
|
||||
alias.addAliasID(new io.github.dsheirer.alias.id.priority.Priority(priority));
|
||||
}
|
||||
|
||||
createdAliases.add(alias);
|
||||
}
|
||||
|
||||
mPlaylistManager.getAliasModel().addAlias(alias);
|
||||
mPlaylistManager.getAliasModel().addAliases(createdAliases);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user