File indexing completed on 2024-05-12 16:21:29
0001 /** 0002 * SPDX-FileCopyrightText: 2021-2022 Bart De Vries <bart@mogwai.be> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDateTime> 0010 #include <QObject> 0011 #include <QString> 0012 0013 class Error : public QObject 0014 { 0015 Q_OBJECT 0016 0017 public: 0018 enum Type { 0019 Unknown, 0020 FeedUpdate, 0021 MediaDownload, 0022 MeteredNotAllowed, 0023 InvalidMedia, 0024 DiscoverError, 0025 StorageMoveError, 0026 SyncError, 0027 MeteredStreamingNotAllowed, 0028 }; 0029 Q_ENUM(Type) 0030 0031 static int typeToDb(Type type); // needed to translate Error::Type values to int for sqlite 0032 static Type dbToType(int value); // needed to translate from int to Error::Type values for sqlite 0033 0034 Q_PROPERTY(QString url MEMBER url CONSTANT) 0035 Q_PROPERTY(QString id MEMBER id CONSTANT) 0036 Q_PROPERTY(int code MEMBER code CONSTANT) 0037 Q_PROPERTY(QString message MEMBER message CONSTANT) 0038 Q_PROPERTY(QDateTime date MEMBER date CONSTANT) 0039 Q_PROPERTY(QString title READ title CONSTANT) 0040 Q_PROPERTY(QString description READ description CONSTANT) 0041 0042 Error(Type type, 0043 const QString url, 0044 const QString id, 0045 const int code, 0046 const QString message, 0047 const QDateTime date, 0048 const QString title = QStringLiteral("")); 0049 0050 QString title() const; 0051 QString description() const; 0052 0053 Type type; 0054 QString url; 0055 QString id; 0056 int code; 0057 QString message; 0058 QDateTime date; 0059 0060 private: 0061 QString m_title; 0062 };