Commit 1459d293 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(utils): add and use a `qStringToLinphoneString` function

parent 31f57b7c
linphone @ 703dc882
Subproject commit 15f2e55bee0a50647fc4cbf66ec9a3d04b232e44
Subproject commit 703dc88223b3bb31d0ba13e3c084a39b20317cfe
......@@ -2,6 +2,8 @@
#include <QFile>
#include <QStandardPaths>
#include "../utils.hpp"
#include "Database.hpp"
#ifdef _WIN32
......@@ -35,7 +37,7 @@ inline string getDatabaseFilePath (const QString &filename) {
QString path(DATABASES_PATH + "/");
path += filename;
return ensureDatabaseFilePathExists(path)
? QDir::toNativeSeparators(path).toStdString()
? Utils::qStringToLinphoneString(QDir::toNativeSeparators(path))
: "";
}
......
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include "ChatModel.hpp"
......@@ -34,5 +35,13 @@ QString ChatModel::getSipAddress () const {
}
void ChatModel::setSipAddress (const QString &sip_address) {
if (sip_address == getSipAddress())
return;
std::shared_ptr<linphone::ChatRoom> chat_room =
CoreManager::getInstance()->getCore()->getChatRoomFromUri(
Utils::qStringToLinphoneString(sip_address)
);
emit sipAddressChanged(sip_address);
}
#include <QtDebug>
#include "../../app/App.hpp"
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include "ContactModel.hpp"
#include "ContactsListProxyModel.hpp"
......@@ -77,7 +78,7 @@ ContactModel *ContactsListModel::mapSipAddressToContact (const QString &sipAddre
// Maybe use a hashtable in future version to get a lower cost?
ContactModel *contact = m_friend_to_contact.value(
m_linphone_friends->findFriendByUri(
sipAddress.toStdString()
Utils::qStringToLinphoneString(sipAddress)
).get()
);
......
......@@ -7,6 +7,10 @@ namespace Utils {
inline QString linphoneStringToQString (const std::string &string) {
return QString::fromLocal8Bit(string.c_str(), string.size());
}
inline std::string qStringToLinphoneString (const QString &string) {
return string.toStdString();
}
}
#endif // UTILS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment