mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-20 12:36:07 -05:00
* Removes the FlatLaf, JIDE, MigLayout and jiconfont-swing dependencies; the runtime image no longer includes javafx.swing. * Removes the Swing channelizer developer viewers and the Swing spectrum panel; the symbol, sync and filter debug viewers are plain JavaFX windows. * ChannelMapModel is no longer a Swing list model; removes unused Swing color menu items and models. * Removes the Swing image methods from the icon classes; icons load as JavaFX images. * Themes no longer use FlatLaf: each theme stores its palette and ThemeManager styles JavaFX only. * The channel auto-start countdown, the event and message filter editor and the alias and deadlock alerts are now JavaFX. The main window only stores split pane divider positions after the user drags a divider. * Main window converted to JavaFX, with a spectrum and waterfall display that can be hidden. * A hidden spectrum and waterfall is disposed so that it uses no processing or memory. Show or hide it from the View menu, Ctrl+Shift+S, the display settings panel or the bar shown while it is hidden. * Streaming status panel converted to JavaFX with status chips, a summary, configurable columns and a shortcut to the streaming editor. * BroadcastModel is no longer a Swing table model. * Audio panel converted to JavaFX and redesigned as a prominent playback display at the top of the main window. * Mono and stereo outputs show one display per channel with the TO alias, icon and color, the FROM radio, system/site/channel, elapsed time, a level meter and per-channel mute. The master section has mute all, volume and audio device settings. * Renames JavaFxWindowManager to WindowManager and removes its standalone launcher and the remaining Swing-era comments. Co-authored-by: denny <dennis.sheirer@gmail.com>
261 lines
8.4 KiB
Java
261 lines
8.4 KiB
Java
/*
|
|
* *****************************************************************************
|
|
* Copyright (C) 2014-2024 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.preference;
|
|
|
|
import io.github.dsheirer.eventbus.MyEventBus;
|
|
import io.github.dsheirer.preference.application.ApplicationPreference;
|
|
import io.github.dsheirer.preference.calibration.VectorCalibrationPreference;
|
|
import io.github.dsheirer.preference.decoder.JmbeLibraryPreference;
|
|
import io.github.dsheirer.preference.directory.DirectoryPreference;
|
|
import io.github.dsheirer.preference.duplicate.CallManagementPreference;
|
|
import io.github.dsheirer.preference.event.DecodeEventPreference;
|
|
import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
|
|
import io.github.dsheirer.preference.javafx.JavaFxPreferences;
|
|
import io.github.dsheirer.preference.map.MapPreference;
|
|
import io.github.dsheirer.preference.mp3.MP3Preference;
|
|
import io.github.dsheirer.preference.playback.PlaybackPreference;
|
|
import io.github.dsheirer.preference.playlist.PlaylistPreference;
|
|
import io.github.dsheirer.preference.radioreference.RadioReferencePreference;
|
|
import io.github.dsheirer.preference.record.RecordPreference;
|
|
import io.github.dsheirer.preference.source.ChannelMultiFrequencyPreference;
|
|
import io.github.dsheirer.preference.source.TunerPreference;
|
|
import io.github.dsheirer.preference.swing.SwingPreference;
|
|
import io.github.dsheirer.sample.Listener;
|
|
|
|
/**
|
|
* User Preferences. A collection of preferences that can be accessed by preference type.
|
|
*
|
|
* Note: user preference updates are broadcast throughout the system using the Google Guava Event Bus. Each component
|
|
* can register with the event bus and annotate a method to receive updates:
|
|
*
|
|
* To register a component to receive events, add this in the constructor:
|
|
* MyEventBus.getEventBus().register(this);
|
|
*
|
|
* To receive preference update notifications, annotate a method with @Subscribe and use a PreferenceType argument:
|
|
*
|
|
* @Subscribe
|
|
* public void preferenceUpdated(PreferenceType preferenceType)
|
|
* {
|
|
* }
|
|
*/
|
|
public class UserPreferences implements Listener<PreferenceType>
|
|
{
|
|
private ApplicationPreference mApplicationPreference;
|
|
private ChannelMultiFrequencyPreference mChannelMultiFrequencyPreference;
|
|
private DecodeEventPreference mDecodeEventPreference;
|
|
private DirectoryPreference mDirectoryPreference;
|
|
private CallManagementPreference mCallManagementPreference;
|
|
private JmbeLibraryPreference mJmbeLibraryPreference;
|
|
private MapPreference mMapPreference;
|
|
private MP3Preference mMP3Preference;
|
|
private PlaybackPreference mPlaybackPreference;
|
|
private PlaylistPreference mPlaylistPreference;
|
|
private RadioReferencePreference mRadioReferencePreference;
|
|
private RecordPreference mRecordPreference;
|
|
private TalkgroupFormatPreference mTalkgroupFormatPreference;
|
|
private TunerPreference mTunerPreference;
|
|
private VectorCalibrationPreference mVectorCalibrationPreference;
|
|
|
|
private SwingPreference mSwingPreference = new SwingPreference();
|
|
private JavaFxPreferences mJavaFxPreferences = new JavaFxPreferences();
|
|
|
|
/**
|
|
* Constructs a new user preferences instance
|
|
*/
|
|
public UserPreferences()
|
|
{
|
|
loadPreferenceTypes();
|
|
}
|
|
|
|
/**
|
|
* Application general/miscellaneous preferences.
|
|
* @return application preferences.
|
|
*/
|
|
public ApplicationPreference getApplicationPreference()
|
|
{
|
|
return mApplicationPreference;
|
|
}
|
|
|
|
/**
|
|
* Vector/SIMD calibration preferences.
|
|
* @return vector calibration preferences.
|
|
*/
|
|
public VectorCalibrationPreference getVectorCalibrationPreference()
|
|
{
|
|
return mVectorCalibrationPreference;
|
|
}
|
|
|
|
/**
|
|
* Java FX window management preferences
|
|
*/
|
|
public JavaFxPreferences getJavaFxPreferences()
|
|
{
|
|
return mJavaFxPreferences;
|
|
}
|
|
|
|
/**
|
|
* Decode Event preferences
|
|
*/
|
|
public DecodeEventPreference getDecodeEventPreference()
|
|
{
|
|
return mDecodeEventPreference;
|
|
}
|
|
|
|
/**
|
|
* Decoder preferences
|
|
*/
|
|
public JmbeLibraryPreference getJmbeLibraryPreference()
|
|
{
|
|
return mJmbeLibraryPreference;
|
|
}
|
|
|
|
/**
|
|
* Directory preferences
|
|
*/
|
|
public DirectoryPreference getDirectoryPreference()
|
|
{
|
|
return mDirectoryPreference;
|
|
}
|
|
|
|
/**
|
|
* Multiple frequency channel source preferences
|
|
*/
|
|
public ChannelMultiFrequencyPreference getChannelMultiFrequencyPreference()
|
|
{
|
|
return mChannelMultiFrequencyPreference;
|
|
}
|
|
|
|
/**
|
|
* Audio playback preferences
|
|
*/
|
|
public PlaybackPreference getPlaybackPreference()
|
|
{
|
|
return mPlaybackPreference;
|
|
}
|
|
|
|
/**
|
|
* Playlist preferences
|
|
*/
|
|
public PlaylistPreference getPlaylistPreference()
|
|
{
|
|
return mPlaylistPreference;
|
|
}
|
|
|
|
/**
|
|
* Radio reference web services preferences
|
|
*/
|
|
public RadioReferencePreference getRadioReferencePreference()
|
|
{
|
|
return mRadioReferencePreference;
|
|
}
|
|
|
|
/**
|
|
* Recording preferences
|
|
*/
|
|
public RecordPreference getRecordPreference()
|
|
{
|
|
return mRecordPreference;
|
|
}
|
|
|
|
/**
|
|
* MP3 preferences
|
|
*/
|
|
public MP3Preference getMP3Preference()
|
|
{
|
|
return mMP3Preference;
|
|
}
|
|
|
|
/**
|
|
* Identifier preferences
|
|
*/
|
|
public TalkgroupFormatPreference getTalkgroupFormatPreference()
|
|
{
|
|
return mTalkgroupFormatPreference;
|
|
}
|
|
|
|
/**
|
|
* Tuner preferences
|
|
*/
|
|
public TunerPreference getTunerPreference()
|
|
{
|
|
return mTunerPreference;
|
|
}
|
|
|
|
|
|
/**
|
|
* Window locations and table column widths stored by the earlier Swing version of the application. Used only to
|
|
* migrate those settings to the JavaFX windows and tables.
|
|
*/
|
|
public SwingPreference getSwingPreference()
|
|
{
|
|
return mSwingPreference;
|
|
}
|
|
|
|
/**
|
|
* Map view preferences: the last center point and zoom level
|
|
*/
|
|
public MapPreference getMapPreference()
|
|
{
|
|
return mMapPreference;
|
|
}
|
|
|
|
/**
|
|
* Call management and duplicate call detection preferences
|
|
*/
|
|
public CallManagementPreference getCallManagementPreference()
|
|
{
|
|
return mCallManagementPreference;
|
|
}
|
|
|
|
/**
|
|
* Loads the managed preferences
|
|
*/
|
|
private void loadPreferenceTypes()
|
|
{
|
|
mApplicationPreference = new ApplicationPreference(this::receive);
|
|
mChannelMultiFrequencyPreference = new ChannelMultiFrequencyPreference(this::receive);
|
|
mDecodeEventPreference = new DecodeEventPreference(this::receive);
|
|
mDirectoryPreference = new DirectoryPreference(this::receive);
|
|
mCallManagementPreference = new CallManagementPreference(this::receive);
|
|
mJmbeLibraryPreference = new JmbeLibraryPreference(this::receive);
|
|
mMapPreference = new MapPreference(this::receive);
|
|
mMP3Preference = new MP3Preference(this::receive);
|
|
mPlaybackPreference = new PlaybackPreference(this::receive);
|
|
mPlaylistPreference = new PlaylistPreference(this::receive, mDirectoryPreference);
|
|
mRadioReferencePreference = new RadioReferencePreference(this::receive);
|
|
mRecordPreference = new RecordPreference(this::receive);
|
|
mTalkgroupFormatPreference = new TalkgroupFormatPreference(this::receive);
|
|
mTunerPreference = new TunerPreference(this::receive);
|
|
mVectorCalibrationPreference = new VectorCalibrationPreference(this::receive);
|
|
}
|
|
|
|
/**
|
|
* Primary method for receiving notification from a managed preference that a preference type
|
|
* has been changed/updated.
|
|
*
|
|
* @param preferenceType that is updated
|
|
*/
|
|
@Override
|
|
public void receive(PreferenceType preferenceType)
|
|
{
|
|
MyEventBus.getGlobalEventBus().post(preferenceType);
|
|
}
|
|
}
|