v0.8.3. Refactoring.
This commit is contained in:
parent
fb988c094b
commit
1fca4f93b9
6 changed files with 61 additions and 48 deletions
|
@ -40,23 +40,23 @@ public class AppPreferences {
|
||||||
return preferences.getBoolean("LOAD_LISTS_ON_START", false); // Don't populate lists by-default
|
return preferences.getBoolean("LOAD_LISTS_ON_START", false); // Don't populate lists by-default
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save lists itself of the latest opened folders (used only in Controller.class)
|
/** Convert strings array to singls string. Used in:
|
||||||
public void setList(String whichList, String value){
|
* setSubsExtensionsList
|
||||||
preferences.put(whichList, value);
|
* setSubsCodepageList
|
||||||
|
*/
|
||||||
|
private void storeSingleStringList(String whichList, String[] strArr){
|
||||||
|
StringBuilder collect = new StringBuilder();
|
||||||
|
for (String e : strArr) {
|
||||||
|
collect.append(e);
|
||||||
|
collect.append("@@@"); // If there is some idiot who will use @@@ in file extension I'll find him.
|
||||||
}
|
}
|
||||||
// Return lists itself of the latest opened folders (used only in Controller.class)
|
String strToStore = collect.toString();
|
||||||
public String getList(String whichList){
|
preferences.put(whichList, strToStore);
|
||||||
return preferences.get(whichList, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle lists of the subtitles extensions selector */
|
/** Handle lists of the subtitles extensions selector */
|
||||||
public void setSubsExtensionsList(String[] subsList){
|
public void setSubsExtensionsList(String[] subsList){
|
||||||
String stringToStore = "";
|
storeSingleStringList("SUBS_EXTENSIONS_LIST", subsList);
|
||||||
for (String e : subsList) {
|
|
||||||
stringToStore += e;
|
|
||||||
stringToStore += "@@@"; // If there is some idiot who will use @@@ in file extension I'll find him.
|
|
||||||
}
|
|
||||||
preferences.put("SUBS_EXTENSIONS_LIST", stringToStore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSubsExtensionsList(){
|
public String[] getSubsExtensionsList(){
|
||||||
|
@ -65,12 +65,7 @@ public class AppPreferences {
|
||||||
|
|
||||||
/** Handle lists of the subtitles codepage selector */
|
/** Handle lists of the subtitles codepage selector */
|
||||||
public void setSubsCodepageList(String[] subsCodepageList){
|
public void setSubsCodepageList(String[] subsCodepageList){
|
||||||
String stringToStore = "";
|
storeSingleStringList("SUBS_CODEPAGE_LIST", subsCodepageList);
|
||||||
for (String e : subsCodepageList) {
|
|
||||||
stringToStore += e;
|
|
||||||
stringToStore += "@@@"; // If there is some idiot who will use @@@ in file extension I'll find him.
|
|
||||||
}
|
|
||||||
preferences.put("SUBS_CODEPAGE_LIST", stringToStore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getSubsCodepageList(){
|
public String[] getSubsCodepageList(){
|
||||||
|
@ -80,6 +75,7 @@ public class AppPreferences {
|
||||||
// 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 void setLastTimeUsedSusExt(String selected){ preferences.put("SUBS_EXT_LAST_TIME_SELECTED", selected); }
|
||||||
public String getLastTimeUsedSubsExt(){ return preferences.get("SUBS_EXT_LAST_TIME_SELECTED", ""); }
|
public String getLastTimeUsedSubsExt(){ return preferences.get("SUBS_EXT_LAST_TIME_SELECTED", ""); }
|
||||||
|
|
||||||
// Save & recover selected by user Subtitles codepage
|
// Save & recover selected by user Subtitles codepage
|
||||||
public void setLastTimeUsedSubsCodepage(String selected){ preferences.put("SUBS_CODEPAGE_LAST_TIME_SELECTED", selected); }
|
public void setLastTimeUsedSubsCodepage(String selected){ preferences.put("SUBS_CODEPAGE_LAST_TIME_SELECTED", selected); }
|
||||||
public String getLastTimeUsedSubsCodepage(){ return preferences.get("SUBS_CODEPAGE_LAST_TIME_SELECTED", ""); }
|
public String getLastTimeUsedSubsCodepage(){ return preferences.get("SUBS_CODEPAGE_LAST_TIME_SELECTED", ""); }
|
||||||
|
@ -89,4 +85,22 @@ public class AppPreferences {
|
||||||
return preferences.getBoolean("FULL_SCREEN_SELECTED", false);
|
return preferences.getBoolean("FULL_SCREEN_SELECTED", false);
|
||||||
}
|
}
|
||||||
public void setFullScreenSelected(boolean set){ preferences.putBoolean("FULL_SCREEN_SELECTED", set); }
|
public void setFullScreenSelected(boolean set){ preferences.putBoolean("FULL_SCREEN_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, "");
|
||||||
|
}
|
||||||
|
// Save lists itself of the latest opened folders (used only in Controller.class)
|
||||||
|
private void setList(String whichList, String value){
|
||||||
|
preferences.put(whichList, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,20 @@ public class Controller implements Initializable {
|
||||||
private ControllerMKA mkaPaneController;
|
private ControllerMKA mkaPaneController;
|
||||||
|
|
||||||
// Get preferences
|
// Get preferences
|
||||||
// Class of settings used
|
|
||||||
private AppPreferences appPreferences = new AppPreferences();
|
private AppPreferences appPreferences = new AppPreferences();
|
||||||
|
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private CheckMenuItem fullScreen;
|
||||||
|
|
||||||
|
// Get host services for opening URLs etc.
|
||||||
|
private HostServices hostServices;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TabPane tabPane;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
// Register this controller in mediator
|
// Register this controller in mediator
|
||||||
|
@ -61,28 +70,19 @@ public class Controller implements Initializable {
|
||||||
/* Populating settings from the previous run /*/
|
/* Populating settings from the previous run /*/
|
||||||
// Populating lists
|
// Populating lists
|
||||||
if (appPreferences.getLoadListsOnStart()){ // TODO: probably should be dedicated method in abstract class defined
|
if (appPreferences.getLoadListsOnStart()){ // TODO: probably should be dedicated method in abstract class defined
|
||||||
if (!appPreferences.getList("MKV").isEmpty()){
|
if (!appPreferences.getListMKV().isEmpty()){
|
||||||
mkvPaneController.getFilesFromFolder(new File(appPreferences.getList("MKV")), ".mkv");
|
mkvPaneController.getFilesFromFolder(new File(appPreferences.getListMKV()), ".mkv");
|
||||||
}
|
}
|
||||||
if (!appPreferences.getList("MKA").isEmpty()){
|
if (!appPreferences.getListMKA().isEmpty()){
|
||||||
mkaPaneController.getFilesFromFolder(new File(appPreferences.getList("MKA")), ".mka");
|
mkaPaneController.getFilesFromFolder(new File(appPreferences.getListMKA()), ".mka");
|
||||||
}
|
}
|
||||||
if (!appPreferences.getList("SUB").isEmpty()){
|
if (!appPreferences.getListSUB().isEmpty()){
|
||||||
subPaneController.getFilesFromFolder(new File(appPreferences.getList("SUB")), appPreferences.getLastTimeUsedSubsExt());
|
subPaneController.getFilesFromFolder(new File(appPreferences.getListSUB()), appPreferences.getLastTimeUsedSubsExt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullScreen.setSelected(appPreferences.getFullScreenSelected());
|
fullScreen.setSelected(appPreferences.getFullScreenSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
|
||||||
private CheckMenuItem fullScreen;
|
|
||||||
|
|
||||||
// Get host services for opening URLs etc.
|
|
||||||
private HostServices hostServices;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TabPane tabPane;
|
|
||||||
|
|
||||||
public void setHostServices(HostServices hostServices) {
|
public void setHostServices(HostServices hostServices) {
|
||||||
this.hostServices = hostServices;
|
this.hostServices = hostServices;
|
||||||
}
|
}
|
||||||
|
@ -194,19 +194,19 @@ public class Controller implements Initializable {
|
||||||
|
|
||||||
if (appPreferences.getLoadListsOnStart()) {
|
if (appPreferences.getLoadListsOnStart()) {
|
||||||
if (mkvPaneController.paneFileList.isEmpty())
|
if (mkvPaneController.paneFileList.isEmpty())
|
||||||
appPreferences.setList("MKV", "");
|
appPreferences.setListMKV("");
|
||||||
else
|
else
|
||||||
appPreferences.setList("MKV", mkvPaneController.paneFileList.get(0).getParent());
|
appPreferences.setListMKV(mkvPaneController.paneFileList.get(0).getParent());
|
||||||
|
|
||||||
if (mkaPaneController.paneFileList.isEmpty())
|
if (mkaPaneController.paneFileList.isEmpty())
|
||||||
appPreferences.setList("MKA", "");
|
appPreferences.setListMKA("");
|
||||||
else
|
else
|
||||||
appPreferences.setList("MKA", mkaPaneController.paneFileList.get(0).getParent());
|
appPreferences.setListMKA(mkaPaneController.paneFileList.get(0).getParent());
|
||||||
|
|
||||||
if (subPaneController.paneFileList.isEmpty())
|
if (subPaneController.paneFileList.isEmpty())
|
||||||
appPreferences.setList("SUB", "");
|
appPreferences.setListSUB("");
|
||||||
else {
|
else {
|
||||||
appPreferences.setList("SUB", subPaneController.paneFileList.get(0).getParent());
|
appPreferences.setListSUB(subPaneController.paneFileList.get(0).getParent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appPreferences.setLastTimeUsedSusExt(subPaneController.subtExt.getValue());
|
appPreferences.setLastTimeUsedSusExt(subPaneController.subtExt.getValue());
|
||||||
|
@ -216,10 +216,10 @@ public class Controller implements Initializable {
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void infoBnt(){ new AboutWindow(this.hostServices); } // TODO: fix this shit with hostSerivces that doesn't work @ linux
|
private void infoBnt(){ new AboutWindow(this.hostServices); } // TODO: fix this shit with hostSerivces that doesn't work @ linux
|
||||||
|
|
||||||
|
|
||||||
/** SETTINGS HANDLE */
|
/** SETTINGS HANDLE */
|
||||||
@FXML
|
@FXML
|
||||||
private void settingsBtn(){ new SettingsWindow(); }
|
private void settingsBtn(){ new SettingsWindow(); }
|
||||||
|
|
|
@ -3,7 +3,7 @@ package mplayer4anime;
|
||||||
* Name: mplayer4anime *
|
* Name: mplayer4anime *
|
||||||
* Author: Dmitry Isaenko *
|
* Author: Dmitry Isaenko *
|
||||||
* License: GNU GPL v.3 *
|
* License: GNU GPL v.3 *
|
||||||
* Version: 0.8.2 *
|
* Version: 0.8.3 *
|
||||||
* Site: https://developersu.blogspot.com/ *
|
* Site: https://developersu.blogspot.com/ *
|
||||||
* 2018, Russia *
|
* 2018, Russia *
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public abstract class ControllerPane implements Initializable {
|
public abstract class ControllerPane implements Initializable {
|
||||||
|
|
||||||
private ResourceBundle resourceBundle; // TODO: consider access thorough mediator
|
private ResourceBundle resourceBundle;
|
||||||
// use folderToOpen same variable in all panes
|
// use folderToOpen same variable in all panes
|
||||||
private static String folderToOpen;
|
private static String folderToOpen;
|
||||||
|
|
||||||
|
@ -136,7 +136,6 @@ public abstract class ControllerPane implements Initializable {
|
||||||
paneListView.getSelectionModel().select(index+1);
|
paneListView.getSelectionModel().select(index+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void Del(){ paneFileList.remove(paneListView.getSelectionModel().getSelectedItem()); }
|
private void Del(){ paneFileList.remove(paneListView.getSelectionModel().getSelectedItem()); }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
about_line1=mplayer4amine distributes under GNU GPLv3 license.
|
about_line1=mplayer4amine distributes under GNU GPLv3 license.
|
||||||
about_line2=Release: v0.8.2
|
about_line2=Release: v0.8.3
|
||||||
about_line3=Development & maintenance by Dmitry Isaenko.
|
about_line3=Development & maintenance by Dmitry Isaenko.
|
||||||
about_AboutName=About
|
about_AboutName=About
|
||||||
main_tab_audio=Audio
|
main_tab_audio=Audio
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
about_line1=mplayer4amine \u0440\u0430\u0441\u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u043E \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438 GNU GPLv3.
|
about_line1=mplayer4amine \u0440\u0430\u0441\u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u044F\u0435\u0442\u0441\u044F \u043F\u043E \u043B\u0438\u0446\u0435\u043D\u0437\u0438\u0438 GNU GPLv3.
|
||||||
about_line2=\u0420\u0435\u043B\u0438\u0437: v0.8.2
|
about_line2=\u0420\u0435\u043B\u0438\u0437: v0.8.3
|
||||||
about_line3=\u0420\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043E \u0438 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0414\u043C\u0438\u0442\u0440\u0438\u0435\u043C \u0418\u0441\u0430\u0435\u043D\u043A\u043E.
|
about_line3=\u0420\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0430\u043D\u043E \u0438 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F \u0414\u043C\u0438\u0442\u0440\u0438\u0435\u043C \u0418\u0441\u0430\u0435\u043D\u043A\u043E.
|
||||||
about_AboutName=\u041E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0438
|
about_AboutName=\u041E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0438
|
||||||
main_tab_audio=\u0410\u0443\u0434\u0438\u043E
|
main_tab_audio=\u0410\u0443\u0434\u0438\u043E
|
||||||
|
|
Loading…
Reference in a new issue