diff --git a/About/AboutController.java b/About/AboutController.java
index be1778f..38a47ad 100644
--- a/About/AboutController.java
+++ b/About/AboutController.java
@@ -2,20 +2,27 @@ package mplayer4anime.About;
import javafx.application.HostServices;
import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
import javafx.scene.control.Button;
+import javafx.scene.control.TextArea;
import javafx.stage.Stage;
+import java.net.URL;
+import java.util.ResourceBundle;
-public class AboutController {
+
+public class AboutController implements Initializable {
private HostServices hostServices;
- public void setHostServices(HostServices hs){
+ void setHostServices(HostServices hs){
this.hostServices = hs;
}
@FXML
private Button buttonOk;
+ @FXML
+ private TextArea GSONLicense;
@FXML
private void buttonClickOk(){
@@ -38,6 +45,29 @@ public class AboutController {
e.printStackTrace();
}
}
+ @FXML
+ private void libGSON(){
+ try {
+ hostServices.showDocument("https://github.com/google/gson");
+ } catch (Exception e){
+ e.printStackTrace();
+ }
+ }
-
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ GSONLicense.setText("Copyright 2008 Google Inc.\n" +
+ "\n" +
+ "Licensed under the Apache License, Version 2.0 (the \"License\");\n" +
+ "you may not use this file except in compliance with the License.\n" +
+ "You may obtain a copy of the License at\n" +
+ "\n" +
+ " http://www.apache.org/licenses/LICENSE-2.0\n" +
+ "\n" +
+ "Unless required by applicable law or agreed to in writing, software\n" +
+ "distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
+ "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
+ "See the License for the specific language governing permissions and\n" +
+ "limitations under the License.");
+ }
}
diff --git a/About/AboutLayout.fxml b/About/AboutLayout.fxml
index 5723966..55da844 100644
--- a/About/AboutLayout.fxml
+++ b/About/AboutLayout.fxml
@@ -4,6 +4,7 @@
+
@@ -42,6 +43,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/About/AboutWindow.java b/About/AboutWindow.java
index 505ad5c..ffb9dbd 100644
--- a/About/AboutWindow.java
+++ b/About/AboutWindow.java
@@ -18,7 +18,7 @@ public class AboutWindow {
Stage stageAbout = new Stage();
stageAbout.setMinWidth(500);
- stageAbout.setMinHeight(230);
+ stageAbout.setMinHeight(450);
FXMLLoader loaderAbout = new FXMLLoader(getClass().getResource("AboutLayout.fxml"));
ResourceBundle resourceBundle;
@@ -42,7 +42,7 @@ public class AboutWindow {
new Image(Main.class.getResourceAsStream("/mplayer4anime/res/app_icon64x64.png")),
new Image(Main.class.getResourceAsStream("/mplayer4anime/res/app_icon128x128.png"))
); // TODO: change to something reliable
- stageAbout.setScene(new Scene(parentAbout, 500, 230));
+ stageAbout.setScene(new Scene(parentAbout, 500, 450));
stageAbout.show();
diff --git a/AppPreferences.java b/AppPreferences.java
index 1e321f0..898bd15 100644
--- a/AppPreferences.java
+++ b/AppPreferences.java
@@ -19,9 +19,10 @@ public class AppPreferences {
return preferences.get("PATH", "mplayer");
}
- /* Return subtitles priority to show
- * TRUE - Subtitles tab opens first
- * FALSE - Subtitles tab opens as usual
+ /** Return subtitles priority to show
+ * @return
+ * TRUE - Subtitles tab opens first
+ * FALSE - Subtitles tab opens as usual
*/
public boolean getSubtilesFirst(){
return preferences.getBoolean("SUBS_TAB_FIRST", false);
@@ -40,9 +41,10 @@ public class AppPreferences {
return preferences.getBoolean("LOAD_LISTS_ON_START", false); // Don't populate lists by-default
}
- /** Convert strings array to singls string. Used in:
- * setSubsExtensionsList
- * setSubsCodepageList
+ /** Convert strings array to singls string.
+ * Used in:
+ * setSubsExtensionsList
+ * setSubsEncodingList
*/
private void storeSingleStringList(String whichList, String[] strArr){
StringBuilder collect = new StringBuilder();
@@ -58,45 +60,49 @@ public class AppPreferences {
public void setSubsExtensionsList(String[] subsList){ storeSingleStringList("SUBS_EXTENSIONS_LIST", subsList); }
public String[] getSubsExtensionsList(){ return preferences.get("SUBS_EXTENSIONS_LIST", ".ass@@@.crt@@@").split("@@@"); }
- /** Handle lists of the subtitles codepage selector */
- public void setSubsCodepageList(String[] subsCodepageList){ storeSingleStringList("SUBS_CODEPAGE_LIST", subsCodepageList); }
- public String[] getSubsCodepageList(){ return preferences.get("SUBS_CODEPAGE_LIST", "default@@@utf8@@@cp1251@@@koi8-r").split("@@@"); }
+ /** Handle lists of the subtitles encodings selector */
+ public void setSubsEncodingList(String[] subsEncodingList){ storeSingleStringList("SUBS_ENCODINGS_LIST", subsEncodingList); }
+ public String[] getSubsEncodingList(){ return preferences.get("SUBS_ENCODINGS_LIST", "default@@@utf8@@@cp1251@@@koi8-r").split("@@@"); }
- // Save & recover selected by user Subtitles format
+ /** Save & recover selected by user Subtitles format */
public void setLastTimeUsedSusExt(String selected){ preferences.put("SUBS_EXT_LAST_TIME_SELECTED", selected); }
public String getLastTimeUsedSubsExt(){ return preferences.get("SUBS_EXT_LAST_TIME_SELECTED", ""); }
- // Save & recover selected by user Subtitles codepage
- public void setLastTimeUsedSubsCodepage(String selected){ preferences.put("SUBS_CODEPAGE_LAST_TIME_SELECTED", selected); }
- public String getLastTimeUsedSubsCodepage(){ return preferences.get("SUBS_CODEPAGE_LAST_TIME_SELECTED", ""); }
+ /** Save & recover selected by user Subtitles encoding */
+ public void setLastTimeUsedSubsEncoding(String selected){ preferences.put("SUBS_ENCODING_LAST_TIME_SELECTED", selected); }
+ public String getLastTimeUsedSubsEncoding(){ return preferences.get("SUBS_ENCODING_LAST_TIME_SELECTED", ""); }
- // Save & recover Full Screen checkbox, if selected
+ /** Save & recover Full Screen checkbox, if selected */
public boolean getFullScreenSelected(){
return preferences.getBoolean("FULL_SCREEN_SELECTED", false);
}
public void setFullScreenSelected(boolean set){ preferences.putBoolean("FULL_SCREEN_SELECTED", set); }
- // Save & recover Subtitles checkbox, if selected
+ /** Save & recover Subtitles checkbox, if selected */
public boolean getSubtitlesHideSelected(){
return preferences.getBoolean("FULL_SUBTITLES_HIDE_SELECTED", false);
}
public void setSubtitlesHideSelected(boolean set){ preferences.putBoolean("FULL_SUBTITLES_HIDE_SELECTED", set); }
- /** Lists managment */
- // Return lists itself of the latest opened folders (used only in Controller.class)
- private String getList(String whichList){
- return preferences.get(whichList, "");
+ /** Return recently opened elements */
+ public String[] getRecentPlaylists(){
+ String[] recentPlaylists = new String[10];
+ for (int i=0; i<10; i++)
+ recentPlaylists[i] = preferences.get("RECENT_PLS_" + i, "");
+ return recentPlaylists;
}
- // Save lists itself of the latest opened folders (used only in Controller.class)
- private void setList(String whichList, String value){
- preferences.put(whichList, value);
+ /** Store recently opened elements */
+ public void setRecentPlaylists(String[] recentPlaylists){
+ if (recentPlaylists != null && recentPlaylists.length > 0) {
+ int i;
+ for (i = 0; i < recentPlaylists.length && !(i > 10); i++)
+ if (recentPlaylists[i] != null && !recentPlaylists[i].isEmpty())
+ preferences.put("RECENT_PLS_" + i, recentPlaylists[i]);
+ else
+ preferences.put("RECENT_PLS_" + i, "");
+ for (;i<10;i++) // Not needed. Logic may handle recieved String to be less or greater then String[10], but it never happened.
+ preferences.put("RECENT_PLS_" + i, "");
+ }
}
- public String getListMKV(){ return getList("MKV"); }
- public String getListMKA(){ return getList("MKA"); }
- public String getListSUB(){ return getList("SUB"); }
-
- public void setListMKV(String value){setList("MKV", value);}
- public void setListMKA(String value){setList("MKA", value);}
- public void setListSUB(String value){setList("SUB", value);}
}
diff --git a/Controller.java b/Controller.java
index 482b2de..70b0056 100644
--- a/Controller.java
+++ b/Controller.java
@@ -2,11 +2,16 @@ package mplayer4anime;
import javafx.application.HostServices;
import javafx.application.Platform;
-import javafx.collections.FXCollections;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
+
+import javafx.stage.Stage;
import mplayer4anime.About.AboutWindow;
+import mplayer4anime.Playlists.JsonStorage;
+import mplayer4anime.Playlists.Playlists;
import mplayer4anime.Settings.SettingsWindow;
import mplayer4anime.appPanes.ControllerMKA;
import mplayer4anime.appPanes.ControllerMKV;
@@ -14,6 +19,7 @@ import mplayer4anime.appPanes.ControllerSUB;
import java.io.*;
import java.net.URL;
+import java.util.ListIterator;
import java.util.ResourceBundle;
public class Controller implements Initializable {
@@ -23,7 +29,10 @@ public class Controller implements Initializable {
private ControllerSUB subPaneController;
@FXML
private ControllerMKA mkaPaneController;
-
+ @FXML
+ private Label statusLbl;
+ @FXML
+ private Menu recentlyOpenedMenu;
// Get preferences
private AppPreferences appPreferences = new AppPreferences();
@@ -41,6 +50,7 @@ public class Controller implements Initializable {
@FXML
private CheckMenuItem subsHide;
+ private String currentPlaylistLocation = null; //TODO: move to the constructor?
@Override
public void initialize(URL url, ResourceBundle rb) {
// Register this controller in mediator
@@ -49,49 +59,30 @@ public class Controller implements Initializable {
resourceBundle = rb;
// Set default extension of the subtitles files:
- subPaneController.subtExtList = FXCollections.observableArrayList( appPreferences.getSubsExtensionsList() ); // Receive list from storage
- subPaneController.subtExt.setItems(subPaneController.subtExtList);
- if (appPreferences.getLastTimeUsedSubsExt().isEmpty()) // not sure that it's possible
- subPaneController.subtExt.setValue(subPaneController.subtExtList.get(0));
- else
- subPaneController.subtExt.setValue(appPreferences.getLastTimeUsedSubsExt());
+ subPaneController.setSubtExt(appPreferences.getSubsExtensionsList(), appPreferences.getLastTimeUsedSubsExt());// Receive list from storage & set selected value
- // Set default list of codepages of the subtitles files:
- subPaneController.subtCodepageList = FXCollections.observableArrayList(appPreferences.getSubsCodepageList());
- subPaneController.subtCodepage.setItems(subPaneController.subtCodepageList);
- if (appPreferences.getLastTimeUsedSubsCodepage().isEmpty())
- subPaneController.subtCodepage.setValue(subPaneController.subtCodepageList.get(0));
- else
- subPaneController.subtCodepage.setValue(appPreferences.getLastTimeUsedSubsCodepage());
+ // Set default list of encodings of the subtitles files:
+ subPaneController.setEncoding(appPreferences.getSubsEncodingList(), appPreferences.getLastTimeUsedSubsEncoding());
// If subtitles should be opened first, per user's settings let's show it first
if (appPreferences.getSubtilesFirst()){
tabPane.getSelectionModel().select(1); // 0 is mka 1 is subs
}
- /* Populating settings from the previous run /*/
- // Populating lists
- if (appPreferences.getLoadListsOnStart()){ // TODO: probably should be dedicated method in abstract class defined
- if (!appPreferences.getListMKV().isEmpty()){
- mkvPaneController.getFilesFromFolder(new File(appPreferences.getListMKV()), ".mkv");
- }
- if (!appPreferences.getListMKA().isEmpty()){
- mkaPaneController.getFilesFromFolder(new File(appPreferences.getListMKA()), ".mka");
- }
- if (!appPreferences.getListSUB().isEmpty()){
- subPaneController.getFilesFromFolder(new File(appPreferences.getListSUB()), appPreferences.getLastTimeUsedSubsExt());
- }
- }
fullScreen.setSelected(appPreferences.getFullScreenSelected());
subsHide.setSelected(appPreferences.getSubtitlesHideSelected());
+
+ String[] recentPlaylists = appPreferences.getRecentPlaylists();
+ for (int i = recentPlaylists.length-1; i >= 0; i--)
+ if (!recentPlaylists[i].isEmpty())
+ addRecentlyOpened(recentPlaylists[i]);
}
public void setHostServices(HostServices hostServices) {
this.hostServices = hostServices;
}
- /** PLAYER COMMANDS */
-
+ /* PLAYER COMMANDS */
private boolean playerSingleCommand(String command){
if (player != null && player.isAlive()) {
playerIn.print(command);
@@ -103,27 +94,26 @@ public class Controller implements Initializable {
@FXML
private void subsTriggerBtn(){
- playerSingleCommand("get_sub_visibility");
- String returnedStr;
- int returnedInt = 1;
- try {
- while ((returnedStr = playerOutErr.readLine()) != null) {
- //System.out.println(returnedStr);
- if (returnedStr.startsWith("ANS_SUB_VISIBILITY=")) {
- returnedInt = Integer.parseInt(returnedStr.substring("ANS_SUB_VISIBILITY=".length()));
- break;
+ if (playerSingleCommand("get_sub_visibility")) {
+ String returnedStr;
+ int returnedInt = 1;
+ try {
+ while ((returnedStr = playerOutErr.readLine()) != null) {
+ //System.out.println(returnedStr);
+ if (returnedStr.startsWith("ANS_SUB_VISIBILITY=")) {
+ returnedInt = Integer.parseInt(returnedStr.substring("ANS_SUB_VISIBILITY=".length()));
+ break;
+ }
}
+ } catch (IOException e) {
+ System.out.println("Can't determine whether subtitles enabled or disabled");
}
- }
- catch (IOException e) {
- System.out.println("Can't determine if subtitles enabled/disabled");
- }
-
- if (returnedInt == 1)
- playerSingleCommand("sub_visibility 0");
- else
- playerSingleCommand("sub_visibility 1");
+ if (returnedInt == 1)
+ playerSingleCommand("sub_visibility 0");
+ else
+ playerSingleCommand("sub_visibility 1");
+ }
}
@FXML
private void fullscreenBtn(){ playerSingleCommand("vo_fullscreen"); }
@@ -136,9 +126,9 @@ public class Controller implements Initializable {
while (player.isAlive()); // TODO: remove crutch, implement bike
}
int index;
- index = mkvPaneController.paneListView.getSelectionModel().getSelectedIndex();
+ index = mkvPaneController.getElementSelectedIndex();
if (index > 0) {
- mkvPaneController.paneListView.getSelectionModel().select(index-1);
+ mkvPaneController.setElementSelectedByIndex(index-1); // .selectNext / .selectPrevious
playBtn();
}
}
@@ -149,9 +139,9 @@ public class Controller implements Initializable {
while (player.isAlive()); // TODO: remove crutch, implement bike
}
int index;
- index = mkvPaneController.paneListView.getSelectionModel().getSelectedIndex();
- if (index+1 < mkvPaneController.paneFileList.size() ) {
- mkvPaneController.paneListView.getSelectionModel().select(index+1);
+ index = mkvPaneController.getElementSelectedIndex();
+ if (index+1 < mkvPaneController.getElementsCount() ) {
+ mkvPaneController.setElementSelectedByIndex(index+1);
playBtn();
}
}
@@ -162,10 +152,10 @@ public class Controller implements Initializable {
@FXML
private void playBtn(){
- if (mkvPaneController.paneListView.getSelectionModel().getSelectedItem() != null) {
- boolean Audio = !mkaPaneController.paneFileList.isEmpty() && mkvPaneController.paneListView.getSelectionModel().getSelectedIndex() < mkaPaneController.paneFileList.size();
- boolean Subtitles = !subPaneController.paneFileList.isEmpty() && mkvPaneController.paneListView.getSelectionModel().getSelectedIndex() < subPaneController.paneFileList.size();
- boolean SubCodepageDefault = subPaneController.subtCodepage.getValue().equals("default");
+ if (mkvPaneController.getElementSelected() != null) {
+ boolean Audio = !mkaPaneController.isElementsListEmpty() && mkvPaneController.getElementSelectedIndex() < mkaPaneController.getElementsCount();
+ boolean Subtitles = !subPaneController.isElementsListEmpty() && mkvPaneController.getElementSelectedIndex() < subPaneController.getElementsCount();
+ boolean SubEncodingDefault = subPaneController.getSelectedEncoding().equals("default");
try {
if (player == null || !player.isAlive()) {
@@ -173,15 +163,15 @@ public class Controller implements Initializable {
appPreferences.getPath(), // It's a chance for Windows ;)
"-slave",
Audio?"-audiofile":"",
- Audio? mkaPaneController.paneFileList.get(mkvPaneController.paneListView.getSelectionModel().getSelectedIndex()).toPath().toString():"",
+ Audio? mkaPaneController.getElementSelected():"",
"-quiet",
fullScreen.isSelected() ? "-fs" : "",
- mkvPaneController.paneFileList.get(mkvPaneController.paneListView.getSelectionModel().getSelectedIndex()).toPath().toString(),
+ mkvPaneController.getElementSelected(),
subsHide.isSelected()||Subtitles?"-nosub":"", // Turn off subtitles embedded into MKV file (and replace by localy-stored subs file if needed)
Subtitles?"-sub":"",
- Subtitles? subPaneController.paneFileList.get(mkvPaneController.paneListView.getSelectionModel().getSelectedIndex()).toPath().toString():"",
- Subtitles?SubCodepageDefault?"":"-subcp":"", // Use subtitles -> YES -> Check if we need codepage
- Subtitles?SubCodepageDefault?"": subPaneController.subtCodepage.getValue():""
+ Subtitles? subPaneController.getElementSelected():"",
+ Subtitles?SubEncodingDefault?"":"-subcp":"", // Use subtitles -> YES -> Check if we need encoding
+ Subtitles?SubEncodingDefault?"": subPaneController.getSelectedEncoding():""
).start();
PipedInputStream readFrom = new PipedInputStream(256 * 1024);
@@ -200,19 +190,13 @@ public class Controller implements Initializable {
*/
if (subsHide.isSelected())
playerSingleCommand("sub_visibility 0");
-
} else {
playerIn.print("pause");
playerIn.print("\n");
playerIn.flush();
}
} catch (IOException e) {
- // e.printStackTrace(); // No need
- Alert alertBox = new Alert(Alert.AlertType.ERROR);
- alertBox.setTitle(resourceBundle.getString("Error"));
- alertBox.setHeaderText(null);
- alertBox.setContentText(resourceBundle.getString("unableToStartMplayerError"));
- alertBox.show();
+ ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("ErrorUnableToStartMplayer"));
}
} else { System.out.println("File not selected"); }
}
@@ -224,69 +208,140 @@ public class Controller implements Initializable {
@FXML
private void volumeDownBtn(){ playerSingleCommand("volume -1 0"); }
+ @FXML
+ private void closeBtn() {
+ Stage currentStage = (Stage) tabPane.getScene().getWindow();
+ currentStage.close();
+ }
+
// Will be used to store lists previously opened.
// Linkage established by ohHidden in Main.java class
- public void shutdown(){
- // If we should save/restore lists ...
-
- if (appPreferences.getLoadListsOnStart()) {
- if (mkvPaneController.paneFileList.isEmpty())
- appPreferences.setListMKV("");
- else
- appPreferences.setListMKV(mkvPaneController.paneFileList.get(0).getParent());
-
- if (mkaPaneController.paneFileList.isEmpty())
- appPreferences.setListMKA("");
- else
- appPreferences.setListMKA(mkaPaneController.paneFileList.get(0).getParent());
-
- if (subPaneController.paneFileList.isEmpty())
- appPreferences.setListSUB("");
- else
- appPreferences.setListSUB(subPaneController.paneFileList.get(0).getParent());
- }
- appPreferences.setLastTimeUsedSusExt(subPaneController.subtExt.getValue());
- appPreferences.setLastTimeUsedSubsCodepage(subPaneController.subtCodepage.getValue());
+ void shutdown(){
+ appPreferences.setLastTimeUsedSusExt(subPaneController.getSelectedExt());
+ appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding());
appPreferences.setFullScreenSelected(fullScreen.isSelected());
appPreferences.setSubtitlesHideSelected(subsHide.isSelected());
+ String[] storeRecentArr = new String[10];
+ for (int i =0; i < recentlyOpenedMenu.getItems().size() - 2 && !(i > 9); i++) { // Don't take separator and Clean button
+ storeRecentArr[i] = (String) recentlyOpenedMenu.getItems().get(i).getUserData();
+ }
+ appPreferences.setRecentPlaylists(storeRecentArr);
+
Platform.exit();
}
-
@FXML
- private void infoBnt(){ new AboutWindow(this.hostServices); } // TODO: fix this shit with hostSerivces that doesn't work @ linux
+ private void infoBtn(){ new AboutWindow(this.hostServices); } // TODO: fix this shit with hostSerivces that doesn't work @ linux
/** SETTINGS HANDLE */
@FXML
private void settingsBtn(){ new SettingsWindow(); }
// Get event that notify application in case some settings has been changed
// This function called from MediatorControl after mediator receives request form SettingsController indicating that user updated some required fields.
- public void updateAfterSettingsChanged(){
- /** update list of extensions */
+ void updateAfterSettingsChanged(){
+ /* update list of extensions */
// Clear and update list
- String extensionPrevSelected = subPaneController.subtExt.getValue();
- subPaneController.subtExtList.clear();
- subPaneController.subtExtList.setAll(appPreferences.getSubsExtensionsList());
- // Try to restore previously selected element
- if (subPaneController.subtExtList.contains(extensionPrevSelected))
- subPaneController.subtExt.setValue(extensionPrevSelected);
- else
- subPaneController.subtExt.setValue(subPaneController.subtExtList.get(0));
+ subPaneController.setSubtExt(appPreferences.getSubsExtensionsList(), null);
// In case of application failure should be better to save this immediately
- appPreferences.setLastTimeUsedSusExt(subPaneController.subtExt.getValue());
+ appPreferences.setLastTimeUsedSusExt(subPaneController.getSelectedEncoding());
- /** update list of codepage */
- String codepagePrevSelected = subPaneController.subtCodepage.getValue();
- subPaneController.subtCodepageList.clear();
- subPaneController.subtCodepageList.setAll(appPreferences.getSubsCodepageList());
- // Try to restore previously selected element
- if (subPaneController.subtCodepageList.contains(codepagePrevSelected))
- subPaneController.subtCodepage.setValue(codepagePrevSelected);
- else
- subPaneController.subtCodepage.setValue(subPaneController.subtCodepageList.get(0));
+ /* update list of encoding */
+ subPaneController.setEncoding(appPreferences.getSubsEncodingList(), null);
// In case of application failure should be better to save this immediately
- appPreferences.setLastTimeUsedSubsCodepage(subPaneController.subtCodepage.getValue());
+ appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding());
}
+ @FXML
+ private void openBtn() {
+ JsonStorage jsonStorage = Playlists.Read(resourceBundle);
+ if (jsonStorage != null) {
+ mkvPaneController.setFilesFromList(jsonStorage.getVideo());
+ mkaPaneController.setFilesFromList(jsonStorage.getAudio());
+ subPaneController.setFilesFromList(jsonStorage.getSubs());
+ subPaneController.selectEncodingValue(jsonStorage.getSubEncoding(), appPreferences);
+
+ this.currentPlaylistLocation = Playlists.getPlaylistLocation(); // TODO: Implement listener? mmm...
+ this.statusLbl.setText(currentPlaylistLocation);
+ addRecentlyOpened(currentPlaylistLocation);
+ }
+ }
+ @FXML
+ private void saveBtn() {
+ if (mkvPaneController.getElementsCount() == 0)
+ ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("ErrorUnableToSaveEmptyPlaylist"));
+ else {
+ JsonStorage jsonStorage = new JsonStorage(mkvPaneController.getElementsAll(), mkaPaneController.getElementsAll(), subPaneController.getElementsAll(), subPaneController.getSelectedEncoding());
+ if (Playlists.SaveCurrent(resourceBundle, jsonStorage)) {
+ this.currentPlaylistLocation = Playlists.getPlaylistLocation();
+ this.statusLbl.setText(currentPlaylistLocation); //TODO: update header of the application to include this?
+ addRecentlyOpened(currentPlaylistLocation);
+ }
+ }
+ }
+ @FXML
+ private void saveAsBtn() {
+ if (mkvPaneController.getElementsCount() == 0)
+ ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("ErrorUnableToSaveEmptyPlaylist"));
+ else {
+ JsonStorage jsonStorage = new JsonStorage(mkvPaneController.getElementsAll(), mkaPaneController.getElementsAll(), subPaneController.getElementsAll(), subPaneController.getSelectedEncoding());
+ if (Playlists.SaveAs(resourceBundle, jsonStorage)) {
+ this.currentPlaylistLocation = Playlists.getPlaylistLocation();
+ this.statusLbl.setText(currentPlaylistLocation); //TODO: update header of the application to include this?
+ addRecentlyOpened(currentPlaylistLocation);
+ }
+ }
+ }
+ @FXML
+ private void cleanAllRecentlyOpened(){
+ recentlyOpenedMenu.getItems().remove(0,recentlyOpenedMenu.getItems().size() - 2);
+ }
+
+ private void addRecentlyOpened(String playlistPath){
+ ListIterator