~moshe-wagner/orayta/Orayta-QT

« back to all changes in this revision

Viewing changes to booklist.h

  • Committer: moshe.wagner
  • Date: 2012-05-05 21:48:52 UTC
  • Revision ID: git-v1:70e09345355d8f7ecaf4ec2176a47d02dea9bcb7
Making the android branch into the main one

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
*
 
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.
 
9
*
 
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
 
13
*
 
14
* Author: Moshe Wagner. <moshe.wagner@gmail.com>
 
15
*/
 
16
 
 
17
#ifndef BookList_H
 
18
#define BookList_H
 
19
 
 
20
#include "book.h"
 
21
 
 
22
//A BookList, basically a vector of books, but with functions associated with it
 
23
class BookList : public vector<Book *>
 
24
{
 
25
public:
 
26
    BookList();
 
27
    ~BookList();
 
28
 
 
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);
 
34
 
 
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);
 
39
 
 
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 *);
 
46
 
 
47
 
 
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);
 
56
 
 
57
    vector<Book*> BooksInSearch (void);
 
58
    vector<Book*> Children ( Book* book );
 
59
 
 
60
    void CheckUid();
 
61
 
 
62
    //Display the booklist in the given QTreeWidget
 
63
    void displayInTree(QTreeWidget *tree, bool showCheck);
 
64
 
 
65
private:
 
66
};
 
67
 
 
68
#endif // BookList_H