diff options
Diffstat (limited to 'Swift/QtUI/QtFileTransferListItemModel.cpp')
-rw-r--r-- | Swift/QtUI/QtFileTransferListItemModel.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Swift/QtUI/QtFileTransferListItemModel.cpp b/Swift/QtUI/QtFileTransferListItemModel.cpp index cf1de07..00afacb 100644 --- a/Swift/QtUI/QtFileTransferListItemModel.cpp +++ b/Swift/QtUI/QtFileTransferListItemModel.cpp @@ -9,14 +9,15 @@ #include <boost/bind.hpp> #include <boost/cstdint.hpp> +#include "QtChatWindow.h" // for formatSize + #include <Swiften/Base/boost_bsignals.h> #include <Swift/Controllers/FileTransfer/FileTransferController.h> #include <Swift/Controllers/FileTransfer/FileTransferOverview.h> +#include "QtSwiftUtil.h" namespace Swift { -extern std::string formatSize(const boost::uintmax_t bytes); - QtFileTransferListItemModel::QtFileTransferListItemModel(QObject *parent) : QAbstractItemModel(parent), fileTransferOverview(0) { } @@ -65,11 +66,14 @@ QVariant QtFileTransferListItemModel::data(const QModelIndex &index, int role) c return controller->isIncoming() ? QVariant(QObject::tr("Incoming")) : QVariant(QObject::tr("Outgoing")); } if (index.column() == OtherParty) { - return QVariant(QString::fromStdString(controller->getOtherParty().toString())); + return QVariant(P2QSTRING(controller->getOtherParty().toString())); } if (index.column() == State) { FileTransfer::State state = controller->getState(); - switch(state.state) { + switch(state.type) { + case FileTransfer::State::Initial: + assert(false); + return QVariant(""); case FileTransfer::State::WaitingForStart: return QVariant(QObject::tr("Waiting for start")); case FileTransfer::State::WaitingForAccept: @@ -91,7 +95,7 @@ QVariant QtFileTransferListItemModel::data(const QModelIndex &index, int role) c return QVariant(QString::number(controller->getProgress())); } if (index.column() == OverallSize) { - return QVariant(QString::fromStdString(formatSize((controller->getSize())))); + return QVariant(P2QSTRING(formatSize((controller->getSize())))); } return QVariant(); } @@ -105,7 +109,7 @@ int QtFileTransferListItemModel::rowCount(const QModelIndex& /* parent */) const } QModelIndex QtFileTransferListItemModel::index(int row, int column, const QModelIndex& /* parent */) const { - return createIndex(row, column, 0); + return createIndex(row, column, (void*) 0); } } |