aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-15 10:01:34 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-15 10:12:52 +0900
commit0910bf6c5bbc6c9250023796b2e641f19232c3cd (patch)
treed76fbd6cdac2691c3512282cda1fd68c0160ef34
parent525be6dce815f88ed9cc97480bff461741665e8f (diff)
downloadlibquotient-0910bf6c5bbc6c9250023796b2e641f19232c3cd.tar.gz
libquotient-0910bf6c5bbc6c9250023796b2e641f19232c3cd.zip
One more fix, this time for MSVC 2015 only
Making a structure from an initializer list seems to be a problem for it if initializers are defined in the structure.
-rw-r--r--room.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/room.cpp b/room.cpp
index f6286a7e..d1b098e7 100644
--- a/room.cpp
+++ b/room.cpp
@@ -96,6 +96,12 @@ class Room::Private
struct FileTransferPrivateInfo
{
+#if defined(_MSC_VER) && _MSC_VER < 1910
+ FileTransferPrivateInfo() = default;
+ FileTransferPrivateInfo(BaseJob* j, QString fileName)
+ : job(j), localFileInfo(fileName)
+ { }
+#endif
QPointer<BaseJob> job = nullptr;
QFileInfo localFileInfo { };
FileTransferInfo::Status status = FileTransferInfo::Started;
@@ -466,10 +472,22 @@ FileTransferInfo Room::fileTransferInfo(const QString& id) const
total = INT_MAX;
}
+#if defined(_MSC_VER) && _MSC_VER < 1910
+ // A workaround for MSVC 2015 that fails with "error C2440: 'return':
+ // cannot convert from 'initializer list' to 'QMatrixClient::FileTransferInfo'"
+ FileTransferInfo fti;
+ fti.status = infoIt->status;
+ fti.progress = int(progress);
+ fti.total = int(total);
+ fti.localDir = QUrl::fromLocalFile(infoIt->localFileInfo.absolutePath());
+ fti.localPath = QUrl::fromLocalFile(infoIt->localFileInfo.absoluteFilePath());
+ return fti;
+#else
return { infoIt->status, int(progress), int(total),
QUrl::fromLocalFile(infoIt->localFileInfo.absolutePath()),
QUrl::fromLocalFile(infoIt->localFileInfo.absoluteFilePath())
};
+#endif
}
QList< User* > Room::usersTyping() const