Add new struct to represent the source where a comic can be opened from

A comic always belongs to a Folder, but when we open one its siblings may be different in we are opening it from a Reading List. I am not sure that Tags should keep the reading order because their purpose is abstract, so their behaviour will be opening the comics from theirs container folders.
This commit is contained in:
Luis Ángel San Martín 2021-05-27 18:35:08 +02:00
parent 50840e955d
commit 51284cb652
2 changed files with 34 additions and 0 deletions

View File

@ -88,3 +88,19 @@ QString YACReader::labelColorToRGBString(LabelColors color)
return "";
}
QDataStream &YACReader::operator<<(QDataStream &stream, const OpenComicSource &source)
{
stream << (quint8)source.source;
stream << source.sourceId;
return stream;
}
QDataStream &YACReader::operator>>(QDataStream &stream, OpenComicSource &source)
{
quint8 sourceRaw;
stream >> sourceRaw;
source.source = (OpenComicSource::Source)sourceRaw;
stream >> source.sourceId;
return stream;
}

View File

@ -2,6 +2,7 @@
#define __YACREADER_GLOBAL_H
#include <QStandardPaths>
#include <QDataStream>
#define VERSION "9.8.0"
@ -54,9 +55,26 @@ enum LabelColors {
YDark
};
struct OpenComicSource {
enum Source {
Folder = 0,
ReadingList
};
Source source;
qulonglong sourceId;
};
QDataStream &operator<<(QDataStream &stream, const OpenComicSource &source);
QDataStream &operator>>(QDataStream &stream, OpenComicSource &source);
QString getSettingsPath();
QString colorToName(LabelColors colors);
QString labelColorToRGBString(LabelColors color);
}
Q_DECLARE_METATYPE(YACReader::OpenComicSource::Source)
Q_DECLARE_METATYPE(YACReader::OpenComicSource)
#endif