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
|
if (lastUpdateTime.secsTo(now) < 1) //update every 1s
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int timediff = startTime.secsTo(now);
|
int timediff = effStartTime.secsTo(now);
|
||||||
if (timediff <= 0)
|
if (timediff <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
long rawspeed = BytesSent / timediff;
|
long rawspeed = (BytesSent - previousBytesSent) / timediff;
|
||||||
|
|
||||||
speed = getHumanReadableSize(rawspeed)+"/s";
|
speed = getHumanReadableSize(rawspeed)+"/s";
|
||||||
size = getHumanReadableSize(Filesize);
|
size = getHumanReadableSize(Filesize);
|
||||||
|
@ -146,7 +146,7 @@ void FileTransferInstance::onFileTransferAccepted(ToxFile File)
|
||||||
|
|
||||||
remotePaused = false;
|
remotePaused = false;
|
||||||
state = tsProcessing;
|
state = tsProcessing;
|
||||||
startTime = QDateTime::currentDateTime();
|
effStartTime = QDateTime::currentDateTime();
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ void FileTransferInstance::acceptRecvRequest()
|
||||||
Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
|
Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
|
||||||
state = tsProcessing;
|
state = tsProcessing;
|
||||||
|
|
||||||
startTime = QDateTime::currentDateTime();
|
effStartTime = QDateTime::currentDateTime();
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,11 @@ void FileTransferInstance::pauseResumeRecv()
|
||||||
// if (state == tsProcessing)
|
// if (state == tsProcessing)
|
||||||
// state = tsPaused;
|
// state = tsPaused;
|
||||||
// else state = tsProcessing;
|
// else state = tsProcessing;
|
||||||
|
if (state == tsPaused)
|
||||||
|
{
|
||||||
|
effStartTime = QDateTime::currentDateTime();
|
||||||
|
previousBytesSent = lastBytesSent;
|
||||||
|
}
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
}
|
}
|
||||||
|
@ -259,6 +264,11 @@ void FileTransferInstance::pauseResumeSend()
|
||||||
// if (state == tsProcessing)
|
// if (state == tsProcessing)
|
||||||
// state = tsPaused;
|
// state = tsPaused;
|
||||||
// else state = tsProcessing;
|
// else state = tsProcessing;
|
||||||
|
if (state == tsPaused)
|
||||||
|
{
|
||||||
|
effStartTime = QDateTime::currentDateTime();
|
||||||
|
previousBytesSent = lastBytesSent;
|
||||||
|
}
|
||||||
|
|
||||||
emit stateUpdated();
|
emit stateUpdated();
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@ private:
|
||||||
QImage pic;
|
QImage pic;
|
||||||
QString filename, size, speed, eta;
|
QString filename, size, speed, eta;
|
||||||
QString filenameElided;
|
QString filenameElided;
|
||||||
QDateTime startTime, lastUpdateTime;
|
QDateTime effStartTime, lastUpdateTime;
|
||||||
long long lastBytesSent, totalBytes;
|
long long lastBytesSent, totalBytes, previousBytesSent = 0; // last var used for eta on resumes
|
||||||
int fileNum;
|
int fileNum;
|
||||||
int friendId;
|
int friendId;
|
||||||
int contentPrefWidth;
|
int contentPrefWidth;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user