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 = {
/* ===================== OVERLAY ===================== */
overlay: null, ramLabel: null, dirLabel: null,
overlay: null, ramLabel: null, dirLabel: null, transferDialog: null,
deleteDirPressedAgain: false, count: 0,
initOverlay: function() {
@ -56,6 +56,10 @@ var settingsOverlay = {
settingsOverlay.dirLabel.setOnAction(function(event)
app.getHostServices().showDocument(settings.updatesDir.toUri()));
settingsOverlay.updateDirLabel();
// Lokup transferDialog pane
settingsOverlay.transferDialog = holder.lookup("#transferDialog");
settingsOverlay.transferDialog.setVisible(false);
// Lookup change dir button
holder.lookup("#changeDir").setOnAction(function(event) {
@ -66,6 +70,7 @@ var settingsOverlay = {
// Set new result
var newDir = chooser.showDialog(stage);
if (newDir !== null) {
settingsOverlay.transferCatalogDialog();
settings.updatesDir = newDir.toPath();
settingsOverlay.updateDirLabel();
}
@ -132,6 +137,15 @@ var settingsOverlay = {
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() {
settingsOverlay.ramLabel.setText(settings.ram <= 0 ? "Автоматически" : settings.ram + " MiB");
},