Refactoring. Quickly looked and remove some dumb things in IPC part. Align package/classes names to some appropriate naming convention, move PlayerToolbar to separate FXML+controller.
This commit is contained in:
		
							parent
							
								
									9d8ab59361
								
							
						
					
					
						commit
						d9ccb3a90a
					
				
					 27 changed files with 390 additions and 300 deletions
				
			
		|  | @ -1,3 +0,0 @@ | ||||||
| Manifest-Version: 1.0 |  | ||||||
| Main-Class: mplayer4anime.Main |  | ||||||
| 
 |  | ||||||
|  | @ -1,50 +0,0 @@ | ||||||
| package mplayer4anime.IPC; |  | ||||||
| 
 |  | ||||||
| import mplayer4anime.Controller; |  | ||||||
| 
 |  | ||||||
| import java.io.*; |  | ||||||
| import java.net.InetAddress; |  | ||||||
| import java.net.ServerSocket; |  | ||||||
| import java.net.Socket; |  | ||||||
| 
 |  | ||||||
| // TODO: Rewrite and remove. Or just remove. |  | ||||||
| public class SingleInstanceHandler implements Runnable{ |  | ||||||
| 
 |  | ||||||
|     private ServerSocket servSock; |  | ||||||
| 
 |  | ||||||
|     public SingleInstanceHandler(Controller mainCntrl, String argument){ |  | ||||||
|         int PORT = 65042; |  | ||||||
|         // Creating client server socket; |  | ||||||
|         try { |  | ||||||
|             servSock = new ServerSocket(PORT, 10, InetAddress.getLocalHost()); |  | ||||||
|             Thread ssp = new Thread(new ServerSocketProvider(mainCntrl, servSock)); |  | ||||||
|             ssp.start(); |  | ||||||
|         } catch (IOException e) { |  | ||||||
|             if (argument != null){ |  | ||||||
|                 // Creating client socket; |  | ||||||
|                 try { |  | ||||||
|                     Socket clientSocket = new Socket(InetAddress.getLocalHost(), PORT); |  | ||||||
|                     OutputStream outStream = clientSocket.getOutputStream(); |  | ||||||
|                     OutputStreamWriter outStreamWriter = new OutputStreamWriter(outStream); |  | ||||||
|                     outStreamWriter.write(argument + "\n"); |  | ||||||
|                     outStreamWriter.flush(); |  | ||||||
|                     outStream.close(); |  | ||||||
|                     clientSocket.close(); |  | ||||||
|                 } catch (IOException ex){ |  | ||||||
|                     System.out.println("Internal issue: unable to create client socket."); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|                 System.out.println("Application is already running."); |  | ||||||
|             System.exit(0); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     @Override |  | ||||||
|     public void run() { |  | ||||||
|         while (! Thread.currentThread().isInterrupted()); |  | ||||||
|         try { |  | ||||||
|             servSock.close(); |  | ||||||
|         } catch (IOException ignore) {} |  | ||||||
|     } |  | ||||||
| } |  | ||||||
|  | @ -24,7 +24,8 @@ import javafx.scene.Parent; | ||||||
| import javafx.scene.Scene; | import javafx.scene.Scene; | ||||||
| import javafx.scene.image.Image; | import javafx.scene.image.Image; | ||||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||||
| import mplayer4anime.IPC.SingleInstanceHandler; | import mplayer4anime.ipc.SingleInstanceHandler; | ||||||
|  | import mplayer4anime.ui.landing.LandingController; | ||||||
| 
 | 
 | ||||||
| import java.util.Locale; | import java.util.Locale; | ||||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||||
|  | @ -39,7 +40,7 @@ public class MainFX extends Application { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void start(Stage primaryStage) throws Exception{ |     public void start(Stage primaryStage) throws Exception{ | ||||||
|         FXMLLoader loader = new FXMLLoader(getClass().getResource("/landingPage.fxml")); |         FXMLLoader loader = new FXMLLoader(getClass().getResource("/LandingPage.fxml")); | ||||||
| 
 | 
 | ||||||
|         Locale userLocale = new Locale(Locale.getDefault().getISO3Language());      // NOTE: user locale based on ISO3 Language codes |         Locale userLocale = new Locale(Locale.getDefault().getISO3Language());      // NOTE: user locale based on ISO3 Language codes | ||||||
|         ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale); |         ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale); | ||||||
|  | @ -47,21 +48,14 @@ public class MainFX extends Application { | ||||||
| 
 | 
 | ||||||
|         Parent root = loader.load(); |         Parent root = loader.load(); | ||||||
| 
 | 
 | ||||||
|         // tmp? |         LandingController landingController = loader.getController(); | ||||||
|         Controller controller = loader.getController(); |         landingController.setHostServices(getHostServices()); | ||||||
|         controller.setHostServices(getHostServices()); |         SingleInstanceHandler singleInstanceHandler; | ||||||
|         SingleInstanceHandler sih; |  | ||||||
| 
 | 
 | ||||||
|         if (!getParameters().getUnnamed().isEmpty()) |         if (getParameters().getUnnamed().isEmpty()) | ||||||
|             sih = new SingleInstanceHandler(controller, getParameters().getUnnamed().get(0)); |             singleInstanceHandler = new SingleInstanceHandler(landingController, null); | ||||||
|         else |         else | ||||||
|             sih = new SingleInstanceHandler(controller, null); |             singleInstanceHandler = new SingleInstanceHandler(landingController, getParameters().getUnnamed().get(0)); | ||||||
|         // end |  | ||||||
|         Thread tsih = new Thread(sih); |  | ||||||
|         tsih.start(); |  | ||||||
| 
 |  | ||||||
|         // TODO: refactor needed? |  | ||||||
|         Runtime.getRuntime().addShutdownHook(new Thread(() -> tsih.interrupt())); |  | ||||||
| 
 | 
 | ||||||
|         primaryStage.getIcons().addAll( |         primaryStage.getIcons().addAll( | ||||||
|                 new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), |                 new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), | ||||||
|  | @ -80,10 +74,10 @@ public class MainFX extends Application { | ||||||
|         primaryStage.setOnHidden(e -> { |         primaryStage.setOnHidden(e -> { | ||||||
|             AppPreferences.getINSTANCE().setSceneHeight(scene.getHeight()); |             AppPreferences.getINSTANCE().setSceneHeight(scene.getHeight()); | ||||||
|             AppPreferences.getINSTANCE().setSceneWidth(scene.getWidth()); |             AppPreferences.getINSTANCE().setSceneWidth(scene.getWidth()); | ||||||
|             tsih.interrupt(); |             singleInstanceHandler.finishWork(); | ||||||
|             controller.shutdown(); |             landingController.shutdown(); | ||||||
|         }); |         }); | ||||||
| 
 |         //Runtime.getRuntime().addShutdownHook(new Thread(sihThread::interrupt)); | ||||||
|         primaryStage.show(); |         primaryStage.show(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,14 +1,30 @@ | ||||||
|  | /* | ||||||
|  |     Copyright 2018-2021 Dmitry Isaenko | ||||||
|  | 
 | ||||||
|  |     This file is part of mplayer4anime. | ||||||
|  | 
 | ||||||
|  |     mplayer4anime is free software: you can redistribute it and/or modify | ||||||
|  |     it under the terms of the GNU General Public License as published by | ||||||
|  |     the Free Software Foundation, either version 3 of the License, or | ||||||
|  |     (at your option) any later version. | ||||||
|  | 
 | ||||||
|  |     mplayer4anime is distributed in the hope that it will be useful, | ||||||
|  |     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |     GNU General Public License for more details. | ||||||
|  | 
 | ||||||
|  |     You should have received a copy of the GNU General Public License | ||||||
|  |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  |  */ | ||||||
| package mplayer4anime; | package mplayer4anime; | ||||||
| 
 | 
 | ||||||
|  | import mplayer4anime.ui.landing.LandingController; | ||||||
|  | 
 | ||||||
| public class MediatorControl { | public class MediatorControl { | ||||||
|     private Controller mainController; |     private LandingController mainLandingController; | ||||||
| 
 | 
 | ||||||
|     public void registerMainController(Controller mc) { |     private static class MediatorControlHold { | ||||||
|         mainController = mc; |         private static final MediatorControl INSTANCE = new MediatorControl(); | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public void sentUpdates() { |  | ||||||
|         mainController.updateAfterSettingsChanged(); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private MediatorControl() {} |     private MediatorControl() {} | ||||||
|  | @ -17,7 +33,12 @@ public class MediatorControl{ | ||||||
|         return MediatorControlHold.INSTANCE; |         return MediatorControlHold.INSTANCE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static class MediatorControlHold { |     public void registerMainController(LandingController mainLandingController) { | ||||||
|         private static final MediatorControl INSTANCE = new MediatorControl(); |         this.mainLandingController = mainLandingController; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public void updateAfterSettingsChanged() { | ||||||
|  |         mainLandingController.updateAfterSettingsChanged(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -16,10 +16,10 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.IPC; | package mplayer4anime.ipc; | ||||||
| 
 | 
 | ||||||
| import javafx.application.Platform; | import javafx.application.Platform; | ||||||
| import mplayer4anime.Controller; | import mplayer4anime.ui.landing.LandingController; | ||||||
| 
 | 
 | ||||||
| import java.io.BufferedReader; | import java.io.BufferedReader; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
|  | @ -30,38 +30,29 @@ import java.net.Socket; | ||||||
| class ServerSocketProvider implements Runnable{ | class ServerSocketProvider implements Runnable{ | ||||||
| 
 | 
 | ||||||
|     private final ServerSocket serverSocket; |     private final ServerSocket serverSocket; | ||||||
|     private final Controller controller; |     private final LandingController landingController; | ||||||
| 
 | 
 | ||||||
|     ServerSocketProvider(Controller mainCntrl, ServerSocket srvSock){ |     ServerSocketProvider(LandingController mainLandingController, ServerSocket srvSock){ | ||||||
|         this.serverSocket = srvSock; |         this.serverSocket = srvSock; | ||||||
|         this.controller = mainCntrl; |         this.landingController = mainLandingController; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void run() { |     public void run() { | ||||||
|         Socket servSockClient; |  | ||||||
|         try{ |         try{ | ||||||
|  |             Socket servSockClient; | ||||||
|             while (!serverSocket.isClosed()){ |             while (!serverSocket.isClosed()){ | ||||||
|                 servSockClient = serverSocket.accept(); |                 servSockClient = serverSocket.accept(); | ||||||
|                 BufferedReader servInpRdr = new BufferedReader( |                 BufferedReader servInpRdr = new BufferedReader( | ||||||
|                         new InputStreamReader(servSockClient.getInputStream()) |                         new InputStreamReader(servSockClient.getInputStream())); | ||||||
|                         ); |  | ||||||
| 
 | 
 | ||||||
|                 String line = servInpRdr.readLine(); |                 String line = servInpRdr.readLine(); | ||||||
|                 // Avoid 'Not on FX application thread' error. |                 // Avoid 'Not on FX application thread' error. | ||||||
|                 Platform.runLater(new Runnable() { |                 Platform.runLater(() -> landingController.setPlaylistAsArgument(line)); | ||||||
|                     @Override |  | ||||||
|                     public void run() { |  | ||||||
|                         controller.setPlaylistAsArgument(line); |  | ||||||
|                     } |  | ||||||
|                 }); |  | ||||||
| 
 | 
 | ||||||
|                 servSockClient.close(); |                 servSockClient.close(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         catch (IOException ex){ |         catch (IOException ignore){} | ||||||
|             ex.printStackTrace(); |  | ||||||
|             System.out.println("Socket has been closed."); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
							
								
								
									
										72
									
								
								src/main/java/mplayer4anime/ipc/SingleInstanceHandler.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								src/main/java/mplayer4anime/ipc/SingleInstanceHandler.java
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,72 @@ | ||||||
|  | package mplayer4anime.ipc; | ||||||
|  | 
 | ||||||
|  | import mplayer4anime.ui.landing.LandingController; | ||||||
|  | 
 | ||||||
|  | import java.io.*; | ||||||
|  | import java.net.InetAddress; | ||||||
|  | import java.net.ServerSocket; | ||||||
|  | import java.net.Socket; | ||||||
|  | 
 | ||||||
|  | // TODO: Rewrite and remove. Or just remove. | ||||||
|  | public class SingleInstanceHandler{ | ||||||
|  |     private ServerSocket servSocket; | ||||||
|  |     private final LandingController mainLandingController; | ||||||
|  |     private final String argument; | ||||||
|  | 
 | ||||||
|  |     private final int PORT = 65042; | ||||||
|  | 
 | ||||||
|  |     public SingleInstanceHandler(LandingController mainLandingController, String argument){ | ||||||
|  |         this.mainLandingController = mainLandingController; | ||||||
|  |         this.argument = argument; | ||||||
|  | 
 | ||||||
|  |        if (firstInstanceScenario()) | ||||||
|  |            secondInstanceScenario(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Creating client server socket; | ||||||
|  |      * @return true of failure | ||||||
|  |      * */ | ||||||
|  |     private boolean firstInstanceScenario(){ | ||||||
|  |         try { | ||||||
|  |             servSocket = new ServerSocket(PORT, 10, InetAddress.getLocalHost()); | ||||||
|  |             Thread ssp = new Thread(new ServerSocketProvider(mainLandingController, servSocket)); | ||||||
|  |             ssp.start(); | ||||||
|  |             return false; | ||||||
|  |         } | ||||||
|  |         catch (IOException ignored){ | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     /** | ||||||
|  |      * If socked occupied then send arguments to the running instance | ||||||
|  |      * */ | ||||||
|  |     private void secondInstanceScenario(){ | ||||||
|  |         try { | ||||||
|  |             if (argument != null){ | ||||||
|  |                 // Creating client socket; | ||||||
|  |                 Socket clientSocket = new Socket(InetAddress.getLocalHost(), PORT); | ||||||
|  |                 OutputStream outStream = clientSocket.getOutputStream(); | ||||||
|  |                 OutputStreamWriter outStreamWriter = new OutputStreamWriter(outStream); | ||||||
|  |                 outStreamWriter.write(argument + "\n"); | ||||||
|  |                 outStreamWriter.flush(); | ||||||
|  |                 outStream.close(); | ||||||
|  |                 clientSocket.close(); | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |                 System.out.println("Application is already running."); | ||||||
|  |         } | ||||||
|  |         catch (IOException ex){ | ||||||
|  |             ex.printStackTrace(); | ||||||
|  |             System.out.println("Internal issue: unable to create client socket."); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         System.exit(0); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public void finishWork(){ | ||||||
|  |         try { | ||||||
|  |             servSocket.close(); | ||||||
|  |         } catch (IOException ignore) {} | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
| package mplayer4anime.mplayer; | package mplayer4anime.mplayer; | ||||||
| 
 | 
 | ||||||
| import mplayer4anime.ISlaveModeAppOrchestration; | import mplayer4anime.ISlaveModeAppOrchestration; | ||||||
| import mplayer4anime.ServiceWindow; | import mplayer4anime.ui.ServiceWindow; | ||||||
| 
 | 
 | ||||||
| import java.io.*; | import java.io.*; | ||||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
| package mplayer4anime.mpv; | package mplayer4anime.mpv; | ||||||
| 
 | 
 | ||||||
| import com.sun.jna.ptr.IntByReference; | import com.sun.jna.ptr.IntByReference; | ||||||
| import mplayer4anime.ServiceWindow; | import mplayer4anime.ui.ServiceWindow; | ||||||
| 
 | 
 | ||||||
| public class MpvProcess implements Runnable{ | public class MpvProcess implements Runnable{ | ||||||
|     private String videoFilename; |     private String videoFilename; | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package mplayer4anime.Playlists; | package mplayer4anime.playlists; | ||||||
| 
 | 
 | ||||||
| public class JsonStorage { | public class JsonStorage { | ||||||
|     private final String Ver; |     private final String Ver; | ||||||
|  | @ -16,11 +16,11 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.Playlists; | package mplayer4anime.playlists; | ||||||
| 
 | 
 | ||||||
| import com.google.gson.*; | import com.google.gson.*; | ||||||
| import javafx.stage.FileChooser; | import javafx.stage.FileChooser; | ||||||
| import mplayer4anime.ServiceWindow; | import mplayer4anime.ui.ServiceWindow; | ||||||
| 
 | 
 | ||||||
| import java.io.*; | import java.io.*; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime; | package mplayer4anime.ui; | ||||||
| 
 | 
 | ||||||
| import javafx.scene.control.Alert; | import javafx.scene.control.Alert; | ||||||
| import javafx.scene.layout.Region; | import javafx.scene.layout.Region; | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package mplayer4anime.About; | package mplayer4anime.ui.about; | ||||||
| 
 | 
 | ||||||
| import javafx.application.HostServices; | import javafx.application.HostServices; | ||||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package mplayer4anime.About; | package mplayer4anime.ui.about; | ||||||
| 
 | 
 | ||||||
| import javafx.application.HostServices; | import javafx.application.HostServices; | ||||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime; | package mplayer4anime.ui.landing; | ||||||
| 
 | 
 | ||||||
| import javafx.application.HostServices; | import javafx.application.HostServices; | ||||||
| import javafx.application.Platform; | import javafx.application.Platform; | ||||||
|  | @ -26,12 +26,16 @@ import javafx.fxml.Initializable; | ||||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||||
| 
 | 
 | ||||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||||
| import mplayer4anime.About.AboutWindow; | import mplayer4anime.ui.about.AboutWindow; | ||||||
| import mplayer4anime.Playlists.JsonStorage; | import mplayer4anime.AppPreferences; | ||||||
| import mplayer4anime.Playlists.Playlists; | import mplayer4anime.ISlaveModeAppOrchestration; | ||||||
| import mplayer4anime.Settings.SettingsWindow; | import mplayer4anime.MediatorControl; | ||||||
| import mplayer4anime.appPanes.ControllerPane; | import mplayer4anime.playlists.JsonStorage; | ||||||
| import mplayer4anime.appPanes.ControllerSUB; | import mplayer4anime.playlists.Playlists; | ||||||
|  | import mplayer4anime.ui.ServiceWindow; | ||||||
|  | import mplayer4anime.ui.settings.SettingsWindow; | ||||||
|  | import mplayer4anime.ui.landing.panes.ControllerPane; | ||||||
|  | import mplayer4anime.ui.landing.panes.ControllerPaneSubtitles; | ||||||
| import mplayer4anime.mplayer.MplayerSlave; | import mplayer4anime.mplayer.MplayerSlave; | ||||||
| import mplayer4anime.mpv.MpvSlave; | import mplayer4anime.mpv.MpvSlave; | ||||||
| 
 | 
 | ||||||
|  | @ -39,21 +43,20 @@ import java.io.*; | ||||||
| import java.net.URL; | import java.net.URL; | ||||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||||
| 
 | 
 | ||||||
| public class Controller implements Initializable { | public class LandingController implements Initializable { | ||||||
|     @FXML |     @FXML | ||||||
|     private ControllerPane mkvPaneController, mkaPaneController; |     ControllerPane mkvPaneController, mkaPaneController; | ||||||
|     @FXML |     @FXML | ||||||
|     private ControllerSUB subPaneController; |     ControllerPaneSubtitles subPaneController; | ||||||
|  |     @FXML | ||||||
|  |     private PlayerToolbarController playerToolbarController; | ||||||
|     @FXML |     @FXML | ||||||
|     private Label statusLbl; |     private Label statusLbl; | ||||||
|     @FXML |     @FXML | ||||||
|     private Menu recentlyOpenedMenu; |     private Menu recentlyOpenedMenu; | ||||||
|     @FXML | 
 | ||||||
|     private CheckMenuItem fullScreen; |  | ||||||
|     @FXML |     @FXML | ||||||
|     private TabPane tabPane; |     private TabPane tabPane; | ||||||
|     @FXML |  | ||||||
|     private CheckMenuItem subsHide; |  | ||||||
| 
 | 
 | ||||||
|     private final AppPreferences appPreferences = AppPreferences.getINSTANCE(); |     private final AppPreferences appPreferences = AppPreferences.getINSTANCE(); | ||||||
| 
 | 
 | ||||||
|  | @ -61,7 +64,8 @@ public class Controller implements Initializable { | ||||||
|     private HostServices hostServices; |     private HostServices hostServices; | ||||||
|     private String currentPlaylistLocation; |     private String currentPlaylistLocation; | ||||||
|     private String backend; |     private String backend; | ||||||
|     private ISlaveModeAppOrchestration player; | 
 | ||||||
|  |     ISlaveModeAppOrchestration player; | ||||||
| 
 | 
 | ||||||
|     // If application started with playlist passed as an argument, then we'll try to load it (if it's valid). |     // If application started with playlist passed as an argument, then we'll try to load it (if it's valid). | ||||||
|     public void setPlaylistAsArgument(String playlist) { |     public void setPlaylistAsArgument(String playlist) { | ||||||
|  | @ -71,11 +75,12 @@ public class Controller implements Initializable { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void initialize(URL url, ResourceBundle rb) { |     public void initialize(URL url, ResourceBundle rb) { | ||||||
|  |         // Register this controller in mediator | ||||||
|  |         MediatorControl.getInstance().registerMainController(this); | ||||||
|  | 
 | ||||||
|         mkvPaneController.setPaneType("Video"); |         mkvPaneController.setPaneType("Video"); | ||||||
|         mkaPaneController.setPaneType("Audio"); |         mkaPaneController.setPaneType("Audio"); | ||||||
|         subPaneController.setPaneType("Subtitles"); |         subPaneController.setPaneType("Subtitles"); | ||||||
|         // Register this controller in mediator |  | ||||||
|         MediatorControl.getInstance().registerMainController(this); |  | ||||||
| 
 | 
 | ||||||
|         resourceBundle = rb; |         resourceBundle = rb; | ||||||
| 
 | 
 | ||||||
|  | @ -87,9 +92,6 @@ public class Controller implements Initializable { | ||||||
|             tabPane.getSelectionModel().select(1);  // 0 is mka 1 is subs |             tabPane.getSelectionModel().select(1);  // 0 is mka 1 is subs | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         fullScreen.setSelected(appPreferences.getFullScreenSelected()); |  | ||||||
|         subsHide.setSelected(appPreferences.getSubtitlesHideSelected()); |  | ||||||
| 
 |  | ||||||
|         String[] recentPlaylists = appPreferences.getRecentPlaylists(); |         String[] recentPlaylists = appPreferences.getRecentPlaylists(); | ||||||
|         for (int i = recentPlaylists.length-1; i >= 0; i--) { |         for (int i = recentPlaylists.length-1; i >= 0; i--) { | ||||||
|             if (recentPlaylists[i].isEmpty()) |             if (recentPlaylists[i].isEmpty()) | ||||||
|  | @ -104,9 +106,11 @@ public class Controller implements Initializable { | ||||||
|             backend = "mpv"; |             backend = "mpv"; | ||||||
|             player = new MpvSlave(resourceBundle); |             player = new MpvSlave(resourceBundle); | ||||||
|         } |         } | ||||||
|  | 
 | ||||||
|  |         playerToolbarController.initializeMainUiController(this); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void setHostServices(HostServices hostServices) { |     public void setHostServices(HostServices hostServices) { | ||||||
|         this.hostServices = hostServices; |         this.hostServices = hostServices; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -118,11 +122,10 @@ public class Controller implements Initializable { | ||||||
| 
 | 
 | ||||||
|     // Will be used to store lists previously opened. |     // Will be used to store lists previously opened. | ||||||
|     // Linkage established by ohHidden in MainFX.java class |     // Linkage established by ohHidden in MainFX.java class | ||||||
|     void shutdown(){ |     public void shutdown(){ | ||||||
|         appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding()); |         appPreferences.setLastTimeUsedSubsEncoding(subPaneController.getSelectedEncoding()); | ||||||
|         appPreferences.setFullScreenSelected(fullScreen.isSelected()); |         playerToolbarController.shutdown(); | ||||||
|         appPreferences.setSubtitlesHideSelected(subsHide.isSelected()); |         // TODO: remove from here; too sophisticated | ||||||
| 
 |  | ||||||
|         String[] storeRecentArr = new String[10]; |         String[] storeRecentArr = new String[10]; | ||||||
|         for (int i =0; i < recentlyOpenedMenu.getItems().size() - 2 && !(i > 9); i++) {       // Don't take separator and Clean button |         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(); |             storeRecentArr[i] = (String) recentlyOpenedMenu.getItems().get(i).getUserData(); | ||||||
|  | @ -143,7 +146,7 @@ public class Controller implements Initializable { | ||||||
|     } |     } | ||||||
|     // Get event that notify application in case some settings has been changed |     // 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. |     // This function called from MediatorControl after mediator receives request form SettingsController indicating that user updated some required fields. | ||||||
|     void updateAfterSettingsChanged(){ |     public void updateAfterSettingsChanged(){ | ||||||
|         /* update list of encoding */ |         /* update list of encoding */ | ||||||
|         subPaneController.setEncoding(appPreferences.getSubsEncodingList(), null); |         subPaneController.setEncoding(appPreferences.getSubsEncodingList(), null); | ||||||
|         // In case of application failure should be better to save this immediately |         // In case of application failure should be better to save this immediately | ||||||
|  | @ -248,86 +251,5 @@ public class Controller implements Initializable { | ||||||
|             items.remove(9, recentlyOpenedMenu.getItems().size() - 2); |             items.remove(9, recentlyOpenedMenu.getItems().size() - 2); | ||||||
|         items.add(0, menuItem); |         items.add(0, menuItem); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     /* PLAYER */ |  | ||||||
|     @FXML |  | ||||||
|     private void subsTriggerBtn(){ |  | ||||||
|         player.subtitlesSwitch(); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void fullscreenBtn(){ |  | ||||||
|         player.fullscreenSwitch(); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void muteBtn(){ |  | ||||||
|         player.mute(); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void playPrevTrackBtn(){ |  | ||||||
|         int index = mkvPaneController.getElementSelectedIndex(); |  | ||||||
|         if (index <= 0) |  | ||||||
|             return; |  | ||||||
| 
 |  | ||||||
|         mkvPaneController.setElementSelectedByIndex(index-1); |  | ||||||
|         player.forcePlay(appPreferences.getPath(), |  | ||||||
|                 mkvPaneController.getElementSelected(), |  | ||||||
|                 mkaPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getSelectedEncoding(), |  | ||||||
|                 subsHide.isSelected(), |  | ||||||
|                 fullScreen.isSelected() |  | ||||||
|         ); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void playNextTrackBtn(){ |  | ||||||
|         int index = mkvPaneController.getElementSelectedIndex(); |  | ||||||
| 
 |  | ||||||
|         if (index + 1 < mkvPaneController.getElementsCount()) { |  | ||||||
|             mkvPaneController.setElementSelectedByIndex(index + 1); |  | ||||||
|         } |  | ||||||
|         index = mkaPaneController.getElementSelectedIndex(); |  | ||||||
|         if (index + 1 < mkaPaneController.getElementsCount()) { |  | ||||||
|             mkaPaneController.setElementSelectedByIndex(index + 1); |  | ||||||
|         } |  | ||||||
|         index = subPaneController.getElementSelectedIndex(); |  | ||||||
|         if (index + 1 < subPaneController.getElementsCount()) { |  | ||||||
|             subPaneController.setElementSelectedByIndex(index + 1); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         player.forcePlay(appPreferences.getPath(), |  | ||||||
|                 mkvPaneController.getElementSelected(), |  | ||||||
|                 mkaPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getSelectedEncoding(), |  | ||||||
|                 subsHide.isSelected(), |  | ||||||
|                 fullScreen.isSelected() |  | ||||||
|         ); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void playBtn(){ |  | ||||||
|         if (mkvPaneController.getElementSelected() == null) |  | ||||||
|             return; |  | ||||||
| 
 |  | ||||||
|         player.playPause(appPreferences.getPath(), |  | ||||||
|                 mkvPaneController.getElementSelected(), |  | ||||||
|                 mkaPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getElementSelected(), |  | ||||||
|                 subPaneController.getSelectedEncoding(), |  | ||||||
|                 subsHide.isSelected(), |  | ||||||
|                 fullScreen.isSelected() |  | ||||||
|                 ); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void stopBtn(){ |  | ||||||
|         player.stop(); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void volumeUpBtn(){ |  | ||||||
|         player.volumeUp(); |  | ||||||
|     } |  | ||||||
|     @FXML |  | ||||||
|     private void volumeDownBtn(){ |  | ||||||
|         player.volumeDown(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -0,0 +1,133 @@ | ||||||
|  | /* | ||||||
|  |     Copyright 2018-2021 Dmitry Isaenko | ||||||
|  |       | ||||||
|  |     This file is part of mcontroller.player.anime. | ||||||
|  | 
 | ||||||
|  |     mcontroller.player.anime is free software: you can redistribute it and/or modify | ||||||
|  |     it under the terms of the GNU General Public License as published by | ||||||
|  |     the Free Software Foundation, either version 3 of the License, or | ||||||
|  |     (at your option) any later version. | ||||||
|  | 
 | ||||||
|  |     mcontroller.player.anime is distributed in the hope that it will be useful, | ||||||
|  |     but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |     GNU General Public License for more details. | ||||||
|  | 
 | ||||||
|  |     You should have received a copy of the GNU General Public License | ||||||
|  |     along with mcontroller.player.anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  |  */ | ||||||
|  | package mplayer4anime.ui.landing; | ||||||
|  | 
 | ||||||
|  | import javafx.fxml.FXML; | ||||||
|  | import javafx.fxml.Initializable; | ||||||
|  | import javafx.scene.control.CheckMenuItem; | ||||||
|  | import mplayer4anime.AppPreferences; | ||||||
|  | 
 | ||||||
|  | import java.net.URL; | ||||||
|  | import java.util.ResourceBundle; | ||||||
|  | 
 | ||||||
|  | public class PlayerToolbarController implements Initializable { | ||||||
|  |     @FXML | ||||||
|  |     private CheckMenuItem fullScreen; | ||||||
|  |     @FXML | ||||||
|  |     private CheckMenuItem subsHide; | ||||||
|  | 
 | ||||||
|  |     private AppPreferences appPreferences; | ||||||
|  |     private LandingController landingController; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public void initialize(URL url, ResourceBundle resourceBundle) { | ||||||
|  |         this.appPreferences = AppPreferences.getINSTANCE(); | ||||||
|  |          | ||||||
|  |         fullScreen.setSelected(appPreferences.getFullScreenSelected()); | ||||||
|  |         subsHide.setSelected(appPreferences.getSubtitlesHideSelected()); | ||||||
|  |     } | ||||||
|  |     public void initializeMainUiController(LandingController landingController){ | ||||||
|  |         this.landingController = landingController; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     @FXML | ||||||
|  |     private void subsTriggerBtn(){ | ||||||
|  |         landingController.player.subtitlesSwitch(); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void fullscreenBtn(){ | ||||||
|  |         landingController.player.fullscreenSwitch(); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void muteBtn(){ | ||||||
|  |         landingController.player.mute(); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void playPrevTrackBtn(){ | ||||||
|  |         int index = landingController.mkvPaneController.getElementSelectedIndex(); | ||||||
|  |         if (index <= 0) | ||||||
|  |             return; | ||||||
|  | 
 | ||||||
|  |         landingController.mkvPaneController.setElementSelectedByIndex(index-1); | ||||||
|  |         landingController.player.forcePlay(appPreferences.getPath(), | ||||||
|  |                 landingController.mkvPaneController.getElementSelected(), | ||||||
|  |                 landingController.mkaPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getSelectedEncoding(), | ||||||
|  |                 subsHide.isSelected(), | ||||||
|  |                 fullScreen.isSelected() | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void playNextTrackBtn(){ | ||||||
|  |         int index = landingController.mkvPaneController.getElementSelectedIndex(); | ||||||
|  | 
 | ||||||
|  |         if (index + 1 < landingController.mkvPaneController.getElementsCount()) { | ||||||
|  |             landingController.mkvPaneController.setElementSelectedByIndex(index + 1); | ||||||
|  |         } | ||||||
|  |         index = landingController.mkaPaneController.getElementSelectedIndex(); | ||||||
|  |         if (index + 1 < landingController.mkaPaneController.getElementsCount()) { | ||||||
|  |             landingController.mkaPaneController.setElementSelectedByIndex(index + 1); | ||||||
|  |         } | ||||||
|  |         index = landingController.subPaneController.getElementSelectedIndex(); | ||||||
|  |         if (index + 1 < landingController.subPaneController.getElementsCount()) { | ||||||
|  |             landingController.subPaneController.setElementSelectedByIndex(index + 1); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         landingController.player.forcePlay(appPreferences.getPath(), | ||||||
|  |                 landingController.mkvPaneController.getElementSelected(), | ||||||
|  |                 landingController.mkaPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getSelectedEncoding(), | ||||||
|  |                 subsHide.isSelected(), | ||||||
|  |                 fullScreen.isSelected() | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void playBtn(){ | ||||||
|  |         if (landingController.mkvPaneController.getElementSelected() == null) | ||||||
|  |             return; | ||||||
|  | 
 | ||||||
|  |         landingController.player.playPause(appPreferences.getPath(), | ||||||
|  |                 landingController.mkvPaneController.getElementSelected(), | ||||||
|  |                 landingController.mkaPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getElementSelected(), | ||||||
|  |                 landingController.subPaneController.getSelectedEncoding(), | ||||||
|  |                 subsHide.isSelected(), | ||||||
|  |                 fullScreen.isSelected() | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void stopBtn(){ | ||||||
|  |         landingController.player.stop(); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void volumeUpBtn(){ | ||||||
|  |         landingController.player.volumeUp(); | ||||||
|  |     } | ||||||
|  |     @FXML | ||||||
|  |     private void volumeDownBtn(){ | ||||||
|  |         landingController.player.volumeDown(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     void shutdown(){ | ||||||
|  |         appPreferences.setFullScreenSelected(fullScreen.isSelected()); | ||||||
|  |         appPreferences.setSubtitlesHideSelected(subsHide.isSelected()); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.appPanes; | package mplayer4anime.ui.landing.panes; | ||||||
| 
 | 
 | ||||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package mplayer4anime.appPanes; | package mplayer4anime.ui.landing.panes; | ||||||
| 
 | 
 | ||||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||||
|  | @ -10,7 +10,7 @@ import java.net.URL; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.ResourceBundle; | import java.util.ResourceBundle; | ||||||
| 
 | 
 | ||||||
| public class ControllerSUB extends ControllerPane { | public class ControllerPaneSubtitles extends ControllerPane { | ||||||
|     @FXML |     @FXML | ||||||
|     private ChoiceBox<String> subtEncoding; |     private ChoiceBox<String> subtEncoding; | ||||||
|     private ObservableList<String> subEncodingList; |     private ObservableList<String> subEncodingList; | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.Settings; | package mplayer4anime.ui.settings; | ||||||
| 
 | 
 | ||||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.Settings; | package mplayer4anime.ui.settings; | ||||||
| 
 | 
 | ||||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||||
| import javafx.fxml.Initializable; | import javafx.fxml.Initializable; | ||||||
|  | @ -109,7 +109,7 @@ public class SettingsController implements Initializable { | ||||||
|         appPreferences.setAudioExtensionsList(audioExtensionListController.getList()); |         appPreferences.setAudioExtensionsList(audioExtensionListController.getList()); | ||||||
|         appPreferences.setBackendEngineIndexId(backEndEngineChoiceBox.getSelectionModel().getSelectedIndex()); |         appPreferences.setBackendEngineIndexId(backEndEngineChoiceBox.getSelectionModel().getSelectedIndex()); | ||||||
| 
 | 
 | ||||||
|         MediatorControl.getInstance().sentUpdates();    // TODO: implement list to track what should be updated |         MediatorControl.getInstance().updateAfterSettingsChanged();    // TODO: implement list to track what should be updated | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void close(){ |     private void close(){ | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|     You should have received a copy of the GNU General Public License |     You should have received a copy of the GNU General Public License | ||||||
|     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. |     along with mplayer4anime.  If not, see <https://www.gnu.org/licenses/>. | ||||||
|  */ |  */ | ||||||
| package mplayer4anime.Settings; | package mplayer4anime.ui.settings; | ||||||
| 
 | 
 | ||||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||||
| import javafx.scene.Parent; | import javafx.scene.Parent; | ||||||
|  | @ -12,7 +12,7 @@ | ||||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| 
 | 
 | ||||||
| <VBox spacing="5.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.About.AboutController"> | <VBox spacing="5.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.about.AboutController"> | ||||||
|          <children> |          <children> | ||||||
|             <HBox> |             <HBox> | ||||||
|                <children> |                <children> | ||||||
|  |  | ||||||
|  | @ -1,25 +1,20 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| 
 | 
 | ||||||
| <?import javafx.geometry.Insets?> | <?import javafx.geometry.Insets?> | ||||||
| <?import javafx.scene.control.Button?> |  | ||||||
| <?import javafx.scene.control.CheckMenuItem?> |  | ||||||
| <?import javafx.scene.control.Label?> | <?import javafx.scene.control.Label?> | ||||||
| <?import javafx.scene.control.Menu?> | <?import javafx.scene.control.Menu?> | ||||||
| <?import javafx.scene.control.MenuBar?> | <?import javafx.scene.control.MenuBar?> | ||||||
| <?import javafx.scene.control.MenuItem?> | <?import javafx.scene.control.MenuItem?> | ||||||
| <?import javafx.scene.control.SeparatorMenuItem?> | <?import javafx.scene.control.SeparatorMenuItem?> | ||||||
| <?import javafx.scene.control.SplitMenuButton?> |  | ||||||
| <?import javafx.scene.control.SplitPane?> | <?import javafx.scene.control.SplitPane?> | ||||||
| <?import javafx.scene.control.Tab?> | <?import javafx.scene.control.Tab?> | ||||||
| <?import javafx.scene.control.TabPane?> | <?import javafx.scene.control.TabPane?> | ||||||
| <?import javafx.scene.control.ToolBar?> |  | ||||||
| <?import javafx.scene.layout.AnchorPane?> | <?import javafx.scene.layout.AnchorPane?> | ||||||
| <?import javafx.scene.layout.HBox?> |  | ||||||
| <?import javafx.scene.layout.Pane?> | <?import javafx.scene.layout.Pane?> | ||||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| 
 | 
 | ||||||
| <AnchorPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.Controller"> | <AnchorPane minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.landing.LandingController"> | ||||||
|     <children> |     <children> | ||||||
|         <VBox prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |         <VBox prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | ||||||
|             <children> |             <children> | ||||||
|  | @ -90,75 +85,7 @@ | ||||||
|                   </TabPane> |                   </TabPane> | ||||||
|                     </items> |                     </items> | ||||||
|                 </SplitPane> |                 </SplitPane> | ||||||
|                 <ToolBar prefHeight="40.0" prefWidth="200.0" styleClass="topToolBar" stylesheets="@res/landing.css"> |                 <fx:include fx:id="playerToolbar" source="PlayerToolbar.fxml" /> | ||||||
|                     <items> |  | ||||||
|                   <HBox> |  | ||||||
|                      <children> |  | ||||||
|                         <Button minHeight="28.0" mnemonicParsing="false" onAction="#playPrevTrackBtn" styleClass="btnLeft" stylesheets="@res/landing.css"> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M 12,12 3.5,6 12,0 Z M 0,0 V 12 H 2 V 0 Z" fill="#e1e1e1" /> |  | ||||||
|                            </graphic></Button> |  | ||||||
|                               <Button minHeight="28.0" minWidth="53.0" mnemonicParsing="false" onAction="#playBtn" styleClass="btnCenter" stylesheets="@res/landing.css" textAlignment="CENTER"> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5" fill="#61dd4e" /> |  | ||||||
|                            </graphic> |  | ||||||
|                         </Button> |  | ||||||
|                         <Button minHeight="28.0" mnemonicParsing="false" onAction="#stopBtn" styleClass="btnCenter" stylesheets="@res/landing.css"> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M18,18H6V6H18V18Z" fill="#e1e1e1" /> |  | ||||||
|                            </graphic> |  | ||||||
|                         </Button> |  | ||||||
|                               <Button minHeight="28.0" mnemonicParsing="false" onAction="#playNextTrackBtn" styleClass="btnRight" stylesheets="@res/landing.css"> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M0,12 L8.5,6 L0,0 L0,12 L0,12 Z M10,0 L10,12 L12,12 L12,0 L10,0 L10,0 Z" fill="#e1e1e1" /> |  | ||||||
|                            </graphic></Button> |  | ||||||
|                      </children> |  | ||||||
|                      <opaqueInsets> |  | ||||||
|                         <Insets /> |  | ||||||
|                      </opaqueInsets> |  | ||||||
|                   </HBox> |  | ||||||
|                   <Pane minWidth="20.0" /> |  | ||||||
|                   <HBox> |  | ||||||
|                      <children> |  | ||||||
|                         <Button minHeight="28.0" minWidth="36.0" mnemonicParsing="false" onAction="#volumeDownBtn" styleClass="btnLeft" stylesheets="@res/landing.css"> |  | ||||||
|                            <opaqueInsets> |  | ||||||
|                               <Insets /> |  | ||||||
|                            </opaqueInsets> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M13.5,8 C13.5,6.2 12.5,4.7 11,4 L11,12 C12.5,11.3 13.5,9.8 13.5,8 L13.5,8 Z M0,5 L0,11 L4,11 L9,16 L9,0 L4,5 L0,5 L0,5 Z" fill="#e1e1e1" /> |  | ||||||
|                            </graphic> |  | ||||||
|                         </Button> |  | ||||||
|                         <Button minHeight="28.0" minWidth="36.0" mnemonicParsing="false" onAction="#volumeUpBtn" styleClass="btnRight" stylesheets="@res/landing.css"> |  | ||||||
|                            <graphic> |  | ||||||
|                               <SVGPath content="M0,6 L0,12 L4,12 L9,17 L9,1 L4,6 L0,6 L0,6 Z M13.5,9 C13.5,7.2 12.5,5.7 11,5 L11,13 C12.5,12.3 13.5,10.8 13.5,9 L13.5,9 Z M11,0.2 L11,2.3 C13.9,3.2 16,5.8 16,9 C16,12.2 13.9,14.8 11,15.7 L11,17.8 C15,16.9 18,13.3 18,9 C18,4.7 15,1.1 11,0.2 L11,0.2 Z" fill="#e1e1e1" /> |  | ||||||
|                            </graphic> |  | ||||||
|                         </Button> |  | ||||||
|                      </children> |  | ||||||
|                   </HBox> |  | ||||||
|                   <Button minHeight="28.0" mnemonicParsing="false" onAction="#muteBtn" styleClass="btnSimple" stylesheets="@res/landing.css"> |  | ||||||
|                      <graphic> |  | ||||||
|                         <SVGPath content="M3,9H7L12,4V20L7,15H3V9M16.59,12L14,9.41L15.41,8L18,10.59L20.59,8L22,9.41L19.41,12L22,14.59L20.59,16L18,13.41L15.41,16L14,14.59L16.59,12Z" fill="#e1e1e1" /> |  | ||||||
|                      </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" /> |  | ||||||
|                     </items> |  | ||||||
|                      <graphic> |  | ||||||
|                         <SVGPath content="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z" fill="#e1e1e1" /> |  | ||||||
|                      </graphic> |  | ||||||
|                   </SplitMenuButton> |  | ||||||
|                     </items> |  | ||||||
|                 </ToolBar> |  | ||||||
|             <Pane VBox.vgrow="NEVER"> |             <Pane VBox.vgrow="NEVER"> | ||||||
|                <children> |                <children> | ||||||
|                   <Label fx:id="statusLbl"> |                   <Label fx:id="statusLbl"> | ||||||
							
								
								
									
										83
									
								
								src/main/resources/PlayerToolbar.fxml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								src/main/resources/PlayerToolbar.fxml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | 
 | ||||||
|  | <?import javafx.geometry.Insets?> | ||||||
|  | <?import javafx.scene.control.Button?> | ||||||
|  | <?import javafx.scene.control.CheckMenuItem?> | ||||||
|  | <?import javafx.scene.control.SplitMenuButton?> | ||||||
|  | <?import javafx.scene.control.ToolBar?> | ||||||
|  | <?import javafx.scene.layout.AnchorPane?> | ||||||
|  | <?import javafx.scene.layout.HBox?> | ||||||
|  | <?import javafx.scene.layout.Pane?> | ||||||
|  | <?import javafx.scene.shape.SVGPath?> | ||||||
|  | 
 | ||||||
|  | <AnchorPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.landing.PlayerToolbarController"> | ||||||
|  |     <ToolBar styleClass="topToolBar" stylesheets="@res/landing.css" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | ||||||
|  |         <items> | ||||||
|  |             <HBox> | ||||||
|  |                 <children> | ||||||
|  |                     <Button minHeight="28.0" mnemonicParsing="false" onAction="#playPrevTrackBtn" styleClass="btnLeft" stylesheets="@res/landing.css"> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M 12,12 3.5,6 12,0 Z M 0,0 V 12 H 2 V 0 Z" fill="#e1e1e1" /> | ||||||
|  |                         </graphic></Button> | ||||||
|  |                     <Button minHeight="28.0" minWidth="53.0" mnemonicParsing="false" onAction="#playBtn" styleClass="btnCenter" stylesheets="@res/landing.css" textAlignment="CENTER"> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5" fill="#61dd4e" /> | ||||||
|  |                         </graphic> | ||||||
|  |                     </Button> | ||||||
|  |                     <Button minHeight="28.0" mnemonicParsing="false" onAction="#stopBtn" styleClass="btnCenter" stylesheets="@res/landing.css"> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M18,18H6V6H18V18Z" fill="#e1e1e1" /> | ||||||
|  |                         </graphic> | ||||||
|  |                     </Button> | ||||||
|  |                     <Button minHeight="28.0" mnemonicParsing="false" onAction="#playNextTrackBtn" styleClass="btnRight" stylesheets="@res/landing.css"> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M0,12 L8.5,6 L0,0 L0,12 L0,12 Z M10,0 L10,12 L12,12 L12,0 L10,0 L10,0 Z" fill="#e1e1e1" /> | ||||||
|  |                         </graphic></Button> | ||||||
|  |                 </children> | ||||||
|  |                 <opaqueInsets> | ||||||
|  |                     <Insets /> | ||||||
|  |                 </opaqueInsets> | ||||||
|  |             </HBox> | ||||||
|  |             <Pane minWidth="20.0" /> | ||||||
|  |             <HBox> | ||||||
|  |                 <children> | ||||||
|  |                     <Button minHeight="28.0" minWidth="36.0" mnemonicParsing="false" onAction="#volumeDownBtn" styleClass="btnLeft" stylesheets="@res/landing.css"> | ||||||
|  |                         <opaqueInsets> | ||||||
|  |                             <Insets /> | ||||||
|  |                         </opaqueInsets> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M13.5,8 C13.5,6.2 12.5,4.7 11,4 L11,12 C12.5,11.3 13.5,9.8 13.5,8 L13.5,8 Z M0,5 L0,11 L4,11 L9,16 L9,0 L4,5 L0,5 L0,5 Z" fill="#e1e1e1" /> | ||||||
|  |                         </graphic> | ||||||
|  |                     </Button> | ||||||
|  |                     <Button minHeight="28.0" minWidth="36.0" mnemonicParsing="false" onAction="#volumeUpBtn" styleClass="btnRight" stylesheets="@res/landing.css"> | ||||||
|  |                         <graphic> | ||||||
|  |                             <SVGPath content="M0,6 L0,12 L4,12 L9,17 L9,1 L4,6 L0,6 L0,6 Z M13.5,9 C13.5,7.2 12.5,5.7 11,5 L11,13 C12.5,12.3 13.5,10.8 13.5,9 L13.5,9 Z M11,0.2 L11,2.3 C13.9,3.2 16,5.8 16,9 C16,12.2 13.9,14.8 11,15.7 L11,17.8 C15,16.9 18,13.3 18,9 C18,4.7 15,1.1 11,0.2 L11,0.2 Z" fill="#e1e1e1" /> | ||||||
|  |                         </graphic> | ||||||
|  |                     </Button> | ||||||
|  |                 </children> | ||||||
|  |             </HBox> | ||||||
|  |             <Button minHeight="28.0" mnemonicParsing="false" onAction="#muteBtn" styleClass="btnSimple" stylesheets="@res/landing.css"> | ||||||
|  |                 <graphic> | ||||||
|  |                     <SVGPath content="M3,9H7L12,4V20L7,15H3V9M16.59,12L14,9.41L15.41,8L18,10.59L20.59,8L22,9.41L19.41,12L22,14.59L20.59,16L18,13.41L15.41,16L14,14.59L16.59,12Z" fill="#e1e1e1" /> | ||||||
|  |                 </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" /> | ||||||
|  |                 </items> | ||||||
|  |                 <graphic> | ||||||
|  |                     <SVGPath content="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z" fill="#e1e1e1" /> | ||||||
|  |                 </graphic> | ||||||
|  |             </SplitMenuButton> | ||||||
|  |         </items> | ||||||
|  |     </ToolBar> | ||||||
|  | </AnchorPane> | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| 
 | 
 | ||||||
| <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.Settings.ControllerListsSelector"> | <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.settings.ControllerListsSelector"> | ||||||
|    <children> |    <children> | ||||||
|       <HBox alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="ALWAYS"> |       <HBox alignment="CENTER_LEFT" spacing="5.0" VBox.vgrow="ALWAYS"> | ||||||
|          <children> |          <children> | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| <?import javafx.scene.text.Font?> | <?import javafx.scene.text.Font?> | ||||||
| 
 | 
 | ||||||
| <VBox xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.Settings.SettingsController"> | <VBox xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.settings.SettingsController"> | ||||||
|    <children> |    <children> | ||||||
|       <TabPane side="LEFT" styleClass="tab-paneSettings" stylesheets="@../res/landing.css" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="100.0" tabMaxWidth="500.0" tabMinHeight="100.0" tabMinWidth="80.0" VBox.vgrow="ALWAYS"> |       <TabPane side="LEFT" styleClass="tab-paneSettings" stylesheets="@../res/landing.css" tabClosingPolicy="UNAVAILABLE" tabMaxHeight="100.0" tabMaxWidth="500.0" tabMinHeight="100.0" tabMinWidth="80.0" VBox.vgrow="ALWAYS"> | ||||||
|          <tabs> |          <tabs> | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ | ||||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| 
 | 
 | ||||||
| <AnchorPane minWidth="200.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.appPanes.ControllerPane"> | <AnchorPane minWidth="200.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.landing.panes.ControllerPane"> | ||||||
|    <children> |    <children> | ||||||
|       <VBox layoutX="87.0" layoutY="-11.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |       <VBox layoutX="87.0" layoutY="-11.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | ||||||
|          <children> |          <children> | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| <?import javafx.scene.layout.VBox?> | <?import javafx.scene.layout.VBox?> | ||||||
| <?import javafx.scene.shape.SVGPath?> | <?import javafx.scene.shape.SVGPath?> | ||||||
| 
 | 
 | ||||||
| <AnchorPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.appPanes.ControllerSUB"> | <AnchorPane xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mplayer4anime.ui.landing.panes.ControllerPaneSubtitles"> | ||||||
|    <children> |    <children> | ||||||
|       <VBox layoutX="39.0" layoutY="42.0" prefHeight="398.0" prefWidth="316.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |       <VBox layoutX="39.0" layoutY="42.0" prefHeight="398.0" prefWidth="316.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> | ||||||
|          <children> |          <children> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Dmitry Isaenko
						Dmitry Isaenko