1
/* This program is free software; you can redistribute it and/or modify
2
* it under the terms of the GNU General Public License version 2
3
* as published by the Free Software Foundation.
5
* This program is distributed in the hope that it will be useful,
6
* but WITHOUT ANY WARRANTY; without even the implied warranty of
7
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8
* GNU General Public License for more details.
10
* You should have received a copy of the GNU General Public License
11
* along with this program; if not, write to the Free Software
12
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
* Author: Moshe Wagner. <moshe.wagner@gmail.com>
22
//A BookList, basically a vector of books, but with functions associated with it
23
class BookList : public vector<Book *>
29
//Return the index of the book with the given UniqueId - in the book list
30
// (Returns -1 if it doesn't exist)
31
int FindBookById(int id);
32
//Same function but returns a pointer to the book
33
Book* findBookById(int id);
35
//Return pointer to the book with the given name/filepath
36
// (Returns NULL if it dosen't exist)
37
Book* FindBookByName (QString name);
38
Book* FindBookByPath (QString path);
40
//Return the index of the book with the given TreeWidgetItem - in the book list
41
// (Returns -1 if it doesn't exist)
42
int FindBookByTWI(QTreeWidgetItem *);
43
//Same function but returns a pointer to the book
44
// (Returns NULL if it doesn't exist)
45
Book* findBookByTWI(QTreeWidgetItem *);
48
//Builds the booklist from all fles within the given folder
49
// (Simply calls "addAllBooks")
50
void BuildFromFolder(QString dirpath, bool userBooks = false);
51
// Recursivly add all book files to the list
52
void addAllBooks (QString dirpath, bool userBooks = false, int parentindex = -1);
53
//Add the book's confs, from it's conf text
54
void AddBookConfs(Book *book, QList<QString> text);
55
//void AddBookConfs(Book *book, QString filename);
57
vector<Book*> BooksInSearch (void);
58
vector<Book*> Children ( Book* book );
62
//Display the booklist in the given QTreeWidget
63
void displayInTree(QTreeWidget *tree, bool showCheck);