diff --git a/.idea/misc.xml b/.idea/misc.xml index 00f52ed7b..769598250 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/src/main/java/io/github/dsheirer/controller/ControllerPanel.java b/src/main/java/io/github/dsheirer/controller/ControllerPanel.java index 66748334c..a3d510d7b 100644 --- a/src/main/java/io/github/dsheirer/controller/ControllerPanel.java +++ b/src/main/java/io/github/dsheirer/controller/ControllerPanel.java @@ -97,8 +97,8 @@ public void setSelectedIndex(int index) mTabbedPane.addTab("Map", mMapPanel); mTabbedPane.addTab("Tuners", mTunerManagerPanel); - Icon gearIcon = IconFontSwing.buildIcon(FontAwesome.COG, 20, Color.DARK_GRAY); - mTabbedPane.addTab("Playlist Editor", gearIcon, new JLabel("Show Playlist Manager")); + Icon playIcon = IconFontSwing.buildIcon(FontAwesome.PLAY_CIRCLE_O, 20, Color.DARK_GRAY); + mTabbedPane.addTab("Playlist Editor", playIcon, new JLabel("Show Playlist Manager")); mSettingsTabIndex = mTabbedPane.getTabCount() - 1; //Set preferred size to influence the split between these panels diff --git a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java index fb18a0180..12ca6475c 100644 --- a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java +++ b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java @@ -54,7 +54,7 @@ import io.github.dsheirer.source.tuner.manager.DiscoveredTuner; import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.ui.TunerSpectralDisplayManager; -import io.github.dsheirer.spectrum.ClearTunerMenuItem; +import io.github.dsheirer.spectrum.DisableSpectrumWaterfallMenuItem; import io.github.dsheirer.spectrum.ShowTunerMenuItem; import io.github.dsheirer.spectrum.SpectralDisplayPanel; import io.github.dsheirer.util.ThreadPool; @@ -73,6 +73,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Files; @@ -415,56 +416,119 @@ public void actionPerformed(ActionEvent event) JMenu viewMenu = new JMenu("View"); JMenuItem viewPlaylistItem = new JMenuItem("Playlist Editor"); + viewPlaylistItem.setIcon(IconFontSwing.buildIcon(FontAwesome.PLAY_CIRCLE_O, 12)); viewPlaylistItem.addActionListener(e -> MyEventBus.getGlobalEventBus().post(new ViewPlaylistRequest())); viewMenu.add(viewPlaylistItem); viewMenu.add(new JSeparator()); + JMenuItem viewApplicationLogsMenu = new JMenuItem("Application Log Files"); + viewApplicationLogsMenu.setIcon(IconFontSwing.buildIcon(FontAwesome.FOLDER_OPEN_O, 12)); + viewApplicationLogsMenu.addActionListener(arg0 -> { + File logsDirectory = mUserPreferences.getDirectoryPreference().getDirectoryApplicationLog().toFile(); + try + { + Desktop.getDesktop().open(logsDirectory); + } + catch(Exception e) + { + mLog.error("Couldn't open file explorer"); + + JOptionPane.showMessageDialog(mMainGui, + "Can't launch file explorer - files are located at: " + logsDirectory, + "Can't launch file explorer", + JOptionPane.ERROR_MESSAGE); + } + }); + viewMenu.add(viewApplicationLogsMenu); + + JMenuItem viewRecordingsMenuItem = new JMenuItem("Audio Recordings"); + viewRecordingsMenuItem.setIcon(IconFontSwing.buildIcon(FontAwesome.FOLDER_OPEN_O, 12)); + viewRecordingsMenuItem.addActionListener(arg0 -> { + File recordingsDirectory = mUserPreferences.getDirectoryPreference().getDirectoryRecording().toFile(); + + try + { + Desktop.getDesktop().open(recordingsDirectory); + } + catch(Exception e) + { + mLog.error("Couldn't open file explorer"); + + JOptionPane.showMessageDialog(mMainGui, + "Can't launch file explorer - files are located at: " + + recordingsDirectory, + "Can't launch file explorer", + JOptionPane.ERROR_MESSAGE); + } + }); + viewMenu.add(viewRecordingsMenuItem); + + JMenuItem viewEventLogsMenu = new JMenuItem("Channel Event Log Files"); + viewEventLogsMenu.setIcon(IconFontSwing.buildIcon(FontAwesome.FOLDER_OPEN_O, 12)); + viewEventLogsMenu.addActionListener(arg0 -> { + File eventLogsDirectory = mUserPreferences.getDirectoryPreference().getDirectoryEventLog().toFile(); + try + { + Desktop.getDesktop().open(eventLogsDirectory); + } + catch(Exception e) + { + mLog.error("Couldn't open file explorer"); + + JOptionPane.showMessageDialog(mMainGui, + "Can't launch file explorer - files are located at: " + eventLogsDirectory, + "Can't launch file explorer", + JOptionPane.ERROR_MESSAGE); + } + }); + viewMenu.add(viewEventLogsMenu); + + JMenuItem iconManagerMenu = new JMenuItem("Icon Manager"); + iconManagerMenu.setIcon(IconFontSwing.buildIcon(FontAwesome.PICTURE_O, 12)); + iconManagerMenu.addActionListener(arg0 -> MyEventBus.getGlobalEventBus().post(new ViewIconManagerRequest())); + viewMenu.add(iconManagerMenu); + JMenuItem recordingViewerMenu = new JMenuItem("Message Recording Viewer (.bits)"); + recordingViewerMenu.setIcon(IconFontSwing.buildIcon(FontAwesome.BRAILLE, 12)); recordingViewerMenu.addActionListener(e -> MyEventBus.getGlobalEventBus().post(new ViewRecordingViewerRequest())); viewMenu.add(recordingViewerMenu); - JMenuItem settingsMenu = new JMenuItem("Icon Manager"); - settingsMenu.addActionListener(arg0 -> MyEventBus.getGlobalEventBus().post(new ViewIconManagerRequest())); - viewMenu.add(settingsMenu); - - JMenuItem logFilesMenu = new JMenuItem("Logs & Recordings"); - logFilesMenu.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent arg0) + JMenuItem viewScreenCapturesMenu = new JMenuItem("Screen Captures"); + viewScreenCapturesMenu.setIcon(IconFontSwing.buildIcon(FontAwesome.FOLDER_OPEN_O, 12)); + viewScreenCapturesMenu.addActionListener(arg0 -> { + File screenCapturesDirectory = mUserPreferences.getDirectoryPreference().getDirectoryScreenCapture().toFile(); + try { - try - { - Desktop.getDesktop().open(getHomePath().toFile()); - } - catch(Exception e) - { - mLog.error("Couldn't open file explorer"); + Desktop.getDesktop().open(screenCapturesDirectory); + } + catch(Exception e) + { + mLog.error("Couldn't open file explorer"); - JOptionPane.showMessageDialog(mMainGui, - "Can't launch file explorer - files are located at: " + - getHomePath().toString(), - "Can't launch file explorer", - JOptionPane.ERROR_MESSAGE); - } + JOptionPane.showMessageDialog(mMainGui, + "Can't launch file explorer - files are located at: " + screenCapturesDirectory, + "Can't launch file explorer", + JOptionPane.ERROR_MESSAGE); } }); - viewMenu.add(logFilesMenu); + viewMenu.add(viewScreenCapturesMenu); JMenuItem preferencesItem = new JMenuItem("User Preferences"); + preferencesItem.setIcon(IconFontSwing.buildIcon(FontAwesome.COG, 12)); preferencesItem.addActionListener(e -> MyEventBus.getGlobalEventBus().post(new ViewUserPreferenceEditorRequest())); viewMenu.add(preferencesItem); viewMenu.add(new JSeparator()); viewMenu.add(new TunersMenu()); viewMenu.add(new JSeparator()); - viewMenu.add(new ClearTunerMenuItem(mSpectralPanel)); + viewMenu.add(new DisableSpectrumWaterfallMenuItem(mSpectralPanel)); viewMenu.add(new BroadcastStatusVisibleMenuItem(mControllerPanel)); menuBar.add(viewMenu); JMenuItem screenCaptureItem = new JMenuItem("Screen Capture"); + screenCaptureItem.setIcon(IconFontSwing.buildIcon(FontAwesome.CAMERA, 12)); screenCaptureItem.setMnemonic(KeyEvent.VK_C); screenCaptureItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)); screenCaptureItem.setMaximumSize(screenCaptureItem.getPreferredSize()); diff --git a/src/main/java/io/github/dsheirer/spectrum/ClearTunerMenuItem.java b/src/main/java/io/github/dsheirer/spectrum/ClearTunerMenuItem.java deleted file mode 100644 index 5085c41dd..000000000 --- a/src/main/java/io/github/dsheirer/spectrum/ClearTunerMenuItem.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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 - * - ******************************************************************************/ -package io.github.dsheirer.spectrum; - -import io.github.dsheirer.properties.SystemProperties; - -import javax.swing.JMenuItem; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -public class ClearTunerMenuItem extends JMenuItem -{ - private SpectralDisplayPanel mSpectralDisplayPanel; - - public ClearTunerMenuItem(SpectralDisplayPanel spectralDisplayPanel) - { - super("Disable Spectrum & Waterfall"); - - mSpectralDisplayPanel = spectralDisplayPanel; - - addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - SystemProperties properties = SystemProperties.getInstance(); - properties.set(SpectralDisplayPanel.SPECTRAL_DISPLAY_ENABLED, false); - mSpectralDisplayPanel.clearTuner(); - } - }); - } -} - diff --git a/src/main/java/io/github/dsheirer/spectrum/DisableSpectrumWaterfallMenuItem.java b/src/main/java/io/github/dsheirer/spectrum/DisableSpectrumWaterfallMenuItem.java new file mode 100644 index 000000000..7fcc22b76 --- /dev/null +++ b/src/main/java/io/github/dsheirer/spectrum/DisableSpectrumWaterfallMenuItem.java @@ -0,0 +1,52 @@ +/* + * ***************************************************************************** + * 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 + * 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 + * **************************************************************************** + */ +package io.github.dsheirer.spectrum; + +import io.github.dsheirer.properties.SystemProperties; +import jiconfont.icons.font_awesome.FontAwesome; +import jiconfont.swing.IconFontSwing; + +import javax.swing.JMenuItem; + +/** + * Menu item to disable the spectrum and waterfall and no longer monitor a tuner. + */ +public class DisableSpectrumWaterfallMenuItem extends JMenuItem +{ + private SpectralDisplayPanel mSpectralDisplayPanel; + + /** + * Construct an instance + * @param spectralDisplayPanel to disable. + */ + public DisableSpectrumWaterfallMenuItem(SpectralDisplayPanel spectralDisplayPanel) + { + super("Disable Spectrum & Waterfall"); + setIcon(IconFontSwing.buildIcon(FontAwesome.EYE_SLASH, 12)); + + mSpectralDisplayPanel = spectralDisplayPanel; + + addActionListener(e -> { + SystemProperties properties = SystemProperties.getInstance(); + properties.set(SpectralDisplayPanel.SPECTRAL_DISPLAY_ENABLED, false); + mSpectralDisplayPanel.clearTuner(); + }); + } +} + diff --git a/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java b/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java index 7e825d8db..fab5cce93 100644 --- a/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java +++ b/src/main/java/io/github/dsheirer/spectrum/SpectralDisplayPanel.java @@ -763,7 +763,7 @@ private void update(MouseEvent event) if(mTuner != null) { contextMenu.add(new JSeparator()); - contextMenu.add(new ClearTunerMenuItem(SpectralDisplayPanel.this)); + contextMenu.add(new DisableSpectrumWaterfallMenuItem(SpectralDisplayPanel.this)); } boolean separatorAdded = false;