mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix #351 (again)
This commit is contained in:
parent
ee0f94a890
commit
2d3cb18f58
|
@ -84,11 +84,11 @@ void FileTransferInstance::onFileTransferInfo(int FriendId, int FileNum, int64_t
|
|||
if (lastUpdateTime.secsTo(now) < 1) //update every 1s
|
||||
return;
|
||||
|
||||
int timediff = startTime.secsTo(now);
|
||||
int timediff = effStartTime.secsTo(now);
|
||||
if (timediff <= 0)
|
||||
return;
|
||||
|
||||
long rawspeed = BytesSent / timediff;
|
||||
long rawspeed = (BytesSent - previousBytesSent) / timediff;
|
||||
|
||||
speed = getHumanReadableSize(rawspeed)+"/s";
|
||||
size = getHumanReadableSize(Filesize);
|
||||
|
@ -146,7 +146,7 @@ void FileTransferInstance::onFileTransferAccepted(ToxFile File)
|
|||
|
||||
remotePaused = false;
|
||||
state = tsProcessing;
|
||||
startTime = QDateTime::currentDateTime();
|
||||
effStartTime = QDateTime::currentDateTime();
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void FileTransferInstance::acceptRecvRequest()
|
|||
Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
|
||||
state = tsProcessing;
|
||||
|
||||
startTime = QDateTime::currentDateTime();
|
||||
effStartTime = QDateTime::currentDateTime();
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
@ -243,6 +243,11 @@ void FileTransferInstance::pauseResumeRecv()
|
|||
// if (state == tsProcessing)
|
||||
// state = tsPaused;
|
||||
// else state = tsProcessing;
|
||||
if (state == tsPaused)
|
||||
{
|
||||
effStartTime = QDateTime::currentDateTime();
|
||||
previousBytesSent = lastBytesSent;
|
||||
}
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
@ -259,6 +264,11 @@ void FileTransferInstance::pauseResumeSend()
|
|||
// if (state == tsProcessing)
|
||||
// state = tsPaused;
|
||||
// else state = tsProcessing;
|
||||
if (state == tsPaused)
|
||||
{
|
||||
effStartTime = QDateTime::currentDateTime();
|
||||
previousBytesSent = lastBytesSent;
|
||||
}
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
|
|
@ -74,8 +74,8 @@ private:
|
|||
QImage pic;
|
||||
QString filename, size, speed, eta;
|
||||
QString filenameElided;
|
||||
QDateTime startTime, lastUpdateTime;
|
||||
long long lastBytesSent, totalBytes;
|
||||
QDateTime effStartTime, lastUpdateTime;
|
||||
long long lastBytesSent, totalBytes, previousBytesSent = 0; // last var used for eta on resumes
|
||||
int fileNum;
|
||||
int friendId;
|
||||
int contentPrefWidth;
|
||||
|
|
Loading…
Reference in New Issue
Block a user