mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added support for loading the content of a realing list
This commit is contained in:
parent
6b12e7ecbf
commit
b80c72f70d
@ -325,6 +325,29 @@ void ComicModel::setupLabelModelData(unsigned long long parentLabel, const QStri
|
||||
emit isEmpty();*/
|
||||
}
|
||||
|
||||
void ComicModel::setupReadingListModelData(unsigned long long parentReadingList, const QString &databasePath)
|
||||
{
|
||||
beginResetModel();
|
||||
qDeleteAll(_data);
|
||||
_data.clear();
|
||||
|
||||
_databasePath = databasePath;
|
||||
QSqlDatabase db = DataBaseManagement::loadDatabase(databasePath);
|
||||
{
|
||||
QSqlQuery selectQuery(db);
|
||||
selectQuery.prepare("SELECT ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read,ci.isBis,ci.currentPage,ci.rating,ci.hasBeenOpened "
|
||||
"FROM comic c INNER JOIN comic_info ci ON (c.comicInfoId = ci.id) "
|
||||
"INNER JOIN comic_reading_list crl ON (c.id == crl.comic_id) "
|
||||
"WHERE crl.reading_list_id = :parentReadingList");
|
||||
selectQuery.bindValue(":parentReadingList", parentReadingList);
|
||||
selectQuery.exec();
|
||||
setupModelData(selectQuery);
|
||||
}
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(_databasePath);
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void ComicModel::setupFavoritesModelData(const QString &databasePath)
|
||||
{
|
||||
beginResetModel();
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
void setupFolderModelData(unsigned long long int parentFolder,const QString & databasePath);
|
||||
void setupLabelModelData(unsigned long long int parentLabel, const QString & databasePath);
|
||||
void setupReadingListModelData(unsigned long long int parentReadingList, const QString & databasePath);
|
||||
void setupFavoritesModelData(const QString & databasePath);
|
||||
void setupReadingModelData(const QString & databasePath);
|
||||
//configures the model for showing the comics matching the filter criteria.
|
||||
|
@ -166,8 +166,22 @@ void YACReaderNavigationController::loadLabelInfo(const QModelIndex &modelIndex)
|
||||
|
||||
void YACReaderNavigationController::loadReadingListInfo(const QModelIndex &modelIndex)
|
||||
{
|
||||
libraryWindow->showEmptyReadingListWidget();
|
||||
libraryWindow->disableComicsActions(true);
|
||||
qulonglong id = modelIndex.data(ReadingListModel::IDRole).toULongLong();
|
||||
//check comics in label with id = id
|
||||
libraryWindow->comicsModel->setupReadingListModelData(id,libraryWindow->foldersModel->getDatabase());
|
||||
libraryWindow->comicsView->setModel(libraryWindow->comicsModel);
|
||||
|
||||
//configure views
|
||||
if(libraryWindow->comicsModel->rowCount() > 0)
|
||||
{
|
||||
//updateView
|
||||
libraryWindow->showComicsView();
|
||||
libraryWindow->disableComicsActions(false);
|
||||
}
|
||||
else{
|
||||
libraryWindow->showEmptyReadingListWidget();
|
||||
libraryWindow->disableComicsActions(true);
|
||||
}
|
||||
}
|
||||
|
||||
void YACReaderNavigationController::selectedList(const QModelIndex &mi)
|
||||
|
Loading…
x
Reference in New Issue
Block a user