2025-05-02 23:54:36 -07:00
|
|
|
#ifndef ALLOWEDDNSMODEL_H
|
|
|
|
|
#define ALLOWEDDNSMODEL_H
|
|
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
2026-04-30 14:53:03 +08:00
|
|
|
#include <QStringList>
|
2025-05-02 23:54:36 -07:00
|
|
|
|
|
|
|
|
class AllowedDnsModel : public QAbstractListModel
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum Roles {
|
|
|
|
|
IpRole = Qt::UserRole + 1
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-30 14:53:03 +08:00
|
|
|
explicit AllowedDnsModel(QObject *parent = nullptr);
|
2025-05-02 23:54:36 -07:00
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
|
|
public slots:
|
2026-04-30 14:53:03 +08:00
|
|
|
void updateModel(const QStringList &dnsServers);
|
2025-05-02 23:54:36 -07:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QStringList m_dnsServers;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ALLOWEDDNSMODEL_H
|