From 0910bf6c5bbc6c9250023796b2e641f19232c3cd Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Mon, 15 Jan 2018 10:01:34 +0900 Subject: 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. --- room.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 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 -- cgit v1.2.3