summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-03-14 15:44:38 (GMT)
committerTobias Markmann <tm@ayena.de>2017-03-14 15:44:38 (GMT)
commit3368a6e5f220f00e03b3ebb41bdd8872ffdf81be (patch)
tree55d8a8745028f6765f53311d1f14ddf4dbc24691 /Swift/QtUI/QtPlainChatView.cpp
parent37057bc3168b43906dd67e51607a893ae1c490af (diff)
downloadswift-3368a6e5f220f00e03b3ebb41bdd8872ffdf81be.zip
swift-3368a6e5f220f00e03b3ebb41bdd8872ffdf81be.tar.bz2
Show correct avatars for file-transfer messages
Previously we simply showed our default avatar. With this change we will use the same avatar as we use for normal chat messages. Test-Information: Tested on macOS 10.12.3 with Qt 5.5.1 by exchanging files between two Swift instances. Change-Id: I20b953a67a290820900b5b35861c1e17f72148bd
Diffstat (limited to 'Swift/QtUI/QtPlainChatView.cpp')
-rw-r--r--Swift/QtUI/QtPlainChatView.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp
index 05a2eb0..7e9c857 100644
--- a/Swift/QtUI/QtPlainChatView.cpp
+++ b/Swift/QtUI/QtPlainChatView.cpp
@@ -1,32 +1,32 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/QtPlainChatView.h>
#include <QDialog>
#include <QFileDialog>
#include <QInputDialog>
#include <QLabel>
#include <QMenu>
#include <QProgressBar>
#include <QPushButton>
#include <QScrollBar>
#include <QTextEdit>
#include <QVBoxLayout>
#include <Swiften/Base/FileSize.h>
#include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/QtUI/ChatSnippet.h>
#include <Swift/QtUI/QtSwiftUtil.h>
#include <Swift/QtUI/QtUtilities.h>
namespace Swift {
QtPlainChatView::QtPlainChatView(QtChatWindow *window, UIEventStream* eventStream)
: QtChatView(window), window_(window), eventStream_(eventStream), idGenerator_(0) {
@@ -149,61 +149,61 @@ void QtPlainChatView::replaceWithAction(const ChatWindow::ChatMessage& message,
}
QString name = id.empty() ? "you" : P2QSTRING(id);
text += QString(tr("At %1 %2 corrected the last action to: <i>")).arg(ChatSnippet::timeToEscapedString(B2QDATE(time))).arg(name);
text += chatMessageToString(message);
text += "</i></p>";
log_->append(text);
}
void QtPlainChatView::replaceLastMessage(const ChatWindow::ChatMessage& message, const ChatWindow::TimestampBehaviour /*timestampBehaviour*/)
{
QString text = "<p>The last message was corrected to:<br/>";
text += chatMessageToString(message);
text += "</p>";
log_->append(text);
}
void QtPlainChatView::replaceSystemMessage(const ChatWindow::ChatMessage& message, const std::string& /*id*/, const ChatWindow::TimestampBehaviour /*timestampBehaviour*/) {
QString text = "<p><i>";
text += chatMessageToString(message);
text += "</i></p>";
log_->append(text);
}
void QtPlainChatView::setAckState(const std::string& /*id*/, ChatWindow::AckState state)
{
if (state == ChatWindow::Failed) {
addSystemMessage(ChatWindow::ChatMessage("Message delivery failed due to disconnection from server."), ChatWindow::DefaultDirection);
}
}
-std::string QtPlainChatView::addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description)
+std::string QtPlainChatView::addFileTransfer(const std::string& senderName, const std::string& /*avatarPath*/, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description)
{
const std::string ftId = "ft" + boost::lexical_cast<std::string>(idGenerator_++);
const std::string sizeString = formatSize(sizeInBytes);
FileTransfer* transfer;
if (senderIsSelf) {
QString description = QInputDialog::getText(this, tr("File transfer description"),
tr("Description:"), QLineEdit::Normal, "");
/* NOTE: it is not possible to abort if description is not provided, since we must always return a valid transfer id */
const std::string descriptionMessage = description.isEmpty() ? "" : (" \"" + Q2PSTRING(description) + "\"");
const std::string message = std::string() + "Confirm file transfer: <i>" + filename + " (" + sizeString + " bytes)</i>" + descriptionMessage;
transfer = new FileTransfer(this, senderIsSelf, ftId, filename, ChatWindow::WaitingForAccept, Q2PSTRING(description), message, true);
addSystemMessage(ChatWindow::ChatMessage("Preparing to start file transfer..."), ChatWindow::DefaultDirection);
} else { /* incoming transfer */
const std::string descriptionMessage = description.empty() ? "" : (" \"" + description + "\"");
const std::string message = std::string() + "Incoming file transfer: <i>" + filename + " (" + sizeString + " bytes)</i>" + descriptionMessage;
transfer = new FileTransfer(this, senderIsSelf, ftId, filename, ChatWindow::WaitingForAccept, "", message, true);
addSystemMessage("Incoming file transfer from " + senderName + "...", ChatWindow::DefaultDirection);
}
fileTransfers_[ftId] = transfer;
layout()->addWidget(transfer->dialog_);
return ftId;
}
void QtPlainChatView::setFileTransferProgress(std::string id, const int percentageDone)
{
FileTransferMap::iterator transfer = fileTransfers_.find(id);
if (transfer != fileTransfers_.end()) {