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:
parent
293a1d615c
commit
3615425234
|
@ -557,18 +557,18 @@ void FileTransferWidget::handleButton(QPushButton* btn)
|
||||||
if (btn->objectName() == "cancel") {
|
if (btn->objectName() == "cancel") {
|
||||||
Core::getInstance()->cancelFileSend(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->cancelFileSend(fileInfo.friendId, fileInfo.fileNum);
|
||||||
} else if (btn->objectName() == "pause") {
|
} else if (btn->objectName() == "pause") {
|
||||||
Core::getInstance()->pauseResumeFileSend(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
|
||||||
} else if (btn->objectName() == "resume") {
|
} else if (btn->objectName() == "resume") {
|
||||||
Core::getInstance()->pauseResumeFileSend(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
|
||||||
}
|
}
|
||||||
} else // receiving or paused
|
} else // receiving or paused
|
||||||
{
|
{
|
||||||
if (btn->objectName() == "cancel") {
|
if (btn->objectName() == "cancel") {
|
||||||
Core::getInstance()->cancelFileRecv(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->cancelFileRecv(fileInfo.friendId, fileInfo.fileNum);
|
||||||
} else if (btn->objectName() == "pause") {
|
} else if (btn->objectName() == "pause") {
|
||||||
Core::getInstance()->pauseResumeFileRecv(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
|
||||||
} else if (btn->objectName() == "resume") {
|
} else if (btn->objectName() == "resume") {
|
||||||
Core::getInstance()->pauseResumeFileRecv(fileInfo.friendId, fileInfo.fileNum);
|
Core::getInstance()->pauseResumeFile(fileInfo.friendId, fileInfo.fileNum);
|
||||||
} else if (btn->objectName() == "accept") {
|
} else if (btn->objectName() == "accept") {
|
||||||
QString path =
|
QString path =
|
||||||
QFileDialog::getSaveFileName(Q_NULLPTR,
|
QFileDialog::getSaveFileName(Q_NULLPTR,
|
||||||
|
|
|
@ -715,18 +715,11 @@ void Core::sendAvatarFile(uint32_t friendId, const QByteArray& data)
|
||||||
CoreFile::sendAvatarFile(this, friendId, 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()};
|
QMutexLocker ml{coreLoopLock.get()};
|
||||||
|
|
||||||
CoreFile::pauseResumeFileSend(this, friendId, fileNum);
|
CoreFile::pauseResumeFile(this, friendId, fileNum);
|
||||||
}
|
|
||||||
|
|
||||||
void Core::pauseResumeFileRecv(uint32_t friendId, uint32_t fileNum)
|
|
||||||
{
|
|
||||||
QMutexLocker ml{coreLoopLock.get()};
|
|
||||||
|
|
||||||
CoreFile::pauseResumeFileRecv(this, friendId, fileNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::cancelFileSend(uint32_t friendId, uint32_t fileNum)
|
void Core::cancelFileSend(uint32_t friendId, uint32_t fileNum)
|
||||||
|
|
|
@ -130,8 +130,7 @@ public slots:
|
||||||
void cancelFileRecv(uint32_t friendId, uint32_t fileNum);
|
void cancelFileRecv(uint32_t friendId, uint32_t fileNum);
|
||||||
void rejectFileRecvRequest(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 acceptFileRecvRequest(uint32_t friendId, uint32_t fileNum, QString path);
|
||||||
void pauseResumeFileSend(uint32_t friendId, uint32_t fileNum);
|
void pauseResumeFile(uint32_t friendId, uint32_t fileNum);
|
||||||
void pauseResumeFileRecv(uint32_t friendId, uint32_t fileNum);
|
|
||||||
|
|
||||||
void setNospam(uint32_t nospam);
|
void setNospam(uint32_t nospam);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString filename, QString
|
||||||
emit core->fileSendStarted(file);
|
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);
|
ToxFile* file = findFile(friendId, fileId);
|
||||||
if (!file) {
|
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)
|
void CoreFile::cancelFileSend(Core* core, uint32_t friendId, uint32_t fileId)
|
||||||
{
|
{
|
||||||
ToxFile* file = findFile(friendId, fileId);
|
ToxFile* file = findFile(friendId, fileId);
|
||||||
|
|
|
@ -51,8 +51,7 @@ private:
|
||||||
static void sendFile(Core* core, uint32_t friendId, QString filename, QString filePath,
|
static void sendFile(Core* core, uint32_t friendId, QString filename, QString filePath,
|
||||||
long long filesize);
|
long long filesize);
|
||||||
static void sendAvatarFile(Core* core, uint32_t friendId, const QByteArray& data);
|
static void sendAvatarFile(Core* core, uint32_t friendId, const QByteArray& data);
|
||||||
static void pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileId);
|
static void pauseResumeFile(Core* core, uint32_t friendId, uint32_t fileId);
|
||||||
static void pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileId);
|
|
||||||
static void cancelFileSend(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 cancelFileRecv(Core* core, uint32_t friendId, uint32_t fileId);
|
||||||
static void rejectFileRecvRequest(Core* core, uint32_t friendId, uint32_t fileId);
|
static void rejectFileRecvRequest(Core* core, uint32_t friendId, uint32_t fileId);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user