Get/set new manga field from/to the db

This commit is contained in:
Luis Ángel San Martín 2021-01-16 18:30:25 +01:00
parent f7fa4adbd0
commit 60de69635b
3 changed files with 23 additions and 1 deletions

View File

@ -649,10 +649,12 @@ void DBHelper::update(const Folder &folder, QSqlDatabase &db)
QSqlQuery updateFolderInfo(db);
updateFolderInfo.prepare("UPDATE folder SET "
"finished = :finished, "
"completed = :completed "
"completed = :completed, "
"manga = :manga "
"WHERE id = :id ");
updateFolderInfo.bindValue(":finished", folder.isFinished() ? 1 : 0);
updateFolderInfo.bindValue(":completed", folder.isCompleted() ? 1 : 0);
updateFolderInfo.bindValue(":manga", folder.isManga() ? 1 : 0);
updateFolderInfo.bindValue(":id", folder.id);
updateFolderInfo.exec();
}
@ -1535,6 +1537,7 @@ Folder DBHelper::loadFolder(qulonglong id, QSqlDatabase &db)
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");
@ -1554,6 +1557,9 @@ Folder DBHelper::loadFolder(qulonglong id, QSqlDatabase &db)
folder.setNumChildren(query.value(numChildren).toInt());
folder.setFirstChildHash(query.value(firstChildHash).toString());
folder.setCustomImage(query.value(customImage).toString());
//new 9.8
folder.setManga(query.value(manga).toBool());
}
return folder;
@ -1576,6 +1582,7 @@ Folder DBHelper::loadFolder(const QString &folderName, qulonglong parentId, QSql
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");
@ -1596,6 +1603,9 @@ Folder DBHelper::loadFolder(const QString &folderName, qulonglong parentId, QSql
folder.setNumChildren(query.value(numChildren).toInt());
folder.setFirstChildHash(query.value(firstChildHash).toString());
folder.setCustomImage(query.value(customImage).toString());
//new 9.8
folder.setManga(query.value(manga).toBool());
}
return folder;

View File

@ -31,6 +31,7 @@ Folder &Folder::operator=(const Folder &other)
this->knownId = other.knownId;
this->finished = other.finished;
this->completed = other.completed;
this->manga = other.manga;
return *this;
}

View File

@ -43,6 +43,11 @@ public:
return completed;
}
inline bool isManga() const
{
return manga;
}
inline void setFinished(bool b)
{
finished = b;
@ -53,6 +58,11 @@ public:
completed = b;
}
inline void setManga(bool b)
{
manga = b;
}
inline qint32 getNumChildren() const
{
return numChildren;
@ -86,6 +96,7 @@ public:
private:
bool finished;
bool completed;
bool manga;
qint32 numChildren; //-1 for unknown number of children
QString firstChildHash; //empty for unknown first child