From 51284cb6521aecef853fd9768c29cf04b1c19310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Thu, 27 May 2021 18:35:08 +0200 Subject: [PATCH] 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. --- common/yacreader_global.cpp | 16 ++++++++++++++++ common/yacreader_global.h | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/common/yacreader_global.cpp b/common/yacreader_global.cpp index 8c4d4e13..53d2bf75 100644 --- a/common/yacreader_global.cpp +++ b/common/yacreader_global.cpp @@ -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; +} diff --git a/common/yacreader_global.h b/common/yacreader_global.h index e35dca6e..6b2ba727 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -2,6 +2,7 @@ #define __YACREADER_GLOBAL_H #include +#include #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