show the number of files being hashed

pull/62/head
Zlatin Balevsky 2021-06-02 20:10:26 +01:00
parent 2af996266f
commit 4b11aca16e
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 9 additions and 5 deletions

View File

@ -126,6 +126,7 @@ class MainFrameModel {
@Observable int messages
@Observable String me
@Observable int loadedFiles
@Observable int hashingFiles
@Observable File hashingFile
@Observable boolean cancelButtonEnabled
@Observable boolean retryButtonEnabled
@ -423,17 +424,18 @@ class MainFrameModel {
void onFileHashingEvent(FileHashingEvent e) {
runInsideUIAsync {
hashingFiles++
hashingFile = e.hashingFile
}
}
void onFileHashedEvent(FileHashedEvent e) {
runInsideUIAsync {
hashingFile = null
}
if (e.error != null)
return // TODO do something
runInsideUIAsync {
hashingFiles--
if (e.sharedFile.file == hashingFile)
hashingFile = null
shared << e.sharedFile
loadedFiles = shared.size()
JTable table = builder.getVariable("shared-files-table")

View File

@ -313,11 +313,13 @@ class MainFrameView {
borderLayout()
panel (constraints : BorderLayout.NORTH) {
label(text : bind {
if (model.hashingFile == null) {
if (model.hashingFile == null && model.hashingFiles == 0) {
trans("YOU_CAN_DRAG_AND_DROP")
} else {
} else if (model.hashingFiles == 1 && model.hashingFile != null) {
trans("HASHING") + ": " +
model.hashingFile.getAbsolutePath() + " (" + formatSize(model.hashingFile.length(),"BYTES_SHORT") + ")"
} else {
trans("HASHING") + " " + model.hashingFiles + " " + trans("FILES")
}
})
}