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:
Denny Sheirer
2018-12-27 06:12:03 -05:00
committed by GitHub
parent 5b5a1431b4
commit 347a71f097
23 changed files with 1491 additions and 253 deletions

View File

@@ -21,19 +21,34 @@
package io.github.dsheirer.preference;
import io.github.dsheirer.eventbus.MyEventBus;
import io.github.dsheirer.preference.directory.DirectoryPreference;
import io.github.dsheirer.preference.event.DecodeEventPreference;
import io.github.dsheirer.preference.identifier.TalkgroupFormatPreference;
import io.github.dsheirer.preference.playlist.FilePreferences;
import io.github.dsheirer.preference.playlist.PlaylistPreference;
import io.github.dsheirer.preference.tuner.TunerPreference;
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 DecodeEventPreference mDecodeEventPreference;
private FilePreferences mFilePreferences;
private DirectoryPreference mDirectoryPreference;
private PlaylistPreference mPlaylistPreference;
private TalkgroupFormatPreference mTalkgroupFormatPreference;
private TunerPreference mTunerPreference;
@@ -53,12 +68,20 @@ public class UserPreferences implements Listener<PreferenceType>
return mDecodeEventPreference;
}
/**
* Directory preferences
*/
public DirectoryPreference getDirectoryPreference()
{
return mDirectoryPreference;
}
/**
* Playlist preferences
*/
public FilePreferences getFilePreferences()
public PlaylistPreference getPlaylistPreference()
{
return mFilePreferences;
return mPlaylistPreference;
}
/**
@@ -83,7 +106,8 @@ public class UserPreferences implements Listener<PreferenceType>
private void loadPreferenceTypes()
{
mDecodeEventPreference = new DecodeEventPreference(this);
mFilePreferences = new FilePreferences(this::receive);
mDirectoryPreference = new DirectoryPreference(this::receive);
mPlaylistPreference = new PlaylistPreference(this, mDirectoryPreference);
mTalkgroupFormatPreference = new TalkgroupFormatPreference(this);
mTunerPreference = new TunerPreference(this);
}