Simplified playback engine selection.
This commit is contained in:
parent
1cd6bfccfc
commit
a98ef2209e
@ -25,20 +25,15 @@ class SwingUIModule extends AbstractModule {
|
|||||||
bind(IPlaylist.class).to(TabbedJTablePlaylist.class).in(Singleton.class);
|
bind(IPlaylist.class).to(TabbedJTablePlaylist.class).in(Singleton.class);
|
||||||
bind(ILibrary.class).to(JTreeLibrary.class).in(Singleton.class);
|
bind(ILibrary.class).to(JTreeLibrary.class).in(Singleton.class);
|
||||||
bind(PlayerCallbackInterface.class).to(PlayerGUI.class).in(Singleton.class);
|
bind(PlayerCallbackInterface.class).to(PlayerGUI.class).in(Singleton.class);
|
||||||
String engineName = ConfigManager.getPlayerEngine();
|
Engine engine = Engine.valueOf(ConfigManager.getPlayerEngine());
|
||||||
boolean engineSet = false;
|
if (engine.isAvailable()) {
|
||||||
for(Engine engine : Engine.values()){
|
|
||||||
if(engineName.equals(engine.getEngineName()) && engine.isAvailable()){
|
|
||||||
bind(IPlayer.class).to(engine.getEngineImplementation()).in(Singleton.class);
|
|
||||||
ConfigManager.setPlayerEngine(engine.getEngineName());
|
|
||||||
engineSet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!engineSet){ // If the user has set an invalid engine, try and set a usable one.
|
|
||||||
for(Engine engine : Engine.values()){
|
|
||||||
if(engine.isAvailable()){
|
|
||||||
bind(IPlayer.class).to(engine.getEngineImplementation()).in(Singleton.class);
|
bind(IPlayer.class).to(engine.getEngineImplementation()).in(Singleton.class);
|
||||||
ConfigManager.setPlayerEngine(engine.getEngineName());
|
ConfigManager.setPlayerEngine(engine.getEngineName());
|
||||||
|
} else { // If the user has set an invalid engine, try and set a usable one.
|
||||||
|
for (Engine potentialEngine : Engine.values()) {
|
||||||
|
if (potentialEngine.isAvailable()) {
|
||||||
|
bind(IPlayer.class).to(potentialEngine.getEngineImplementation()).in(Singleton.class);
|
||||||
|
ConfigManager.setPlayerEngine(potentialEngine.getEngineName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user