mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Current comic view only makes sense for folders and reading lists.
This commit is contained in:
parent
4be84c6845
commit
450997762e
@ -21,6 +21,50 @@ class ComicModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns {
|
||||
Number = 0,
|
||||
Title = 1,
|
||||
FileName = 2,
|
||||
NumPages = 3,
|
||||
Id = 4,
|
||||
Parent_Id = 5,
|
||||
Path = 6,
|
||||
Hash = 7,
|
||||
ReadColumn = 8,
|
||||
IsBis = 9,
|
||||
CurrentPage = 10,
|
||||
Rating = 11,
|
||||
HasBeenOpened = 12
|
||||
};
|
||||
|
||||
enum Roles {
|
||||
NumberRole = Qt::UserRole + 1,
|
||||
TitleRole,
|
||||
FileNameRole,
|
||||
NumPagesRole,
|
||||
IdRole,
|
||||
Parent_IdRole,
|
||||
PathRole,
|
||||
HashRole,
|
||||
ReadColumnRole,
|
||||
IsBisRole,
|
||||
CurrentPageRole,
|
||||
RatingRole,
|
||||
HasBeenOpenedRole,
|
||||
CoverPathRole
|
||||
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Folder,
|
||||
Favorites,
|
||||
Reading,
|
||||
Label,
|
||||
ReadingList
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
ComicModel(QObject *parent = 0);
|
||||
ComicModel( QSqlQuery &sqlquery, QObject *parent = 0);
|
||||
@ -86,52 +130,10 @@ public:
|
||||
|
||||
bool isFavorite(const QModelIndex &index);
|
||||
|
||||
ComicModel::Mode getMode() {return mode;}
|
||||
|
||||
QHash<int, QByteArray> roleNames() const;
|
||||
|
||||
enum Columns {
|
||||
Number = 0,
|
||||
Title = 1,
|
||||
FileName = 2,
|
||||
NumPages = 3,
|
||||
Id = 4,
|
||||
Parent_Id = 5,
|
||||
Path = 6,
|
||||
Hash = 7,
|
||||
ReadColumn = 8,
|
||||
IsBis = 9,
|
||||
CurrentPage = 10,
|
||||
Rating = 11,
|
||||
HasBeenOpened = 12
|
||||
};
|
||||
|
||||
enum Roles {
|
||||
NumberRole = Qt::UserRole + 1,
|
||||
TitleRole,
|
||||
FileNameRole,
|
||||
NumPagesRole,
|
||||
IdRole,
|
||||
Parent_IdRole,
|
||||
PathRole,
|
||||
HashRole,
|
||||
ReadColumnRole,
|
||||
IsBisRole,
|
||||
CurrentPageRole,
|
||||
RatingRole,
|
||||
HasBeenOpenedRole,
|
||||
CoverPathRole
|
||||
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Folder,
|
||||
Favorites,
|
||||
Reading,
|
||||
Label,
|
||||
ReadingList
|
||||
};
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
void remove(int row);
|
||||
void startTransaction();
|
||||
|
@ -455,7 +455,13 @@ void GridComicsView::setCurrentComicIfNeeded()
|
||||
|
||||
QQmlContext *ctxt = view->rootContext();
|
||||
|
||||
if (found && filterEnabled == false) {
|
||||
ComicModel::Mode mode = model->getMode();
|
||||
|
||||
bool showCurrentComic = found &&
|
||||
filterEnabled == false &&
|
||||
(mode == ComicModel::Mode::Folder || mode == ComicModel::Mode::ReadingList);
|
||||
|
||||
if (showCurrentComic) {
|
||||
ctxt->setContextProperty("currentComic", ¤tComic);
|
||||
ctxt->setContextProperty("currentComicInfo", &(currentComic.info));
|
||||
ctxt->setContextProperty("showCurrentComic", true);
|
||||
|
Loading…
Reference in New Issue
Block a user