mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 08:49:19 +00:00
fix(app): coding style
This commit is contained in:
parent
2df59f19ee
commit
12636b34b2
6 changed files with 24 additions and 27 deletions
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
QHash<int, QByteArray> ChatModel::roleNames () const {
|
||||
QHash<int, QByteArray> roles;
|
||||
|
|
@ -62,7 +62,7 @@ bool ChatModel::removeRows (int row, int count, const QModelIndex &parent) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ChatModel::removeEntry (int id) {
|
||||
qInfo() << QStringLiteral("Removing chat entry: %1 of %2.")
|
||||
|
|
@ -85,7 +85,7 @@ void ChatModel::removeAllEntries () {
|
|||
endResetModel();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ChatModel::fillMessageEntry (
|
||||
QVariantMap &dest,
|
||||
|
|
@ -125,7 +125,7 @@ void ChatModel::fillCallEndEntry (
|
|||
dest["isStart"] = false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ChatModel::removeEntry (ChatEntryData &pair) {
|
||||
int type = pair.first["type"].toInt();
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef CHAT_MODEL_H_
|
||||
#define CHAT_MODEL_H_
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <linphone++/linphone.hh>
|
||||
#include <QAbstractListModel>
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
// Fetch all N messages of a ChatRoom.
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
class ChatModel : public QAbstractListModel {
|
||||
friend class ChatProxyModel;
|
||||
|
|
@ -20,9 +20,6 @@ class ChatModel : public QAbstractListModel {
|
|||
NOTIFY sipAddressChanged
|
||||
);
|
||||
|
||||
signals:
|
||||
void sipAddressChanged (const QString &sipAddress);
|
||||
|
||||
public:
|
||||
typedef QPair<QVariantMap, std::shared_ptr<void> > ChatEntryData;
|
||||
|
||||
|
|
@ -36,6 +33,7 @@ public:
|
|||
MessageEntry,
|
||||
CallEntry
|
||||
};
|
||||
|
||||
Q_ENUM(EntryType);
|
||||
|
||||
enum CallStatus {
|
||||
|
|
@ -43,6 +41,7 @@ public:
|
|||
CallStatusMissed = linphone::CallStatusMissed,
|
||||
CallStatusSuccess = linphone::CallStatusSuccess
|
||||
};
|
||||
|
||||
Q_ENUM(CallStatus);
|
||||
|
||||
ChatModel (QObject *parent = Q_NULLPTR) : QAbstractListModel(parent) {}
|
||||
|
|
@ -59,6 +58,9 @@ public slots:
|
|||
void removeEntry (int id);
|
||||
void removeAllEntries ();
|
||||
|
||||
signals:
|
||||
void sipAddressChanged (const QString &sipAddress);
|
||||
|
||||
private:
|
||||
void fillMessageEntry (
|
||||
QVariantMap &dest,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "ChatProxyModel.hpp"
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
ChatModelFilter::ChatModelFilter (QObject *parent) : QSortFilterProxyModel(parent) {
|
||||
setSourceModel(&m_chat_model);
|
||||
|
|
@ -11,9 +11,7 @@ bool ChatModelFilter::filterAcceptsRow (int source_row, const QModelIndex &) con
|
|||
return true;
|
||||
|
||||
QModelIndex index = sourceModel()->index(source_row, 0, QModelIndex());
|
||||
const QVariantMap &data = qvariant_cast<QVariantMap>(
|
||||
index.data()
|
||||
);
|
||||
const QVariantMap &data = qvariant_cast<QVariantMap>(index.data());
|
||||
|
||||
return data["type"].toInt() == m_entry_type_filter;
|
||||
}
|
||||
|
|
@ -23,7 +21,7 @@ void ChatModelFilter::setEntryTypeFilter (ChatModel::EntryType type) {
|
|||
invalidateFilter();
|
||||
}
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
const unsigned int ChatProxyModel::ENTRIES_CHUNK_SIZE = 50;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
#include "ChatModel.hpp"
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
// Fetch the L last filtered chat entries.
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
// Cannot be used as a nested class by Qt and `Q_OBJECT` macro
|
||||
// must be used in header c++ file.
|
||||
|
|
@ -28,7 +28,7 @@ private:
|
|||
ChatModel::EntryType m_entry_type_filter = ChatModel::EntryType::GenericEntry;
|
||||
};
|
||||
|
||||
// ===================================================================
|
||||
// =============================================================================
|
||||
|
||||
class ChatProxyModel : public QSortFilterProxyModel {
|
||||
Q_OBJECT;
|
||||
|
|
@ -40,11 +40,6 @@ class ChatProxyModel : public QSortFilterProxyModel {
|
|||
NOTIFY sipAddressChanged
|
||||
);
|
||||
|
||||
signals:
|
||||
void sipAddressChanged (const QString &sipAddress);
|
||||
void moreEntriesLoaded (int n);
|
||||
void entryTypeFilterChanged (ChatModel::EntryType type);
|
||||
|
||||
public:
|
||||
ChatProxyModel (QObject *parent = Q_NULLPTR);
|
||||
|
||||
|
|
@ -59,6 +54,11 @@ public slots:
|
|||
static_cast<ChatModel *>(m_chat_model_filter.sourceModel())->removeAllEntries();
|
||||
}
|
||||
|
||||
signals:
|
||||
void sipAddressChanged (const QString &sipAddress);
|
||||
void moreEntriesLoaded (int n);
|
||||
void entryTypeFilterChanged (ChatModel::EntryType type);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
|
|
@ -74,7 +74,6 @@ private:
|
|||
}
|
||||
|
||||
ChatModelFilter m_chat_model_filter;
|
||||
|
||||
int m_n_max_displayed_entries = ENTRIES_CHUNK_SIZE;
|
||||
|
||||
static const unsigned int ENTRIES_CHUNK_SIZE;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "../../app/App.hpp"
|
||||
|
||||
#include "ContactModel.hpp"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public slots:
|
|||
}
|
||||
|
||||
void abortEdit () {
|
||||
// TODO.
|
||||
// TODO: call linphone friend abort function.
|
||||
// m_linphone_friend->abort();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue