Finished (for now) filling of bible passage and now renders html from it
[kworship.git] / kworship / bible / KwBibleModuleBibleGateway.h
blob9ac309a66cba514d78c5ab0cf04846d0f4f9bb2b
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 bool fillPassageVerse(int bookIndex, int chapterIndex, int verseIndex, KwBiblePassage* outPassage);
69 // Reimplemented
70 virtual QString renderText(const KwBibleModule::Key& key);
72 protected:
75 * Protected virtual interface
78 // Reimplemented
79 virtual void obtainBooks();
81 private:
84 * Private functions
87 struct Chapter;
89 /// Ensure chapter contents are fetched and return the chapter object.
90 struct Chapter* fetchChapter(int book, int chapter);
93 * Variables
96 /// The name of the publisher.
97 QString m_publisher;
99 /// The long version information.
100 QString m_versionInfo;
102 /// The long copyright information.
103 QString m_copyrightInfo;
105 /// Chapter data.
106 struct Chapter
108 /// BibleGateway.com URL for this chapter.
109 KUrl url;
111 /// Whether the verses have been fetched.
112 bool fetched;
114 /// List of verse contents.
115 QStringList verses;
118 /// Book data.
119 struct Book
121 /// Name of the book.
122 QString name;
124 /// List of chapter information.
125 QList<Chapter> chapters;
128 /// List of books.
129 QList<Book> m_bookList;
132 #endif // _KwBibleModuleBibleGateway_h_