Commit 31f57b7c authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): improve compilation performance

parent b28d9f8e
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
#include <QtDebug> #include <QtDebug>
#include "../components/chat/ChatModel.hpp" #include "../components/chat/ChatModel.hpp"
#include "../components/contacts/ContactModel.hpp"
#include "../components/contacts/ContactsListModel.hpp"
#include "../components/contacts/ContactsListProxyModel.hpp" #include "../components/contacts/ContactsListProxyModel.hpp"
#include "../components/core/CoreManager.hpp" #include "../components/core/CoreManager.hpp"
#include "../components/notifier/Notifier.hpp"
#include "../components/settings/AccountSettingsModel.hpp" #include "../components/settings/AccountSettingsModel.hpp"
#include "../components/timeline/TimelineModel.hpp" #include "../components/timeline/TimelineModel.hpp"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QTranslator> #include <QTranslator>
#include "../components/notifier/Notifier.hpp" class Notifier;
// =================================================================== // ===================================================================
......
#include "../../utils.hpp"
#include "ChatModel.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);
} }
#ifndef CHAT_MODEL_H_ #ifndef CHAT_MODEL_H_
#define 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_OBJECT;
Q_PROPERTY( Q_PROPERTY(
QString remoteSipAddress QString sipAddress
READ getRemoteSipAddress READ getSipAddress
WRITE setRemoteSipAddress WRITE setSipAddress
NOTIFY remoteSipAddressChanged NOTIFY sipAddressChanged
); );
public: 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: signals:
void remoteSipAddressChanged (QString remote_sip_address); void sipAddressChanged (const QString &sipAddress);
private: private:
QString getRemoteSipAddress () const { QString getSipAddress () const;
return m_remote_sip_address; void setSipAddress (const QString &sip_address);
}
void setRemoteSipAddress (QString &remote_sip_address) {
m_remote_sip_address = remote_sip_address;
}
QString m_remote_sip_address; QList<QVariantMap> m_entries;
std::shared_ptr<linphone::ChatRoom> m_chat_room;
}; };
#endif // CHAT_MODEL_H_ #endif // CHAT_MODEL_H_
#include "../../utils.hpp"
#include "ContactModel.hpp" #include "ContactModel.hpp"
// =================================================================== // ===================================================================
...@@ -9,3 +11,15 @@ Presence::PresenceStatus ContactModel::getPresenceStatus () const { ...@@ -9,3 +11,15 @@ Presence::PresenceStatus ContactModel::getPresenceStatus () const {
Presence::PresenceLevel ContactModel::getPresenceLevel () const { Presence::PresenceLevel ContactModel::getPresenceLevel () const {
return Presence::getPresenceLevel(m_presence_status); 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 @@ ...@@ -4,7 +4,6 @@
#include <QObject> #include <QObject>
#include <linphone++/linphone.hh> #include <linphone++/linphone.hh>
#include "../../utils.hpp"
#include "../presence/Presence.hpp" #include "../presence/Presence.hpp"
// =================================================================== // ===================================================================
...@@ -54,11 +53,7 @@ signals: ...@@ -54,11 +53,7 @@ signals:
void contactUpdated (); void contactUpdated ();
private: private:
QString getUsername () const { QString getUsername () const;
return Utils::linphoneStringToQString(
m_linphone_friend->getName()
);
}
QString getAvatar () const { QString getAvatar () const {
return ""; return "";
...@@ -67,11 +62,7 @@ private: ...@@ -67,11 +62,7 @@ private:
Presence::PresenceStatus getPresenceStatus () const; Presence::PresenceStatus getPresenceStatus () const;
Presence::PresenceLevel getPresenceLevel () const; Presence::PresenceLevel getPresenceLevel () const;
QString getSipAddress () const { QString getSipAddress () const;
return Utils::linphoneStringToQString(
m_linphone_friend->getAddress()->asString()
);
}
Presence::PresenceStatus m_presence_status = Presence::Offline; Presence::PresenceStatus m_presence_status = Presence::Offline;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "../../app/App.hpp" #include "../../app/App.hpp"
#include "../core/CoreManager.hpp" #include "../core/CoreManager.hpp"
#include "ContactModel.hpp"
#include "ContactsListProxyModel.hpp" #include "ContactsListProxyModel.hpp"
#include "ContactsListModel.hpp" #include "ContactsListModel.hpp"
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
#define CONTACTS_LIST_MODEL_H_ #define CONTACTS_LIST_MODEL_H_
#include <QAbstractListModel> #include <QAbstractListModel>
#include <linphone++/linphone.hh>
#include "ContactModel.hpp" class ContactModel;
// =================================================================== // ===================================================================
......
#include <QDebug> #include <QDebug>
#include "../../utils.hpp"
#include "ContactModel.hpp"
#include "ContactsListModel.hpp"
#include "ContactsListProxyModel.hpp" #include "ContactsListProxyModel.hpp"
#define USERNAME_WEIGHT 50.0 #define USERNAME_WEIGHT 50.0
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "ContactsListModel.hpp" class ContactModel;
class ContactsListModel;
// =================================================================== // ===================================================================
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <QtDebug> #include <QtDebug>
#include "../../app/App.hpp" #include "../../app/App.hpp"
#include "Notifier.hpp" #include "Notifier.hpp"
// Notifications QML properties/methods. // Notifications QML properties/methods.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linphone++/linphone.hh> #include <linphone++/linphone.hh>
#include "../../utils.hpp" #include "../../utils.hpp"
#include "../contacts/ContactsListModel.hpp"
#include "../core/CoreManager.hpp" #include "../core/CoreManager.hpp"
#include "TimelineModel.hpp" #include "TimelineModel.hpp"
......
#ifndef TIMELINE_MODEL_H_ #ifndef TIMELINE_MODEL_H_
#define TIMELINE_MODEL_H_ #define TIMELINE_MODEL_H_
#include "../contacts/ContactsListModel.hpp" #include <QAbstractListModel>
class ContactsListModel;
// =================================================================== // ===================================================================
......
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