mirror of https://github.com/zlatinb/muwire
show the number of files being hashed
parent
2af996266f
commit
4b11aca16e
|
@ -126,6 +126,7 @@ class MainFrameModel {
|
||||||
@Observable int messages
|
@Observable int messages
|
||||||
@Observable String me
|
@Observable String me
|
||||||
@Observable int loadedFiles
|
@Observable int loadedFiles
|
||||||
|
@Observable int hashingFiles
|
||||||
@Observable File hashingFile
|
@Observable File hashingFile
|
||||||
@Observable boolean cancelButtonEnabled
|
@Observable boolean cancelButtonEnabled
|
||||||
@Observable boolean retryButtonEnabled
|
@Observable boolean retryButtonEnabled
|
||||||
|
@ -423,17 +424,18 @@ class MainFrameModel {
|
||||||
|
|
||||||
void onFileHashingEvent(FileHashingEvent e) {
|
void onFileHashingEvent(FileHashingEvent e) {
|
||||||
runInsideUIAsync {
|
runInsideUIAsync {
|
||||||
|
hashingFiles++
|
||||||
hashingFile = e.hashingFile
|
hashingFile = e.hashingFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFileHashedEvent(FileHashedEvent e) {
|
void onFileHashedEvent(FileHashedEvent e) {
|
||||||
runInsideUIAsync {
|
|
||||||
hashingFile = null
|
|
||||||
}
|
|
||||||
if (e.error != null)
|
if (e.error != null)
|
||||||
return // TODO do something
|
return // TODO do something
|
||||||
runInsideUIAsync {
|
runInsideUIAsync {
|
||||||
|
hashingFiles--
|
||||||
|
if (e.sharedFile.file == hashingFile)
|
||||||
|
hashingFile = null
|
||||||
shared << e.sharedFile
|
shared << e.sharedFile
|
||||||
loadedFiles = shared.size()
|
loadedFiles = shared.size()
|
||||||
JTable table = builder.getVariable("shared-files-table")
|
JTable table = builder.getVariable("shared-files-table")
|
||||||
|
|
|
@ -313,11 +313,13 @@ class MainFrameView {
|
||||||
borderLayout()
|
borderLayout()
|
||||||
panel (constraints : BorderLayout.NORTH) {
|
panel (constraints : BorderLayout.NORTH) {
|
||||||
label(text : bind {
|
label(text : bind {
|
||||||
if (model.hashingFile == null) {
|
if (model.hashingFile == null && model.hashingFiles == 0) {
|
||||||
trans("YOU_CAN_DRAG_AND_DROP")
|
trans("YOU_CAN_DRAG_AND_DROP")
|
||||||
} else {
|
} else if (model.hashingFiles == 1 && model.hashingFile != null) {
|
||||||
trans("HASHING") + ": " +
|
trans("HASHING") + ": " +
|
||||||
model.hashingFile.getAbsolutePath() + " (" + formatSize(model.hashingFile.length(),"BYTES_SHORT") + ")"
|
model.hashingFile.getAbsolutePath() + " (" + formatSize(model.hashingFile.length(),"BYTES_SHORT") + ")"
|
||||||
|
} else {
|
||||||
|
trans("HASHING") + " " + model.hashingFiles + " " + trans("FILES")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue