Browse Source

File send error message

pull/307/head
apprb 11 years ago
parent
commit
06178f00d9
  1. 1
      core.cpp
  2. 2
      core.h
  3. 9
      widget/form/chatform.cpp
  4. 1
      widget/form/chatform.h

1
core.cpp

@ -517,6 +517,7 @@ void Core::sendFile(int32_t friendId, QString Filename, QString FilePath, long l @@ -517,6 +517,7 @@ void Core::sendFile(int32_t friendId, QString Filename, QString FilePath, long l
if (fileNum == -1)
{
qWarning() << "Core::sendFile: Can't create the Tox file sender";
emit fileSendFailed(friendId, Filename);
return;
}
qDebug() << QString("Core::sendFile: Created file sender %1 with friend %2").arg(fileNum).arg(friendId);

2
core.h

@ -150,6 +150,8 @@ signals: @@ -150,6 +150,8 @@ signals:
void fileTransferInfo(int FriendId, int FileNum, int64_t Filesize, int64_t BytesSent, ToxFile::FileDirection direction);
void fileTransferRemotePausedUnpaused(ToxFile file, bool paused);
void fileSendFailed(int FriendId, const QString& fname);
void avInvite(int friendId, int callIndex, bool video);
void avStart(int friendId, int callIndex, bool video);
void avCancel(int friendId, int callIndex);

9
widget/form/chatform.cpp

@ -51,6 +51,7 @@ ChatForm::ChatForm(Friend* chatFriend) @@ -51,6 +51,7 @@ ChatForm::ChatForm(Friend* chatFriend)
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
connect(chatWidget, &ChatAreaWidget::onFileTranfertInterract, this, &ChatForm::onFileTansBtnClicked);
connect(Core::getInstance(), &Core::fileSendFailed, this, &ChatForm::onFileSendFailed);
}
ChatForm::~ChatForm()
@ -455,3 +456,11 @@ void ChatForm::onFileTansBtnClicked(QString widgetName, QString buttonName) @@ -455,3 +456,11 @@ void ChatForm::onFileTansBtnClicked(QString widgetName, QString buttonName)
else
qDebug() << "no filetransferwidget: " << id;
}
void ChatForm::onFileSendFailed(int FriendId, const QString &fname)
{
if (FriendId != f->friendId)
return;
addSystemInfoMessage("File: \"" + fname + "\" failed to send.", "red");
}

1
widget/form/chatform.h

@ -65,6 +65,7 @@ private slots: @@ -65,6 +65,7 @@ private slots:
void onHangupCallTriggered();
void onCancelCallTriggered();
void onFileTansBtnClicked(QString widgetName, QString buttonName);
void onFileSendFailed(int FriendId, const QString &fname);
private:
Friend* f;

Loading…
Cancel
Save