Add Transfer dialog (#74)

Я программист-экономист... Чем я вообще занимаюсь...
This commit is contained in:
Yaroslavik 2018-11-21 21:59:29 +03:00 committed by Zaxar163
parent 7e7a3c5fa3
commit 23d60cb28f

View file

@ -37,7 +37,7 @@ var settingsClass = Java.extend(LauncherSettingsClass.static, {
}); });
var settingsOverlay = { var settingsOverlay = {
/* ===================== OVERLAY ===================== */ /* ===================== OVERLAY ===================== */
overlay: null, ramLabel: null, dirLabel: null, overlay: null, ramLabel: null, dirLabel: null, transferDialog: null,
deleteDirPressedAgain: false, count: 0, deleteDirPressedAgain: false, count: 0,
initOverlay: function() { initOverlay: function() {
@ -57,6 +57,10 @@ var settingsOverlay = {
app.getHostServices().showDocument(settings.updatesDir.toUri())); app.getHostServices().showDocument(settings.updatesDir.toUri()));
settingsOverlay.updateDirLabel(); settingsOverlay.updateDirLabel();
// Lokup transferDialog pane
settingsOverlay.transferDialog = holder.lookup("#transferDialog");
settingsOverlay.transferDialog.setVisible(false);
// Lookup change dir button // Lookup change dir button
holder.lookup("#changeDir").setOnAction(function(event) { holder.lookup("#changeDir").setOnAction(function(event) {
var chooser = new javafx.stage.DirectoryChooser(); var chooser = new javafx.stage.DirectoryChooser();
@ -66,6 +70,7 @@ var settingsOverlay = {
// Set new result // Set new result
var newDir = chooser.showDialog(stage); var newDir = chooser.showDialog(stage);
if (newDir !== null) { if (newDir !== null) {
settingsOverlay.transferCatalogDialog();
settings.updatesDir = newDir.toPath(); settings.updatesDir = newDir.toPath();
settingsOverlay.updateDirLabel(); settingsOverlay.updateDirLabel();
} }
@ -132,6 +137,15 @@ var settingsOverlay = {
holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null)); holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null));
}, },
transferCatalogDialog: function() {
settingsOverlay.transferDialog.setVisible(true);
settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) settingsOverlay.transferDialog.setVisible(false));
settingsOverlay.transferDialog.lookup("#applyTransfer").setOnAction(function(event) {
//Здесь могла быть ваша реклама, либо DirBridge.move();
settingsOverlay.transferDialog.setVisible(false);
});
},
updateRAMLabel: function() { updateRAMLabel: function() {
settingsOverlay.ramLabel.setText(settings.ram <= 0 ? "Автоматически" : settings.ram + " MiB"); settingsOverlay.ramLabel.setText(settings.ram <= 0 ? "Автоматически" : settings.ram + " MiB");
}, },