-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.8.2. Fullscreen selection saves after restart. Refactoring in prog…
…ress.
- Loading branch information
0 parents
commit fb988c0
Showing
34 changed files
with
2,318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package mplayer4anime.About; | ||
|
||
import javafx.application.HostServices; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Button; | ||
import javafx.stage.Stage; | ||
|
||
|
||
public class AboutController { | ||
|
||
private HostServices hostServices; | ||
|
||
public void setHostServices(HostServices hs){ | ||
this.hostServices = hs; | ||
} | ||
|
||
@FXML | ||
private Button buttonOk; | ||
|
||
@FXML | ||
private void buttonClickOk(){ | ||
Stage thisStage = (Stage) buttonOk.getScene().getWindow(); | ||
thisStage.close(); | ||
} | ||
@FXML | ||
private void gitHubUrl(){ | ||
try { | ||
hostServices.showDocument("https://github.com/developersu/mplayer4anime"); | ||
} catch (Exception e){ | ||
e.printStackTrace(); | ||
} | ||
} | ||
@FXML | ||
private void bloggerUrl(){ | ||
try { | ||
hostServices.showDocument("https://developersu.blogspot.com/"); | ||
} catch (Exception e){ | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
|
||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package mplayer4anime.About; | ||
|
||
import javafx.application.HostServices; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.image.Image; | ||
import javafx.stage.Stage; | ||
import mplayer4anime.Main; | ||
|
||
import java.io.IOException; | ||
import java.util.Locale; | ||
import java.util.ResourceBundle; | ||
|
||
public class AboutWindow { | ||
|
||
public AboutWindow(HostServices hostServices){ | ||
Stage stageAbout = new Stage(); | ||
|
||
stageAbout.setMinWidth(500); | ||
stageAbout.setMinHeight(230); | ||
|
||
FXMLLoader loaderAbout = new FXMLLoader(getClass().getResource("AboutLayout.fxml")); | ||
ResourceBundle resourceBundle; | ||
|
||
if (Locale.getDefault().getISO3Language().equals("rus")) { | ||
resourceBundle = ResourceBundle.getBundle("mplayer4anime.localization.locale", new Locale("ru")); | ||
} else { | ||
resourceBundle = ResourceBundle.getBundle("mplayer4anime.localization.locale", new Locale("en")); | ||
} | ||
loaderAbout.setResources(resourceBundle); | ||
|
||
try { | ||
Parent parentAbout = loaderAbout.load(); | ||
AboutController abtController = loaderAbout.getController(); | ||
abtController.setHostServices(hostServices); | ||
|
||
stageAbout.setTitle(resourceBundle.getString("about_AboutName")); | ||
stageAbout.getIcons().addAll( | ||
new Image(Main.class.getResourceAsStream("/mplayer4anime/res/app_icon32x32.png")), | ||
new Image(Main.class.getResourceAsStream("/mplayer4anime/res/app_icon48x48.png")), | ||
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.show(); | ||
|
||
} catch (IOException e){ | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package mplayer4anime; | ||
|
||
import java.util.prefs.Preferences; | ||
|
||
// Rule application settings | ||
public class AppPreferences { | ||
|
||
private Preferences preferences; | ||
|
||
public AppPreferences(){ | ||
preferences = Preferences.userRoot().node("mplayer4anime"); | ||
} | ||
|
||
public void setPath(String path){ | ||
preferences.put("PATH", path); | ||
} | ||
|
||
public String getPath(){ | ||
return preferences.get("PATH", "mplayer"); | ||
} | ||
|
||
/* Return subtitles priority to show | ||
* TRUE - Subtitles tab opens first | ||
* FALSE - Subtitles tab opens as usual | ||
*/ | ||
public boolean getSubtilesFirst(){ | ||
return preferences.getBoolean("SUBS_TAB_FIRST", false); | ||
} | ||
|
||
public void setSubtilesFirst(boolean set){ | ||
preferences.putBoolean("SUBS_TAB_FIRST", set); | ||
} | ||
|
||
// Set option, that tells that we have to save/restore lists on startup | ||
public void setLoadListsOnStart(boolean set){ | ||
preferences.putBoolean("LOAD_LISTS_ON_START", set); | ||
} | ||
// Returns settings for the save/restore lists option | ||
public boolean getLoadListsOnStart(){ | ||
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) | ||
public void setList(String whichList, String value){ | ||
preferences.put(whichList, value); | ||
} | ||
// Return lists itself of the latest opened folders (used only in Controller.class) | ||
public String getList(String whichList){ | ||
return preferences.get(whichList, ""); | ||
} | ||
|
||
/** Handle lists of the subtitles extensions selector */ | ||
public void setSubsExtensionsList(String[] subsList){ | ||
String stringToStore = ""; | ||
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(){ | ||
return preferences.get("SUBS_EXTENSIONS_LIST", ".ass@@@.crt@@@").split("@@@"); | ||
} | ||
|
||
/** Handle lists of the subtitles codepage selector */ | ||
public void setSubsCodepageList(String[] subsCodepageList){ | ||
String stringToStore = ""; | ||
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(){ | ||
return preferences.get("SUBS_CODEPAGE_LIST", "default@@@utf8@@@cp1251@@@koi8-r").split("@@@"); | ||
} | ||
|
||
// 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 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); } | ||
} |
Oops, something went wrong.