From dc5ba1425b6f1458aca644f7c6986fe00a79269f Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Fri, 15 Mar 2019 00:58:04 +0300 Subject: [PATCH] Size displays now as GB/MB/kB --- .../java/nsusbloader/Controllers/NSLMainController.java | 3 +-- src/main/java/nsusbloader/Controllers/NSLRowModel.java | 7 ++++++- src/main/resources/locale.properties | 2 +- src/main/resources/locale_rus.properties | 2 +- src/main/resources/locale_ukr.properties | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/nsusbloader/Controllers/NSLMainController.java b/src/main/java/nsusbloader/Controllers/NSLMainController.java index 2ae90bd..e4d9c74 100644 --- a/src/main/java/nsusbloader/Controllers/NSLMainController.java +++ b/src/main/java/nsusbloader/Controllers/NSLMainController.java @@ -223,7 +223,7 @@ public class NSLMainController implements Initializable { if ((filesAlreadyInTable = tableFilesListController.getFiles()) != null) { filesDropped.removeAll(filesAlreadyInTable); // Get what we already have and add new file(s) if (!filesDropped.isEmpty()) { - filesDropped.addAll(tableFilesListController.getFiles()); + filesDropped.addAll(filesAlreadyInTable); tableFilesListController.setFiles(filesDropped); } } @@ -234,7 +234,6 @@ public class NSLMainController implements Initializable { } event.setDropCompleted(true); - } /** * Save preferences before exit diff --git a/src/main/java/nsusbloader/Controllers/NSLRowModel.java b/src/main/java/nsusbloader/Controllers/NSLRowModel.java index afd3f17..8ede8d5 100644 --- a/src/main/java/nsusbloader/Controllers/NSLRowModel.java +++ b/src/main/java/nsusbloader/Controllers/NSLRowModel.java @@ -16,7 +16,12 @@ public class NSLRowModel { this.nspFile = nspFile; this.markForUpload = checkBoxValue; this.nspFileName = nspFile.getName(); - this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0); + if (nspFile.length()/1024.0/1024.0/1024.0 > 1) + this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0/1024.0)+" GB"; + else if (nspFile.length()/1024.0/1024.0 > 1) + this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0/1024.0)+" MB"; + else + this.nspFileSize = String.format("%.2f", nspFile.length()/1024.0)+" kB"; this.status = ""; } // Model methods start diff --git a/src/main/resources/locale.properties b/src/main/resources/locale.properties index 17ee4b2..b81bc63 100644 --- a/src/main/resources/locale.properties +++ b/src/main/resources/locale.properties @@ -17,5 +17,5 @@ windowBodyConfirmWrongPFS0=Selected NSP file has incrrect starting symbols. Most It's better to interrupt proccess now. Continue process anyway? tableStatusLbl=Status tableFileNameLbl=File name -tableSizeLbl=Size (~Mb) +tableSizeLbl=Size tableUploadLbl=Upload? diff --git a/src/main/resources/locale_rus.properties b/src/main/resources/locale_rus.properties index 2c7ed7e..e215f8e 100644 --- a/src/main/resources/locale_rus.properties +++ b/src/main/resources/locale_rus.properties @@ -17,7 +17,7 @@ windowBodyConfirmWrongPFS0=\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u043 \u041B\u0443\u0447\u0448\u0435 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C\u0441\u044F \u043F\u0440\u044F\u043C\u043E \u0441\u0435\u0439\u0447\u0430\u0441. \u0425\u043E\u0447\u0435\u0448\u044C \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0430\u0442\u044C \u043D\u0438 \u0441\u043C\u043E\u0442\u0440\u044F \u043D\u0438 \u043D\u0430 \u0447\u0442\u043E?\ tableUploadLbl=\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044C? -tableSizeLbl=\u0420\u0430\u0437\u043C\u0435\u0440 (~\u041C\u0431) +tableSizeLbl=\u0420\u0430\u0437\u043C\u0435\u0440 tableFileNameLbl=\u0418\u043C\u044F \u0444\u0430\u0439\u043B\u0430 tableStatusLbl=\u0421\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0435 diff --git a/src/main/resources/locale_ukr.properties b/src/main/resources/locale_ukr.properties index 9f59484..ba9e5d5 100644 --- a/src/main/resources/locale_ukr.properties +++ b/src/main/resources/locale_ukr.properties @@ -17,5 +17,5 @@ windowBodyConfirmWrongPFS0=\u0412\u0438\u0431\u0440\u0430\u043D\u0438\u0439 \u04 \u041A\u0440\u0430\u0449\u0435 \u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438\u0441\u044F \u043F\u0440\u044F\u043C\u043E \u0437\u0430\u0440\u0430\u0437. \u0425\u043E\u0447\u0435\u0448 \u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438 \u043D\u0435 \u0437\u0432\u0430\u0436\u0430\u044E\u0447\u0438 \u043D\u0456 \u043D\u0430 \u0449\u043E? tableStatusLbl=\u0421\u0442\u0430\u043D tableFileNameLbl=\u0406\u043C'\u044F \u0444\u0430\u0439\u043B\u0443 -tableSizeLbl=\u0420\u043E\u0437\u043C\u0456\u0440 (~\u041C\u0431) +tableSizeLbl=\u0420\u043E\u0437\u043C\u0456\u0440 tableUploadLbl=\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436.? \ No newline at end of file