mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
added a border to selected/mouseHover elements in the grid view
This commit is contained in:
80
common/bookmarks.h
Normal file
80
common/bookmarks.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef BOOKMARKS_H
|
||||
#define BOOKMARKS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QImage>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QDateTime>
|
||||
class BookmarksList
|
||||
{
|
||||
public:
|
||||
struct Bookmark {
|
||||
int lastPage;
|
||||
QList<int> bookmarks;
|
||||
QDateTime added;
|
||||
Bookmark():lastPage(0){};
|
||||
friend QDataStream & operator<< ( QDataStream & out, const Bookmark & bm )
|
||||
{
|
||||
out << bm.lastPage;
|
||||
out << bm.bookmarks;
|
||||
out << bm.added;
|
||||
return out;
|
||||
}
|
||||
friend QDataStream & operator>> ( QDataStream & in, Bookmark & bm )
|
||||
{
|
||||
in >> bm.lastPage;
|
||||
in >> bm.bookmarks;
|
||||
in >> bm.added;
|
||||
return in;
|
||||
}
|
||||
|
||||
};
|
||||
BookmarksList():numMaxBookmarks(400){}
|
||||
void load();
|
||||
void save();
|
||||
void add(const QString & comicID, const Bookmark & b);
|
||||
Bookmark get(const QString & comicID);
|
||||
protected:
|
||||
QMap<QString,Bookmark> list;
|
||||
void deleteOldest(int num);
|
||||
private:
|
||||
int numMaxBookmarks;
|
||||
|
||||
};
|
||||
|
||||
class Bookmarks : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
QString comicPath;
|
||||
//bookmarks setted by the user
|
||||
QMap<int,QImage> bookmarks;
|
||||
QList<int> latestBookmarks;
|
||||
//last page readed
|
||||
int lastPageIndex;
|
||||
QImage lastPage;
|
||||
BookmarksList list;
|
||||
QDateTime added;
|
||||
|
||||
public:
|
||||
Bookmarks();
|
||||
void setLastPage(int index,const QImage & page);
|
||||
void setBookmark(int index,const QImage & page);
|
||||
void removeBookmark(int index);
|
||||
QList<int> getBookmarkPages() const;
|
||||
QImage getBookmarkPixmap(int page) const;
|
||||
QImage getLastPagePixmap() const;
|
||||
int getLastPage() const;
|
||||
bool isBookmark(int page);
|
||||
bool imageLoaded(int page);
|
||||
void newComic(const QString & path);
|
||||
void clear();
|
||||
void save();
|
||||
bool load(const QList<int> & bookmarkIndexes, int lastPage);
|
||||
|
||||
};
|
||||
|
||||
#endif // BOOKMARKS_H
|
Reference in New Issue
Block a user