1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(transfer): Remove unnecessary split for pause send/recv

This commit is contained in:
Mick Sayson 2018-10-03 23:50:12 -07:00
parent 293a1d615c
commit 3615425234
5 changed files with 9 additions and 23 deletions

View File

@ -557,18 +557,18 @@ void FileTransferWidget::handleButton(QPushButton* btn)
if (btn->objectName() == "cancel") {
Core::getInstance()->cancelFileSend(fileInfo.friendId, fileInfo.fileNum);
} else if (btn->objectName() == "pause") {
Core::getInstance()->pauseResumeFileSend(fileInfo.friendId, fileInfo.fileNum);
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
} else if (btn->objectName() == "resume") {
Core::getInstance()->pauseResumeFileSend(fileInfo.friendId, fileInfo.fileNum);
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
}
} else // receiving or paused
{
if (btn->objectName() == "cancel") {
Core::getInstance()->cancelFileRecv(fileInfo.friendId, fileInfo.fileNum);
} else if (btn->objectName() == "pause") {
Core::getInstance()->pauseResumeFileRecv(fileInfo.friendId, fileInfo.fileNum);
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
} else if (btn->objectName() == "resume") {
Core::getInstance()->pauseResumeFileRecv(fileInfo.friendId, fileInfo.fileNum);
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
} else if (btn->objectName() == "accept") {
QString path =
QFileDialog::getSaveFileName(Q_NULLPTR,

View File

@ -715,18 +715,11 @@ void Core::sendAvatarFile(uint32_t friendId, const QByteArray& data)
CoreFile::sendAvatarFile(this, friendId, data);
}
void Core::pauseResumeFileSend(uint32_t friendId, uint32_t fileNum)
void Core::pauseResumeFile(uint32_t friendId, uint32_t fileNum)
{
QMutexLocker ml{coreLoopLock.get()};
CoreFile::pauseResumeFileSend(this, friendId, fileNum);
}
void Core::pauseResumeFileRecv(uint32_t friendId, uint32_t fileNum)
{
QMutexLocker ml{coreLoopLock.get()};
CoreFile::pauseResumeFileRecv(this, friendId, fileNum);
CoreFile::pauseResumeFile(this, friendId, fileNum);
}
void Core::cancelFileSend(uint32_t friendId, uint32_t fileNum)

View File

@ -130,8 +130,7 @@ public slots:
void cancelFileRecv(uint32_t friendId, uint32_t fileNum);
void rejectFileRecvRequest(uint32_t friendId, uint32_t fileNum);
void acceptFileRecvRequest(uint32_t friendId, uint32_t fileNum, QString path);
void pauseResumeFileSend(uint32_t friendId, uint32_t fileNum);
void pauseResumeFileRecv(uint32_t friendId, uint32_t fileNum);
void pauseResumeFile(uint32_t friendId, uint32_t fileNum);
void setNospam(uint32_t nospam);

View File

@ -145,7 +145,7 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString filename, QString
emit core->fileSendStarted(file);
}
void CoreFile::pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileId)
void CoreFile::pauseResumeFile(Core* core, uint32_t friendId, uint32_t fileId)
{
ToxFile* file = findFile(friendId, fileId);
if (!file) {
@ -177,11 +177,6 @@ void CoreFile::pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileI
}
}
void CoreFile::pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileId)
{
pauseResumeFileSend(core, friendId, fileId);
}
void CoreFile::cancelFileSend(Core* core, uint32_t friendId, uint32_t fileId)
{
ToxFile* file = findFile(friendId, fileId);

View File

@ -51,8 +51,7 @@ private:
static void sendFile(Core* core, uint32_t friendId, QString filename, QString filePath,
long long filesize);
static void sendAvatarFile(Core* core, uint32_t friendId, const QByteArray& data);
static void pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileId);
static void pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileId);
static void pauseResumeFile(Core* core, uint32_t friendId, uint32_t fileId);
static void cancelFileSend(Core* core, uint32_t friendId, uint32_t fileId);
static void cancelFileRecv(Core* core, uint32_t friendId, uint32_t fileId);
static void rejectFileRecvRequest(Core* core, uint32_t friendId, uint32_t fileId);