From bcfb2700cb92eec6eb5683769d7478753a612cb7 Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Fri, 18 Oct 2024 02:43:55 -0400 Subject: [PATCH] #2030 Playlist Editor double-click channel row to auto-start channel. (#2031) Co-authored-by: Dennis Sheirer --- .../channel/ChannelConfigurationEditor.java | 13 ++++++++++++- .../gui/playlist/channel/ChannelEditor.java | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelConfigurationEditor.java b/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelConfigurationEditor.java index b07f10f8..67966d90 100644 --- a/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelConfigurationEditor.java +++ b/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelConfigurationEditor.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 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 @@ -142,6 +142,17 @@ public abstract class ChannelConfigurationEditor extends Editor { } + /** + * Starts the current channel when the play button is not disabled. + */ + public void startChannel() + { + if(!getPlayButton().disabledProperty().get()) + { + getPlayButton().fire(); + } + } + public abstract DecoderType getDecoderType(); @Override diff --git a/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelEditor.java b/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelEditor.java index 28b3f516..dddbed26 100644 --- a/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelEditor.java +++ b/src/main/java/io/github/dsheirer/gui/playlist/channel/ChannelEditor.java @@ -57,6 +57,7 @@ import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.ToggleButton; import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.input.MouseButton; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; @@ -504,6 +505,12 @@ public class ChannelEditor extends SplitPane implements IFilterProcessor mChannelTableView.setItems(sortedList); mChannelTableView.getSelectionModel().selectedItemProperty() .addListener((observable, oldValue, newValue) -> setChannel(newValue)); + mChannelTableView.setOnMouseClicked(event -> { + if(event.getButton().equals(MouseButton.PRIMARY) && event.getClickCount() == 2) + { + getChannelConfigurationEditor().startChannel(); + } + }); } return mChannelTableView;