Ignore:
Timestamp:
10/02/19 14:19:48 (5 years ago)
Author:
bln4
Message:

Implementation of ProfileManager. Refactor + additional content for how new profiles are created. The refactoring split out the creation of the default profile from user profiles. Refactoring revealed a long term bug that was causing user profiles to generate with incorrect information. The additional content fixed this bug by introducing the ${USER.NAME} variable, so that the default profile frameset can specify resource locations located in the users resource directory.

org.expeditee.auth.AuthenticatorBrowser
org.expeditee.auth.account.Create
org.expeditee.gui.Browser
org.expeditee.gui.management.ProfileManager
org.expeditee.setting.DirectoryListSetting
org.expeditee.setting.ListSetting
org.expeditee.settings.UserSettings

Implementation of ResourceManager as a core location to get resources from the file system. Also the additional variable ${CURRENT_FRAMESET} to represent the current frameset, so that images can be stored in the directory of the current frameset. This increases portability of framesets.

org.expeditee.gui.FrameIO
org.expeditee.gui.management.ResourceManager
org.expeditee.gui.management.ResourceUtil
Audio:

#NB: Audio used to only operate on a single directory. This has been updated to work in a same way as images. That is: when you ask for a specific resouce, it looks to the user settings to find a sequence of directories to look at in order until it manages to find the desired resource.


There is still need however for a single(ish) source of truth for the .banks and .mastermix file. Therefore these files are now always located in resource-<username>\audio.
org.apollo.agents.MelodySearch
org.apollo.audio.structure.AudioStructureModel
org.apollo.audio.util.MultiTrackPlaybackController
org.apollo.audio.util.SoundDesk
org.apollo.gui.FrameLayoutDaemon
org.apollo.io.AudioPathManager
org.apollo.util.AudioPurger
org.apollo.widgets.FramePlayer
org.apollo.widgets.SampledTrack

Images:

org.expeditee.items.ItemUtils

Frames:

org.expeditee.gui.FrameIO

Fixed a error in the FramePlayer class caused by an incorrect use of toArray().

org.apollo.widgets.FramePlayer


Added several short cut keys to allow for the Play/Pause (Ctrl + P), mute (Ctrl + M) and volume up/down (Ctrl + +/-) when hovering over SampledTrack widgets.

org.apollo.widgets.SampledTrack


Changed the way that Authenticate.login parses the new users profile to be more consistance with other similar places in code.

org.expeditee.auth.account.Authenticate


Encapsulated _body, _surrogateItemsBody and _primaryItemsBody in Frame class. Also changed getBody function to take a boolean flag as to if it should respect the current surrogate mode. If it should then it makes sure that labels have not changed since last time getBody was called.

