This repository has been archived by the owner on Feb 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpresencemodel.h
47 lines (40 loc) · 1.8 KB
/
presencemodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef PRESENCEMODEL_H
#define PRESENCEMODEL_H
#include "sqlite3helper.h"
struct PresenceItem
{
int id;
QDateTime time;
QStringList presences;
};
class PresenceModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit PresenceModel(QObject *parent = 0, Sqlite3HelperPtr sqlite3Helper = nullptr);
virtual ~PresenceModel();
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
void requestReceivedPresenceBuddyList();
signals:
void receivedPresenceBuddyList(QStringList);
void gotPresences(QStringList, QList<QSharedPointer<PresenceItem>>);
void resizeTableCells(int, int);
public slots:
void onDatabaseCreated(const QString &dbFile);
void onSelectedJIDChanged(const QString &text);
void onGetPrsences(QStringList jidList, QList<QSharedPointer<PresenceItem>> presences);
private:
Sqlite3HelperPtr m_sqlite3Helper;
QMutex m_mutex;
QString m_dbFile;
QStringList m_fullJIDList;
QList<QSharedPointer<PresenceItem>> m_presences;
void doRequestReceivedPresenceBuddyList();
void doQueryPresence(const QString &jid);
};
#endif // PRESENCEMODEL_H