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/items/ItemUtils.java

    r1426 r1434  
    3939import org.expeditee.gui.FreeItems;
    4040import org.expeditee.gui.Vector;
     41import org.expeditee.gui.management.ResourceManager;
    4142import org.expeditee.items.Item.HighlightMode;
    4243import org.expeditee.items.widgets.InteractiveWidgetInitialisationFailedException;
     
    376377         */
    377378        public static Picture CreatePicture(Text source, boolean tryRemote) {
    378                 String text = source.getText();
    379                 String path = "";
    380                 String fileName = "";
    381                 String size = "";
    382 
    383                 try {
    384                         // remove @i tag
    385                         text = text.replaceFirst("@i:", "");
    386                         text = text.replaceAll("\n", "");
    387                         text = text.trim();
    388 
    389                         int fileSuffixChar = text.indexOf('.');
    390                         if (fileSuffixChar < 0) {
    391                                 return null;
    392                         }
    393                         int endOfFileName = text.indexOf(' ', fileSuffixChar);
    394                         if (endOfFileName < 0) {
    395                                 path = text;
    396                                 size = "";
    397                         } else {
    398                                 path = text.substring(0, endOfFileName);
    399                                 size = text.substring(endOfFileName).trim();
    400                         }
    401                         fileName = path;
    402                        
    403                         if (!fileName.equals(Picture.REDACTED_IMAGE_NAME)) {
    404                                 // try images subdirectory
    405                                 File file = null;
    406 
    407                                 for (String dir : FolderSettings.ImageDirs.getAbsoluteDirs()) {
    408                                         file = new File(dir + path);
    409                                         if (file.exists() && !file.isDirectory()) {
    410                                                 break;
    411                                         }
    412                                 }
    413 
    414                                 if (file == null || !file.exists() || file.isDirectory()) {
    415                                         file = new File(path);
    416                                 }
    417 
    418                                 // try relative path
    419                                 if (!file.exists() || file.isDirectory()) {
    420                                         URL picture = new Object().getClass().getResource(path);
    421 
    422                                         // decode to remove %20 in windows folder names
    423                                         if (picture != null) {
    424                                                 try {
    425                                                         path = URLDecoder.decode(picture.getFile(), "UTF-8");
    426                                                 } catch (UnsupportedEncodingException e) {
    427                                                         // TODO Auto-generated catch block
    428                                                         e.printStackTrace();
    429                                                 }
    430                                         }
    431 
    432                                 } else {
    433                                         path = file.getPath();
    434                                 }
    435 
    436                                 // if the image isn't found by now, try remote servers
    437                                 file = new File(path);
    438                                 if (!file.exists() || file.isDirectory()) {
    439                                 if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) {
    440                                         // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop
    441                                         // if something goes wrong with finding the downloaded image
    442                                         return CreatePicture(source, false);
    443                                 }
    444                                         return null;
    445                                 }
    446                         }
    447                 } catch (Exception e) {
    448                         return null;
    449                 }
    450 
    451                 try {
    452                         Picture pic = new Picture(source, fileName, path, size);
    453 
    454                         return pic;
    455                 } catch (Exception e) {
    456                         e.printStackTrace();
    457                         return null;
    458                 }
    459 
    460         }
     379                return ResourceManager.getExpediteePicture(source, tryRemote);
     380        }
     381//      public static Picture CreatePicture(Text source, boolean tryRemote) {
     382//              String text = source.getText();
     383//              String path = "";
     384//              String fileName = "";
     385//              String size = "";
     386//
     387//              try {
     388//                      // remove @i tag
     389//                      text = text.replaceFirst("@i:", "");
     390//                      text = text.replaceAll("\n", "");
     391//                      text = text.trim();
     392//
     393//                      int fileSuffixChar = text.indexOf('.');
     394//                      if (fileSuffixChar < 0) {
     395//                              return null;
     396//                      }
     397//                      int endOfFileName = text.indexOf(' ', fileSuffixChar);
     398//                      if (endOfFileName < 0) {
     399//                              path = text;
     400//                              size = "";
     401//                      } else {
     402//                              path = text.substring(0, endOfFileName);
     403//                              size = text.substring(endOfFileName).trim();
     404//                      }
     405//                      fileName = path;
     406//                     
     407//                      if (!fileName.equals(Picture.REDACTED_IMAGE_NAME)) {
     408//                              // try images subdirectory
     409//                              File file = null;
     410//
     411//                              List<String> absoluteDirs = FolderSettings.ImageDirs.getAbsoluteDirs();
     412//                              for (String dir : absoluteDirs) {
     413//                                      file = new File(dir + path);
     414//                                      if (file.exists() && !file.isDirectory()) {
     415//                                              break;
     416//                                      }
     417//                              }
     418//
     419//                              if (file == null || !file.exists() || file.isDirectory()) {
     420//                                      file = new File(path);
     421//                              }
     422//
     423//                              // try relative path
     424//                              if (!file.exists() || file.isDirectory()) {
     425//                                      URL picture = new Object().getClass().getResource(path);
     426//
     427//                                      // decode to remove %20 in windows folder names
     428//                                      if (picture != null) {
     429//                                              try {
     430//                                                      path = URLDecoder.decode(picture.getFile(), "UTF-8");
     431//                                              } catch (UnsupportedEncodingException e) {
     432//                                                      // TODO Auto-generated catch block
     433//                                                      e.printStackTrace();
     434//                                              }
     435//                                      }
     436//
     437//                              } else {
     438//                                      path = file.getPath();
     439//                              }
     440//
     441//                              // if the image isn't found by now, try remote servers
     442//                              file = new File(path);
     443//                              if (!file.exists() || file.isDirectory()) {
     444//                              if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) {
     445//                                      // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop
     446//                                      // if something goes wrong with finding the downloaded image
     447//                                      return CreatePicture(source, false);
     448//                              }
     449//                                      return null;
     450//                              }
     451//                      }
     452//              } catch (Exception e) {
     453//                      return null;
     454//              }
     455//
     456//              try {
     457//                      Picture pic = new Picture(source, fileName, path, size);
     458//
     459//                      return pic;
     460//              } catch (Exception e) {
     461//                      e.printStackTrace();
     462//                      return null;
     463//              }
     464//
     465//      }
    461466       
    462467        public static Picture CreatePicture(Text source) {
Note: See TracChangeset for help on using the changeset viewer.