mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 00:08:13 +00:00
feat(utils): add and use a qStringToLinphoneString function
This commit is contained in:
parent
31f57b7cf7
commit
1459d29311
5 changed files with 19 additions and 3 deletions
|
|
@ -1 +1 @@
|
|||
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))
|
||||
: "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#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_
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue