diff --git a/src/main/java/nsusbloader/Controllers/FrontController.java b/src/main/java/nsusbloader/Controllers/GamesController.java similarity index 97% rename from src/main/java/nsusbloader/Controllers/FrontController.java rename to src/main/java/nsusbloader/Controllers/GamesController.java index 423fe67..5d2424c 100644 --- a/src/main/java/nsusbloader/Controllers/FrontController.java +++ b/src/main/java/nsusbloader/Controllers/GamesController.java @@ -44,7 +44,7 @@ import java.util.LinkedList; import java.util.List; import java.util.ResourceBundle; -public class FrontController implements Initializable { +public class GamesController implements Initializable { @FXML private AnchorPane usbNetPane; @@ -353,6 +353,7 @@ public class FrontController implements Initializable { usbNetPane.setDisable(isActive); return; } + selectNspBtn.setDisable(isActive); selectSplitNspBtn.setDisable(isActive); btnUpStopImage.getStyleClass().clear(); @@ -362,16 +363,17 @@ public class FrontController implements Initializable { uploadStopBtn.setOnAction(e-> stopBtnAction()); uploadStopBtn.setText(resourceBundle.getString("btn_Stop")); - uploadStopBtn.getStyleClass().clear(); + uploadStopBtn.getStyleClass().remove("buttonUp"); uploadStopBtn.getStyleClass().add("buttonStop"); - return; } - btnUpStopImage.getStyleClass().add("regionUpload"); + else { + btnUpStopImage.getStyleClass().add("regionUpload"); - uploadStopBtn.setOnAction(e-> uploadBtnAction()); - uploadStopBtn.setText(resourceBundle.getString("btn_Upload")); - uploadStopBtn.getStyleClass().clear(); - uploadStopBtn.getStyleClass().add("buttonUp"); + uploadStopBtn.setOnAction(e-> uploadBtnAction()); + uploadStopBtn.setText(resourceBundle.getString("btn_Upload")); + uploadStopBtn.getStyleClass().remove("buttonStop"); + uploadStopBtn.getStyleClass().add("buttonUp"); + } } /** * Crunch. This function called from NSTableViewController diff --git a/src/main/java/nsusbloader/Controllers/NSLMainController.java b/src/main/java/nsusbloader/Controllers/NSLMainController.java index 4e564bf..0e74123 100644 --- a/src/main/java/nsusbloader/Controllers/NSLMainController.java +++ b/src/main/java/nsusbloader/Controllers/NSLMainController.java @@ -41,7 +41,7 @@ public class NSLMainController implements Initializable { public ProgressBar progressBar; // Accessible from Mediator @FXML - public FrontController FrontTabController; // Accessible from Mediator | todo: incapsulate + public GamesController GamesTabController; // Accessible from Mediator | todo: incapsulate @FXML private SettingsController SettingsTabController; @FXML @@ -103,8 +103,8 @@ public class NSLMainController implements Initializable { return SettingsTabController; } - public FrontController getFrontCtrlr(){ - return FrontTabController; + public GamesController getGamesCtrlr(){ + return GamesTabController; } public SplitMergeController getSmCtrlr(){ @@ -118,7 +118,7 @@ public class NSLMainController implements Initializable { * Save preferences before exit * */ public void exit(){ - FrontTabController.updatePreferencesOnExit(); + GamesTabController.updatePreferencesOnExit(); SettingsTabController.updatePreferencesOnExit(); SplitMergeTabController.updatePreferencesOnExit(); // NOTE: This shit above should be re-written to similar pattern RcmTabController.updatePreferencesOnExit(); diff --git a/src/main/java/nsusbloader/Controllers/NSTableViewController.java b/src/main/java/nsusbloader/Controllers/NSTableViewController.java index e7368ba..b47e47c 100644 --- a/src/main/java/nsusbloader/Controllers/NSTableViewController.java +++ b/src/main/java/nsusbloader/Controllers/NSTableViewController.java @@ -24,12 +24,10 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; -import javafx.scene.SnapshotParameters; import javafx.scene.control.*; import javafx.scene.control.cell.CheckBoxTableCell; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.*; -import javafx.scene.paint.Paint; import nsusbloader.MediatorControl; import nsusbloader.NSLDataTypes.EFileStatus; @@ -59,7 +57,7 @@ public class NSTableViewController implements Initializable { if (keyEvent.getCode() == KeyCode.DELETE && !MediatorControl.getInstance().getTransferActive()) { rowsObsLst.removeAll(table.getSelectionModel().getSelectedItems()); if (rowsObsLst.isEmpty()) - MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better + MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better table.refresh(); } else if (keyEvent.getCode() == KeyCode.SPACE) { for (NSLRowModel item : table.getSelectionModel().getSelectedItems()) { @@ -177,13 +175,13 @@ public class NSTableViewController implements Initializable { deleteMenuItem.setOnAction(actionEvent -> { rowsObsLst.remove(row.getItem()); if (rowsObsLst.isEmpty()) - MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better + MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better table.refresh(); }); MenuItem deleteAllMenuItem = new MenuItem(resourceBundle.getString("tab1_table_contextMenu_Btn_DeleteAll")); deleteAllMenuItem.setOnAction(actionEvent -> { rowsObsLst.clear(); - MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(true); // TODO: change to something better + MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(true); // TODO: change to something better table.refresh(); }); contextMenu.getItems().addAll(deleteMenuItem, deleteAllMenuItem); @@ -228,7 +226,7 @@ public class NSTableViewController implements Initializable { } else { rowsObsLst.add(new NSLRowModel(file, true)); - MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(false); // TODO: change to something better + MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(false); // TODO: change to something better } table.refresh(); } @@ -248,7 +246,7 @@ public class NSTableViewController implements Initializable { else { for (File file: newFiles) rowsObsLst.add(new NSLRowModel(file, true)); - MediatorControl.getInstance().getContoller().getFrontCtrlr().disableUploadStopBtn(false); // TODO: change to something better + MediatorControl.getInstance().getContoller().getGamesCtrlr().disableUploadStopBtn(false); // TODO: change to something better } //rowsObsLst.get(0).setMarkForUpload(true); table.refresh(); diff --git a/src/main/java/nsusbloader/MediatorControl.java b/src/main/java/nsusbloader/MediatorControl.java index e14564a..a644e50 100644 --- a/src/main/java/nsusbloader/MediatorControl.java +++ b/src/main/java/nsusbloader/MediatorControl.java @@ -41,7 +41,7 @@ public class MediatorControl { public synchronized void setBgThreadActive(boolean isActive, EModule appModuleType) { isTransferActive.set(isActive); - mainCtrler.getFrontCtrlr().notifyThreadStarted(isActive, appModuleType); + mainCtrler.getGamesCtrlr().notifyThreadStarted(isActive, appModuleType); mainCtrler.getSmCtrlr().notifySmThreadStarted(isActive, appModuleType); mainCtrler.getRcmCtrlr().notifyThreadStarted(isActive, appModuleType); mainCtrler.getNXDTabController().notifyThreadStarted(isActive, appModuleType); diff --git a/src/main/java/nsusbloader/ModelControllers/MessagesConsumer.java b/src/main/java/nsusbloader/ModelControllers/MessagesConsumer.java index 25549d1..2b62f36 100644 --- a/src/main/java/nsusbloader/ModelControllers/MessagesConsumer.java +++ b/src/main/java/nsusbloader/ModelControllers/MessagesConsumer.java @@ -26,7 +26,6 @@ import nsusbloader.Controllers.NSTableViewController; import nsusbloader.MediatorControl; import nsusbloader.NSLDataTypes.EFileStatus; import nsusbloader.NSLDataTypes.EModule; -import nsusbloader.NSLDataTypes.EMsgType; import java.util.ArrayList; import java.util.HashMap; @@ -62,7 +61,7 @@ public class MessagesConsumer extends AnimationTimer { this.progressBar = MediatorControl.getInstance().getContoller().progressBar; this.statusMap = statusMap; - this.tableViewController = MediatorControl.getInstance().getContoller().FrontTabController.tableFilesListController; + this.tableViewController = MediatorControl.getInstance().getContoller().GamesTabController.tableFilesListController; this.oneLinerStatus = oneLinerStatus; diff --git a/src/main/resources/FrontTab.fxml b/src/main/resources/GamesTab.fxml similarity index 99% rename from src/main/resources/FrontTab.fxml rename to src/main/resources/GamesTab.fxml index 24a1a75..4df7b16 100644 --- a/src/main/resources/FrontTab.fxml +++ b/src/main/resources/GamesTab.fxml @@ -16,7 +16,7 @@ - + diff --git a/src/main/resources/NSLMain.fxml b/src/main/resources/NSLMain.fxml index a2d42d6..635902f 100644 --- a/src/main/resources/NSLMain.fxml +++ b/src/main/resources/NSLMain.fxml @@ -23,7 +23,7 @@ Steps to roll NXDT functionality back: - + diff --git a/src/test/java/nsusbloader/com/usb/NoLogPrinter.java b/src/test/java/nsusbloader/com/usb/NoLogPrinter.java new file mode 100644 index 0000000..be380ae --- /dev/null +++ b/src/test/java/nsusbloader/com/usb/NoLogPrinter.java @@ -0,0 +1,28 @@ +package nsusbloader.com.usb; + +import nsusbloader.ModelControllers.ILogPrinter; +import nsusbloader.NSLDataTypes.EFileStatus; +import nsusbloader.NSLDataTypes.EMsgType; + +import java.io.File; +import java.util.HashMap; + +public class NoLogPrinter implements ILogPrinter { + @Override + public void print(String message, EMsgType type) { } + + @Override + public void updateProgress(Double value) { } + + @Override + public void update(HashMap nspMap, EFileStatus status) { } + + @Override + public void update(File file, EFileStatus status) { } + + @Override + public void updateOneLinerStatus(boolean status) { } + + @Override + public void close() { } +} diff --git a/src/test/java/nsusbloader/com/usb/TransferModuleTest.java b/src/test/java/nsusbloader/com/usb/TransferModuleTest.java index 2803d2f..604bf90 100644 --- a/src/test/java/nsusbloader/com/usb/TransferModuleTest.java +++ b/src/test/java/nsusbloader/com/usb/TransferModuleTest.java @@ -2,7 +2,6 @@ package nsusbloader.com.usb; import nsusbloader.ModelControllers.CancellableRunnable; import nsusbloader.ModelControllers.ILogPrinter; -import nsusbloader.ModelControllers.LogPrinterCli; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -81,7 +80,7 @@ class TransferModuleTest{ filesMap.put(splitFileName10, splitFile10); filesMap.put(splitFileName11, splitFile11); - ILogPrinter printer = new LogPrinterCli(); + ILogPrinter printer = new NoLogPrinter(); this.transferModule = new TransferModuleImplementation((DeviceHandle)null, filesMap, (CancellableRunnable)null, printer); }