File indexing completed on 2024-05-26 16:43:07

0001 /*
0002  *   SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de>
0003  *   SPDX-License-Identifier: LGPL-2.0-or-later
0004  */
0005 #ifndef COMIC_ENGINE_TYPES
0006 #define COMIC_ENGINE_TYPES
0007 
0008 #include <QIcon>
0009 #include <QString>
0010 #include <QUrl>
0011 
0012 /**
0013  * Describes the type of how this comic provider
0014  * references the previous or next comic strip.
0015  */
0016 enum class IdentifierType {
0017     DateIdentifier = 0, ///< References by date
0018     NumberIdentifier, ///< References by numerical identifier
0019     StringIdentifier, ///< References by arbitrary string
0020 };
0021 
0022 inline IdentifierType stringToIdentifierType(const QString type)
0023 {
0024     if (type == QLatin1String("Date")) {
0025         return IdentifierType::DateIdentifier;
0026     } else if (type == QLatin1String("Number")) {
0027         return IdentifierType::NumberIdentifier;
0028     } else if (type == QLatin1String("String")) {
0029         return IdentifierType::StringIdentifier;
0030     }
0031     return IdentifierType::StringIdentifier;
0032 }
0033 
0034 struct ComicProviderInfo {
0035     QString pluginId;
0036     QString name;
0037     QString icon;
0038 };
0039 
0040 struct ComicMetaData {
0041     QString stripTitle;
0042     QUrl imageUrl;
0043     QImage image;
0044     QUrl websiteUrl;
0045     QUrl shopUrl;
0046     QString firstStripIdentifier;
0047     QString previousStripIdentifier;
0048     QString nextIdentifier;
0049     QString previousIdentifier;
0050     QString author;
0051     QString comicAuthor;
0052     QString additionalText;
0053     QString identifier;
0054     IdentifierType identifierType;
0055     bool isLeftToRight = false;
0056     bool isTopToBottom = false;
0057     QString lastCachedStripIdentifier;
0058     QString providerName;
0059     bool error = false;
0060     bool errorAutomaticallyFixable = false;
0061 };
0062 
0063 #endif