From 4586f71f55dd09fa244792815b71206e4be5ee7b Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 1 Mar 2019 23:19:33 +0300 Subject: [PATCH] v0.13 rolling. UI changes, extension filter bug fixed. --- Readme.md | 2 + pom.xml | 112 +++++++++++++++++- .../java/mplayer4anime/AppPreferences.java | 1 - .../Settings/ControllerListsSelector.java | 31 +++-- .../appPanes/ControllerPane.java | 29 +++-- .../resources/Settings/SettingsLayout.fxml | 2 +- src/main/resources/locale_en.properties | 2 +- src/main/resources/locale_ru.properties | 2 +- src/main/resources/res/landing.css | 39 ++++++ 9 files changed, 196 insertions(+), 24 deletions(-) diff --git a/Readme.md b/Readme.md index 9bd077a..29ac80e 100644 --- a/Readme.md +++ b/Readme.md @@ -2,6 +2,8 @@ mplayer4anime is mplayer launcher to play video file with audio layer and/or subtitles (.ass, .srt, etc,,,) at once. +![Screenshot](https://farm8.staticflickr.com/7917/40285210053_fe9c781698_o.png) + ## License Source code spreads under the GNU General Public License v.3. You can find it in LICENSE file or just visit www.gnu.org (it should be there for sure). diff --git a/pom.xml b/pom.xml index cb231f8..26d2292 100644 --- a/pom.xml +++ b/pom.xml @@ -5,13 +5,52 @@ 4.0.0 loper + mplayer4anime + mplayer4anime - 0.12-SNAPSHOT + 0.13-SNAPSHOT + jar - InnaIrcBot + + https://github.com/developersu/mplayer4anime + + mplayer front end to play content pairs, that mostly used for anime (mka+mkv, mp4+ac3, mkv+srt) + + 2018-2019 + + Dmitry Isaenko + https://developersu.blogspot.com/search/label/mplayer4anime + + + + + GPLv3 + LICENSE + manual + + + + + + developer.su + Dmitry Isaenko + + Developer + + +3 + https://developersu.blogspot.com/ + + + UTF-8 + + + GitHub + https://github.com/developer_su/${project.artifactId}/issues + + com.google.code.gson @@ -19,22 +58,91 @@ 2.8.5 compile + org.openjfx javafx-controls 11 + linux compile org.openjfx javafx-media 11 + linux compile org.openjfx javafx-fxml 11 + linux + compile + + + org.openjfx + javafx-graphics + 11 + linux + compile + + + + org.openjfx + javafx-controls + 11 + win + compile + + + org.openjfx + javafx-media + 11 + win + compile + + + org.openjfx + javafx-fxml + 11 + win + compile + + + org.openjfx + javafx-graphics + 11 + win + compile + + + + org.openjfx + javafx-controls + 11 + mac + compile + + + org.openjfx + javafx-media + 11 + mac + compile + + + org.openjfx + javafx-fxml + 11 + mac + compile + + + org.openjfx + javafx-graphics + 11 + mac compile diff --git a/src/main/java/mplayer4anime/AppPreferences.java b/src/main/java/mplayer4anime/AppPreferences.java index 79187d1..3114110 100644 --- a/src/main/java/mplayer4anime/AppPreferences.java +++ b/src/main/java/mplayer4anime/AppPreferences.java @@ -52,7 +52,6 @@ public class AppPreferences { /** Handle lists of the audio files extensions */ public void setAudioExtensionsList(String[] audioExtensionsList){ storeSingleStringList("AUDIO_EXTENSIONS_LIST", audioExtensionsList); } public String[] getAudioExtensionsList(){ return preferences.get("AUDIO_EXTENSIONS_LIST", "*.mka *.ac3").split(" "); } - /** Handle lists of the subtitles extensions selector */ public void setSubsExtensionsList(String[] subsList){ storeSingleStringList("SUBS_EXTENSIONS_LIST", subsList); } public String[] getSubsExtensionsList(){ return preferences.get("SUBS_EXTENSIONS_LIST", "*.ass *.srt ").split(" "); } diff --git a/src/main/java/mplayer4anime/Settings/ControllerListsSelector.java b/src/main/java/mplayer4anime/Settings/ControllerListsSelector.java index 427d8e6..b455a90 100644 --- a/src/main/java/mplayer4anime/Settings/ControllerListsSelector.java +++ b/src/main/java/mplayer4anime/Settings/ControllerListsSelector.java @@ -31,7 +31,7 @@ public class ControllerListsSelector implements Initializable { * Must be run on start * Set list content */ - void setList(String[] listFromStorage, boolean isListOfExtensions){ + void setList(String[] listFromStorage, boolean isListOfExtensions){ observableList = FXCollections.observableArrayList(listFromStorage); listView.setItems(observableList); this.listOfExtensions = isListOfExtensions; @@ -71,26 +71,30 @@ public class ControllerListsSelector implements Initializable { private void removeRecord(){ observableList.remove(listView.getSelectionModel().getSelectedItem()); } @FXML private void addNewRecord(){ - String addingItem = newRecordText.getText().trim(); + String addingItem = newRecordText.getText().trim().toLowerCase(); if (!addingItem.isEmpty()) // If this field is non-empty if (!addingItem.contains(" ") && !addingItem.contains("\t")) { if (this.listOfExtensions) { - if (addingItem.startsWith("*.")) + if (addingItem.startsWith("*.")) { if (addingItem.substring(2).contains("*")) { ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("settings_fieldContainUnacceptedChars")); - } else { - observableList.add(addingItem); } + else { + validateAndAdd(addingItem); + } + } else if (addingItem.contains("*")) { ServiceWindow.getErrorNotification(resourceBundle.getString("Error"), resourceBundle.getString("settings_fieldContainUnacceptedChars")); - } else if (addingItem.startsWith(".")) { - observableList.add("*" + addingItem); - } else { - observableList.add("*." + addingItem); + } + else if (addingItem.startsWith(".")) { + validateAndAdd("*" + addingItem); + } + else { + validateAndAdd("*." + addingItem); } } else { - observableList.add(addingItem); + validateAndAdd(addingItem); } } else{ @@ -98,4 +102,9 @@ public class ControllerListsSelector implements Initializable { } newRecordText.clear(); } -} + private void validateAndAdd(String addingItem){ + if (!observableList.contains(addingItem)) { + observableList.add(addingItem); + } + } +} \ No newline at end of file diff --git a/src/main/java/mplayer4anime/appPanes/ControllerPane.java b/src/main/java/mplayer4anime/appPanes/ControllerPane.java index 3c2dfa7..64a3a6d 100644 --- a/src/main/java/mplayer4anime/appPanes/ControllerPane.java +++ b/src/main/java/mplayer4anime/appPanes/ControllerPane.java @@ -16,6 +16,7 @@ import mplayer4anime.AppPreferences; import java.io.File; import java.io.FilenameFilter; import java.net.URL; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.ResourceBundle; @@ -126,22 +127,29 @@ public class ControllerPane implements Initializable { * */ @FXML void openDirChooser(){ - String[] filesExtension; + String[] filesExtensionTmp; switch (paneType) { case "Video": - filesExtension = appPreferences.getVideoExtensionsList(); + filesExtensionTmp = appPreferences.getVideoExtensionsList(); break; case "Audio": - filesExtension = appPreferences.getAudioExtensionsList(); + filesExtensionTmp = appPreferences.getAudioExtensionsList(); break; case "Subtitles": - filesExtension = appPreferences.getSubsExtensionsList(); + filesExtensionTmp = appPreferences.getSubsExtensionsList(); break; default: - filesExtension = new String[]{"*"}; + filesExtensionTmp = new String[]{"*"}; break; } + List lowerAndUpperExts = new ArrayList<>(); + for (String s: filesExtensionTmp) { + lowerAndUpperExts.add(s); + lowerAndUpperExts.add(s.toUpperCase()); + } + String[] filesExtension = lowerAndUpperExts.toArray(new String[lowerAndUpperExts.size()]); + File directoryReceived; // Store files (folder) received from selector DirectoryChooser dirSelect; @@ -164,7 +172,7 @@ public class ControllerPane implements Initializable { if (Name.lastIndexOf('.') > 0) { int lastindex = Name.lastIndexOf('.'); String ext = Name.substring(lastindex); - for (String key : filesExtension){ + for (String key : filesExtension){ // TODO: add toLowerCase and validate whatever registry extension noted if (ext.equals(key.substring(1))) return true; } @@ -200,6 +208,13 @@ public class ControllerPane implements Initializable { break; } + List lowerAndUpperExts = new ArrayList<>(); + for (String s: filesExtension) { + lowerAndUpperExts.add(s); + lowerAndUpperExts.add(s.toUpperCase()); + } + filesExtension = lowerAndUpperExts.toArray(new String[lowerAndUpperExts.size()]); + List filesRecievedList; FileChooser fc = new FileChooser(); @@ -211,7 +226,7 @@ public class ControllerPane implements Initializable { fc.getExtensionFilters().addAll(new FileChooser.ExtensionFilter(paneType, filesExtension)); filesRecievedList = fc.showOpenMultipleDialog(paneListView.getScene().getWindow()); - if (filesRecievedList != null){ + if (filesRecievedList != null){ // TODO: and !filesRecieved.isEmpty() File[] filesRecieved = new File[filesRecievedList.size()]; filesRecievedList.toArray(filesRecieved); displayFiles(filesRecieved); diff --git a/src/main/resources/Settings/SettingsLayout.fxml b/src/main/resources/Settings/SettingsLayout.fxml index 769404f..73af378 100644 --- a/src/main/resources/Settings/SettingsLayout.fxml +++ b/src/main/resources/Settings/SettingsLayout.fxml @@ -14,7 +14,7 @@ - + diff --git a/src/main/resources/locale_en.properties b/src/main/resources/locale_en.properties index 5eda1f5..5705bb2 100644 --- a/src/main/resources/locale_en.properties +++ b/src/main/resources/locale_en.properties @@ -1,5 +1,5 @@ about_line1=mplayer4amine distributes under GNU GPLv3 license. -about_line2=Release: v0.12 +about_line2=Release: v0.13 about_line3=Development & maintenance by Dmitry Isaenko. about_AboutName=About main_tab_audio=Audio diff --git a/src/main/resources/locale_ru.properties b/src/main/resources/locale_ru.properties index 2527455..5876ffc 100644 --- a/src/main/resources/locale_ru.properties +++ b/src/main/resources/locale_ru.properties @@ -1,6 +1,6 @@ menu_File_Recent=\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0444\u0430\u0439\u043B\u044B... 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.12 +about_line2=\u0420\u0435\u043B\u0438\u0437: v0.13 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 diff --git a/src/main/resources/res/landing.css b/src/main/resources/res/landing.css index a1902c9..48ff804 100644 --- a/src/main/resources/res/landing.css +++ b/src/main/resources/res/landing.css @@ -90,4 +90,43 @@ -fx-background-image: url(gjel.png); -fx-background-position: center; -fx-background-repeat: repeat; +} + +/* -======================== TAB PANE =========================- */ +.tab-paneSettings .tab SVGPath{ + -fx-fill: #000000; +} +.tab-paneSettings .tab:selected SVGPath{ + -fx-fill: #267a9e; +} +.tab-paneSettings .tab{ + -fx-background-color: #ffffff; + -fx-focus-color: transparent; + -fx-faint-focus-color: transparent; + -fx-border-radius: 0 0 0 0; + -fx-border-width: 0 0 5 0; + -fx-border-color: #ffffff; +} + +.tab-paneSettings .tab:selected{ + -fx-background-color: #ebffff; + -fx-focus-color: transparent; + -fx-faint-focus-color: transparent; + -fx-border-radius: 0 0 0 0; + -fx-border-width: 0 0 5 0; + -fx-border-color: #8dbee4; +} + +.tab-paneSettings > .tab-header-area { + -fx-background-insets: 0.0; + -fx-padding: 0; +} + +.tab-paneSettings > .tab-header-area > .tab-header-background +{ + -fx-background-color: #ffffff; + +} +.tab-paneSettings > .tab-header-area > .headers-region > .tab { + -fx-padding: 10; } \ No newline at end of file