org.expeditee.gui.Frame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameIO.java

    r1433 r1434  
    5757import org.expeditee.encryption.io.EncryptedExpWriter;
    5858import org.expeditee.gio.EcosystemManager;
     59import org.expeditee.gui.management.ProfileManager;
     60import org.expeditee.gui.management.ResourceManager;
    5961import org.expeditee.io.Conversion;
    6062import org.expeditee.io.ExpReader;
     
    110112        public static String SHARED_FRAMESETS_PATH;
    111113        public static String CONTACTS_PATH;
    112         public static String RESOURCES_PRIVATE_PATH;
    113         public static String RESOURCES_PATH;
    114         public static String FRAME_PRIVATE_PATH;
    115         public static String IMAGES_PRIVATE_PATH;
    116         public static String AUDIO_PRIVATE_PATH;
    117         public static String HELP_PRIVATE_PATH;
    118114        public static String HELP_PATH;
    119115        public static String DEAD_DROPS_PATH;
    120116        public static String GROUP_PATH;
     117        public static String RESOURCES_PRIVATE_PATH;
     118        public static String RESOURCES_PATH;
     119        public static String FRAME_USERNAME_PRIVATE_PATH;
     120        public static String IMAGES_USERNAME_PRIVATE_PATH;
     121        public static String AUDIO_USERNAME_PRIVATE_PATH;
     122        public static String HELP_USERNAME_PRIVATE_PATH;
    121123
    122124        // Paths that appear to be unused.
     
    144146               
    145147                String resourcesPublicPath = PARENT_FOLDER + "resources-public" + File.separator;
    146                 String resourcesPrivateIndividualPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator;
     148                String resourcesPrivateUserPath = PARENT_FOLDER + "resources-" + UserSettings.UserName.get() + File.separator;
    147149               
    148150                if (UserSettings.PublicAndPrivateResources) {
     
    151153                        DICT_PATH = resourcesPublicPath + "dict" + File.separator;
    152154                        HELP_PATH = resourcesPublicPath + "documentation" + File.separator;
    153                         HELP_PRIVATE_PATH = resourcesPrivateIndividualPath + "documentation" + File.separator;
     155                        HELP_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "documentation" + File.separator;
    154156                        FRAME_PATH = resourcesPublicPath + "framesets" + File.separator;
    155                         FRAME_PRIVATE_PATH = resourcesPrivateIndividualPath + "framesets" + File.separator;
    156                         MESSAGES_PATH = resourcesPrivateIndividualPath + "messages" + File.separator;
     157                        FRAME_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "framesets" + File.separator;
     158                        MESSAGES_PATH = resourcesPrivateUserPath + "messages" + File.separator;
    157159                        IMAGES_PATH = resourcesPublicPath + "images" + File.separator;
    158                         IMAGES_PRIVATE_PATH = resourcesPrivateIndividualPath + "images" + File.separator;
     160                        IMAGES_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "images" + File.separator;
    159161                        AUDIO_PATH = resourcesPublicPath + "audio" + File.separator;
    160                         AUDIO_PRIVATE_PATH = resourcesPrivateIndividualPath + "audio" + File.separator;
    161                         GROUP_PATH = resourcesPrivateIndividualPath + "groups" + File.separator;
     162                        AUDIO_USERNAME_PRIVATE_PATH = resourcesPrivateUserPath + "audio" + File.separator;
     163                        GROUP_PATH = resourcesPrivateUserPath + "groups" + File.separator;
    162164
    163165                        // Used only when extracting resources (when expeditee is run for first time)
     
    166168                        if (AuthenticatorBrowser.isAuthenticated()) {
    167169                                // Paths for the new regime while authenticated
    168                                 SHARED_FRAMESETS_PATH = resourcesPrivateIndividualPath + "framesets-shared" + File.separator;
    169                                 DEAD_DROPS_PATH = resourcesPrivateIndividualPath + "deaddrops" + File.separator;
    170                                 CONTACTS_PATH = resourcesPrivateIndividualPath + "contacts" + File.separator;
    171                                 MAIL_PATH = resourcesPrivateIndividualPath + "mail" + File.separator;
     170                                SHARED_FRAMESETS_PATH = resourcesPrivateUserPath + "framesets-shared" + File.separator;
     171                                DEAD_DROPS_PATH = resourcesPrivateUserPath + "deaddrops" + File.separator;
     172                                CONTACTS_PATH = resourcesPrivateUserPath + "contacts" + File.separator;
     173                                MAIL_PATH = resourcesPrivateUserPath + "mail" + File.separator;
    172174                        } else {
    173175                                SHARED_FRAMESETS_PATH = null;
     
    188190                       
    189191                        // These paths are not used by old regime.
    190                         HELP_PRIVATE_PATH = null;
    191                         FRAME_PRIVATE_PATH = null;
    192                         IMAGES_PRIVATE_PATH = null;
    193                         AUDIO_PRIVATE_PATH = null;
     192                        HELP_USERNAME_PRIVATE_PATH = null;
     193                        FRAME_USERNAME_PRIVATE_PATH = null;
     194                        IMAGES_USERNAME_PRIVATE_PATH = null;
     195                        AUDIO_USERNAME_PRIVATE_PATH = null;
    194196                        // - This last one is never used because old regime is never extracted.  If we are going to FrameUtils.extractResources then we are doing new regime.
    195197                        RESOURCES_PRIVATE_PATH = null;
     
    209211                }
    210212               
    211                 System.err.println("**** FrameIO::changeParentAndSubFolder(): Calling AudioPathManger.changeParentAndSubFolder()");
    212                 AudioPathManager.changeParentAndSubFolders(newFolder);
     213                //System.err.println("**** FrameIO::changeParentAndSubFolder(): Calling AudioPathManger.changeParentAndSubFolder()");
     214                //AudioPathManager.changeParentAndSubFolders(newFolder);
    213215        }
    214216       
     
    370372                return null;
    371373        }
    372 
    373         private static Frame LoadFromDisk(String framename, String knownPath,
    374                         boolean ignoreAnnotations) {
    375                 Frame loaded = null;
    376 
    377                 if (knownPath != null) {
    378                         loaded = LoadKnownPath(knownPath, framename);
    379                 } else {
    380                         List<String> directoriesToSearch = FolderSettings.FrameDirs.getAbsoluteDirs();
    381                        
    382                         for (String path : directoriesToSearch) {
    383                                 loaded = LoadKnownPath(path, framename);
    384                                 if (loaded != null) {
    385                                         break;
    386                                 }
    387                         }
    388                 }
    389 
    390                 if (loaded == null && FrameShare.getInstance() != null) {
    391                         loaded = FrameShare.getInstance().loadFrame(framename, knownPath);
    392                 }
    393 
    394                 if (loaded != null) {
    395                         FrameUtils.Parse(loaded, true, ignoreAnnotations);
    396                         FrameIO.setSavedProperties(loaded);
    397                 }
    398 
    399                 return loaded;
    400         }
     374       
     375        private static Frame LoadFromDisk(String frameName, String knownPath, boolean ignoreAnnotationsOnParse) {
     376                return ResourceManager.getExpediteeFrame(frameName, knownPath, ignoreAnnotationsOnParse);
     377        }
     378
     379//      private static Frame LoadFromDisk(String framename, String knownPath,
     380//                      boolean ignoreAnnotations) {
     381//              Frame loaded = null;
     382//
     383//              if (knownPath != null) {
     384//                      loaded = LoadKnownPath(knownPath, framename);
     385//              } else {
     386//                      List<String> directoriesToSearch = FolderSettings.FrameDirs.getAbsoluteDirs();
     387//                     
     388//                      for (String path : directoriesToSearch) {
     389//                              loaded = LoadKnownPath(path, framename);
     390//                              if (loaded != null) {
     391//                                      break;
     392//                              }
     393//                      }
     394//              }
     395//
     396//              if (loaded == null && FrameShare.getInstance() != null) {
     397//                      loaded = FrameShare.getInstance().loadFrame(framename, knownPath);
     398//              }
     399//
     400//              if (loaded != null) {
     401//                      FrameUtils.Parse(loaded, true, ignoreAnnotations);
     402//                      FrameIO.setSavedProperties(loaded);
     403//              }
     404//
     405//              return loaded;
     406//      }
    401407
    402408        /**
     
    563569        }
    564570
    565         private static Frame LoadKnownPath(String path, String frameName) {
     571        public static Frame LoadKnownPath(String path, String frameName) {
    566572                String fullPath = getFrameFullPathName(path, frameName);
    567573                if (fullPath == null) {
     
    13811387        public static boolean isProfileFrame(Frame toCheck)
    13821388        {
    1383                 if (toCheck.getNumber() == 0) {
     1389                if (toCheck.getNumber() == 0 || toCheck.getFramesetName().equals(UserSettings.DEFAULT_PROFILE_NAME)) {
    13841390                        return false;
    13851391                }
     
    14011407
    14021408        public static Frame CreateNewProfile(String username, Map<String, Setting> initialSettings, Map<String, Consumer<Frame>> toNotifyOnSet) throws InvalidFramesetNameException, ExistingFramesetException {
    1403                 Frame profile = CreateFrameset(username, PROFILE_PATH, true);
    1404                 if (profile != null) {
    1405                         FrameUtils.CreateDefaultProfile(username, profile, initialSettings, toNotifyOnSet);
     1409//              Frame profile = CreateFrameset(username, PROFILE_PATH, true);
     1410//              if (profile != null) {
     1411//                      FrameUtils.CreateDefaultProfile(username, profile, initialSettings, toNotifyOnSet);
     1412//              } else {
     1413//                      System.err.println("An error occured while attempting to create the profile named: " + username);
     1414//                      System.err.println("Unable to proceed.");
     1415//                      System.exit(1);
     1416//              }
     1417//              return profile;
     1418                if (username.equals(UserSettings.DEFAULT_PROFILE_NAME)) {
     1419                        ProfileManager.ensureDefaultProfile();
     1420                        return FrameIO.LoadFrame(UserSettings.DEFAULT_PROFILE_NAME + "1");
    14061421                } else {
    1407                         System.err.println("An error occured while attempting to create the profile named: " + username);
    1408                         System.err.println("Unable to proceed.");
    1409                         System.exit(1);
    1410                 }
    1411                 return profile;
     1422                        return ProfileManager.createProfile(username, initialSettings, toNotifyOnSet);
     1423                }
    14121424        }
    14131425
Note: See TracChangeset for help on using the changeset viewer.