IZPLApi.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package de.nplusc.izc.iZpl.API;
  7. import de.nplusc.izc.iZpl.Main;
  8. import java.io.File;
  9. import java.util.List;
  10. /**
  11. *
  12. * @author iZc <nplusc.de>
  13. */
  14. public class IZPLApi
  15. {
  16. /**
  17. * defines the path to load the standard skin file inside the iZpl jar
  18. */
  19. public static final String DEFAULT_SKIN_PATH = IZPLApi.class.getProtectionDomain().getCodeSource().getLocation().getPath()+File.separator+"rsrc";
  20. /**
  21. * defines the application directory of iZpl where it got installed
  22. */
  23. public static final String APPDIR = new File(IZPLApi.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getParent();
  24. public static final String PLUGINPATH = APPDIR + File.separator + "plugins";
  25. public static final String SKINPATH = APPDIR + File.separator + "skins";
  26. /**
  27. * Checks whether the Program runs in fully new UI mode or in the old Mode where only the managing UI is loaded
  28. * @return true when the program is in the new UI mode
  29. */
  30. public static boolean isNEwGUIMode()
  31. {
  32. return Main.isStandaloneGUI();
  33. }
  34. /**
  35. * Obtains the path of the last selected Skin. Points to the file in skins folder or to the default path defined in DEFAULT_SKIN_PATH
  36. * @return Path of the currently selected skin from the Skins folder
  37. */
  38. public static String getSkinPath()
  39. {
  40. return Main.getSelectedSkinPath();
  41. }
  42. /**
  43. * Exits the program without saving the statefile for the current session. Recommended in case of a error
  44. */
  45. public static void quickQuitWithoutSaving()
  46. {
  47. Main.quickQuit();
  48. }
  49. /**
  50. * Obtains a reference to the currently loaded PlaybackPlugin
  51. * @return PlaybackPlugin that is currently in use
  52. */
  53. public static PlaybackPlugin getCurrentPlaybackPlugin()
  54. {
  55. return Main.getSelectedPlaybackPlugin();
  56. }
  57. public static UIPlugin getUIPlugin()
  58. {
  59. return Main.getSelectedUIPlugin();
  60. }
  61. /**
  62. * Saves the state of the session and then exits the program
  63. */
  64. public static void shutdownWithSave()
  65. {
  66. Main.checkpointedExit(false);
  67. }
  68. /**
  69. * Obtains the next Item to play
  70. * @return PlayListItem that should be played next
  71. */
  72. public static PlayListItem getNextItem()
  73. {
  74. return Main.getPLServer().ppp.getBlockRaw();
  75. }
  76. private IZPLApi()
  77. {
  78. }
  79. public static List<UIPlugin> getDetectedUIPlugins()
  80. {
  81. return Main.getRegisteredUIs();
  82. }
  83. public static List<PlaybackPlugin> getDetectedPlaybackPlugins()
  84. {
  85. return Main.getRegisteredPlayBackAdapters();
  86. }
  87. public static List<String> getAvailableSkins()
  88. {
  89. return Main.getDetectedSkins();
  90. }
  91. }