File indexing completed on 2024-12-01 04:35:41
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QAbstractListModel> 0010 0011 #include "libruqolacore_export.h" 0012 #include "servererrorinfo.h" 0013 #include <QVector> 0014 0015 class LIBRUQOLACORE_EXPORT ServerErrorInfoHistoryModel : public QAbstractListModel 0016 { 0017 Q_OBJECT 0018 public: 0019 enum ServerErrorInfoHistoryRoles { 0020 AccountName = Qt::UserRole + 1, 0021 MessageStr, 0022 Identifier, 0023 DateTime, 0024 DateTimeStr, 0025 }; 0026 Q_ENUM(ServerErrorInfoHistoryRoles) 0027 explicit ServerErrorInfoHistoryModel(QObject *parent = nullptr); 0028 ~ServerErrorInfoHistoryModel() override; 0029 0030 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0031 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; 0032 0033 void clear(); 0034 0035 void insertServerErrorInfos(const QVector<ServerErrorInfo> &infos); 0036 0037 void addServerErrorInfo(const ServerErrorInfo &info); 0038 0039 private: 0040 QVector<ServerErrorInfo> mServerErrorInfo; 0041 };