Extended BibleGateway integration, now loads chapters
[kworship.git] / kworship / bible / KwBibleModuleBibleGateway.h
blob291f704996323db5cb159e32f2105417653a7fde
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwBibleModuleBibleGateway_h_
21 #define _KwBibleModuleBibleGateway_h_
23 /**
24 * @file KwBibleModuleBibleGateway.h
25 * @brief A BibleGateway bible module.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwBibleModule.h"
31 #include <KUrl>
33 #include <QList>
35 /// A BibleGateway bible module.
36 class KwBibleModuleBibleGateway : public KwBibleModule
38 public:
41 * Constructors + destructor
44 /// Default constructor.
45 KwBibleModuleBibleGateway(int id);
47 /// Destructor.
48 virtual ~KwBibleModuleBibleGateway();
51 * Main interface
54 // Reimplemented
55 virtual QString name();
57 // Reimplemented
58 virtual QString description();
60 // Reimplemented
61 virtual int numChapters(int book);
63 // Reimplemented
64 virtual int numVerses(int book, int chapter);
66 // Reimplemented
67 virtual QString renderText(const KwBibleModule::Key& key);
69 protected:
72 * Protected virtual interface
75 // Reimplemented
76 virtual void obtainBooks();
78 private:
81 * Private functions
84 struct Chapter;
86 /// Ensure chapter contents are fetched and return the chapter object.
87 struct Chapter* fetchChapter(int book, int chapter);
90 * Variables
93 /// The name of the publisher.
94 QString m_publisher;
96 /// The long version information.
97 QString m_versionInfo;
99 /// The long copyright information.
100 QString m_copyrightInfo;
102 /// Chapter data.
103 struct Chapter
105 /// BibleGateway.com URL for this chapter.
106 KUrl url;
108 /// Whether the verses have been fetched.
109 bool fetched;
111 /// List of verse contents.
112 QStringList verses;
115 /// Book data.
116 struct Book
118 /// Name of the book.
119 QString name;
121 /// List of chapter information.
122 QList<Chapter> chapters;
125 /// List of books.
126 QList<Book> m_bookList;
129 #endif // _KwBibleModuleBibleGateway_h_