diff --git a/src/main/java/io/github/dsheirer/alias/AliasFactory.java b/src/main/java/io/github/dsheirer/alias/AliasFactory.java index c89071605..9c1a3892f 100644 --- a/src/main/java/io/github/dsheirer/alias/AliasFactory.java +++ b/src/main/java/io/github/dsheirer/alias/AliasFactory.java @@ -184,6 +184,7 @@ public static Alias shallowCopyOf(Alias original) copy.setGroup(original.getGroup()); copy.setColor(original.getColor()); copy.setIconName(original.getIconName()); + copy.setRecordable(original.isRecordable()); return copy; } diff --git a/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasBulkEditor.java b/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasBulkEditor.java index c7d827d56..b152d121f 100644 --- a/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasBulkEditor.java +++ b/src/main/java/io/github/dsheirer/gui/playlist/alias/AliasBulkEditor.java @@ -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,16 +19,12 @@ package io.github.dsheirer.gui.playlist.alias; -import java.util.List; - -import org.controlsfx.control.ToggleSwitch; - import com.google.common.collect.Ordering; - import io.github.dsheirer.alias.Alias; import io.github.dsheirer.gui.playlist.Editor; import io.github.dsheirer.icon.Icon; import io.github.dsheirer.playlist.PlaylistManager; +import java.util.List; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ReadOnlyBooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -49,6 +45,7 @@ import javafx.scene.layout.GridPane; import javafx.scene.paint.Color; import javafx.util.Callback; +import org.controlsfx.control.ToggleSwitch; /** * Editor for multiple selected aliases providing limited options for changing attributes of multiple aliases @@ -65,6 +62,8 @@ public class AliasBulkEditor extends Editor> private ToggleSwitch mMonitorAudioToggleSwitch; private ComboBox mMonitorPriorityComboBox; private Button mApplyMonitorButton; + private ToggleSwitch mRecordToggleSwitch; + private Button mApplyRecordButton; private BooleanProperty mChangeInProgressProperty; private ReadOnlyBooleanProperty mChangeInProgressROProperty; @@ -144,6 +143,17 @@ public AliasBulkEditor(PlaylistManager playlistManager) GridPane.setConstraints(getApplyMonitorButton(), 4, row); gridPane.getChildren().add(getApplyMonitorButton()); + Label recordLabel = new Label("Record"); + GridPane.setHalignment(recordLabel, HPos.RIGHT); + GridPane.setConstraints(recordLabel, 0, ++row); + gridPane.getChildren().add(recordLabel); + + GridPane.setConstraints(getRecordToggleSwitch(), 1, row); + gridPane.getChildren().add(getRecordToggleSwitch()); + + GridPane.setConstraints(getApplyRecordButton(), 4, row); + gridPane.getChildren().add(getApplyRecordButton()); + getChildren().add(gridPane); } @@ -326,6 +336,19 @@ private ToggleSwitch getMonitorAudioToggleSwitch() return mMonitorAudioToggleSwitch; } + private ToggleSwitch getRecordToggleSwitch() + { + if(mRecordToggleSwitch == null) + { + mRecordToggleSwitch = new ToggleSwitch(); + mRecordToggleSwitch.setSelected(false); + mRecordToggleSwitch.selectedProperty() + .addListener((observable, oldValue, newValue) -> modifiedProperty().set(true)); + } + + return mRecordToggleSwitch; + } + private ComboBox getMonitorPriorityComboBox() { if(mMonitorPriorityComboBox == null) @@ -346,8 +369,6 @@ private ComboBox getMonitorPriorityComboBox() return mMonitorPriorityComboBox; } - private static int setCount = 0; - private Button getApplyMonitorButton() { if(mApplyMonitorButton == null) @@ -378,7 +399,6 @@ public void handle(ActionEvent event) for(Alias alias : getItem()) { alias.setCallPriority(pri); - //System.out.println(++setCount); } endChange(); @@ -389,6 +409,25 @@ public void handle(ActionEvent event) return mApplyMonitorButton; } + private Button getApplyRecordButton() + { + if(mApplyRecordButton == null) + { + mApplyRecordButton = new Button("Apply"); + mApplyRecordButton.setOnAction(event -> { + startChange(); + boolean record = getRecordToggleSwitch().isSelected(); + for(Alias alias : getItem()) + { + alias.setRecordable(record); + } + endChange(); + }); + } + + return mApplyRecordButton; + } + /** * Cell factory for combo box for dislaying icon name and graphic */