Cleanup from last PR.

This commit is contained in:
Denny
2018-02-11 06:12:57 -05:00
parent bb078de0a9
commit 54227703a2
4 changed files with 277 additions and 15 deletions

View File

@@ -2,15 +2,19 @@ package io.github.dsheirer.instrument.gui;
import io.github.dsheirer.alias.AliasModel;
import io.github.dsheirer.audio.broadcast.BroadcastModel;
import io.github.dsheirer.controller.channel.Channel;
import io.github.dsheirer.controller.channel.ChannelModel;
import io.github.dsheirer.controller.channel.map.ChannelMapModel;
import io.github.dsheirer.module.decode.DecodeConfigurationEditor;
import io.github.dsheirer.module.decode.config.DecodeConfiguration;
import io.github.dsheirer.playlist.PlaylistManager;
import io.github.dsheirer.source.IControllableFileSource;
import net.miginfocom.swing.MigLayout;
import javax.swing.*;
import java.awt.*;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -18,14 +22,14 @@ public class DecoderSelectionFrame extends JInternalFrame
{
private static final long serialVersionUID = 1L;
private Channel mChannel = new Channel();
private DecodeConfigurationEditor mDecodeEditor = new DecodeConfigurationEditor(null);
private PlaylistManager mPlaylistManager;
private IControllableFileSource mSource;
private JDesktopPane mDesktop;
public DecoderSelectionFrame(JDesktopPane desktop,
IControllableFileSource source)
public DecoderSelectionFrame(JDesktopPane desktop, IControllableFileSource source)
{
AliasModel aliasModel = new AliasModel();
BroadcastModel broadcastModel = new BroadcastModel(null);
@@ -37,6 +41,7 @@ public class DecoderSelectionFrame extends JInternalFrame
mDesktop = desktop;
mSource = source;
mDecodeEditor.setItem(mChannel);
initGUI();
}
@@ -72,17 +77,23 @@ public class DecoderSelectionFrame extends JInternalFrame
@Override
public void actionPerformed(ActionEvent arg0)
{
// DecodeConfiguration config = mDecodeEditor.getDecodeConfig();
//
// if( config != null )
// {
// DecoderViewFrame decoderFrame = new DecoderViewFrame(
// mPlaylistManager, null, mSource );
//
// decoderFrame.setVisible( true );
//
// mDesktop.add( decoderFrame );
// }
mDecodeEditor.save();
Channel channel = mDecodeEditor.getItem();
if(channel != null)
{
DecodeConfiguration config = channel.getDecodeConfiguration();
if( config != null )
{
DecoderViewFrame decoderFrame = new DecoderViewFrame(mPlaylistManager, channel, mSource );
decoderFrame.setVisible( true );
mDesktop.add( decoderFrame );
}
}
}
});
}

View File

@@ -0,0 +1,120 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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 the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import java.io.File;
/**
* Application for viewing and working with demodulators and recording files.
*/
public class DemodulatorViewerFX extends Application
{
private Stage mStage;
private MenuBar mMenuBar;
private ViewerDesktop mViewerDesktop;
@Override
public void start(Stage primaryStage) throws Exception
{
mStage = primaryStage;
mStage.setTitle("Demodulator Viewer FX");
BorderPane borderPane = new BorderPane();
borderPane.setTop(getMenuBar());
borderPane.setCenter(getViewerDesktop());
Scene scene = new Scene(borderPane, 1200, 800);
mStage.setScene(scene);
mStage.show();
}
private ViewerDesktop getViewerDesktop()
{
if(mViewerDesktop == null)
{
mViewerDesktop = new ViewerDesktop();
}
return mViewerDesktop;
}
private MenuBar getMenuBar()
{
if(mMenuBar == null)
{
mMenuBar = new MenuBar();
Menu menuFile = new Menu("File");
MenuItem menuItemOpen = new MenuItem("Open ...");
menuItemOpen.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open an I/Q recording file");
File file = fileChooser.showOpenDialog(mStage);
getViewerDesktop().load(file);
}
});
MenuItem menuItemClose = new MenuItem("Close");
menuItemClose.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
getViewerDesktop().close();
}
});
MenuItem menuItemExit = new MenuItem("Exit");
menuItemExit.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
Platform.exit();
}
});
menuFile.getItems().addAll(menuItemOpen, menuItemClose, new SeparatorMenuItem(), menuItemExit);
mMenuBar.getMenus().addAll(menuFile);
}
return mMenuBar;
}
public static void main(String[] args)
{
launch(args);
}
}

View File

@@ -0,0 +1,81 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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 the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import java.nio.file.Path;
public class PlaybackController extends HBox
{
private Button mPlay1Button;
private Button mPlay10Button;
private Button mPlay100Button;
private Button mPlay1000Button;
public PlaybackController()
{
getChildren().addAll(getPlay1Button(), getPlay10Button(), getPlay100Button(), getPlay1000Button());
}
public void load(Path path)
{
}
public Button getPlay1Button()
{
if(mPlay1Button == null)
{
mPlay1Button = new Button("> 1");
}
return mPlay1Button;
}
public Button getPlay10Button()
{
if(mPlay10Button == null)
{
mPlay10Button = new Button(">> 10");
}
return mPlay10Button;
}
public Button getPlay100Button()
{
if(mPlay100Button == null)
{
mPlay100Button = new Button(">> 100");
}
return mPlay100Button;
}
public Button getPlay1000Button()
{
if(mPlay1000Button == null)
{
mPlay1000Button = new Button(">> 1000");
}
return mPlay1000Button;
}
}

View File

@@ -0,0 +1,50 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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 the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
package io.github.dsheirer.instrument.gui.viewer;
import javafx.scene.layout.BorderPane;
import java.io.File;
public class ViewerDesktop extends BorderPane
{
private PlaybackController mPlaybackController;
public ViewerDesktop()
{
setBottom(getPlaybackController());
}
public void load(File file)
{
}
public void close()
{
}
private PlaybackController getPlaybackController()
{
if(mPlaybackController == null)
{
mPlaybackController = new PlaybackController();
}
return mPlaybackController;
}
}