mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
FileTransferInstance responce on broken filetransfer state
This commit is contained in:
parent
76f7df3135
commit
904de559e5
8
core.cpp
8
core.cpp
|
@ -442,6 +442,11 @@ void Core::onFileControlCallback(Tox* tox, int32_t friendnumber, uint8_t receive
|
|||
}
|
||||
else if (receive_send == 0 && control_type == TOX_FILECONTROL_ACCEPT)
|
||||
{
|
||||
if (file->status == ToxFile::BROKEN)
|
||||
{
|
||||
emit static_cast<Core*>(core)->fileTransferBrokenUnbroken(*file, false);
|
||||
file->status = ToxFile::TRANSMITTING;
|
||||
}
|
||||
emit static_cast<Core*>(core)->fileTransferRemotePausedUnpaused(*file, false);
|
||||
}
|
||||
else if ((receive_send == 0 || receive_send == 1) && control_type == TOX_FILECONTROL_PAUSE)
|
||||
|
@ -464,6 +469,9 @@ void Core::onFileControlCallback(Tox* tox, int32_t friendnumber, uint8_t receive
|
|||
return;
|
||||
}
|
||||
|
||||
file->status = ToxFile::TRANSMITTING;
|
||||
emit static_cast<Core*>(core)->fileTransferBrokenUnbroken(*file, false);
|
||||
|
||||
file->bytesSent = resumePos;
|
||||
tox_file_send_control(tox, file->friendId, 0, file->fileNum, TOX_FILECONTROL_ACCEPT, nullptr, 0);
|
||||
}
|
||||
|
|
|
@ -291,6 +291,12 @@ QString FileTransferInstance::getHtmlImage()
|
|||
rightBtnImg = QImage(":/ui/fileTransferInstance/pauseGreyFileButton.png");
|
||||
|
||||
res = draw2ButtonsForm("silver", leftBtnImg, rightBtnImg);
|
||||
} else if (state == tsBroken)
|
||||
{
|
||||
QImage leftBtnImg(":/ui/fileTransferInstance/stopFileButton.png");
|
||||
QImage rightBtnImg(":/ui/fileTransferInstance/pauseGreyFileButton.png");
|
||||
|
||||
res = draw2ButtonsForm("red", leftBtnImg, rightBtnImg);
|
||||
} else if (state == tsCanceled)
|
||||
{
|
||||
res = drawButtonlessForm("red");
|
||||
|
@ -416,3 +422,16 @@ QImage FileTransferInstance::drawProgressBarImg(const double &part, int w, int h
|
|||
|
||||
return progressBar;
|
||||
}
|
||||
|
||||
void FileTransferInstance::onFileTransferBrokenUnbroken(ToxFile File, bool broken)
|
||||
{
|
||||
if (File.fileNum != fileNum || File.friendId != friendId || File.direction != direction)
|
||||
return;
|
||||
|
||||
if (broken)
|
||||
state = tsBroken;
|
||||
else
|
||||
state = tsProcessing;
|
||||
|
||||
emit stateUpdated();
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ public slots:
|
|||
void onFileTransferAccepted(ToxFile File);
|
||||
void onFileTransferPaused(int FriendId, int FileNum, ToxFile::FileDirection Direction);
|
||||
void onFileTransferRemotePausedUnpaused(ToxFile File, bool paused);
|
||||
void onFileTransferBrokenUnbroken(ToxFile File, bool broken);
|
||||
void pressFromHtml(QString);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -119,6 +119,7 @@ void ChatForm::startFileSend(ToxFile file)
|
|||
connect(Core::getInstance(), SIGNAL(fileTransferAccepted(ToxFile)), fileTrans, SLOT(onFileTransferAccepted(ToxFile)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferPaused(int,int,ToxFile::FileDirection)), fileTrans, SLOT(onFileTransferPaused(int,int,ToxFile::FileDirection)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferRemotePausedUnpaused(ToxFile,bool)), fileTrans, SLOT(onFileTransferRemotePausedUnpaused(ToxFile,bool)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferBrokenUnbroken(ToxFile, bool)), fileTrans, SLOT(onFileTransferBrokenUnbroken(ToxFile, bool)));
|
||||
|
||||
QString name = Widget::getInstance()->getUsername();
|
||||
if (name == previousName)
|
||||
|
@ -142,6 +143,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
|||
connect(Core::getInstance(), SIGNAL(fileTransferAccepted(ToxFile)), fileTrans, SLOT(onFileTransferAccepted(ToxFile)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferPaused(int,int,ToxFile::FileDirection)), fileTrans, SLOT(onFileTransferPaused(int,int,ToxFile::FileDirection)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferRemotePausedUnpaused(ToxFile,bool)), fileTrans, SLOT(onFileTransferRemotePausedUnpaused(ToxFile,bool)));
|
||||
connect(Core::getInstance(), SIGNAL(fileTransferBrokenUnbroken(ToxFile, bool)), fileTrans, SLOT(onFileTransferBrokenUnbroken(ToxFile, bool)));
|
||||
|
||||
Widget* w = Widget::getInstance();
|
||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->getIsWindowMinimized() || !w->isActiveWindow())
|
||||
|
|
Loading…
Reference in New Issue
Block a user