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...
//"originalCoverSize," // h/w
// new 9.8 fields
"manga,"
// "manga," //removed in 9.13
// new 9.13 fields
"added,"
"type,"
@ -315,7 +315,7 @@ bool DataBaseManagement::createV8Tables(QSqlDatabase &database)
"name TEXT NOT NULL, "
"finished BOOLEAN DEFAULT 0, "
"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)");
QSqlQuery queryIndexReadingList(database);
@ -485,7 +485,7 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
//--
// new 9.8 fields
"manga = :manga,"
// "manga = :manga," //removed in 9.13
// new 9.13 fields
"added = :added,"
@ -539,7 +539,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
"comicVineID,"
"lastTimeOpened,"
"coverSizeRatio,"
"manga,"
"added,"
"type,"
"editor,"
@ -582,7 +581,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
":format,"
":color,"
":ageRating,"
":manga,"
":synopsis,"
":characters,"
@ -597,7 +595,6 @@ bool DataBaseManagement::importComicsInfo(QString source, QString dest)
":coverSizeRatio,"
":originalCoverSize,"
":manga,"
":added,"
":type,"
":editor,"
@ -704,7 +701,6 @@ void DataBaseManagement::bindValuesFromRecord(const QSqlRecord &record, QSqlQuer
bindValue("format", record, query);
bindValue("color", record, query);
bindValue("ageRating", record, query);
bindValue("manga", record, query);
bindValue("synopsis", record, query);
bindValue("characters", record, query);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@
Folder::Folder()
: knownParent(false),
knownId(false),
manga(false),
numChildren(-1)
{
}
@ -11,7 +10,6 @@ Folder::Folder()
Folder::Folder(qulonglong folderId, qulonglong parentId, const QString &folderName, const QString &folderPath)
: knownParent(true),
knownId(true),
manga(false),
numChildren(-1)
{
this->id = folderId;
@ -26,7 +24,6 @@ Folder::Folder(qulonglong folderId,
const QString &folderPath,
bool completed,
bool finished,
bool manga,
int numChildren,
const QString &firstChildHash,
const QString &customImage,
@ -43,7 +40,6 @@ Folder::Folder(qulonglong folderId,
this->path = folderPath;
this->completed = completed;
this->finished = finished;
this->manga = manga;
this->numChildren = numChildren;
this->firstChildHash = firstChildHash;
this->customImage = customImage;
@ -65,7 +61,6 @@ Folder &Folder::operator=(const Folder &other)
this->knownId = other.knownId;
this->finished = other.finished;
this->completed = other.completed;
this->manga = other.manga;
this->numChildren = other.numChildren;
this->firstChildHash = other.firstChildHash;
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 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
QString firstChildHash; // empty for unknown first child
@ -32,7 +31,6 @@ public:
const QString &folderPath,
bool completed,
bool finished,
bool manga,
int numChildren,
const QString &firstChildHash,
const QString &customImage,