summaryrefslogtreecommitdiff
path: root/src/backend/rendering
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:58:34 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:58:34 -0400
commit1ea03c0fce8066c1e22188447b4a6ca4dcef1201 (patch)
tree1ad46980fdca402062502b20b7e16468b89393f8 /src/backend/rendering
parent579657c8cb4ecd8a313221e70bdbbc7267f20286 (diff)
Imported Upstream version 2.10.1
Diffstat (limited to 'src/backend/rendering')
-rw-r--r--src/backend/rendering/cbookdisplay.cpp2
-rw-r--r--src/backend/rendering/cbookdisplay.h4
-rw-r--r--src/backend/rendering/cchapterdisplay.cpp6
-rw-r--r--src/backend/rendering/cchapterdisplay.h4
-rw-r--r--src/backend/rendering/cdisplayrendering.cpp5
-rw-r--r--src/backend/rendering/cdisplayrendering.h9
-rw-r--r--src/backend/rendering/centrydisplay.cpp7
-rw-r--r--src/backend/rendering/centrydisplay.h8
-rw-r--r--src/backend/rendering/chtmlexportrendering.cpp30
-rw-r--r--src/backend/rendering/chtmlexportrendering.h12
-rw-r--r--src/backend/rendering/cplaintextexportrendering.cpp2
-rw-r--r--src/backend/rendering/cplaintextexportrendering.h9
-rw-r--r--src/backend/rendering/ctextrendering.cpp25
-rw-r--r--src/backend/rendering/ctextrendering.h6
14 files changed, 79 insertions, 50 deletions
diff --git a/src/backend/rendering/cbookdisplay.cpp b/src/backend/rendering/cbookdisplay.cpp
index 6589e99..e139c6f 100644
--- a/src/backend/rendering/cbookdisplay.cpp
+++ b/src/backend/rendering/cbookdisplay.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
diff --git a/src/backend/rendering/cbookdisplay.h b/src/backend/rendering/cbookdisplay.h
index 4bd5c22..6ed1bba 100644
--- a/src/backend/rendering/cbookdisplay.h
+++ b/src/backend/rendering/cbookdisplay.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
diff --git a/src/backend/rendering/cchapterdisplay.cpp b/src/backend/rendering/cchapterdisplay.cpp
index eea2a72..e4fd1a1 100644
--- a/src/backend/rendering/cchapterdisplay.cpp
+++ b/src/backend/rendering/cchapterdisplay.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -42,13 +42,13 @@ const QString Rendering::CChapterDisplay::text(
Q_ASSERT((module->type() == CSwordModuleInfo::Bible));
if (module->type() == CSwordModuleInfo::Bible) {
- ((sword::VerseKey*)(module->module()->getKey()))->Headings(1); //HACK: enable headings for VerseKeys
+ ((sword::VerseKey*)(module->module()->getKey()))->setIntros(true); //HACK: enable headings for VerseKeys
Q_ASSERT(dynamic_cast<const CSBMI*>(module) != 0);
const CSBMI *bible = static_cast<const CSBMI*>(module);
CSwordVerseKey k1(module);
- k1.Headings(1);
+ k1.setIntros(true);
k1.setKey(keyName);
if (k1.getChapter() == 1)
diff --git a/src/backend/rendering/cchapterdisplay.h b/src/backend/rendering/cchapterdisplay.h
index c245c57..b19f103 100644
--- a/src/backend/rendering/cchapterdisplay.h
+++ b/src/backend/rendering/cchapterdisplay.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
diff --git a/src/backend/rendering/cdisplayrendering.cpp b/src/backend/rendering/cdisplayrendering.cpp
index bd5aa87..cbcc046 100644
--- a/src/backend/rendering/cdisplayrendering.cpp
+++ b/src/backend/rendering/cdisplayrendering.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -15,6 +15,7 @@
#include "backend/keys/cswordversekey.h"
#include "backend/managers/cdisplaytemplatemgr.h"
#include "backend/managers/referencemanager.h"
+#include "backend/config/btconfig.h"
namespace Rendering {
@@ -33,7 +34,7 @@ QString CDisplayRendering::entryLink(const KeyTreeItem &item,
const bool isBible = module && (module->type() == CSwordModuleInfo::Bible);
CSwordVerseKey vk(module); //only valid for bible modules, i.e. isBible == true
- vk.Headings(true);
+ vk.setIntros(true);
if (isBible) {
vk.setKey(item.key());
diff --git a/src/backend/rendering/cdisplayrendering.h b/src/backend/rendering/cdisplayrendering.h
index 362fc2a..da87b79 100644
--- a/src/backend/rendering/cdisplayrendering.h
+++ b/src/backend/rendering/cdisplayrendering.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -11,6 +13,7 @@
#define RENDERINGCDISPLAYRENDERING_H
#include "backend/rendering/chtmlexportrendering.h"
+#include "backend/config/btconfig.h"
namespace Rendering {
@@ -27,8 +30,8 @@ class CDisplayRendering : public CHTMLExportRendering {
static QString keyToHTMLAnchor(const QString &key);
CDisplayRendering(
- const DisplayOptions &displayOptions = CBTConfig::getDisplayOptionDefaults(),
- const FilterOptions &filterOptions = CBTConfig::getFilterOptionDefaults());
+ const DisplayOptions &displayOptions = btConfig().getDisplayOptions(),
+ const FilterOptions &filterOptions = btConfig().getFilterOptions());
protected: /* Methods: */
diff --git a/src/backend/rendering/centrydisplay.cpp b/src/backend/rendering/centrydisplay.cpp
index 7415eda..3dbe63f 100644
--- a/src/backend/rendering/centrydisplay.cpp
+++ b/src/backend/rendering/centrydisplay.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -12,7 +12,6 @@
#include <QApplication>
#include <QRegExp>
-#include "backend/config/cbtconfig.h"
#include "backend/drivers/cswordbookmoduleinfo.h"
#include "backend/keys/cswordkey.h"
#include "backend/keys/cswordversekey.h"
@@ -40,10 +39,10 @@ const QString CEntryDisplay::text(
//in Bibles and Commentaries we need to check if 0:0 and X:0 contain something
if (module->type() == CSwordModuleInfo::Bible || module->type() == CSwordModuleInfo::Commentary) {
- ((sword::VerseKey*)(module->module()->getKey()))->Headings(1); //HACK: enable headings for VerseKeys
+ ((sword::VerseKey*)(module->module()->getKey()))->setIntros(true); //HACK: enable headings for VerseKeys
CSwordVerseKey k1(module);
- k1.Headings(1);
+ k1.setIntros(true);
k1.setKey(keyName);
// don't print the key
diff --git a/src/backend/rendering/centrydisplay.h b/src/backend/rendering/centrydisplay.h
index 50b6447..8773eb7 100644
--- a/src/backend/rendering/centrydisplay.h
+++ b/src/backend/rendering/centrydisplay.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -14,7 +16,7 @@
// Sword includes:
#include <swdisp.h>
-
+#include <swmodule.h>
class CSwordModuleInfo;
struct DisplayOptions;
@@ -35,6 +37,8 @@ class CEntryDisplay: public sword::SWDisplay {
const DisplayOptions &displayOptions,
const FilterOptions &filterOptions);
+ virtual char display(sword::SWModule& mod) { (void)mod; return 'c';}
+
}; /* class CEntryDisplay */
} /* namespace Rendering */
diff --git a/src/backend/rendering/chtmlexportrendering.cpp b/src/backend/rendering/chtmlexportrendering.cpp
index 0e19897..7c467b1 100644
--- a/src/backend/rendering/chtmlexportrendering.cpp
+++ b/src/backend/rendering/chtmlexportrendering.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -65,7 +65,7 @@ QString CHTMLExportRendering::renderEntry(const KeyTreeItem& i, CSwordKey* k) {
ret.append(i.getAlternativeContent());
// Q_ASSERT(i.hasChildItems());
-
+
if (!i.childList()->isEmpty()) {
const KeyTree & tree = *i.childList();
@@ -97,7 +97,7 @@ QString CHTMLExportRendering::renderEntry(const KeyTreeItem& i, CSwordKey* k) {
CSwordVerseKey* myVK = dynamic_cast<CSwordVerseKey*>(key);
if (myVK) {
- myVK->Headings(1);
+ myVK->setIntros(true);
}
QString renderedText( (modules.count() > 1) ? "\n\t\t<tr>\n" : "\n" );
@@ -128,9 +128,9 @@ QString CHTMLExportRendering::renderEntry(const KeyTreeItem& i, CSwordKey* k) {
}
else {
langAttr = QString("xml:lang=\"")
- .append((*mod_Itr)->module()->Lang())
+ .append((*mod_Itr)->module()->getLanguage())
.append("\" lang=\"")
- .append((*mod_Itr)->module()->Lang())
+ .append((*mod_Itr)->module()->getLanguage())
.append("\"");
}
@@ -139,7 +139,7 @@ QString CHTMLExportRendering::renderEntry(const KeyTreeItem& i, CSwordKey* k) {
if (m_filterOptions.headings) {
// only process EntryAttributes, do not render, this might destroy the EntryAttributes again
- (*mod_Itr)->module()->RenderText(0, -1, 0);
+ (*mod_Itr)->module()->renderText(0, -1, 0);
sword::AttributeValue::const_iterator it =
(*mod_Itr)->module()->getEntryAttributes()["Heading"]["Preverse"].begin();
@@ -150,12 +150,16 @@ QString CHTMLExportRendering::renderEntry(const KeyTreeItem& i, CSwordKey* k) {
QString unfiltered = QString::fromUtf8(it->second.c_str());
/// \todo This is only a preliminary workaround to strip the tags:
- QRegExp filter("<title>(.*)</title>");
- if (unfiltered.indexOf(filter) >= 0) {
- preverseHeading = filter.cap(1);
- } else {
- preverseHeading = unfiltered;
+ QRegExp filter("(.*)<title[^>]*>(.*)</title>(.*)");
+ while(filter.indexIn(unfiltered) >= 0) {
+ unfiltered = filter.cap(1) + filter.cap(2) + filter.cap(3);
+ }
+ // Fiter out offending self-closing div tags, which are bad HTML
+ QRegExp ofilter("(.*)<div[^>]*/>(.*)");
+ while(ofilter.indexIn(unfiltered) >= 0) {
+ unfiltered = ofilter.cap(1) + ofilter.cap(2);
}
+ preverseHeading = unfiltered;
/// \todo Take care of the heading type!
if (!preverseHeading.isEmpty()) {
@@ -237,7 +241,9 @@ QString CHTMLExportRendering::finishText(const QString &text, const KeyTree &tre
settings.langAbbrev = "unknown";
}
- return CDTM::instance()->fillTemplate(QObject::tr("Export"), text, settings);
+ return CDTM::instance()->fillTemplate(CDisplayTemplateMgr::activeTemplateName(),
+ text,
+ settings);
}
/*!
diff --git a/src/backend/rendering/chtmlexportrendering.h b/src/backend/rendering/chtmlexportrendering.h
index db90707..51041a3 100644
--- a/src/backend/rendering/chtmlexportrendering.h
+++ b/src/backend/rendering/chtmlexportrendering.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -12,7 +14,7 @@
#include "backend/rendering/ctextrendering.h"
-#include "backend/config/cbtconfig.h"
+#include "backend/config/btconfig.h"
#include "backend/managers/cswordbackend.h"
#include "btglobal.h"
@@ -31,8 +33,10 @@ class CHTMLExportRendering: public CTextRendering {
CHTMLExportRendering(
bool addText,
- const DisplayOptions &displayOptions = CBTConfig::getDisplayOptionDefaults(),
- const FilterOptions &filterOptions = CBTConfig::getFilterOptionDefaults());
+ const DisplayOptions &displayOptions = btConfig().getDisplayOptions(),
+ const FilterOptions &filterOptions = btConfig().getFilterOptions());
+
+ ~CHTMLExportRendering() {};
protected: /* Methods: */
diff --git a/src/backend/rendering/cplaintextexportrendering.cpp b/src/backend/rendering/cplaintextexportrendering.cpp
index 4bff025..e462e53 100644
--- a/src/backend/rendering/cplaintextexportrendering.cpp
+++ b/src/backend/rendering/cplaintextexportrendering.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
diff --git a/src/backend/rendering/cplaintextexportrendering.h b/src/backend/rendering/cplaintextexportrendering.h
index 9360474..45ad8ac 100644
--- a/src/backend/rendering/cplaintextexportrendering.h
+++ b/src/backend/rendering/cplaintextexportrendering.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -11,6 +13,7 @@
#define RENDERINGCPLAINTEXTEXPORTRENDERING_H
#include "backend/rendering/chtmlexportrendering.h"
+#include "backend/config/btconfig.h"
namespace Rendering {
@@ -26,8 +29,8 @@ class CPlainTextExportRendering: public CHTMLExportRendering {
CPlainTextExportRendering(
bool addText,
- const DisplayOptions &displayOptions = CBTConfig::getDisplayOptionDefaults(),
- const FilterOptions &filterOptions = CBTConfig::getFilterOptionDefaults());
+ const DisplayOptions &displayOptions = btConfig().getDisplayOptions(),
+ const FilterOptions &filterOptions = btConfig().getFilterOptions());
protected: /* Methods: */
diff --git a/src/backend/rendering/ctextrendering.cpp b/src/backend/rendering/ctextrendering.cpp
index 72e4e12..409a601 100644
--- a/src/backend/rendering/ctextrendering.cpp
+++ b/src/backend/rendering/ctextrendering.cpp
@@ -2,7 +2,7 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -136,19 +136,19 @@ CTextRendering::KeyTreeItem::KeyTreeItem(const QString &startKey,
else {
sword::VerseKey vk(startKey.toUtf8().constData(), stopKey.toUtf8().constData());
- if (vk.LowerBound().getBook() != vk.UpperBound().getBook()) {
+ if (vk.getLowerBound().getBook() != vk.getUpperBound().getBook()) {
m_alternativeContent = QString::fromUtf8(vk.getRangeText());
}
- else if (vk.LowerBound().getChapter() != vk.UpperBound().getChapter()) {
+ else if (vk.getLowerBound().getChapter() != vk.getUpperBound().getChapter()) {
m_alternativeContent = QString("%1 - %2:%3")
- .arg(QString::fromUtf8(vk.LowerBound().getText()))
- .arg(vk.UpperBound().getChapter())
- .arg(vk.UpperBound().getVerse());
+ .arg(QString::fromUtf8(vk.getLowerBound().getText()))
+ .arg(vk.getUpperBound().getChapter())
+ .arg(vk.getUpperBound().getVerse());
}
else { //only verses differ (same book, same chapter)
m_alternativeContent = QString("%1 - %2")
- .arg(QString::fromUtf8(vk.LowerBound().getText()))
- .arg(vk.UpperBound().getVerse());
+ .arg(QString::fromUtf8(vk.getLowerBound().getText()))
+ .arg(vk.getUpperBound().getVerse());
}
}
@@ -231,8 +231,8 @@ const QString CTextRendering::renderKeyRange(
CSwordVerseKey* vk_stop = dynamic_cast<CSwordVerseKey*>(upperBound.data());
Q_ASSERT(vk_stop);
- bool ok = true;
- while (ok && ((*vk_start < *vk_stop) || (*vk_start == *vk_stop))) {
+ while ((*vk_start < *vk_stop) || (*vk_start == *vk_stop)) {
+
//make sure the key given by highlightKey gets marked as current key
settings.highlight = (!highlightKey.isEmpty() ? (vk_start->key() == highlightKey) : false);
@@ -249,7 +249,10 @@ const QString CTextRendering::renderKeyRange(
vk_start->setVerse(0);
}
tree.append( new KeyTreeItem(vk_start->key(), modules, settings) );
- ok = vk_start->next(CSwordVerseKey::UseVerse);
+ if (!vk_start->next(CSwordVerseKey::UseVerse)) {
+ /// \todo Notify the user about this failure.
+ break;
+ }
}
return renderKeyTree(tree);
}
diff --git a/src/backend/rendering/ctextrendering.h b/src/backend/rendering/ctextrendering.h
index 9d467cc..c62a877 100644
--- a/src/backend/rendering/ctextrendering.h
+++ b/src/backend/rendering/ctextrendering.h
@@ -1,8 +1,10 @@
/*********
*
+* In the name of the Father, and of the Son, and of the Holy Spirit.
+*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
@@ -134,7 +136,7 @@ class CTextRendering {
public: /* Methods: */
- virtual inline ~CTextRendering() {}
+ virtual ~CTextRendering() {};
const QString renderKeyTree(const KeyTree &tree);