v0.9 Fixed bug when embedded subtitles doesn't superseded by stand-alone subtitles. Added button for disable subtitles (all kind). Status of this button saved and restored on application startup.
This commit is contained in:
parent
a22827d547
commit
fa31999daf
6 changed files with 58 additions and 3 deletions
|
@ -76,6 +76,12 @@ public class AppPreferences {
|
|||
}
|
||||
public void setFullScreenSelected(boolean set){ preferences.putBoolean("FULL_SCREEN_SELECTED", set); }
|
||||
|
||||
// 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){
|
||||
|
|
|
@ -38,6 +38,9 @@ public class Controller implements Initializable {
|
|||
@FXML
|
||||
private TabPane tabPane;
|
||||
|
||||
@FXML
|
||||
private CheckMenuItem subsHide;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
// Register this controller in mediator
|
||||
|
@ -80,6 +83,7 @@ public class Controller implements Initializable {
|
|||
}
|
||||
}
|
||||
fullScreen.setSelected(appPreferences.getFullScreenSelected());
|
||||
subsHide.setSelected(appPreferences.getSubtitlesHideSelected());
|
||||
}
|
||||
|
||||
public void setHostServices(HostServices hostServices) {
|
||||
|
@ -96,6 +100,31 @@ public class Controller implements Initializable {
|
|||
return true;
|
||||
} else { return false; }
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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");
|
||||
|
||||
}
|
||||
@FXML
|
||||
private void fullscreenBtn(){ playerSingleCommand("vo_fullscreen"); }
|
||||
@FXML
|
||||
|
@ -148,6 +177,7 @@ public class Controller implements Initializable {
|
|||
"-quiet",
|
||||
fullScreen.isSelected() ? "-fs" : "",
|
||||
mkvPaneController.paneFileList.get(mkvPaneController.paneListView.getSelectionModel().getSelectedIndex()).toPath().toString(),
|
||||
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
|
||||
|
@ -163,6 +193,14 @@ public class Controller implements Initializable {
|
|||
new LineRedirecter(player.getErrorStream(), writeTo).start();
|
||||
|
||||
playerIn = new PrintStream(player.getOutputStream());
|
||||
|
||||
/* If user desired to disable subtitles but populated the list in the SUB pane, then load them and disable visibility.
|
||||
* It's should be done this way because if we won't pass them to mplayer during start them user won't be able to enable them later on.
|
||||
* There is another bike could be implemented such as passing input file during load but it's far more dumb idea then current implementation.
|
||||
*/
|
||||
if (subsHide.isSelected())
|
||||
playerSingleCommand("sub_visibility 0");
|
||||
|
||||
} else {
|
||||
playerIn.print("pause");
|
||||
playerIn.print("\n");
|
||||
|
@ -210,6 +248,7 @@ public class Controller implements Initializable {
|
|||
appPreferences.setLastTimeUsedSusExt(subPaneController.subtExt.getValue());
|
||||
appPreferences.setLastTimeUsedSubsCodepage(subPaneController.subtCodepage.getValue());
|
||||
appPreferences.setFullScreenSelected(fullScreen.isSelected());
|
||||
appPreferences.setSubtitlesHideSelected(subsHide.isSelected());
|
||||
|
||||
Platform.exit();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package mplayer4anime;
|
|||
* Name: mplayer4anime *
|
||||
* Author: Dmitry Isaenko *
|
||||
* License: GNU GPL v.3 *
|
||||
* Version: 0.8.4 *
|
||||
* Version: 0.9 *
|
||||
* Site: https://developersu.blogspot.com/ *
|
||||
* 2018, Russia *
|
||||
***********************************************/
|
||||
|
|
|
@ -69,6 +69,14 @@
|
|||
</graphic>
|
||||
</Button>
|
||||
<Pane HBox.hgrow="ALWAYS" />
|
||||
<SplitMenuButton mnemonicParsing="false" onAction="#subsTriggerBtn" styleClass="splitMenuButton" stylesheets="@res/landing.css">
|
||||
<graphic>
|
||||
<SVGPath content="M 4,18 C 2.8954305,18 2,17.104569 2,16 V 4 C 2,2.89 2.9,2 4,2 h 16 c 1.104569,0 2,0.8954305 2,2 v 12 c 0,1.104569 -0.895431,2 -2,2 m -6,-7 v 1 h 5 V 11 M 5,12 h 8 V 11 H 5 m 0,3 v 1 h 14 v -1 z" fill="#e1e1e1" />
|
||||
</graphic>
|
||||
<items>
|
||||
<CheckMenuItem fx:id="subsHide" mnemonicParsing="false" text="%subsShow_option" />
|
||||
</items>
|
||||
</SplitMenuButton>
|
||||
<SplitMenuButton mnemonicParsing="false" onAction="#fullscreenBtn" styleClass="splitMenuButton" stylesheets="@res/landing.css">
|
||||
<items>
|
||||
<CheckMenuItem fx:id="fullScreen" mnemonicParsing="false" text="%fullscreen_option" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
about_line1=mplayer4amine distributes under GNU GPLv3 license.
|
||||
about_line2=Release: v0.8.4
|
||||
about_line2=Release: v0.9
|
||||
about_line3=Development & maintenance by Dmitry Isaenko.
|
||||
about_AboutName=About
|
||||
main_tab_audio=Audio
|
||||
|
@ -24,4 +24,5 @@ settings_LoadListsOnStart=Save & restore previously opened lists after applicati
|
|||
settings_subsExtensionList=Avaliable subtitles extensions:
|
||||
settings_subsCodepageList=Avaliable codepages for subtitles:
|
||||
settings_fieldContainSpacesTabs=Spaces and tab symbols are not allowed.
|
||||
subsShow_option=Don't show subtitles.
|
||||
|
||||
|
|
|
@ -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_line2=\u0420\u0435\u043B\u0438\u0437: v0.8.4
|
||||
about_line2=\u0420\u0435\u043B\u0438\u0437: v0.9
|
||||
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
|
||||
main_tab_audio=\u0410\u0443\u0434\u0438\u043E
|
||||
|
@ -24,3 +24,4 @@ settings_LoadListsOnStart=\u0417\u0430\u043F\u043E\u043C\u0438\u043D\u0430\u0442
|
|||
settings_subsExtensionList=\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043D\u0438\u044F \u0434\u043B\u044F \u0441\u0443\u0431\u0442\u0438\u0442\u0440\u043E\u0432:
|
||||
settings_subsCodepageList=\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u043A\u043E\u0434\u0438\u0440\u043E\u0432\u043A\u0438 \u0434\u043B\u044F \u0441\u0443\u0431\u0442\u0438\u0442\u0440\u043E\u0432:
|
||||
settings_fieldContainSpacesTabs=\u041F\u0440\u043E\u0431\u0435\u043B\u044B \u0438 \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u0442\u0430\u0431\u0443\u043B\u044F\u0446\u0438\u0438 \u043D\u0435\u0434\u043E\u043F\u0443\u0441\u0442\u0438\u043C\u044B.
|
||||
subsShow_option=\u041D\u0435 \u043E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u0441\u0443\u0431\u0442\u0438\u0442\u0440\u044B.
|
||||
|
|
Loading…
Reference in a new issue