From 776987c0e0c18b2db71d2481b396a3add5e4555c Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 1 Sep 2021 18:34:54 +0200 Subject: [PATCH] Fix UTF8 for Windows on file transfert --- .../components/chat-events/ChatMessageModel.cpp | 14 +++++++------- .../src/components/chat-room/ChatRoomModel.cpp | 2 +- .../contacts/ContactsImporterListProxyModel.cpp | 2 +- .../src/components/ldap/LdapProxyModel.cpp | 2 +- .../participant/ParticipantProxyModel.cpp | 2 +- .../sip-addresses/SipAddressesProxyModel.cpp | 2 +- .../sip-addresses/SipAddressesSorter.cpp | 2 +- linphone-sdk | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/linphone-app/src/components/chat-events/ChatMessageModel.cpp b/linphone-app/src/components/chat-events/ChatMessageModel.cpp index f8dcba304..cd8827901 100644 --- a/linphone-app/src/components/chat-events/ChatMessageModel.cpp +++ b/linphone-app/src/components/chat-events/ChatMessageModel.cpp @@ -75,7 +75,7 @@ quint64 ContentModel::getFileSize() const{ } QString ContentModel::getName() const{ - return Utils::coreStringToAppString(mContent->getName()); + return QString::fromStdString(mContent->getName()); } QString ContentModel::getThumbnail() const{ @@ -125,10 +125,10 @@ void ContentModel::createThumbnail () { QString id; QString path = Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getFileTransferInformation()->getFilePath()); - auto appdata = ChatMessageModel::AppDataManager(Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getAppdata())); + auto appdata = ChatMessageModel::AppDataManager(QString::fromStdString(mChatMessageModel->getChatMessage()->getAppdata())); if(!appdata.mData.contains(path) - || !QFileInfo(Utils::coreStringToAppString(Paths::getThumbnailsDirPath())+appdata.mData[path]).isFile()){ + || !QFileInfo(QString::fromStdString(Paths::getThumbnailsDirPath())+appdata.mData[path]).isFile()){ // File don't exist. Create the thumbnail QImage image(path); @@ -164,11 +164,11 @@ void ContentModel::createThumbnail () { QString uuid = QUuid::createUuid().toString(); id = QStringLiteral("%1.jpg").arg(uuid.mid(1, uuid.length() - 2)); - if (!thumbnail.save(Utils::coreStringToAppString(Paths::getThumbnailsDirPath()) + id , "jpg", 100)) { + if (!thumbnail.save(QString::fromStdString(Paths::getThumbnailsDirPath()) + id , "jpg", 100)) { qWarning() << QStringLiteral("Unable to create thumbnail of: `%1`.").arg(path); }else{ appdata.mData[path] = id; - mChatMessageModel->getChatMessage()->setAppdata(Utils::appStringToCoreString(appdata.toString())); + mChatMessageModel->getChatMessage()->setAppdata(appdata.toString().toStdString()); } } } @@ -456,11 +456,11 @@ void ChatMessageModel::resendMessage (){ void ChatMessageModel::deleteEvent(){ if (mChatMessage && mChatMessage->getFileTransferInformation()) {// Remove thumbnail mChatMessage->cancelFileTransfer(); - QString appdata = Utils::coreStringToAppString(mChatMessage->getAppdata()); + QString appdata = QString::fromStdString(mChatMessage->getAppdata()); QStringList fields = appdata.split(':'); if(fields[0].size() > 0) { - QString thumbnailPath = Utils::coreStringToAppString(Paths::getThumbnailsDirPath()) + fields[0]; + QString thumbnailPath = QString::fromStdString(Paths::getThumbnailsDirPath()) + fields[0]; if (!QFile::remove(thumbnailPath)) qWarning() << QStringLiteral("Unable to remove `%1`.").arg(thumbnailPath); } diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index 3531fb0ff..ba6f1d425 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -638,7 +638,7 @@ void ChatRoomModel::sendFileMessage (const QString &path) { content->setSubtype(Utils::appStringToCoreString(mimeType[1])); } content->setSize(size_t(fileSize)); - content->setName(Utils::appStringToCoreString( QFileInfo(file).fileName())); + content->setName(QFileInfo(file).fileName().toStdString()); shared_ptr message = mChatRoom->createFileTransferMessage(content); message->getContents().front()->setFilePath(Utils::appStringToCoreString(path)); diff --git a/linphone-app/src/components/contacts/ContactsImporterListProxyModel.cpp b/linphone-app/src/components/contacts/ContactsImporterListProxyModel.cpp index 21c8fe7b5..ce6c52976 100644 --- a/linphone-app/src/components/contacts/ContactsImporterListProxyModel.cpp +++ b/linphone-app/src/components/contacts/ContactsImporterListProxyModel.cpp @@ -55,7 +55,7 @@ bool ContactsImporterListProxyModel::lessThan (const QModelIndex &left, const QM const ContactsImporterModel *contactA = sourceModel()->data(left).value(); const ContactsImporterModel *contactB = sourceModel()->data(right).value(); - return contactA->getIdentity() <= contactB->getIdentity(); + return contactA->getIdentity() < contactB->getIdentity(); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/ldap/LdapProxyModel.cpp b/linphone-app/src/components/ldap/LdapProxyModel.cpp index a3a689aa4..be8341689 100644 --- a/linphone-app/src/components/ldap/LdapProxyModel.cpp +++ b/linphone-app/src/components/ldap/LdapProxyModel.cpp @@ -45,5 +45,5 @@ bool LdapProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right const LdapModel* ldapA = sourceModel()->data(left).value(); const LdapModel* ldapB = sourceModel()->data(right).value(); - return ldapA->mId <= ldapB->mId; + return ldapA->mId < ldapB->mId; } diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index 1c5440f4d..f6c41c56e 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -121,5 +121,5 @@ bool ParticipantProxyModel::lessThan (const QModelIndex &left, const QModelIndex const ParticipantModel* a = sourceModel()->data(left).value(); const ParticipantModel* b = sourceModel()->data(right).value(); - return a->getCreationTime() >= b->getCreationTime(); + return a->getCreationTime() > b->getCreationTime(); } diff --git a/linphone-app/src/components/sip-addresses/SipAddressesProxyModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesProxyModel.cpp index e49ef6a3e..f2e25521f 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesProxyModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesProxyModel.cpp @@ -94,7 +94,7 @@ bool SipAddressesProxyModel::lessThan (const QModelIndex &left, const QModelInde return diff <= 0; // 6. Same contact name, so compare sip addresses. - return sipAddressA <= sipAddressB; + return sipAddressA < sipAddressB; } int SipAddressesProxyModel::computeEntryWeight (const QVariantMap &entry) const { diff --git a/linphone-app/src/components/sip-addresses/SipAddressesSorter.cpp b/linphone-app/src/components/sip-addresses/SipAddressesSorter.cpp index 128b4578d..3f4213ff3 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesSorter.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesSorter.cpp @@ -79,7 +79,7 @@ bool SipAddressesSorter::lessThan (const QString& filter, const SearchResultMode return diff <= 0; // 6. Same contact name, so compare sip addresses. - return sipAddressA <= sipAddressB; + return sipAddressA < sipAddressB; } int SipAddressesSorter::computeEntryWeight (const QString& filter, const SearchResultModel *entry) { diff --git a/linphone-sdk b/linphone-sdk index ecd5e0be3..48e870383 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit ecd5e0be3e83efba08759ed7f865d770eda6a5ff +Subproject commit 48e87038360e272436570b6dc062c34f85625237