mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
6f119cd083
* fix: fixed dns processing * fix: fixed proceesed index/id selection * refactor: stop using the server index as state * fix: fixed autostart and start minimized * fix: fixed typo * fix: add socks5 extractConfigFromContainer * fix: remove unused currentContainerUpdated * fix: fixed clear cached profile order
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#ifndef SERVERSMODEL_H
|
|
#define SERVERSMODEL_H
|
|
|
|
#include <QAbstractListModel>
|
|
#include <QVector>
|
|
|
|
#include "core/utils/selfhosted/sshSession.h"
|
|
#include "core/models/serverDescription.h"
|
|
|
|
class ServersModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum Roles {
|
|
NameRole = Qt::UserRole + 1,
|
|
ServerDescriptionRole,
|
|
HostNameRole,
|
|
ServerIdRole,
|
|
|
|
CredentialsLoginRole,
|
|
|
|
IsDefaultRole,
|
|
|
|
HasWriteAccessRole,
|
|
|
|
DefaultContainerRole,
|
|
|
|
HasInstalledContainers,
|
|
|
|
IsServerFromGatewayApiRole,
|
|
IsSubscriptionExpiredRole,
|
|
IsSubscriptionExpiringSoonRole,
|
|
};
|
|
|
|
ServersModel(QObject *parent = nullptr);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
QVariant data(const int index, int role = Qt::DisplayRole) const;
|
|
|
|
public slots:
|
|
void updateModel(const QVector<amnezia::ServerDescription> &descriptions,
|
|
const QString &defaultServerId);
|
|
void setDefaultServerId(const QString &serverId);
|
|
|
|
protected:
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
private:
|
|
ServerCredentials serverCredentials(int index) const;
|
|
|
|
QVector<amnezia::ServerDescription> m_descriptions;
|
|
|
|
QString m_defaultServerId;
|
|
};
|
|
|
|
#endif // SERVERSMODEL_H
|