Add option to open software oscilloscope online

pull/60/head
James Ball 2022-05-09 21:33:40 +01:00
rodzic ade45fa9e6
commit d454970c28
3 zmienionych plików z 15 dodań i 0 usunięć

Wyświetl plik

@ -51,6 +51,10 @@ public class Gui extends Application {
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/css/main.css").toExternalForm());
controller.setSoftwareOscilloscopeAction(() -> {
getHostServices().showDocument("https://james.ball.sh/oscilloscope");
});
scene.addEventHandler(KeyEvent.KEY_PRESSED, (event -> {
switch (event.getCode()) {
// frame selection controls

Wyświetl plik

@ -163,6 +163,8 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
private MenuItem recordMenuItem;
@FXML
private Spinner<Double> recordLengthSpinner;
@FXML
private MenuItem softwareOscilloscopeMenuItem;
public MainController() throws Exception {
// Clone DEFAULT_OBJ InputStream using a ByteArrayOutputStream
@ -477,6 +479,10 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
new Thread(() -> sendAudioDataToWebSocket(webSocketServer)).start();
}
public void setSoftwareOscilloscopeAction(Runnable openBrowser) {
softwareOscilloscopeMenuItem.setOnAction((e) -> openBrowser.run());
}
private void sendAudioDataToWebSocket(ByteWebSocketServer server) {
while (true) {
try {

Wyświetl plik

@ -154,6 +154,11 @@
</CustomMenuItem>
</items>
</Menu>
<Menu mnemonicParsing="false" text="Window">
<items>
<MenuItem fx:id="softwareOscilloscopeMenuItem" mnemonicParsing="false" text="Open Software Oscilloscope" />
</items>
</Menu>
</menus>
</MenuBar>
<TitledPane animated="false" collapsible="false" layoutX="7.0" layoutY="33.0" prefHeight="371.0" prefWidth="378.0" text="Main settings">