fix(app): coding style

This commit is contained in:
Ronan Abhamon 2017-03-20 10:11:21 +01:00
parent 0310ccb6c6
commit dd09e6d3b1
3 changed files with 10 additions and 6 deletions

View file

@ -39,6 +39,8 @@ ContactModel::ContactModel (shared_ptr<linphone::Friend> linphone_friend) {
}
ContactModel::ContactModel (VcardModel *vcard) {
Q_ASSERT(vcard != nullptr);
QQmlEngine *engine = App::getInstance()->getEngine();
if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership)
throw invalid_argument("A contact is already linked to this vcard.");
@ -49,8 +51,11 @@ ContactModel::ContactModel (VcardModel *vcard) {
engine->setObjectOwnership(vcard, QQmlEngine::CppOwnership);
}
void ContactModel::presenceReceived () {
Presence::PresenceStatus status = static_cast<Presence::PresenceStatus>(m_linphone_friend->getConsolidatedPresence());
void ContactModel::refreshPresence () {
Presence::PresenceStatus status = static_cast<Presence::PresenceStatus>(
m_linphone_friend->getConsolidatedPresence()
);
emit presenceStatusChanged(status);
emit presenceLevelChanged(Presence::getPresenceLevel(status));
}

View file

@ -48,7 +48,7 @@ public:
return m_vcard;
}
void presenceReceived ();
void refreshPresence ();
Q_INVOKABLE void startEdit ();
Q_INVOKABLE void endEdit ();

View file

@ -69,12 +69,11 @@ void CoreHandlers::onMessageReceived (
void CoreHandlers::onNotifyPresenceReceivedForUriOrTel (
const shared_ptr<linphone::Core> &,
const shared_ptr<linphone::Friend> &lf,
const shared_ptr<linphone::Friend> &linphone_friend,
const string &,
const shared_ptr<linphone::PresenceModel> &
) {
ContactModel *contact_model = &lf->getData<ContactModel>("contact-model");
contact_model->presenceReceived();
linphone_friend->getData<ContactModel>("contact-model").refreshPresence();
}
void CoreHandlers::onRegistrationStateChanged (