mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 00:57:31 -05:00
Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -63,6 +63,7 @@ import io.github.dsheirer.preference.PreferenceType;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.preference.identifier.IntegerFormat;
|
||||
import io.github.dsheirer.protocol.Protocol;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -768,28 +769,35 @@ public class AliasItemEditor extends Editor<Alias>
|
||||
|
||||
private void updateStreamViews()
|
||||
{
|
||||
getAvailableStreamsView().getItems().clear();
|
||||
getSelectedStreamsView().getItems().clear();
|
||||
getAvailableStreamsView().setDisable(getItem() == null);
|
||||
getSelectedStreamsView().setDisable(getItem() == null);
|
||||
|
||||
if(getItem() != null)
|
||||
Platform.runLater(new Runnable()
|
||||
{
|
||||
List<String> availableStreams = mPlaylistManager.getBroadcastModel().getBroadcastConfigurationNames();
|
||||
|
||||
Set<BroadcastChannel> selectedChannels = getItem().getBroadcastChannels();
|
||||
|
||||
for(BroadcastChannel channel: selectedChannels)
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(availableStreams.contains(channel.getChannelName()))
|
||||
getAvailableStreamsView().getItems().clear();
|
||||
getSelectedStreamsView().getItems().clear();
|
||||
getAvailableStreamsView().setDisable(getItem() == null);
|
||||
getSelectedStreamsView().setDisable(getItem() == null);
|
||||
|
||||
if(getItem() != null)
|
||||
{
|
||||
availableStreams.remove(channel.getChannelName());
|
||||
List<String> availableStreams = mPlaylistManager.getBroadcastModel().getBroadcastConfigurationNames();
|
||||
|
||||
Set<BroadcastChannel> selectedChannels = getItem().getBroadcastChannels();
|
||||
|
||||
for(BroadcastChannel channel: selectedChannels)
|
||||
{
|
||||
if(availableStreams.contains(channel.getChannelName()))
|
||||
{
|
||||
availableStreams.remove(channel.getChannelName());
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedStreamsView().getItems().addAll(selectedChannels);
|
||||
getAvailableStreamsView().getItems().addAll(availableStreams);
|
||||
}
|
||||
}
|
||||
|
||||
getSelectedStreamsView().getItems().addAll(selectedChannels);
|
||||
getAvailableStreamsView().getItems().addAll(availableStreams);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ListView<String> getAvailableStreamsView()
|
||||
|
||||
@@ -36,6 +36,8 @@ import io.github.dsheirer.record.config.RecordConfiguration;
|
||||
import io.github.dsheirer.source.config.SourceConfigTuner;
|
||||
import io.github.dsheirer.source.config.SourceConfiguration;
|
||||
import io.github.dsheirer.source.tuner.TunerModel;
|
||||
import io.github.dsheirer.util.ThreadPool;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.transformation.FilteredList;
|
||||
@@ -300,51 +302,62 @@ public abstract class ChannelConfigurationEditor extends Editor<Channel>
|
||||
mPlayButton.setOnAction((ActionEvent event) -> {
|
||||
if(getItem() != null)
|
||||
{
|
||||
if(getItem().processingProperty().get())
|
||||
if(modifiedProperty().get())
|
||||
{
|
||||
try
|
||||
{
|
||||
mPlaylistManager.getChannelProcessingManager().stop(getItem());
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping channel [" + getItem().getName() + "] - " + ce.getMessage());
|
||||
Alert alert = new Alert(Alert.AlertType.WARNING,
|
||||
"Do you want to save these changes?", ButtonType.YES, ButtonType.NO);
|
||||
alert.setTitle("Channel Configuration Modified");
|
||||
alert.setHeaderText("Channel configuration has unsaved changes");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait().ifPresent(buttonType -> {
|
||||
if(buttonType == ButtonType.YES)
|
||||
{
|
||||
save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR, "Error: " + ce.getMessage(), ButtonType.OK);
|
||||
alert.setTitle("Channel Stop Error");
|
||||
alert.setHeaderText("Can't stop channel");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait();
|
||||
}
|
||||
if(!getItem().processingProperty().get())
|
||||
{
|
||||
ThreadPool.SCHEDULED.execute(() -> {
|
||||
try
|
||||
{
|
||||
mPlaylistManager.getChannelProcessingManager().start(getItem());
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error starting channel [" + getItem().getName() + "] - " + ce.getMessage());
|
||||
|
||||
Platform.runLater(() -> {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR, "Error: " + ce.getMessage(), ButtonType.OK);
|
||||
alert.setTitle("Channel Play Error");
|
||||
alert.setHeaderText("Can't play channel");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if(modifiedProperty().get())
|
||||
ThreadPool.SCHEDULED.execute(() -> {
|
||||
try
|
||||
{
|
||||
Alert alert = new Alert(Alert.AlertType.WARNING,
|
||||
"Do you want to save these changes before play?", ButtonType.YES, ButtonType.NO);
|
||||
alert.setTitle("Channel Configuration Modified");
|
||||
alert.setHeaderText("Channel configuration has unsaved changes");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait().ifPresent(buttonType -> {
|
||||
if(buttonType == ButtonType.YES)
|
||||
{
|
||||
save();
|
||||
}
|
||||
mPlaylistManager.getChannelProcessingManager().stop(getItem());
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
mLog.error("Error stopping channel [" + getItem().getName() + "] - " + ce.getMessage());
|
||||
|
||||
Platform.runLater(() -> {
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR, "Error: " + ce.getMessage(), ButtonType.OK);
|
||||
alert.setTitle("Channel Stop Error");
|
||||
alert.setHeaderText("Can't stop channel");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait();
|
||||
});
|
||||
}
|
||||
mPlaylistManager.getChannelProcessingManager().start(getItem());
|
||||
}
|
||||
catch(ChannelException ce)
|
||||
{
|
||||
Alert alert = new Alert(Alert.AlertType.ERROR, "Error: " + ce.getMessage(), ButtonType.OK);
|
||||
alert.setTitle("Channel Play Error");
|
||||
alert.setHeaderText("Can't play channel");
|
||||
alert.initOwner((getPlayButton()).getScene().getWindow());
|
||||
alert.showAndWait();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ public class LoginDialog extends Dialog<AuthorizationInformation>
|
||||
{
|
||||
mUserPreferences = userPreferences;
|
||||
|
||||
setTitle("Radio Reference Login");
|
||||
setTitle("sdrtrunk - Radio Reference");
|
||||
final DialogPane dialogPane = getDialogPane();
|
||||
dialogPane.setContent(getGridPane());
|
||||
dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
|
||||
|
||||
@@ -323,14 +323,13 @@ public class SystemEditor extends VBox
|
||||
private HBox mHBox;
|
||||
private Label mName;
|
||||
private Label mProtocol;
|
||||
private Label mIdLabel;
|
||||
private IconNode mIconNode;
|
||||
|
||||
public SystemListCell()
|
||||
{
|
||||
mHBox = new HBox();
|
||||
mHBox.setSpacing(15);
|
||||
mHBox.setPadding(new Insets(0,30,0,0));
|
||||
mHBox.setPadding(new Insets(0,15,0,0));
|
||||
mHBox.setMaxWidth(Double.MAX_VALUE);
|
||||
mName = new Label();
|
||||
mName.setMaxWidth(Double.MAX_VALUE);
|
||||
@@ -339,12 +338,9 @@ public class SystemEditor extends VBox
|
||||
mProtocol.setMaxWidth(Double.MAX_VALUE);
|
||||
mProtocol.setAlignment(Pos.CENTER_RIGHT);
|
||||
mProtocol.setContentDisplay(ContentDisplay.RIGHT);
|
||||
mIdLabel = new Label();
|
||||
mIdLabel.setAlignment(Pos.CENTER_RIGHT);
|
||||
mIdLabel.setContentDisplay(ContentDisplay.RIGHT);
|
||||
HBox.setHgrow(mName, Priority.ALWAYS);
|
||||
HBox.setHgrow(mProtocol, Priority.ALWAYS);
|
||||
mHBox.getChildren().addAll(mName, mProtocol, mIdLabel);
|
||||
mHBox.getChildren().addAll(mName, mProtocol);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,13 +355,11 @@ public class SystemEditor extends VBox
|
||||
setGraphic(null);
|
||||
mName.setText(null);
|
||||
mProtocol.setText(null);
|
||||
mIdLabel.setText(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
mName.setText(item.getName());
|
||||
mProtocol.setText(getType(item));
|
||||
mIdLabel.setText("ID:" + item.getSystemId());
|
||||
|
||||
if(isSupported(item))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user