Remove deprecated property manga from folder and comic_info

This commit is contained in:
Luis Ángel San Martín 2023-06-10 11:09:55 +02:00
parent 13993f0381
commit 51a4dbf049
9 changed files with 9 additions and 43 deletions

View File

@ -64,7 +64,7 @@ static QString fields = "title,"
//"coverSizeRatio," cover may have changed since the info was exported... //"coverSizeRatio," cover may have changed since the info was exported...
//"originalCoverSize," // h/w //"originalCoverSize," // h/w
// new 9.8 fields // new 9.8 fields
"manga," // "manga," //removed in 9.13
// new 9.13 fields // new 9.13 fields
"added," "added,"
"type," "type,"
@ -315,7 +315,7 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
"name TEXT NOT NULL, " "name TEXT NOT NULL, "
"finished BOOLEAN DEFAULT 0, " "finished BOOLEAN DEFAULT 0, "
"completed BOOLEAN DEFAULT 1, " "completed BOOLEAN DEFAULT 1, "
"manga BOOLEAN DEFAULT 0, " "manga BOOLEAN DEFAULT 0, " // TODO never used, replace with `type`
"FOREIGN KEY(parentId) REFERENCES reading_list(id) ON DELETE CASCADE)"); "FOREIGN KEY(parentId) REFERENCES reading_list(id) ON DELETE CASCADE)");
QSqlQuery queryIndexReadingList(database); QSqlQuery queryIndexReadingList(database);
@ -485,7 +485,7 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
//-- //--
// new 9.8 fields // new 9.8 fields
"manga = :manga," // "manga = :manga," //removed in 9.13
// new 9.13 fields // new 9.13 fields
"added = :added," "added = :added,"
@ -539,7 +539,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
"comicVineID," "comicVineID,"
"lastTimeOpened," "lastTimeOpened,"
"coverSizeRatio," "coverSizeRatio,"
"manga,"
"added," "added,"
"type," "type,"
"editor," "editor,"
@ -582,7 +581,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
":format," ":format,"
":color," ":color,"
":ageRating," ":ageRating,"
":manga,"
":synopsis," ":synopsis,"
":characters," ":characters,"
@ -597,7 +595,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
":coverSizeRatio," ":coverSizeRatio,"
":originalCoverSize," ":originalCoverSize,"
":manga,"
":added," ":added,"
":type," ":type,"
":editor," ":editor,"
@ -704,7 +701,6 @@ void DataBaseManagement::bindValuesFromRecord(const QSqlRecord &record, QSqlQuer
bindValue("format", record, query); bindValue("format", record, query);
bindValue("color", record, query); bindValue("color", record, query);
bindValue("ageRating", record, query); bindValue("ageRating", record, query);
bindValue("manga", record, query);
bindValue("synopsis", record, query); bindValue("synopsis", record, query);
bindValue("characters", record, query); bindValue("characters", record, query);

View File

@ -94,7 +94,6 @@ QHash<int, QByteArray> FolderModel::roleNames() const
roles[FinishedRole] = "is_finished"; roles[FinishedRole] = "is_finished";
roles[CompletedRole] = "is_completed"; roles[CompletedRole] = "is_completed";
roles[IdRole] = "id"; roles[IdRole] = "id";
roles[MangaRole] = "is_manga";
roles[CoverPathRole] = "cover_path"; roles[CoverPathRole] = "cover_path";
roles[FolderNameRole] = "name"; roles[FolderNameRole] = "name";
roles[NumChildrenRole] = "num_children"; roles[NumChildrenRole] = "num_children";
@ -164,9 +163,6 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
if (role == FolderModel::FinishedRole) if (role == FolderModel::FinishedRole)
return item->data(FolderModel::Finished); return item->data(FolderModel::Finished);
if (role == FolderModel::MangaRole)
return item->data(FolderModel::Manga);
if (role == FolderModel::IdRole) if (role == FolderModel::IdRole)
return item->id; return item->id;
@ -343,7 +339,6 @@ void FolderModel::setupModelData(QSqlQuery &sqlquery, FolderItem *parent)
int path = record.indexOf("path"); int path = record.indexOf("path");
int finished = record.indexOf("finished"); int finished = record.indexOf("finished");
int completed = record.indexOf("completed"); int completed = record.indexOf("completed");
int manga = record.indexOf("manga");
int id = record.indexOf("id"); int id = record.indexOf("id");
int parentId = record.indexOf("parentId"); int parentId = record.indexOf("parentId");
int numChildren = record.indexOf("numChildren"); int numChildren = record.indexOf("numChildren");
@ -360,7 +355,6 @@ void FolderModel::setupModelData(QSqlQuery &sqlquery, FolderItem *parent)
data << sqlquery.value(path); data << sqlquery.value(path);
data << sqlquery.value(finished); data << sqlquery.value(finished);
data << sqlquery.value(completed); data << sqlquery.value(completed);
data << sqlquery.value(manga);
data << sqlquery.value(numChildren); data << sqlquery.value(numChildren);
data << sqlquery.value(firstChildHash); data << sqlquery.value(firstChildHash);
data << sqlquery.value(customImage); data << sqlquery.value(customImage);
@ -549,7 +543,6 @@ Folder FolderModel::getFolder(const QModelIndex &mi)
folderItem->parent()->data(Columns::Path).toString() + "/" + name, folderItem->parent()->data(Columns::Path).toString() + "/" + name,
folderItem->data(Columns::Completed).toBool(), folderItem->data(Columns::Completed).toBool(),
folderItem->data(Columns::Finished).toBool(), folderItem->data(Columns::Finished).toBool(),
folderItem->data(Columns::Manga).toBool(),
folderItem->data(Columns::NumChildren).toInt(), folderItem->data(Columns::NumChildren).toInt(),
folderItem->data(Columns::FirstChildHash).toString(), folderItem->data(Columns::FirstChildHash).toString(),
folderItem->data(Columns::CustomImage).toString(), folderItem->data(Columns::CustomImage).toString(),
@ -605,7 +598,6 @@ QModelIndex FolderModel::addFolderAtParent(const QString &folderName, const QMod
newFolder.name = folderName; newFolder.name = folderName;
newFolder.parentId = parentItem->id; newFolder.parentId = parentItem->id;
newFolder.path = parentItem->data(Columns::Path).toString() + "/" + folderName; newFolder.path = parentItem->data(Columns::Path).toString() + "/" + folderName;
newFolder.manga = parentItem->data(Columns::Manga).toBool();
newFolder.type = parentItem->data(Columns::Type).value<YACReader::FileType>(); newFolder.type = parentItem->data(Columns::Type).value<YACReader::FileType>();
QString connectionName = ""; QString connectionName = "";
@ -624,7 +616,6 @@ QModelIndex FolderModel::addFolderAtParent(const QString &folderName, const QMod
data << newFolder.path; data << newFolder.path;
data << false; // finished data << false; // finished
data << true; // completed data << true; // completed
data << newFolder.manga;
data << 0; // numChildren data << 0; // numChildren
data << QVariant(); // first child hash, new folder is empty data << QVariant(); // first child hash, new folder is empty
data << QVariant(); // custom cover data << QVariant(); // custom cover

View File

@ -89,7 +89,6 @@ public:
Path, Path,
Finished, Finished,
Completed, Completed,
Manga, // deprecated
NumChildren, NumChildren,
FirstChildHash, FirstChildHash,
CustomImage, CustomImage,
@ -102,7 +101,6 @@ public:
FinishedRole = Qt::UserRole + 1, FinishedRole = Qt::UserRole + 1,
CompletedRole, CompletedRole,
IdRole, IdRole,
MangaRole, // deprecated
CoverPathRole, CoverPathRole,
FolderNameRole, FolderNameRole,
NumChildrenRole, NumChildrenRole,

View File

@ -637,7 +637,7 @@ void DBHelper::update(ComicInfo *comicInfo, QSqlDatabase &db)
//-- //--
// new 9.8 fields // new 9.8 fields
"manga = :manga," // "manga = :manga," removed in 9.13
//-- //--
// new 9.13 fields // new 9.13 fields
@ -688,7 +688,6 @@ void DBHelper::update(ComicInfo *comicInfo, QSqlDatabase &db)
updateComicInfo.bindValue(":format", comicInfo->format); updateComicInfo.bindValue(":format", comicInfo->format);
updateComicInfo.bindValue(":color", comicInfo->color); updateComicInfo.bindValue(":color", comicInfo->color);
updateComicInfo.bindValue(":ageRating", comicInfo->ageRating); updateComicInfo.bindValue(":ageRating", comicInfo->ageRating);
updateComicInfo.bindValue(":manga", comicInfo->manga);
updateComicInfo.bindValue(":synopsis", comicInfo->synopsis); updateComicInfo.bindValue(":synopsis", comicInfo->synopsis);
updateComicInfo.bindValue(":characters", comicInfo->characters); updateComicInfo.bindValue(":characters", comicInfo->characters);
@ -1426,7 +1425,6 @@ QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat
int path = record.indexOf("path"); int path = record.indexOf("path");
int finished = record.indexOf("finished"); int finished = record.indexOf("finished");
int completed = record.indexOf("completed"); int completed = record.indexOf("completed");
int manga = record.indexOf("manga");
int id = record.indexOf("id"); int id = record.indexOf("id");
int numChildren = record.indexOf("numChildren"); int numChildren = record.indexOf("numChildren");
int firstChildHash = record.indexOf("firstChildHash"); int firstChildHash = record.indexOf("firstChildHash");
@ -1447,7 +1445,6 @@ QList<LibraryItem *> DBHelper::getFoldersFromParent(qulonglong parentId, QSqlDat
} }
currentItem->firstChildHash = selectQuery.value(firstChildHash).toString(); currentItem->firstChildHash = selectQuery.value(firstChildHash).toString();
currentItem->customImage = selectQuery.value(customImage).toString(); currentItem->customImage = selectQuery.value(customImage).toString();
currentItem->manga = selectQuery.value(manga).toBool();
currentItem->type = selectQuery.value(type).value<YACReader::FileType>(); currentItem->type = selectQuery.value(type).value<YACReader::FileType>();
currentItem->added = selectQuery.value(added).toLongLong(); currentItem->added = selectQuery.value(added).toLongLong();
currentItem->updated = selectQuery.value(updated).toLongLong(); currentItem->updated = selectQuery.value(updated).toLongLong();
@ -1679,7 +1676,6 @@ void DBHelper::readFolderFromQuery(Folder &folder, QSqlQuery &query)
int path = record.indexOf("path"); int path = record.indexOf("path");
int finished = record.indexOf("finished"); int finished = record.indexOf("finished");
int completed = record.indexOf("completed"); int completed = record.indexOf("completed");
int manga = record.indexOf("manga");
int numChildren = record.indexOf("numChildren"); int numChildren = record.indexOf("numChildren");
int firstChildHash = record.indexOf("firstChildHash"); int firstChildHash = record.indexOf("firstChildHash");
int customImage = record.indexOf("customImage"); int customImage = record.indexOf("customImage");
@ -1706,7 +1702,7 @@ void DBHelper::readFolderFromQuery(Folder &folder, QSqlQuery &query)
folder.customImage = query.value(customImage).toString(); folder.customImage = query.value(customImage).toString();
// new 9.8 // new 9.8
folder.manga = query.value(manga).toBool(); // folder.manga = query.value(manga).toBool(); //removed in 9.13
// new 9.13 // new 9.13
folder.type = query.value(type).value<YACReader::FileType>(); folder.type = query.value(type).value<YACReader::FileType>();
@ -1831,7 +1827,6 @@ ComicInfo DBHelper::getComicInfoFromQuery(QSqlQuery &query, const QString &idKey
int format = record.indexOf("format"); int format = record.indexOf("format");
int color = record.indexOf("color"); int color = record.indexOf("color");
int ageRating = record.indexOf("ageRating"); int ageRating = record.indexOf("ageRating");
int manga = record.indexOf("manga");
int synopsis = record.indexOf("synopsis"); int synopsis = record.indexOf("synopsis");
int characters = record.indexOf("characters"); int characters = record.indexOf("characters");
@ -1921,7 +1916,7 @@ ComicInfo DBHelper::getComicInfoFromQuery(QSqlQuery &query, const QString &idKey
//-- //--
// new 9.8 fields // new 9.8 fields
comicInfo.manga = query.value(manga); // comicInfo.manga = query.value(manga); // removed in 9.13
//-- //--
// new 9.13 fields // new 9.13 fields

View File

@ -234,7 +234,6 @@ qulonglong LibraryCreator::insertFolders()
for (i = _currentPathFolders.begin(); i != _currentPathFolders.end(); ++i) { for (i = _currentPathFolders.begin(); i != _currentPathFolders.end(); ++i) {
if (!(i->knownId)) { if (!(i->knownId)) {
i->setFather(currentId); i->setFather(currentId);
i->manga = currentParent.manga;
i->type = currentParent.type; i->type = currentParent.type;
currentId = DBHelper::insert(&(*i), _database); // insertFolder(currentId,*i); currentId = DBHelper::insert(&(*i), _database); // insertFolder(currentId,*i);
i->setId(currentId); i->setId(currentId);
@ -333,7 +332,6 @@ void LibraryCreator::insertComic(const QString &relativePath, const QFileInfo &f
} }
comic.parentId = _currentPathFolders.last().id; comic.parentId = _currentPathFolders.last().id;
comic.info.manga = _currentPathFolders.last().manga;
comic.info.type = QVariant::fromValue(_currentPathFolders.last().type); // TODO_METADATA test this comic.info.type = QVariant::fromValue(_currentPathFolders.last().type); // TODO_METADATA test this
DBHelper::insert(&comic, _database, parsed); DBHelper::insert(&comic, _database, parsed);

View File

@ -105,8 +105,9 @@ QString ComicDB::toTXT()
if (!info.ageRating.isNull()) if (!info.ageRating.isNull())
txt.append(QString("ageRating:%1\r\n").arg(info.ageRating.toString())); txt.append(QString("ageRating:%1\r\n").arg(info.ageRating.toString()));
if (!info.manga.isNull()) if (!info.type.isNull())
txt.append(QString("manga:%1\r\n").arg(info.manga.toString())); txt.append(QString("manga:%1\r\n").arg(info.type.value<YACReader::FileType>() == YACReader::FileType::Manga ? "1" : "0"));
// Argumento // Argumento
if (!info.synopsis.isNull()) if (!info.synopsis.isNull())
txt.append(QString("synopsis:%1\r\n").arg(info.synopsis.toString())); txt.append(QString("synopsis:%1\r\n").arg(info.synopsis.toString()));
@ -308,7 +309,6 @@ void ComicInfo::deleteMetadata()
format = QVariant(); format = QVariant();
color = QVariant(); color = QVariant();
ageRating = QVariant(); ageRating = QVariant();
manga = QVariant();
synopsis = QVariant(); synopsis = QVariant();
characters = QVariant(); characters = QVariant();
@ -372,7 +372,6 @@ ComicInfo &ComicInfo::operator=(const ComicInfo &comicInfo)
publisher = comicInfo.publisher; publisher = comicInfo.publisher;
format = comicInfo.format; format = comicInfo.format;
color = comicInfo.color; color = comicInfo.color;
manga = comicInfo.manga;
ageRating = comicInfo.ageRating; ageRating = comicInfo.ageRating;
synopsis = comicInfo.synopsis; synopsis = comicInfo.synopsis;
characters = comicInfo.characters; characters = comicInfo.characters;
@ -655,7 +654,6 @@ QDataStream &operator<<(QDataStream &stream, const ComicInfo &comicInfo)
stream << comicInfo.format; stream << comicInfo.format;
stream << comicInfo.color; stream << comicInfo.color;
stream << comicInfo.ageRating; stream << comicInfo.ageRating;
stream << comicInfo.manga;
stream << comicInfo.synopsis; stream << comicInfo.synopsis;
stream << comicInfo.characters; stream << comicInfo.characters;
@ -735,7 +733,6 @@ QDataStream &operator>>(QDataStream &stream, ComicInfo &comicInfo)
stream >> comicInfo.format; stream >> comicInfo.format;
stream >> comicInfo.color; stream >> comicInfo.color;
stream >> comicInfo.ageRating; stream >> comicInfo.ageRating;
stream >> comicInfo.manga;
stream >> comicInfo.synopsis; stream >> comicInfo.synopsis;
stream >> comicInfo.characters; stream >> comicInfo.characters;

View File

@ -80,7 +80,6 @@ public:
QVariant format; // string QVariant format; // string
QVariant color; // bool QVariant color; // bool
QVariant ageRating; // string QVariant ageRating; // string
[[deprecated("use type instead")]] QVariant manga; // bool
QVariant synopsis; // string QVariant synopsis; // string
QVariant characters; // string QVariant characters; // string
@ -186,7 +185,6 @@ public:
Q_PROPERTY(QVariant format MEMBER format CONSTANT) Q_PROPERTY(QVariant format MEMBER format CONSTANT)
Q_PROPERTY(QVariant color MEMBER color CONSTANT) Q_PROPERTY(QVariant color MEMBER color CONSTANT)
Q_PROPERTY(QVariant ageRating MEMBER ageRating CONSTANT) Q_PROPERTY(QVariant ageRating MEMBER ageRating CONSTANT)
Q_PROPERTY(QVariant manga MEMBER manga CONSTANT)
Q_PROPERTY(QVariant synopsis MEMBER synopsis CONSTANT) Q_PROPERTY(QVariant synopsis MEMBER synopsis CONSTANT)
Q_PROPERTY(QVariant characters MEMBER characters CONSTANT) Q_PROPERTY(QVariant characters MEMBER characters CONSTANT)

View File

@ -3,7 +3,6 @@
Folder::Folder() Folder::Folder()
: knownParent(false), : knownParent(false),
knownId(false), knownId(false),
manga(false),
numChildren(-1) numChildren(-1)
{ {
} }
@ -11,7 +10,6 @@ Folder::Folder()
Folder::Folder(qulonglong folderId, qulonglong parentId, const QString &folderName, const QString &folderPath) Folder::Folder(qulonglong folderId, qulonglong parentId, const QString &folderName, const QString &folderPath)
: knownParent(true), : knownParent(true),
knownId(true), knownId(true),
manga(false),
numChildren(-1) numChildren(-1)
{ {
this->id = folderId; this->id = folderId;
@ -26,7 +24,6 @@ Folder::Folder(qulonglong folderId,
const QString &folderPath, const QString &folderPath,
bool completed, bool completed,
bool finished, bool finished,
bool manga,
int numChildren, int numChildren,
const QString &firstChildHash, const QString &firstChildHash,
const QString &customImage, const QString &customImage,
@ -43,7 +40,6 @@ Folder::Folder(qulonglong folderId,
this->path = folderPath; this->path = folderPath;
this->completed = completed; this->completed = completed;
this->finished = finished; this->finished = finished;
this->manga = manga;
this->numChildren = numChildren; this->numChildren = numChildren;
this->firstChildHash = firstChildHash; this->firstChildHash = firstChildHash;
this->customImage = customImage; this->customImage = customImage;
@ -65,7 +61,6 @@ Folder &Folder::operator=(const Folder &other)
this->knownId = other.knownId; this->knownId = other.knownId;
this->finished = other.finished; this->finished = other.finished;
this->completed = other.completed; this->completed = other.completed;
this->manga = other.manga;
this->numChildren = other.numChildren; this->numChildren = other.numChildren;
this->firstChildHash = other.firstChildHash; this->firstChildHash = other.firstChildHash;
this->customImage = other.customImage; this->customImage = other.customImage;

View File

@ -14,7 +14,6 @@ public:
bool finished; // finished means read, the user has read all the content in this folder bool finished; // finished means read, the user has read all the content in this folder
bool completed; // completed means the folder has all the content, e.g. a series got its final issue and the user has collected all of them bool completed; // completed means the folder has all the content, e.g. a series got its final issue and the user has collected all of them
[[deprecated("use type instead")]] bool manga;
qint32 numChildren; //-1 for unknown number of children qint32 numChildren; //-1 for unknown number of children
QString firstChildHash; // empty for unknown first child QString firstChildHash; // empty for unknown first child
@ -32,7 +31,6 @@ public:
const QString &folderPath, const QString &folderPath,
bool completed, bool completed,
bool finished, bool finished,
bool manga,
int numChildren, int numChildren,
const QString &firstChildHash, const QString &firstChildHash,
const QString &customImage, const QString &customImage,