Make jumpToPage strip-aware
[qcomicbook-oblomov] / src / bookmarks.h
1 /*
2  * This file is a part of QComicBook.
3  *
4  * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
5  *
6  * QComicBook is free software; you can redestribute it and/or modify it
7  * under terms of GNU General Public License by Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY. See GPL for more details.
11  */
12
13 /*! \file bookmarks.h */
14
15 #ifndef __BOOKMARKS_H
16 #define __BOOKMARKS_H
17
18 #include <qstring.h>
19 #include <qvaluelist.h>
20 #include <qptrlist.h>
21 #include <qmap.h>
22 #include "bookmark.h"
23
24 class QPopupMenu;
25
26 namespace QComicBook
27 {
28         class Bookmarks
29         {
30                 private:
31                         QPtrList<Bookmark> blist; //!<pointers to bookmark objects
32                         QMap<int, Bookmark *> bmap; //!<for fast id->bookmark lookup
33                         QPopupMenu *bmenu; //!<popup menu containing bookmarks
34                         bool changed; //!<flag indicator to decide if bookmarks should be saved
35                         QString fname; //!<bookmarks file
36
37                 public:
38                         Bookmarks(QPopupMenu *menu);
39                         ~Bookmarks();
40                         bool load();
41                         bool save();
42
43                         void set(const QString &cbname, int page);
44                         bool remove(const QString &cbname);
45                         bool remove(int id);
46                         bool get(int id, Bookmark &b);
47                         QValueList<Bookmark> get();
48                         bool exists(const QString &cbname);
49         };
50 }
51
52 #endif
53