mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
444 Expose Application Directories via User Preferences (#458)
* Refactors DirectoryPreference from PLaylistPreference. Adds editor to PreferenceEditor for directories. Organizes preference editor tree. * Adds recording directory preference to editor and updates recording manager to dynamically use this property for recordings. * Adds event logs directory preference to editor and updates event log manager to dynamically use this property for event logging. * Adds application log directory preference. Updates logging to use user preference for application log directory. Moves logging initialization into the main application class and removes file based logging configs from the logback.xml configuration file. * Refactors application logging into its own class and adds prefeence update monitoring to dynamically stop/start the logger in the new directory location. * Adds streaming and screen capture directories to the user preferences editor and updates streaming and screen captures to dynamically adapt to user changes.
This commit is contained in:
@@ -36,6 +36,7 @@ import io.github.dsheirer.eventbus.MyEventBus;
|
||||
import io.github.dsheirer.gui.preference.PreferenceEditorType;
|
||||
import io.github.dsheirer.gui.preference.PreferenceEditorViewRequest;
|
||||
import io.github.dsheirer.icon.IconManager;
|
||||
import io.github.dsheirer.log.ApplicationLog;
|
||||
import io.github.dsheirer.map.MapService;
|
||||
import io.github.dsheirer.module.log.EventLogManager;
|
||||
import io.github.dsheirer.playlist.PlaylistManager;
|
||||
@@ -56,7 +57,6 @@ import io.github.dsheirer.spectrum.SpectralDisplayPanel;
|
||||
import io.github.dsheirer.util.ThreadPool;
|
||||
import io.github.dsheirer.util.TimeStamp;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -89,6 +89,7 @@ import java.util.List;
|
||||
public class SDRTrunk implements Listener<TunerEvent>
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(SDRTrunk.class);
|
||||
|
||||
private static final String PROPERTY_BROADCAST_STATUS_VISIBLE = "main.broadcast.status.visible";
|
||||
private boolean mBroadcastStatusVisible;
|
||||
|
||||
@@ -106,21 +107,14 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
private JideSplitPane mSplitPane;
|
||||
private JavaFxWindowManager mJavaFxWindowManager;
|
||||
private UserPreferences mUserPreferences = new UserPreferences();
|
||||
private ApplicationLog mApplicationLog;
|
||||
|
||||
private String mTitle;
|
||||
|
||||
public SDRTrunk()
|
||||
{
|
||||
mLog.info("*******************************************************************");
|
||||
mLog.info("**** sdrtrunk: a trunked radio and digital decoding application ***");
|
||||
mLog.info("**** website: https://github.com/dsheirer/sdrtrunk ***");
|
||||
mLog.info("*******************************************************************");
|
||||
mLog.info("Memory Logging Format: [Used/Allocated PercentUsed%]");
|
||||
mLog.info("Host OS Name: " + System.getProperty("os.name"));
|
||||
mLog.info("Host OS Arch: " + System.getProperty("os.arch"));
|
||||
mLog.info("Host OS Version: " + System.getProperty("os.version"));
|
||||
mLog.info("Host CPU Cores: " + Runtime.getRuntime().availableProcessors());
|
||||
mLog.info("Host Max Java Memory: " + FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()));
|
||||
mApplicationLog = new ApplicationLog(mUserPreferences);
|
||||
mApplicationLog.start();
|
||||
|
||||
//Setup the application home directory
|
||||
Path home = getHomePath();
|
||||
@@ -151,9 +145,9 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
|
||||
ChannelMapModel channelMapModel = new ChannelMapModel();
|
||||
|
||||
EventLogManager eventLogManager = new EventLogManager();
|
||||
EventLogManager eventLogManager = new EventLogManager(mUserPreferences);
|
||||
|
||||
RecorderManager recorderManager = new RecorderManager(aliasModel);
|
||||
RecorderManager recorderManager = new RecorderManager(aliasModel, mUserPreferences);
|
||||
|
||||
mJavaFxWindowManager = new JavaFxWindowManager(mUserPreferences);
|
||||
|
||||
@@ -170,7 +164,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
|
||||
AudioPlaybackManager audioPlaybackManager = new AudioPlaybackManager(mSourceManager.getMixerManager());
|
||||
|
||||
mBroadcastModel = new BroadcastModel(aliasModel, mIconManager);
|
||||
mBroadcastModel = new BroadcastModel(aliasModel, mIconManager, mUserPreferences);
|
||||
|
||||
//Audio packets are routed through the audio packet manager for metadata enrichment and then
|
||||
//distributed to the audio packet processors (ie playback, recording, streaming, etc.)
|
||||
@@ -373,47 +367,20 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
{
|
||||
Robot robot = new Robot();
|
||||
|
||||
final BufferedImage image =
|
||||
robot.createScreenCapture(mMainGui.getBounds());
|
||||
final BufferedImage image = robot.createScreenCapture(mMainGui.getBounds());
|
||||
|
||||
SystemProperties props = SystemProperties.getInstance();
|
||||
String filename = TimeStamp.getTimeStamp("_") + "_screen_capture.png";
|
||||
|
||||
Path capturePath = props.getApplicationFolder("screen_captures");
|
||||
final Path captureFile = mUserPreferences.getDirectoryPreference().getDirectoryScreenCapture().resolve(filename);
|
||||
|
||||
if(!Files.exists(capturePath))
|
||||
{
|
||||
EventQueue.invokeLater(() -> {
|
||||
try
|
||||
{
|
||||
Files.createDirectory(capturePath);
|
||||
ImageIO.write(image, "png", captureFile.toFile());
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
mLog.error("Couldn't create 'screen_captures' "
|
||||
+ "subdirectory in the " +
|
||||
"SDRTrunk application directory", e);
|
||||
}
|
||||
}
|
||||
|
||||
String filename = TimeStamp.getTimeStamp("_") +
|
||||
"_screen_capture.png";
|
||||
|
||||
final Path captureFile = capturePath.resolve(filename);
|
||||
|
||||
EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "png",
|
||||
captureFile.toFile());
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
mLog.error("Couldn't write screen capture to "
|
||||
+ "file [" + captureFile.toString() + "]", e);
|
||||
}
|
||||
mLog.error("Couldn't write screen capture to file [" + captureFile.toString() + "]", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -442,6 +409,7 @@ public class SDRTrunk implements Listener<TunerEvent>
|
||||
mLog.info("Releasing tuners ...");
|
||||
mSourceManager.shutdown();
|
||||
mLog.info("Shutdown complete.");
|
||||
mApplicationLog.stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
package io.github.dsheirer.gui.preference;
|
||||
|
||||
import io.github.dsheirer.gui.preference.directory.DirectoryPreferenceEditor;
|
||||
import io.github.dsheirer.gui.preference.tuner.TunerPreferenceEditor;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import javafx.scene.Node;
|
||||
@@ -33,10 +34,12 @@ public class PreferenceEditorFactory
|
||||
{
|
||||
switch(preferenceEditorType)
|
||||
{
|
||||
case TALKGROUP_FORMAT:
|
||||
return new TalkgroupFormatPreferenceEditor(userPreferences);
|
||||
case CHANNEL_EVENT:
|
||||
return new DecodeEventViewPreferenceEditor(userPreferences);
|
||||
case DIRECTORY:
|
||||
return new DirectoryPreferenceEditor(userPreferences);
|
||||
case TALKGROUP_FORMAT:
|
||||
return new TalkgroupFormatPreferenceEditor(userPreferences);
|
||||
case TUNER:
|
||||
return new TunerPreferenceEditor(userPreferences);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,10 @@ package io.github.dsheirer.gui.preference;
|
||||
*/
|
||||
public enum PreferenceEditorType
|
||||
{
|
||||
CHANNEL_EVENT("Channel Event"),
|
||||
TALKGROUP_FORMAT("Talkgroup Display"),
|
||||
TUNER("Tuner");
|
||||
CHANNEL_EVENT("Channel Events"),
|
||||
DIRECTORY("Directories"),
|
||||
TALKGROUP_FORMAT("Talkgroups"),
|
||||
TUNER("Tuners");
|
||||
|
||||
private String mLabel;
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class PreferencesEditor extends Application
|
||||
public void start(Stage stage) throws Exception
|
||||
{
|
||||
stage.setTitle("Preferences");
|
||||
Scene scene = new Scene(getBorderPane(), 800, 500);
|
||||
Scene scene = new Scene(getBorderPane(), 900, 500);
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
@@ -192,10 +192,19 @@ public class PreferencesEditor extends Application
|
||||
TreeItem<String> displayItem = new TreeItem<>("Display");
|
||||
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.CHANNEL_EVENT));
|
||||
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.TALKGROUP_FORMAT));
|
||||
displayItem.getChildren().add(new TreeItem(PreferenceEditorType.TUNER));
|
||||
treeRoot.getChildren().add(displayItem);
|
||||
displayItem.setExpanded(true);
|
||||
|
||||
TreeItem<String> storageItem = new TreeItem<>("File Storage");
|
||||
storageItem.getChildren().add(new TreeItem(PreferenceEditorType.DIRECTORY));
|
||||
treeRoot.getChildren().add(storageItem);
|
||||
storageItem.setExpanded(true);
|
||||
|
||||
TreeItem<String> sourceItem = new TreeItem<>("Source");
|
||||
sourceItem.getChildren().add(new TreeItem(PreferenceEditorType.TUNER));
|
||||
treeRoot.getChildren().add(sourceItem);
|
||||
sourceItem.setExpanded(true);
|
||||
|
||||
mEditorSelectionTreeView = new TreeView();
|
||||
mEditorSelectionTreeView.setShowRoot(false);
|
||||
mEditorSelectionTreeView.setRoot(treeRoot);
|
||||
|
||||
@@ -0,0 +1,684 @@
|
||||
/*
|
||||
* ******************************************************************************
|
||||
* sdrtrunk
|
||||
* 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.gui.preference.directory;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import io.github.dsheirer.eventbus.MyEventBus;
|
||||
import io.github.dsheirer.preference.PreferenceType;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.preference.directory.DirectoryPreference;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Separator;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* Preference settings for channel event view
|
||||
*/
|
||||
public class DirectoryPreferenceEditor extends HBox
|
||||
{
|
||||
private final static Logger mLog = LoggerFactory.getLogger(DirectoryPreferenceEditor.class);
|
||||
|
||||
private DirectoryPreference mDirectoryPreference;
|
||||
private GridPane mEditorPane;
|
||||
|
||||
private Label mApplicationRootLabel;
|
||||
private Button mChangeApplicationRootButton;
|
||||
private Button mResetApplicationRootButton;
|
||||
private Label mApplicationRootPathLabel;
|
||||
|
||||
private Label mApplicationLogsLabel;
|
||||
private Button mChangeApplicationLogsButton;
|
||||
private Button mResetApplicationLogsButton;
|
||||
private Label mApplicationLogsPathLabel;
|
||||
|
||||
private Label mEventLogsLabel;
|
||||
private Button mChangeEventLogsButton;
|
||||
private Button mResetEventLogsButton;
|
||||
private Label mEventLogsPathLabel;
|
||||
|
||||
private Label mPlaylistLabel;
|
||||
private Button mChangePlaylistButton;
|
||||
private Button mResetPlaylistButton;
|
||||
private Label mPlaylistPathLabel;
|
||||
|
||||
private Label mRecordingLabel;
|
||||
private Button mChangeRecordingButton;
|
||||
private Button mResetRecordingButton;
|
||||
private Label mRecordingPathLabel;
|
||||
|
||||
private Label mScreenCaptureLabel;
|
||||
private Button mChangeScreenCaptureButton;
|
||||
private Button mResetScreenCaptureButton;
|
||||
private Label mScreenCapturePathLabel;
|
||||
|
||||
private Label mStreamingLabel;
|
||||
private Button mChangeStreamingButton;
|
||||
private Button mResetStreamingButton;
|
||||
private Label mStreamingPathLabel;
|
||||
|
||||
public DirectoryPreferenceEditor(UserPreferences userPreferences)
|
||||
{
|
||||
mDirectoryPreference = userPreferences.getDirectoryPreference();
|
||||
|
||||
//Register to receive directory preference update notifications so we can update the path labels
|
||||
MyEventBus.getEventBus().register(this);
|
||||
|
||||
HBox.setHgrow(getEditorPane(), Priority.ALWAYS);
|
||||
getChildren().add(getEditorPane());
|
||||
}
|
||||
|
||||
private GridPane getEditorPane()
|
||||
{
|
||||
if(mEditorPane == null)
|
||||
{
|
||||
mEditorPane = new GridPane();
|
||||
mEditorPane.setPadding(new Insets(10, 10, 10, 10));
|
||||
|
||||
int row = 0;
|
||||
|
||||
Label itemLabel = new Label("Item");
|
||||
GridPane.setMargin(itemLabel, new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(itemLabel, 0, row);
|
||||
|
||||
Label directoryLabel = new Label("Directory");
|
||||
GridPane.setMargin(directoryLabel, new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(directoryLabel, 1, row++);
|
||||
|
||||
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, row++, 4, 1);
|
||||
|
||||
GridPane.setMargin(getApplicationRootLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getApplicationRootLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getApplicationRootPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getApplicationRootPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeApplicationRootButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeApplicationRootButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetApplicationRootButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetApplicationRootButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getApplicationLogsLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getApplicationLogsLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getApplicationLogsPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getApplicationLogsPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeApplicationLogsButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeApplicationLogsButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetApplicationLogsButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetApplicationLogsButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getEventLogsLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getEventLogsLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getEventLogsPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getEventLogsPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeEventLogsButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeEventLogsButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetEventLogsButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetEventLogsButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getPlaylistLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getPlaylistLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getPlaylistPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getPlaylistPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangePlaylistButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangePlaylistButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetPlaylistButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetPlaylistButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getRecordingLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getRecordingLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getRecordingPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getRecordingPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeRecordingButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeRecordingButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetRecordingButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetRecordingButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getScreenCaptureLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getScreenCaptureLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getScreenCapturePathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getScreenCapturePathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeScreenCaptureButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeScreenCaptureButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetScreenCaptureButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetScreenCaptureButton(), 3, row++);
|
||||
|
||||
|
||||
GridPane.setMargin(getStreamingLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getStreamingLabel(), 0, row);
|
||||
|
||||
GridPane.setMargin(getStreamingPathLabel(), new Insets(0, 10, 0, 0));
|
||||
mEditorPane.add(getStreamingPathLabel(), 1, row);
|
||||
|
||||
GridPane.setMargin(getChangeStreamingButton(), new Insets(2, 10, 2, 0));
|
||||
mEditorPane.add(getChangeStreamingButton(), 2, row);
|
||||
|
||||
GridPane.setMargin(getResetStreamingButton(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getResetStreamingButton(), 3, row++);
|
||||
}
|
||||
|
||||
return mEditorPane;
|
||||
}
|
||||
|
||||
private Label getApplicationRootLabel()
|
||||
{
|
||||
if(mApplicationRootLabel == null)
|
||||
{
|
||||
mApplicationRootLabel = new Label("Application Root");
|
||||
}
|
||||
|
||||
return mApplicationRootLabel;
|
||||
}
|
||||
|
||||
private Button getChangeApplicationRootButton()
|
||||
{
|
||||
if(mChangeApplicationRootButton == null)
|
||||
{
|
||||
mChangeApplicationRootButton = new Button("Change...");
|
||||
mChangeApplicationRootButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Application Root Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryApplicationRoot().toFile());
|
||||
Stage stage = (Stage)getChangeApplicationRootButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryApplicationRoot(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeApplicationRootButton;
|
||||
}
|
||||
|
||||
private Button getResetApplicationRootButton()
|
||||
{
|
||||
if(mResetApplicationRootButton == null)
|
||||
{
|
||||
mResetApplicationRootButton = new Button("Reset");
|
||||
mResetApplicationRootButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryApplicationRoot();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetApplicationRootButton;
|
||||
}
|
||||
|
||||
private Label getApplicationRootPathLabel()
|
||||
{
|
||||
if(mApplicationRootPathLabel == null)
|
||||
{
|
||||
mApplicationRootPathLabel = new Label(mDirectoryPreference.getDirectoryApplicationRoot().toString());
|
||||
}
|
||||
|
||||
return mApplicationRootPathLabel;
|
||||
}
|
||||
|
||||
private Label getApplicationLogsLabel()
|
||||
{
|
||||
if(mApplicationLogsLabel == null)
|
||||
{
|
||||
mApplicationLogsLabel = new Label("Application Logs");
|
||||
}
|
||||
|
||||
return mApplicationLogsLabel;
|
||||
}
|
||||
|
||||
private Button getChangeApplicationLogsButton()
|
||||
{
|
||||
if(mChangeApplicationLogsButton == null)
|
||||
{
|
||||
mChangeApplicationLogsButton = new Button("Change...");
|
||||
mChangeApplicationLogsButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Application Logs Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryApplicationLog().toFile());
|
||||
Stage stage = (Stage)getChangeApplicationLogsButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryApplicationLogs(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeApplicationLogsButton;
|
||||
}
|
||||
|
||||
private Button getResetApplicationLogsButton()
|
||||
{
|
||||
if(mResetApplicationLogsButton == null)
|
||||
{
|
||||
mResetApplicationLogsButton = new Button("Reset");
|
||||
mResetApplicationLogsButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryApplicationLogs();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetApplicationLogsButton;
|
||||
}
|
||||
|
||||
private Label getApplicationLogsPathLabel()
|
||||
{
|
||||
if(mApplicationLogsPathLabel == null)
|
||||
{
|
||||
mApplicationLogsPathLabel = new Label(mDirectoryPreference.getDirectoryApplicationLog().toString());
|
||||
}
|
||||
|
||||
return mApplicationLogsPathLabel;
|
||||
}
|
||||
|
||||
private Label getEventLogsLabel()
|
||||
{
|
||||
if(mEventLogsLabel == null)
|
||||
{
|
||||
mEventLogsLabel = new Label("Event Logs");
|
||||
}
|
||||
|
||||
return mEventLogsLabel;
|
||||
}
|
||||
|
||||
private Button getChangeEventLogsButton()
|
||||
{
|
||||
if(mChangeEventLogsButton == null)
|
||||
{
|
||||
mChangeEventLogsButton = new Button("Change...");
|
||||
mChangeEventLogsButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Event Logs Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryEventLog().toFile());
|
||||
Stage stage = (Stage)getChangeEventLogsButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryEventLogs(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeEventLogsButton;
|
||||
}
|
||||
|
||||
private Button getResetEventLogsButton()
|
||||
{
|
||||
if(mResetEventLogsButton == null)
|
||||
{
|
||||
mResetEventLogsButton = new Button("Reset");
|
||||
mResetEventLogsButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryEventLogs();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetEventLogsButton;
|
||||
}
|
||||
|
||||
private Label getEventLogsPathLabel()
|
||||
{
|
||||
if(mEventLogsPathLabel == null)
|
||||
{
|
||||
mEventLogsPathLabel = new Label(mDirectoryPreference.getDirectoryEventLog().toString());
|
||||
}
|
||||
|
||||
return mEventLogsPathLabel;
|
||||
}
|
||||
|
||||
private Label getPlaylistLabel()
|
||||
{
|
||||
if(mPlaylistLabel == null)
|
||||
{
|
||||
mPlaylistLabel = new Label("Playlists");
|
||||
}
|
||||
|
||||
return mPlaylistLabel;
|
||||
}
|
||||
|
||||
private Button getChangePlaylistButton()
|
||||
{
|
||||
if(mChangePlaylistButton == null)
|
||||
{
|
||||
mChangePlaylistButton = new Button("Change...");
|
||||
mChangePlaylistButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Playlist Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryPlaylist().toFile());
|
||||
Stage stage = (Stage)getChangePlaylistButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryPlaylist(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangePlaylistButton;
|
||||
}
|
||||
|
||||
private Button getResetPlaylistButton()
|
||||
{
|
||||
if(mResetPlaylistButton == null)
|
||||
{
|
||||
mResetPlaylistButton = new Button("Reset");
|
||||
mResetPlaylistButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryPlaylist();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetPlaylistButton;
|
||||
}
|
||||
|
||||
private Label getPlaylistPathLabel()
|
||||
{
|
||||
if(mPlaylistPathLabel == null)
|
||||
{
|
||||
mPlaylistPathLabel = new Label(mDirectoryPreference.getDirectoryPlaylist().toString());
|
||||
}
|
||||
|
||||
return mPlaylistPathLabel;
|
||||
}
|
||||
|
||||
private Label getRecordingLabel()
|
||||
{
|
||||
if(mRecordingLabel == null)
|
||||
{
|
||||
mRecordingLabel = new Label("Recordings");
|
||||
}
|
||||
|
||||
return mRecordingLabel;
|
||||
}
|
||||
|
||||
private Button getChangeRecordingButton()
|
||||
{
|
||||
if(mChangeRecordingButton == null)
|
||||
{
|
||||
mChangeRecordingButton = new Button("Change...");
|
||||
mChangeRecordingButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Recording Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryRecording().toFile());
|
||||
Stage stage = (Stage)getChangeRecordingButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryRecording(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeRecordingButton;
|
||||
}
|
||||
|
||||
private Button getResetRecordingButton()
|
||||
{
|
||||
if(mResetRecordingButton == null)
|
||||
{
|
||||
mResetRecordingButton = new Button("Reset");
|
||||
mResetRecordingButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryRecording();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetRecordingButton;
|
||||
}
|
||||
|
||||
private Label getRecordingPathLabel()
|
||||
{
|
||||
if(mRecordingPathLabel == null)
|
||||
{
|
||||
mRecordingPathLabel = new Label(mDirectoryPreference.getDirectoryRecording().toString());
|
||||
}
|
||||
|
||||
return mRecordingPathLabel;
|
||||
}
|
||||
|
||||
private Label getScreenCaptureLabel()
|
||||
{
|
||||
if(mScreenCaptureLabel == null)
|
||||
{
|
||||
mScreenCaptureLabel = new Label("Screen Captures");
|
||||
}
|
||||
|
||||
return mScreenCaptureLabel;
|
||||
}
|
||||
|
||||
private Button getChangeScreenCaptureButton()
|
||||
{
|
||||
if(mChangeScreenCaptureButton == null)
|
||||
{
|
||||
mChangeScreenCaptureButton = new Button("Change...");
|
||||
mChangeScreenCaptureButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Screen Capture Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryScreenCapture().toFile());
|
||||
Stage stage = (Stage)getChangeScreenCaptureButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryScreenCapture(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeScreenCaptureButton;
|
||||
}
|
||||
|
||||
private Button getResetScreenCaptureButton()
|
||||
{
|
||||
if(mResetScreenCaptureButton == null)
|
||||
{
|
||||
mResetScreenCaptureButton = new Button("Reset");
|
||||
mResetScreenCaptureButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryScreenCapture();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetScreenCaptureButton;
|
||||
}
|
||||
|
||||
private Label getScreenCapturePathLabel()
|
||||
{
|
||||
if(mScreenCapturePathLabel == null)
|
||||
{
|
||||
mScreenCapturePathLabel = new Label(mDirectoryPreference.getDirectoryScreenCapture().toString());
|
||||
}
|
||||
|
||||
return mScreenCapturePathLabel;
|
||||
}
|
||||
|
||||
private Label getStreamingLabel()
|
||||
{
|
||||
if(mStreamingLabel == null)
|
||||
{
|
||||
mStreamingLabel = new Label("Streaming");
|
||||
}
|
||||
|
||||
return mStreamingLabel;
|
||||
}
|
||||
|
||||
private Button getChangeStreamingButton()
|
||||
{
|
||||
if(mChangeStreamingButton == null)
|
||||
{
|
||||
mChangeStreamingButton = new Button("Change...");
|
||||
mChangeStreamingButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
directoryChooser.setTitle("Select Streaming Folder");
|
||||
directoryChooser.setInitialDirectory(mDirectoryPreference.getDirectoryStreaming().toFile());
|
||||
Stage stage = (Stage)getChangeStreamingButton().getScene().getWindow();
|
||||
File selected = directoryChooser.showDialog(stage);
|
||||
|
||||
if(selected != null)
|
||||
{
|
||||
mDirectoryPreference.setDirectoryStreaming(selected.toPath());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mChangeStreamingButton;
|
||||
}
|
||||
|
||||
private Button getResetStreamingButton()
|
||||
{
|
||||
if(mResetStreamingButton == null)
|
||||
{
|
||||
mResetStreamingButton = new Button("Reset");
|
||||
mResetStreamingButton.setOnAction(new EventHandler<ActionEvent>()
|
||||
{
|
||||
@Override
|
||||
public void handle(ActionEvent event)
|
||||
{
|
||||
mDirectoryPreference.resetDirectoryStreaming();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return mResetStreamingButton;
|
||||
}
|
||||
|
||||
private Label getStreamingPathLabel()
|
||||
{
|
||||
if(mStreamingPathLabel == null)
|
||||
{
|
||||
mStreamingPathLabel = new Label(mDirectoryPreference.getDirectoryStreaming().toString());
|
||||
}
|
||||
|
||||
return mStreamingPathLabel;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void preferenceUpdated(PreferenceType preferenceType)
|
||||
{
|
||||
if(preferenceType != null && preferenceType == PreferenceType.DIRECTORY)
|
||||
{
|
||||
getApplicationRootPathLabel().setText(mDirectoryPreference.getDirectoryApplicationRoot().toString());
|
||||
getApplicationLogsPathLabel().setText(mDirectoryPreference.getDirectoryApplicationLog().toString());
|
||||
getEventLogsPathLabel().setText(mDirectoryPreference.getDirectoryEventLog().toString());
|
||||
getPlaylistPathLabel().setText(mDirectoryPreference.getDirectoryPlaylist().toString());
|
||||
getRecordingPathLabel().setText(mDirectoryPreference.getDirectoryRecording().toString());
|
||||
getScreenCapturePathLabel().setText(mDirectoryPreference.getDirectoryScreenCapture().toString());
|
||||
getStreamingPathLabel().setText(mDirectoryPreference.getDirectoryStreaming().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ public class TunerPreferenceEditor extends HBox
|
||||
GridPane.setMargin(getChannelizerLabel(), new Insets(0, 10, 0, 0));
|
||||
GridPane.setHalignment(getChannelizerLabel(), HPos.LEFT);
|
||||
mEditorPane.add(getChannelizerLabel(), 0, 0);
|
||||
GridPane.setMargin(getChannelizerTypeChoiceBox(), new Insets(2, 0, 2, 0));
|
||||
mEditorPane.add(getChannelizerTypeChoiceBox(), 1, 0);
|
||||
mEditorPane.add(new Separator(Orientation.HORIZONTAL), 0, 1, 2, 1);
|
||||
mEditorPane.add(getPolyphaseLabel(), 0, 2, 2, 1);
|
||||
|
||||
Reference in New Issue
Block a user