File: qofonoextmodemlistmodel.h

package info (click to toggle)
libqofonoext 1.0.32-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 268 kB
  • sloc: cpp: 2,683; makefile: 8
file content (77 lines) | stat: -rw-r--r-- 2,585 bytes parent folder | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/****************************************************************************
**
** Copyright (C) 2015-2021 Jolla Ltd.
** Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
****************************************************************************/

#ifndef QOFONOEXTMODEMLISTMODEL_H
#define QOFONOEXTMODEMLISTMODEL_H

#include "qofonoextmodemmanager.h"

#include <QAbstractListModel>

class QOfonoExtModemListModel : public QAbstractListModel {
    Q_OBJECT
    Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
    Q_PROPERTY(int count READ count NOTIFY countChanged)

public:
    enum Role {
        PathRole = Qt::UserRole,
        EnabledRole,
        DefaultDataRole,
        DefaultVoiceRole,
        SimPresentRole,
        IMEIRole,
        IMEISVRole
    };

    explicit QOfonoExtModemListModel(QObject* aParent = NULL);

    bool valid() const;
    int count() const;

    QHash<int,QByteArray> roleNames() const;
    int rowCount(const QModelIndex& aParent) const;
    QVariant data(const QModelIndex& aIndex, int aRole) const;
    bool setData(const QModelIndex& aIndex, const QVariant& aValue, int aRole);

Q_SIGNALS:
    void validChanged(bool aValid);
    void countChanged(int aCount);

private Q_SLOTS:
    void onValidChanged(bool aValid);
    void onAvailableModemsChanged(QStringList aModems);
    void onEnabledModemsChanged(QStringList aModems);
    void onDefaultDataModemChanged(QString aModemPath);
    void onDefaultVoiceModemChanged(QString aModemPath);
    void onPresentSimChanged(int aIndex, bool aPresent);
    void onImeiCodesChanged(QStringList aList);
    void onImeisvCodesChanged(QStringList aList);

private:
    void defaultModemChanged(Role aRole, int aPrevRow, int aNewRow);
    void roleChanged(Role aRole, QStringList aPrevList, QStringList aNewList);

private:
    QSharedPointer<QOfonoExtModemManager> iModemManager;
    QStringList iAvailableModems;
    QStringList iEnabledModems;
    QString iDefaultVoiceModem;
    QString iDefaultDataModem;
    QStringList iImeiList;
    QStringList iImeisvList;
};

#endif // QOFONOEXTMODEMLISTMODEL_H