mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 04:55:55 -05:00
Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ import javafx.animation.KeyFrame;
|
|||||||
import javafx.animation.Timeline;
|
import javafx.animation.Timeline;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.css.PseudoClass;
|
import javafx.css.PseudoClass;
|
||||||
|
import javafx.geometry.Orientation;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
@@ -62,7 +63,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio playback display. A master section with the output mute, volume and audio device settings, followed by one
|
* Audio playback display. A narrow master column with the output mute, audio device settings and (when the output
|
||||||
|
* supports it) a vertical volume slider, followed by one
|
||||||
* display per audio channel: a single wide display for a mono output or side by side left and right displays for a
|
* display per audio channel: a single wide display for a mono output or side by side left and right displays for a
|
||||||
* stereo output. Rebuilds the channel displays when the audio playback device configuration changes.
|
* stereo output. Rebuilds the channel displays when the audio playback device configuration changes.
|
||||||
*/
|
*/
|
||||||
@@ -82,8 +84,8 @@ public class AudioView extends HBox
|
|||||||
private final HBox mChannelsBox = new HBox(8);
|
private final HBox mChannelsBox = new HBox(8);
|
||||||
private final ToggleButton mMuteButton = new ToggleButton();
|
private final ToggleButton mMuteButton = new ToggleButton();
|
||||||
private final IconNode mMuteIcon = new IconNode(FontAwesome.VOLUME_UP);
|
private final IconNode mMuteIcon = new IconNode(FontAwesome.VOLUME_UP);
|
||||||
private final Label mDeviceLabel = new Label();
|
private final Button mSettingsButton = new Button();
|
||||||
private final HBox mVolumeBox;
|
private final VBox mVolumeBox;
|
||||||
private final Slider mVolumeSlider = new Slider(0, 100, 50);
|
private final Slider mVolumeSlider = new Slider(0, 100, 50);
|
||||||
private final Timeline mTimeline;
|
private final Timeline mTimeline;
|
||||||
private FloatControl mGainControl;
|
private FloatControl mGainControl;
|
||||||
@@ -122,33 +124,31 @@ public class AudioView extends HBox
|
|||||||
//Master controls
|
//Master controls
|
||||||
Label title = new Label("AUDIO");
|
Label title = new Label("AUDIO");
|
||||||
title.getStyleClass().add("audio-master-title");
|
title.getStyleClass().add("audio-master-title");
|
||||||
mDeviceLabel.getStyleClass().add("audio-device");
|
|
||||||
mDeviceLabel.setMaxWidth(150);
|
|
||||||
|
|
||||||
mMuteIcon.setIconSize(22);
|
mMuteIcon.setIconSize(22);
|
||||||
mMuteIcon.getStyleClass().add("audio-button-icon");
|
mMuteIcon.getStyleClass().add("audio-button-icon");
|
||||||
mMuteButton.setGraphic(mMuteIcon);
|
mMuteButton.setGraphic(mMuteIcon);
|
||||||
mMuteButton.getStyleClass().addAll("audio-icon-button", "audio-master-mute");
|
mMuteButton.getStyleClass().addAll("audio-icon-button", "audio-master-mute");
|
||||||
|
mMuteButton.setMaxWidth(Double.MAX_VALUE);
|
||||||
mMuteButton.setOnAction(event -> setOutputMuted(mMuteButton.isSelected()));
|
mMuteButton.setOnAction(event -> setOutputMuted(mMuteButton.isSelected()));
|
||||||
|
|
||||||
IconNode settingsIcon = new IconNode(FontAwesome.COG);
|
IconNode settingsIcon = new IconNode(FontAwesome.COG);
|
||||||
settingsIcon.setIconSize(16);
|
settingsIcon.setIconSize(16);
|
||||||
settingsIcon.getStyleClass().add("audio-button-icon");
|
settingsIcon.getStyleClass().add("audio-button-icon");
|
||||||
Button settingsButton = new Button();
|
mSettingsButton.setGraphic(settingsIcon);
|
||||||
settingsButton.setGraphic(settingsIcon);
|
mSettingsButton.getStyleClass().add("audio-icon-button");
|
||||||
settingsButton.getStyleClass().add("audio-icon-button");
|
mSettingsButton.setMaxWidth(Double.MAX_VALUE);
|
||||||
settingsButton.setTooltip(new Tooltip("Audio playback device and preferences"));
|
mSettingsButton.setAccessibleText("Audio settings");
|
||||||
settingsButton.setAccessibleText("Audio settings");
|
mSettingsButton.setOnAction(event -> showAudioPreferences());
|
||||||
settingsButton.setOnAction(event -> showAudioPreferences());
|
|
||||||
|
|
||||||
HBox buttons = new HBox(6, mMuteButton, settingsButton);
|
|
||||||
buttons.setAlignment(Pos.CENTER_LEFT);
|
|
||||||
|
|
||||||
IconNode volumeIcon = new IconNode(FontAwesome.VOLUME_DOWN);
|
IconNode volumeIcon = new IconNode(FontAwesome.VOLUME_DOWN);
|
||||||
volumeIcon.setIconSize(12);
|
volumeIcon.setIconSize(12);
|
||||||
volumeIcon.getStyleClass().add("audio-detail-icon");
|
volumeIcon.getStyleClass().add("audio-detail-icon");
|
||||||
mVolumeSlider.getStyleClass().add("audio-volume");
|
mVolumeSlider.getStyleClass().add("audio-volume");
|
||||||
mVolumeSlider.setPrefWidth(110);
|
mVolumeSlider.setOrientation(Orientation.VERTICAL);
|
||||||
|
mVolumeSlider.setMinHeight(40);
|
||||||
|
mVolumeSlider.setPrefHeight(60);
|
||||||
|
VBox.setVgrow(mVolumeSlider, Priority.ALWAYS);
|
||||||
mVolumeSlider.setTooltip(new Tooltip("Volume (double-click to reset)"));
|
mVolumeSlider.setTooltip(new Tooltip("Volume (double-click to reset)"));
|
||||||
mVolumeSlider.setAccessibleText("Volume");
|
mVolumeSlider.setAccessibleText("Volume");
|
||||||
mVolumeSlider.valueProperty().addListener((observable, oldValue, newValue) -> applyVolume(newValue.intValue()));
|
mVolumeSlider.valueProperty().addListener((observable, oldValue, newValue) -> applyVolume(newValue.intValue()));
|
||||||
@@ -158,12 +158,16 @@ public class AudioView extends HBox
|
|||||||
mVolumeSlider.setValue(50);
|
mVolumeSlider.setValue(50);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mVolumeBox = new HBox(5, volumeIcon, mVolumeSlider);
|
mVolumeBox = new VBox(4, mVolumeSlider, volumeIcon);
|
||||||
mVolumeBox.setAlignment(Pos.CENTER_LEFT);
|
mVolumeBox.setAlignment(Pos.TOP_CENTER);
|
||||||
|
|
||||||
VBox master = new VBox(6, title, buttons, mVolumeBox, mDeviceLabel);
|
VBox controls = new VBox(6, title, mMuteButton, mSettingsButton);
|
||||||
|
controls.setAlignment(Pos.TOP_CENTER);
|
||||||
|
controls.setFillWidth(true);
|
||||||
|
|
||||||
|
HBox master = new HBox(4, controls, mVolumeBox);
|
||||||
master.getStyleClass().add("audio-master");
|
master.getStyleClass().add("audio-master");
|
||||||
master.setMinWidth(VBox.USE_PREF_SIZE);
|
master.setMinWidth(HBox.USE_PREF_SIZE);
|
||||||
|
|
||||||
HBox.setHgrow(mChannelsBox, Priority.ALWAYS);
|
HBox.setHgrow(mChannelsBox, Priority.ALWAYS);
|
||||||
mChannelsBox.setFillHeight(true);
|
mChannelsBox.setFillHeight(true);
|
||||||
@@ -283,8 +287,8 @@ public class AudioView extends HBox
|
|||||||
case 2 -> "Stereo";
|
case 2 -> "Stereo";
|
||||||
default -> channels.size() + " channels";
|
default -> channels.size() + " channels";
|
||||||
};
|
};
|
||||||
mDeviceLabel.setText(layout.isEmpty() ? deviceName : layout + " · " + deviceName);
|
String deviceText = layout.isEmpty() ? deviceName : layout + " · " + deviceName;
|
||||||
mDeviceLabel.setTooltip(new Tooltip(mDeviceLabel.getText()));
|
mSettingsButton.setTooltip(new Tooltip("Audio playback device and preferences\n" + deviceText));
|
||||||
|
|
||||||
if(channels.isEmpty())
|
if(channels.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,8 +45,7 @@
|
|||||||
|
|
||||||
.audio-view .audio-master
|
.audio-view .audio-master
|
||||||
{
|
{
|
||||||
-fx-padding: 2 8 2 2;
|
-fx-padding: 2 4 2 0;
|
||||||
-fx-alignment: top-left;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-view .audio-master-title
|
.audio-view .audio-master-title
|
||||||
@@ -61,17 +60,6 @@
|
|||||||
-fx-fill: -audio-text-secondary;
|
-fx-fill: -audio-text-secondary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-view .audio-device
|
|
||||||
{
|
|
||||||
-fx-text-fill: -audio-text-dim;
|
|
||||||
-fx-font-size: 0.85em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.audio-view .audio-device .text
|
|
||||||
{
|
|
||||||
-fx-fill: -audio-text-dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
.audio-view .audio-icon-button
|
.audio-view .audio-icon-button
|
||||||
{
|
{
|
||||||
-fx-background-color: -audio-panel;
|
-fx-background-color: -audio-panel;
|
||||||
@@ -111,15 +99,14 @@
|
|||||||
|
|
||||||
.audio-view .audio-master-mute
|
.audio-view .audio-master-mute
|
||||||
{
|
{
|
||||||
-fx-padding: 6 12 6 12;
|
-fx-padding: 6 10 6 10;
|
||||||
-fx-min-width: 48;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-view .audio-volume .track
|
.audio-view .audio-volume .track
|
||||||
{
|
{
|
||||||
-fx-background-color: -audio-border;
|
-fx-background-color: -audio-border;
|
||||||
-fx-background-radius: 3;
|
-fx-background-radius: 3;
|
||||||
-fx-pref-height: 4;
|
-fx-pref-width: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-view .audio-volume .thumb
|
.audio-view .audio-volume .thumb
|
||||||
|
|||||||
Reference in New Issue
Block a user