mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 07:08:07 +00:00
feat(app): improve compilation performance
This commit is contained in:
parent
b28d9f8e97
commit
31f57b7cf7
13 changed files with 87 additions and 32 deletions
|
|
@ -5,8 +5,11 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "../components/chat/ChatModel.hpp"
|
||||
#include "../components/contacts/ContactModel.hpp"
|
||||
#include "../components/contacts/ContactsListModel.hpp"
|
||||
#include "../components/contacts/ContactsListProxyModel.hpp"
|
||||
#include "../components/core/CoreManager.hpp"
|
||||
#include "../components/notifier/Notifier.hpp"
|
||||
#include "../components/settings/AccountSettingsModel.hpp"
|
||||
#include "../components/timeline/TimelineModel.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "../components/notifier/Notifier.hpp"
|
||||
class Notifier;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,38 @@
|
|||
#include "../../utils.hpp"
|
||||
|
||||
#include "ChatModel.hpp"
|
||||
|
||||
// ===================================================================
|
||||
|
||||
ChatModel::ChatModel (QObject *parent) : QObject(parent) {
|
||||
|
||||
QHash<int, QByteArray> ChatModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
roles[Qt::DisplayRole] = "$chatEntry";
|
||||
return roles;
|
||||
}
|
||||
|
||||
QVariant ChatModel::data (const QModelIndex &index, int role) const {
|
||||
int row = index.row();
|
||||
|
||||
if (row < 0 || row >= m_entries.count())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole)
|
||||
return QVariant::fromValue(m_entries[row]);
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
QString ChatModel::getSipAddress () const {
|
||||
if (!m_chat_room)
|
||||
return "";
|
||||
|
||||
return Utils::linphoneStringToQString(
|
||||
m_chat_room->getPeerAddress()->asString()
|
||||
);
|
||||
}
|
||||
|
||||
void ChatModel::setSipAddress (const QString &sip_address) {
|
||||
emit sipAddressChanged(sip_address);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,40 @@
|
|||
#ifndef CHAT_MODEL_H_
|
||||
#define CHAT_MODEL_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractListModel>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class ChatModel : public QObject {
|
||||
class ChatModel : public QAbstractListModel {
|
||||
Q_OBJECT;
|
||||
|
||||
Q_PROPERTY(
|
||||
QString remoteSipAddress
|
||||
READ getRemoteSipAddress
|
||||
WRITE setRemoteSipAddress
|
||||
NOTIFY remoteSipAddressChanged
|
||||
QString sipAddress
|
||||
READ getSipAddress
|
||||
WRITE setSipAddress
|
||||
NOTIFY sipAddressChanged
|
||||
);
|
||||
|
||||
public:
|
||||
ChatModel (QObject *parent = Q_NULLPTR);
|
||||
ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {}
|
||||
|
||||
int rowCount (const QModelIndex &index = QModelIndex()) const {
|
||||
return m_entries.count();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> roleNames () const;
|
||||
QVariant data (const QModelIndex &index, int role) const;
|
||||
|
||||
signals:
|
||||
void remoteSipAddressChanged (QString remote_sip_address);
|
||||
void sipAddressChanged (const QString &sipAddress);
|
||||
|
||||
private:
|
||||
QString getRemoteSipAddress () const {
|
||||
return m_remote_sip_address;
|
||||
}
|
||||
void setRemoteSipAddress (QString &remote_sip_address) {
|
||||
m_remote_sip_address = remote_sip_address;
|
||||
}
|
||||
QString getSipAddress () const;
|
||||
void setSipAddress (const QString &sip_address);
|
||||
|
||||
QString m_remote_sip_address;
|
||||
QList<QVariantMap> m_entries;
|
||||
std::shared_ptr<linphone::ChatRoom> m_chat_room;
|
||||
};
|
||||
|
||||
#endif // CHAT_MODEL_H_
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include "../../utils.hpp"
|
||||
|
||||
#include "ContactModel.hpp"
|
||||
|
||||
// ===================================================================
|
||||
|
|
@ -9,3 +11,15 @@ Presence::PresenceStatus ContactModel::getPresenceStatus () const {
|
|||
Presence::PresenceLevel ContactModel::getPresenceLevel () const {
|
||||
return Presence::getPresenceLevel(m_presence_status);
|
||||
}
|
||||
|
||||
QString ContactModel::getUsername () const {
|
||||
return Utils::linphoneStringToQString(
|
||||
m_linphone_friend->getName()
|
||||
);
|
||||
}
|
||||
|
||||
QString ContactModel::getSipAddress () const {
|
||||
return Utils::linphoneStringToQString(
|
||||
m_linphone_friend->getAddress()->asString()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include <QObject>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
#include "../../utils.hpp"
|
||||
#include "../presence/Presence.hpp"
|
||||
|
||||
// ===================================================================
|
||||
|
|
@ -54,11 +53,7 @@ signals:
|
|||
void contactUpdated ();
|
||||
|
||||
private:
|
||||
QString getUsername () const {
|
||||
return Utils::linphoneStringToQString(
|
||||
m_linphone_friend->getName()
|
||||
);
|
||||
}
|
||||
QString getUsername () const;
|
||||
|
||||
QString getAvatar () const {
|
||||
return "";
|
||||
|
|
@ -67,11 +62,7 @@ private:
|
|||
Presence::PresenceStatus getPresenceStatus () const;
|
||||
Presence::PresenceLevel getPresenceLevel () const;
|
||||
|
||||
QString getSipAddress () const {
|
||||
return Utils::linphoneStringToQString(
|
||||
m_linphone_friend->getAddress()->asString()
|
||||
);
|
||||
}
|
||||
QString getSipAddress () const;
|
||||
|
||||
Presence::PresenceStatus m_presence_status = Presence::Offline;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "../../app/App.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
#include "ContactModel.hpp"
|
||||
#include "ContactsListProxyModel.hpp"
|
||||
|
||||
#include "ContactsListModel.hpp"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
#define CONTACTS_LIST_MODEL_H_
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <linphone++/linphone.hh>
|
||||
|
||||
#include "ContactModel.hpp"
|
||||
class ContactModel;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "../../utils.hpp"
|
||||
#include "ContactModel.hpp"
|
||||
#include "ContactsListModel.hpp"
|
||||
|
||||
#include "ContactsListProxyModel.hpp"
|
||||
|
||||
#define USERNAME_WEIGHT 50.0
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "ContactsListModel.hpp"
|
||||
class ContactModel;
|
||||
class ContactsListModel;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "../../app/App.hpp"
|
||||
|
||||
#include "Notifier.hpp"
|
||||
|
||||
// Notifications QML properties/methods.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <linphone++/linphone.hh>
|
||||
|
||||
#include "../../utils.hpp"
|
||||
#include "../contacts/ContactsListModel.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
#include "TimelineModel.hpp"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef TIMELINE_MODEL_H_
|
||||
#define TIMELINE_MODEL_H_
|
||||
|
||||
#include "../contacts/ContactsListModel.hpp"
|
||||
#include <QAbstractListModel>
|
||||
|
||||
class ContactsListModel;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue