mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: 改进 SFTP 传输进度
This commit is contained in:
@@ -74,11 +74,14 @@ class FileTransportTableModel(transportManager: TransportManager) : DefaultTable
|
||||
val speed = if (isTransporting) transport.speed else 0
|
||||
val estimatedTime = if (isTransporting && speed > 0)
|
||||
(transport.size - transport.transferredSize) / speed else 0
|
||||
val progress = transport.progress * 100.0
|
||||
|
||||
return when (column) {
|
||||
COLUMN_NAME -> " ${transport.name}"
|
||||
COLUMN_STATUS -> formatStatus(transport.state)
|
||||
COLUMN_PROGRESS -> String.format("%.0f%%", transport.progress * 100.0)
|
||||
|
||||
// 如果进度已经完成但是状态还是传输中,那么进度显示:99%
|
||||
COLUMN_PROGRESS -> String.format("%.0f%%", if (progress >= 100.0 && isTransporting) 99 else progress)
|
||||
|
||||
// 大小
|
||||
COLUMN_SIZE -> if (transport.size < 0) "-"
|
||||
|
||||
Reference in New Issue
Block a user