summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:49 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:49 -0400
commit579657c8cb4ecd8a313221e70bdbbc7267f20286 (patch)
treedff1f966a17b4c6f76dc6a0ce5e0871e3f81386a /src
parent00bc0a3de99e088902379dcb2905fb1546c7eca2 (diff)
Imported Upstream version 2.9.2
Diffstat (limited to 'src')
-rw-r--r--src/backend/bookshelfmodel/btbookshelftreemodel.cpp9
-rw-r--r--src/backend/drivers/cswordlexiconmoduleinfo.cpp9
-rw-r--r--src/backend/drivers/cswordmoduleinfo.cpp12
-rw-r--r--src/backend/managers/cdisplaytemplatemgr.cpp212
-rw-r--r--src/backend/managers/cdisplaytemplatemgr.h46
-rw-r--r--src/backend/rendering/cdisplayrendering.cpp7
-rw-r--r--src/backend/rendering/chtmlexportrendering.cpp5
-rw-r--r--src/backend/rendering/ctextrendering.h2
-rw-r--r--src/bibletime.cpp2
-rw-r--r--src/display-templates/Basic.tmpl10
-rw-r--r--src/frontend/bookmarks/btbookmarkloader.cpp4
-rw-r--r--src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp5
-rw-r--r--src/frontend/bookshelfmanager/removepage/btremovepage.cpp4
-rw-r--r--src/frontend/btaboutdialog.cpp1
-rw-r--r--src/frontend/btmenuview.cpp42
-rw-r--r--src/frontend/btmenuview.h2
-rw-r--r--src/frontend/btopenworkaction.cpp12
-rw-r--r--src/frontend/cmdiarea.cpp3
-rw-r--r--src/frontend/cprinter.cpp13
-rw-r--r--src/frontend/display/bthtmljsobject.cpp2
-rw-r--r--src/frontend/display/bthtmlreaddisplay.cpp4
-rw-r--r--src/frontend/displaywindow/btactioncollection.cpp4
-rw-r--r--src/frontend/searchdialog/btsearchresultarea.cpp4
-rw-r--r--src/frontend/searchdialog/cmoduleresultview.h2
-rw-r--r--src/frontend/settingsdialogs/btlanguagesettings.cpp2
-rw-r--r--src/frontend/settingsdialogs/btshortcutseditor.cpp12
-rw-r--r--src/frontend/settingsdialogs/cswordsettings.cpp61
-rw-r--r--src/frontend/settingsdialogs/cswordsettings.h85
-rw-r--r--src/main.cpp18
29 files changed, 337 insertions, 257 deletions
diff --git a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
index 3d6008f..0fcd14e 100644
--- a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
+++ b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
@@ -367,6 +367,10 @@ void BtBookshelfTreeModel::resetData() {
void BtBookshelfTreeModel::addModule(CSwordModuleInfo *module, bool checked) {
if (m_modules.contains(module)) return;
+
+#if QT_VERSION >= 0x040600
+ beginResetModel();
+#endif
Grouping g(m_groupingOrder);
addModule(module, QModelIndex(), g, checked);
@@ -376,7 +380,12 @@ void BtBookshelfTreeModel::addModule(CSwordModuleInfo *module, bool checked) {
new modules. As a side effect, all attached views will also reset
themselves.
*/
+
+#if QT_VERSION >= 0x040600
+ endResetModel();
+#else
reset();
+#endif
}
void BtBookshelfTreeModel::addModule(CSwordModuleInfo *module,
diff --git a/src/backend/drivers/cswordlexiconmoduleinfo.cpp b/src/backend/drivers/cswordlexiconmoduleinfo.cpp
index 4e53361..1b976d3 100644
--- a/src/backend/drivers/cswordlexiconmoduleinfo.cpp
+++ b/src/backend/drivers/cswordlexiconmoduleinfo.cpp
@@ -100,13 +100,8 @@ const QStringList &CSwordLexiconModuleInfo::entries() const {
module()->setPosition(sword::TOP); // back to the first entry
module()->setSkipConsecutiveLinks(false);
- if (m_entries.count()) {
- m_entries.first().simplified();
-
- if (m_entries.first().trimmed().isEmpty()) {
- m_entries.erase( m_entries.begin() );
- }
- }
+ if (!m_entries.empty() && m_entries.front().simplified().isEmpty())
+ m_entries.pop_front();
qDebug() << "Writing cache file for lexicon module" << name();
diff --git a/src/backend/drivers/cswordmoduleinfo.cpp b/src/backend/drivers/cswordmoduleinfo.cpp
index a7ceca9..08721c9 100644
--- a/src/backend/drivers/cswordmoduleinfo.cpp
+++ b/src/backend/drivers/cswordmoduleinfo.cpp
@@ -218,7 +218,7 @@ bool CSwordModuleInfo::hasIndex() const {
}
//then check if the index is there
- return lucene::index::IndexReader::indexExists(getModuleStandardIndexLocation().toAscii().constData());
+ return lucene::index::IndexReader::indexExists(getModuleStandardIndexLocation().toLatin1().constData());
}
bool CSwordModuleInfo::buildIndex() {
@@ -249,13 +249,13 @@ bool CSwordModuleInfo::buildIndex() {
dir.mkpath( getModuleBaseIndexLocation() );
dir.mkpath( getModuleStandardIndexLocation() );
- if (lucene::index::IndexReader::indexExists(index.toAscii().constData())) {
- if (lucene::index::IndexReader::isLocked(index.toAscii().constData()) ) {
- lucene::index::IndexReader::unlock(index.toAscii().constData());
+ if (lucene::index::IndexReader::indexExists(index.toLatin1().constData())) {
+ if (lucene::index::IndexReader::isLocked(index.toLatin1().constData()) ) {
+ lucene::index::IndexReader::unlock(index.toLatin1().constData());
}
}
- QSharedPointer<lucene::index::IndexWriter> writer( new lucene::index::IndexWriter(index.toAscii().constData(), &an, true) ); //always create a new index
+ QSharedPointer<lucene::index::IndexWriter> writer( new lucene::index::IndexWriter(index.toLatin1().constData(), &an, true) ); //always create a new index
writer->setMaxFieldLength(BT_MAX_LUCENE_FIELD_LENGTH);
writer->setUseCompoundFile(true); //merge segments into a single file
@@ -458,7 +458,7 @@ int CSwordModuleInfo::searchIndexed(const QString &searchedText,
// do not use any stop words
const TCHAR* stop_words[] = { NULL };
lucene::analysis::standard::StandardAnalyzer analyzer( stop_words );
- lucene::search::IndexSearcher searcher(getModuleStandardIndexLocation().toAscii().constData());
+ lucene::search::IndexSearcher searcher(getModuleStandardIndexLocation().toLatin1().constData());
lucene_utf8towcs(wcharBuffer, searchedText.toUtf8().constData(), BT_MAX_LUCENE_FIELD_LENGTH);
QSharedPointer<lucene::search::Query> q( lucene::queryParser::QueryParser::parse((const TCHAR*)wcharBuffer, (const TCHAR*)_T("content"), &analyzer) );
diff --git a/src/backend/managers/cdisplaytemplatemgr.cpp b/src/backend/managers/cdisplaytemplatemgr.cpp
index b433dd7..fbeb921 100644
--- a/src/backend/managers/cdisplaytemplatemgr.cpp
+++ b/src/backend/managers/cdisplaytemplatemgr.cpp
@@ -9,7 +9,6 @@
#include "backend/managers/cdisplaytemplatemgr.h"
-#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QStringList>
@@ -20,47 +19,73 @@
#include "util/directory.h"
-CDisplayTemplateMgr *CDisplayTemplateMgr::m_instance = 0;
+#define CSSTEMPLATEBASE "Basic.tmpl"
-CDisplayTemplateMgr::CDisplayTemplateMgr(QString &errorMessage) {
- Q_ASSERT(m_instance == 0);
+CDisplayTemplateMgr * CDisplayTemplateMgr::m_instance = 0;
+CDisplayTemplateMgr::CDisplayTemplateMgr(QString & errorMessage) {
+ Q_ASSERT(m_instance == 0);
m_instance = this;
- namespace DU = util::directory;
- QStringList filter("*.tmpl");
- QStringList cssfilter("*.css");
-
- // Preload global display templates from disk:
- QDir td = DU::getDisplayTemplatesDir();
- Q_FOREACH(const QString &file, td.entryList(filter, QDir::Files | QDir::Readable))
- loadTemplate(td.canonicalPath() + "/" + file);
-
- // Load app stylesheets
- Q_FOREACH(const QString &file, td.entryList(cssfilter, QDir::Files | QDir::Readable))
- loadCSSTemplate(td.canonicalPath() + "/" + file);
-
- /*
- Preload user display templates from disk, overriding any global templates
- with the same file name:
- */
- QDir utd = DU::getUserDisplayTemplatesDir();
- Q_FOREACH(const QString &file, utd.entryList(filter, QDir::Files | QDir::Readable))
- loadTemplate(utd.canonicalPath() + "/" + file);
-
- if (m_cssMap.contains(defaultTemplateName())) {
- errorMessage = QString::null;
- } else {
+ {
+ namespace DU = util::directory;
+ const QDir::Filters readableFileFilter(QDir::Files | QDir::Readable);
+ const QDir & td = DU::getDisplayTemplatesDir(); // Global template directory
+ const QDir & utd = DU::getUserDisplayTemplatesDir(); // User template directory
+
+ // Load regular templates:
+ {
+ const QStringList filter("*.tmpl");
+ // Preload global display templates from disk:
+ Q_FOREACH(const QString & file, td.entryList(filter, readableFileFilter))
+ loadTemplate(td.canonicalPath() + "/" + file);
+ // Preload user display templates from disk:
+ Q_FOREACH(const QString & file, utd.entryList(filter, readableFileFilter))
+ loadTemplate(utd.canonicalPath() + "/" + file);
+ }
+
+ if (!m_templateMap.contains(CSSTEMPLATEBASE)) {
+ errorMessage = QObject::tr("CSS base template not found!");
+ return;
+ }
+
+ // Load CSS templates:
+ {
+ const QStringList cssfilter("*.css");
+ // Load global app stylesheets
+ Q_FOREACH(const QString & file, td.entryList(cssfilter, readableFileFilter))
+ loadCSSTemplate(td.canonicalPath() + "/" + file);
+ // Load user app stylesheets
+ Q_FOREACH(const QString & file, utd.entryList(cssfilter, readableFileFilter))
+ loadCSSTemplate(td.canonicalPath() + "/" + file);
+ }
+ }
+
+ if (!m_cssMap.contains(defaultTemplateName())) {
errorMessage = QObject::tr("Default template \"%1\" not found!")
.arg(defaultTemplateName());
+ return;
}
+
+ // Create template names cache:
+ m_availableTemplateNamesCache = m_templateMap.keys();
+ const bool b = m_availableTemplateNamesCache.removeOne(CSSTEMPLATEBASE);
+ Q_ASSERT(b);
+ m_availableTemplateNamesCache.append(m_cssMap.keys());
+ qSort(m_availableTemplateNamesCache);
+
+ errorMessage = QString::null;
}
-QString CDisplayTemplateMgr::fillTemplate(const QString &name,
- const QString &content,
- const Settings &settings)
+QString CDisplayTemplateMgr::fillTemplate(const QString & name,
+ const QString & content,
+ const Settings & settings) const
{
- const QString templateName = m_cssMap.contains(name) ? name : defaultTemplateName();
+ Q_ASSERT(name != CSSTEMPLATEBASE);
+ Q_ASSERT(name.endsWith(".css") || name.endsWith(".tmpl"));
+ Q_ASSERT(!name.endsWith(".css") || m_cssMap.contains(name));
+ Q_ASSERT(!name.endsWith(".tmpl") || m_templateMap.contains(name));
+ const bool templateIsCss = name.endsWith(".css");
QString displayTypeString;
QString moduleName;
@@ -100,10 +125,10 @@ QString CDisplayTemplateMgr::fillTemplate(const QString &name,
if (moduleCount >= 2) {
//create header for the modules
- qDebug() << "There were more than 1 module, create headers";
+ // qDebug() << "There were more than 1 module, create headers";
QString header;
- Q_FOREACH(const CSwordModuleInfo *mi, settings.modules) {
+ Q_FOREACH(const CSwordModuleInfo * mi, settings.modules) {
header.append("<th style=\"width:")
.append(QString::number(int( 100.0 / (float)moduleCount )))
.append("%;\">")
@@ -119,63 +144,53 @@ QString CDisplayTemplateMgr::fillTemplate(const QString &name,
}
QString langCSS;
- CLanguageMgr::LangMap langMap = CLanguageMgr::instance()->availableLanguages();
-
- foreach(const CLanguageMgr::Language* lang, langMap) {
- //const CLanguageMgr::Language* lang = *it;
-
- //if (lang->isValid() && CBTConfig::get(lang).first) {
- if (!lang->abbrev().isEmpty() && CBTConfig::get(lang).first) {
- const QFont f = CBTConfig::get(lang).second;
-
- //don't use important, because it would reset the title formatting, etc. to the setup font
- QString css("{ ");
- css.append("font-family:").append(f.family())/*.append(" !important")*/;
- css.append("; font-size:").append(QString::number(f.pointSize())).append("pt /*!important*/");
- css.append("; font-weight:").append(f.bold() ? "bold" : "normal /*!important*/");
- css.append("; font-style:").append(f.italic() ? "italic" : "normal /*!important*/");
- css.append("; }\n");
-
- langCSS +=
- QString("\n*[lang=%1] %2")
- .arg(lang->abbrev())
- .arg(css);
+ {
+ /*
+ At first append the font standard settings for all languages without
+ configured font. Create a dummy language (the langmap may be empty).
+ */
+ const CLanguageMgr::Language lang(QString("en"), QString("English"), QString::null);
+ const QFont f = CBTConfig::getDefault(&lang);
+ langCSS.append("#content{font-family:").append(f.family())
+ .append(";font-size:").append(QString::number(f.pointSizeF(), 'f'))
+ .append("pt;font-weight:").append(f.bold() ? "bold" : "normal")
+ .append(";font-style:").append(f.italic() ? "italic" : "normal")
+ .append('}');
+ }
+ {
+ const CLanguageMgr::LangMap & langMap = CLanguageMgr::instance()->availableLanguages();
+ Q_FOREACH (const CLanguageMgr::Language * lang, langMap) {
+ if (!lang->abbrev().isEmpty() && CBTConfig::get(lang).first) {
+ const QFont f = CBTConfig::get(lang).second;
+
+ langCSS.append("*[lang=").append(lang->abbrev()).append("]{")
+ .append("font-family:").append(f.family())
+ .append(";font-size:").append(QString::number(f.pointSizeF(), 'f'))
+ .append("pt;font-weight:").append(f.bold() ? "bold" : "normal")
+ .append(";font-style:").append(f.italic() ? "italic" : "normal")
+ .append('}');
+ }
}
}
- //at first append the font standard settings for all languages without configured font
- // Create a dummy language (the langmap may be empty)
- CLanguageMgr::Language lang_v(QString("en"), QString("English"), QString::null);
- CLanguageMgr::Language* lang = &lang_v;
-
- if (lang && !lang->abbrev().isEmpty()/*&& lang->isValid()*/) {
- const QFont standardFont = CBTConfig::getDefault(lang); //we just need a dummy lang param
- langCSS.prepend(
- QString("\n#content {font-family:%1; font-size:%2pt; font-weight:%3; font-style: %4;}\n")
- .arg(standardFont.family())
- .arg(standardFont.pointSize())
- .arg(standardFont.bold() ? "bold" : "normal")
- .arg(standardFont.italic() ? "italic" : "normal")
- );
- }
-
- // Template stylesheet
-
-
-// qWarning("Outputing unformated text");
- const QString t = QString(m_templateMap[ "Basic.tmpl" ]) //don't change the map's content directly, use a copy
- .replace("#TITLE#", settings.title)
- .replace("#LANG_ABBREV#", settings.langAbbrev.isEmpty() ? QString("en") : settings.langAbbrev)
- .replace("#DISPLAYTYPE#", displayTypeString)
- .replace("#LANG_CSS#", langCSS)
- .replace("#PAGE_DIRECTION#", settings.pageDirection)
- .replace("#CONTENT#", newContent)
- .replace("#THEME_STYLE#", m_cssMap[ templateName ])
- .replace("#MODTYPE#", displayTypeString)
- .replace("#MODNAME#", moduleName)
- .replace("#MODULE_STYLESHEET#", QString("")); // Let's fix this!
-
- return t;
+ namespace DU = util::directory;
+ QString output(m_templateMap[templateIsCss
+ ? QString(CSSTEMPLATEBASE)
+ : name]); // don't change the map's content directly, use a copy
+ output.replace("#TITLE#", settings.title)
+ .replace("#LANG_ABBREV#", settings.langAbbrev)
+ .replace("#DISPLAYTYPE#", displayTypeString)
+ .replace("#LANG_CSS#", langCSS)
+ .replace("#PAGE_DIRECTION#", settings.textDirectionAsHtmlDirAttr())
+ .replace("#CONTENT#", newContent)
+ .replace("#MODTYPE#", displayTypeString)
+ .replace("#MODNAME#", moduleName)
+ .replace("#DISPLAY_TEMPLATES_PATH#", DU::getDisplayTemplatesDir().absolutePath());
+
+ if (templateIsCss)
+ output.replace("#THEME_STYLE#", m_cssMap[name]);
+
+ return output;
}
QString CDisplayTemplateMgr::activeTemplateName() {
@@ -186,18 +201,21 @@ QString CDisplayTemplateMgr::activeTemplateName() {
return tn;
}
-void CDisplayTemplateMgr::loadTemplate(const QString &filename) {
+void CDisplayTemplateMgr::loadTemplate(const QString & filename) {
+ Q_ASSERT(filename.endsWith(".tmpl"));
+ Q_ASSERT(QFileInfo(filename).isFile());
QFile f(filename);
if (f.open(QIODevice::ReadOnly)) {
- QString fileContent = QTextStream(&f).readAll();
-
- if (!fileContent.isEmpty()) {
- m_templateMap[QFileInfo(f).fileName()] = fileContent;
- }
+ const QString fileContent(QTextStream(&f).readAll());
+ if (!fileContent.isEmpty())
+ m_templateMap.insert(QFileInfo(f).fileName(), fileContent);
}
}
-void CDisplayTemplateMgr::loadCSSTemplate(const QString &filename) {
- QFile f(filename);
- m_cssMap[QFileInfo(f).fileName()] = QString("file://") + filename;
+void CDisplayTemplateMgr::loadCSSTemplate(const QString & filename) {
+ Q_ASSERT(filename.endsWith(".css"));
+ const QFileInfo fi(filename);
+ Q_ASSERT(fi.isFile());
+ if (fi.isReadable())
+ m_cssMap.insert(fi.fileName(), fi.absoluteFilePath());
}
diff --git a/src/backend/managers/cdisplaytemplatemgr.h b/src/backend/managers/cdisplaytemplatemgr.h
index a7b49e5..a9e6380 100644
--- a/src/backend/managers/cdisplaytemplatemgr.h
+++ b/src/backend/managers/cdisplaytemplatemgr.h
@@ -10,13 +10,11 @@
#ifndef CDISPLAYTEMPLATEMGR_H
#define CDISPLAYTEMPLATEMGR_H
-#include <QMap>
-#include <QString>
+#include <QHash>
#include <QStringList>
+#include "../drivers/cswordmoduleinfo.h"
-class CSwordModuleInfo;
-
/**
Manages the display templates used in the filters and display classes.
\note This is a singleton.
@@ -30,10 +28,16 @@ class CDisplayTemplateMgr {
*/
struct Settings {
- inline Settings() : pageDirection("ltr") {}
+ inline Settings()
+ : langAbbrev("en")
+ , textDirection(CSwordModuleInfo::LeftToRight) {}
+
+ inline const char * textDirectionAsHtmlDirAttr() const {
+ return textDirection == CSwordModuleInfo::LeftToRight ? "ltr" : "rtl";
+ }
/** The list of modules */
- QList<const CSwordModuleInfo*> modules;
+ QList<const CSwordModuleInfo *> modules;
/** The title which is used for the new processed HTML page */
QString title;
@@ -41,12 +45,12 @@ class CDisplayTemplateMgr {
/** The language for the HTML page. */
QString langAbbrev;
- /** The language direction for the HTML page. */
- QString pageDirection;
-
/** The CSS ID which is used in the content part of the page */
QString pageCSS_ID;
+ /** The language direction for the HTML page. */
+ CSwordModuleInfo::TextDirection textDirection;
+
};
public: /* Methods: */
@@ -55,13 +59,13 @@ class CDisplayTemplateMgr {
\param[out] errorMessage Set to error string on error, otherwise set
to QString::null.
*/
- explicit CDisplayTemplateMgr(QString &errorMessage);
+ explicit CDisplayTemplateMgr(QString & errorMessage);
/**
\returns the list of available templates.
*/
- inline const QStringList availableTemplates() const {
- return m_cssMap.keys();
+ inline const QStringList & availableTemplates() const {
+ return m_availableTemplateNamesCache;
}
/**
@@ -76,8 +80,9 @@ class CDisplayTemplateMgr {
\returns The full HTML template HTML code including the CSS data.
*/
- QString fillTemplate(const QString &name, const QString &content,
- const Settings &settings);
+ QString fillTemplate(const QString & name,
+ const QString & content,
+ const Settings & settings) const;
/**
\returns the name of the default template.
@@ -92,7 +97,7 @@ class CDisplayTemplateMgr {
/**
\returns The singleton instance of the instance of this class.
*/
- static inline CDisplayTemplateMgr *instance() {
+ static inline CDisplayTemplateMgr * instance() {
Q_ASSERT(m_instance != 0);
return m_instance;
}
@@ -100,14 +105,15 @@ class CDisplayTemplateMgr {
private: /* Methods: */
/** Preloads a single template from disk: */
- void loadTemplate(const QString &filename);
- void loadCSSTemplate(const QString &filename);
+ void loadTemplate(const QString & filename);
+ void loadCSSTemplate(const QString & filename);
private: /* Fields: */
- QMap<QString, QString> m_templateMap;
- QMap<QString, QString> m_cssMap;
- static CDisplayTemplateMgr *m_instance;
+ QHash<QString, QString> m_templateMap;
+ QHash<QString, QString> m_cssMap;
+ static CDisplayTemplateMgr * m_instance;
+ QStringList m_availableTemplateNamesCache;
};
diff --git a/src/backend/rendering/cdisplayrendering.cpp b/src/backend/rendering/cdisplayrendering.cpp
index 175cf4e..bd5aa87 100644
--- a/src/backend/rendering/cdisplayrendering.cpp
+++ b/src/backend/rendering/cdisplayrendering.cpp
@@ -147,12 +147,11 @@ QString CDisplayRendering::finishText(const QString &text, const KeyTree &tree)
CDisplayTemplateMgr::Settings settings;
settings.modules = modules;
- settings.langAbbrev = ((modules.count() == 1) && lang->isValid()) ? lang->abbrev() : QString::null;
+ if (modules.count() == 1 && lang->isValid())
+ settings.langAbbrev = lang->abbrev();
if (modules.count() == 1)
- settings.pageDirection = (modules.first()->textDirection() == CSwordModuleInfo::LeftToRight) ? "ltr" : "rtl";
- else
- settings.pageDirection = QString::null;
+ settings.textDirection = modules.first()->textDirection();
return tMgr->fillTemplate(CDisplayTemplateMgr::activeTemplateName(), text, settings);
}
diff --git a/src/backend/rendering/chtmlexportrendering.cpp b/src/backend/rendering/chtmlexportrendering.cpp
index 66897b5..0e19897 100644
--- a/src/backend/rendering/chtmlexportrendering.cpp
+++ b/src/backend/rendering/chtmlexportrendering.cpp
@@ -232,12 +232,9 @@ QString CHTMLExportRendering::finishText(const QString &text, const KeyTree &tre
const CSwordModuleInfo * const firstModule = settings.modules.first();
const CLanguageMgr::Language * const lang = firstModule->language();
settings.langAbbrev = lang->isValid() ? lang->abbrev() : "unknown";
- if (firstModule->textDirection() == CSwordModuleInfo::RightToLeft) {
- settings.pageDirection = "rtl";
- }
+ settings.textDirection = firstModule->textDirection();
} else {
settings.langAbbrev = "unknown";
- settings.pageDirection = QString::null;
}
return CDTM::instance()->fillTemplate(QObject::tr("Export"), text, settings);
diff --git a/src/backend/rendering/ctextrendering.h b/src/backend/rendering/ctextrendering.h
index 161deef..9d467cc 100644
--- a/src/backend/rendering/ctextrendering.h
+++ b/src/backend/rendering/ctextrendering.h
@@ -134,6 +134,8 @@ class CTextRendering {
public: /* Methods: */
+ virtual inline ~CTextRendering() {}
+
const QString renderKeyTree(const KeyTree &tree);
const QString renderKeyRange(
diff --git a/src/bibletime.cpp b/src/bibletime.cpp
index 4864c9a..72cb4cd 100644
--- a/src/bibletime.cpp
+++ b/src/bibletime.cpp
@@ -117,7 +117,7 @@ BibleTime::~BibleTime() {
/** Creates a new presenter in the MDI area according to the type of the module. */
CDisplayWindow* BibleTime::createReadDisplayWindow(QList<CSwordModuleInfo*> modules, const QString& key) {
qApp->setOverrideCursor( QCursor(Qt::WaitCursor) );
- qDebug() << "BibleTime::createReadDisplayWindow(QList<CSwordModuleInfo*> modules, const QString& key)";
+ // qDebug() << "BibleTime::createReadDisplayWindow(QList<CSwordModuleInfo*> modules, const QString& key)";
CDisplayWindow* displayWindow = CDisplayWindowFactory::createReadInstance(modules, m_mdi);
if ( displayWindow ) {
displayWindow->init();
diff --git a/src/display-templates/Basic.tmpl b/src/display-templates/Basic.tmpl
index c707b50..192e5b4 100644
--- a/src/display-templates/Basic.tmpl
+++ b/src/display-templates/Basic.tmpl
@@ -6,11 +6,6 @@
<meta name="GENERATOR" content="BibleTime - www.bibletime.info" />
<meta name="AUTHOR" content="BibleTime - www.bibletime.info" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <!-- Link to the application default stylesheet -->
- <link rel="stylesheet" type="text/css" href="#THEME_STYLE#" />
- <!-- Link to module stylesheet, if applicable -->
- #MODULE_STYLESHEET#
-
<style type="text/css">
/* <![CDATA[ */
#LANG_CSS#
@@ -18,6 +13,11 @@
/* ]]> */
</style>
+
+ <!-- Link to the application default stylesheet -->
+ <link rel="stylesheet" type="text/css" href="file://#THEME_STYLE#" />
+ <!-- Link to module stylesheet, if applicable -->
+
</head>
<body id="#DISPLAYTYPE#" class="#MODTYPE# #MODTYPE#_#MODNAME#">
diff --git a/src/frontend/bookmarks/btbookmarkloader.cpp b/src/frontend/bookmarks/btbookmarkloader.cpp
index c9133a4..daebfe1 100644
--- a/src/frontend/bookmarks/btbookmarkloader.cpp
+++ b/src/frontend/bookmarks/btbookmarkloader.cpp
@@ -64,7 +64,11 @@ QTreeWidgetItem* BtBookmarkLoader::handleXmlElement(QDomElement& element, QTreeW
newFolder->setText(0, element.attribute("caption"));
}
QDomNodeList childList = element.childNodes();
+#if QT_VERSION < 0x050000
for (unsigned int i = 0; i < childList.length(); i++) {
+#else
+ for (int i = 0; i < childList.length(); i++) {
+#endif
QDomElement newElement = childList.at(i).toElement();
QTreeWidgetItem* newChildItem = handleXmlElement(newElement, newFolder);
newFolder->addChild(newChildItem);
diff --git a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
index 288be4e..cc862fa 100644
--- a/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
+++ b/src/frontend/bookshelfmanager/installpage/btinstallprogressdialog.cpp
@@ -37,8 +37,13 @@ BtInstallProgressDialog::BtInstallProgressDialog(
m_statusWidget->setRootIsDecorated(false);
m_statusWidget->setHeaderLabels(QStringList(tr("Work")) << tr("Progress") << QString::null);
m_statusWidget->header()->setStretchLastSection(false);
+#if QT_VERSION < 0x050000
m_statusWidget->header()->setResizeMode(1, QHeaderView::Stretch);
m_statusWidget->header()->setMovable(false);
+#else
+ m_statusWidget->header()->setSectionResizeMode(1, QHeaderView::Stretch);
+ m_statusWidget->header()->setSectionsMovable(false);
+#endif
//m_statusWidget->setColumnWidth(1, util::tool::mWidth(m_statusWidget, 2));
Q_FOREACH(const CSwordModuleInfo *module, modules) {
diff --git a/src/frontend/bookshelfmanager/removepage/btremovepage.cpp b/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
index 6c664a8..8b9dd3c 100644
--- a/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
+++ b/src/frontend/bookshelfmanager/removepage/btremovepage.cpp
@@ -62,7 +62,11 @@ BtRemovePage::BtRemovePage(BtModuleManagerDialog *parent)
m_bookshelfWidget->showHideAction()->setVisible(false);
m_bookshelfWidget->showHideButton()->hide();
m_bookshelfWidget->treeView()->header()->show();
+#if QT_VERSION < 0x050000
m_bookshelfWidget->treeView()->header()->setResizeMode(QHeaderView::ResizeToContents);
+#else
+ m_bookshelfWidget->treeView()->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+#endif
wLayout->addWidget(m_bookshelfWidget);
m_uninstallGroupBox = new QGroupBox(this);
diff --git a/src/frontend/btaboutdialog.cpp b/src/frontend/btaboutdialog.cpp
index 60253dd..1bfe708 100644
--- a/src/frontend/btaboutdialog.cpp
+++ b/src/frontend/btaboutdialog.cpp
@@ -210,6 +210,7 @@ void BtAboutDialog::retranslateContributorsTab() {
"<li>Vlad Savitsky</li>"
"<li>Henrik Sonesson</li>"
"<li>Johan van der Lingen</li>"
+ "<li>Konstantin Maslyuk</li>"
"<li>Jean Van Schaftingen</li>"
"<li>Roland Teschner</li>"
"<li>Giovanni Tedaldi</li>"
diff --git a/src/frontend/btmenuview.cpp b/src/frontend/btmenuview.cpp
index b7ce9b4..71998b7 100644
--- a/src/frontend/btmenuview.cpp
+++ b/src/frontend/btmenuview.cpp
@@ -20,8 +20,6 @@ BtMenuView::BtMenuView(QWidget *parent)
{
connect(this, SIGNAL(aboutToShow()),
this, SLOT(slotAboutToShow()));
- connect(this, SIGNAL(aboutToHide()),
- this, SLOT(slotAboutToHide()));
connect(this, SIGNAL(triggered(QAction*)),
this, SLOT(slotActionTriggered(QAction*)));
}
@@ -61,27 +59,27 @@ QAction *BtMenuView::newAction(QMenu *parentMenu, const QModelIndex &itemIndex)
QAction *childAction = new QAction(parentMenu);
// Set text:
- if (qVariantCanConvert<QString>(displayData)) {
+ if (displayData.canConvert(QVariant::String)) {
childAction->setText(displayData.toString());
}
// Set icon:
- if (qVariantCanConvert<QIcon>(iconData)) {
+ if (iconData.canConvert(QVariant::Icon)) {
childAction->setIcon(iconData.value<QIcon>());
}
// Set tooltip:
- if (qVariantCanConvert<QString>(toolTipData)) {
+ if (toolTipData.canConvert(QVariant::String)) {
childAction->setToolTip(toolTipData.toString());
}
// Set status tip:
- if (qVariantCanConvert<QString>(statusTipData)) {
+ if (statusTipData.canConvert(QVariant::String)) {
childAction->setStatusTip(statusTipData.toString());
}
// Set whatsthis:
- if (qVariantCanConvert<QString>(whatsThisData)) {
+ if (whatsThisData.canConvert(QVariant::String)) {
childAction->setWhatsThis(whatsThisData.toString());
}
@@ -111,27 +109,27 @@ QMenu *BtMenuView::newMenu(QMenu *parentMenu, const QModelIndex &itemIndex) {
QMenu *childMenu = new QMenu(parentMenu);
// Set text:
- if (qVariantCanConvert<QString>(displayData)) {
+ if (displayData.canConvert(QVariant::String)) {
childMenu->setTitle(displayData.toString());
}
// Set icon:
- if (qVariantCanConvert<QIcon>(iconData)) {
+ if (iconData.canConvert(QVariant::Icon)) {
childMenu->setIcon(iconData.value<QIcon>());
}
// Set tooltip:
- if (qVariantCanConvert<QString>(toolTipData)) {
+ if (toolTipData.canConvert(QVariant::String)) {
childMenu->setToolTip(toolTipData.toString());
}
// Set status tip:
- if (qVariantCanConvert<QString>(statusTipData)) {
+ if (statusTipData.canConvert(QVariant::String)) {
childMenu->setStatusTip(statusTipData.toString());
}
// Set whatsthis:
- if (qVariantCanConvert<QString>(whatsThisData)) {
+ if (whatsThisData.canConvert(QVariant::String)) {
childMenu->setWhatsThis(whatsThisData.toString());
}
@@ -150,14 +148,9 @@ void BtMenuView::buildMenu(QMenu *parentMenu, const QModelIndex &parentIndex) {
QMenu *childMenu = newMenu(parentMenu, childIndex);
if (childMenu != 0) {
- // Add to menu:
+ // Add the child menu and populate it:
parentMenu->addMenu(childMenu);
-
- // Populate the menu if not prohibited:
- QVariant populate(childMenu->property("BtMenuView_NoPopulate"));
- if (!populate.isValid() || populate.toBool()) {
- buildMenu(childMenu, childIndex);
- }
+ buildMenu(childMenu, childIndex);
}
} else {
QAction *childAction = newAction(parentMenu, childIndex);
@@ -177,6 +170,10 @@ void BtMenuView::buildMenu(QMenu *parentMenu, const QModelIndex &parentIndex) {
}
void BtMenuView::slotAboutToShow() {
+ // The signal "aboutToHide" comes before the signal "triggered" and
+ // leads to executing a deleted action and a crash. It is much safer
+ // to remove the menus here.
+ removeMenus();
delete m_actions;
m_actions = 0;
m_indexMap.clear();
@@ -191,8 +188,13 @@ void BtMenuView::slotAboutToShow() {
postBuildMenu();
}
-void BtMenuView::slotAboutToHide() {
+void BtMenuView::removeMenus() {
+ // QMenu::clear() is documented only to delete direct child actions:
clear();
+
+ // Delete submenus also:
+ Q_FOREACH (QObject * const child, children())
+ delete qobject_cast<QMenu *>(child);
}
void BtMenuView::slotActionTriggered(QAction *action) {
diff --git a/src/frontend/btmenuview.h b/src/frontend/btmenuview.h
index 87c0d90..98ec729 100644
--- a/src/frontend/btmenuview.h
+++ b/src/frontend/btmenuview.h
@@ -130,10 +130,10 @@ class BtMenuView: public QMenu {
private:
void buildMenu(QMenu *parentMenu, const QModelIndex &parentIndex);
+ void removeMenus();
private slots:
void slotAboutToShow();
- void slotAboutToHide();
void slotActionTriggered(QAction *action);
protected:
diff --git a/src/frontend/btopenworkaction.cpp b/src/frontend/btopenworkaction.cpp
index 9f33fc5..50d0d5f 100644
--- a/src/frontend/btopenworkaction.cpp
+++ b/src/frontend/btopenworkaction.cpp
@@ -29,14 +29,8 @@ BtOpenWorkActionMenu::BtOpenWorkActionMenu(const QString &groupingConfigKey,
m_postFilterModel->setSourceModel(m_treeModel);
setModel(m_postFilterModel);
- m_groupingMenu = new BtBookshelfGroupingMenu(false, this);
-
connect(this, SIGNAL(triggered(QModelIndex)),
this, SLOT(slotIndexTriggered(QModelIndex)));
- connect(m_groupingMenu, SIGNAL(signalGroupingOrderChanged(BtBookshelfTreeModel::Grouping)),
- this, SLOT(slotGroupingActionTriggered(BtBookshelfTreeModel::Grouping)));
-
- retranslateUi();
}
BtOpenWorkActionMenu::~BtOpenWorkActionMenu() {
@@ -55,6 +49,12 @@ void BtOpenWorkActionMenu::retranslateUi() {
void BtOpenWorkActionMenu::postBuildMenu() {
addSeparator();
+ m_groupingMenu = new BtBookshelfGroupingMenu(false, this);
+
+ connect(m_groupingMenu, SIGNAL(signalGroupingOrderChanged(BtBookshelfTreeModel::Grouping)),
+ this, SLOT(slotGroupingActionTriggered(BtBookshelfTreeModel::Grouping)));
+
+ retranslateUi();
addMenu(m_groupingMenu);
}
diff --git a/src/frontend/cmdiarea.cpp b/src/frontend/cmdiarea.cpp
index b2896da..fb116af 100644
--- a/src/frontend/cmdiarea.cpp
+++ b/src/frontend/cmdiarea.cpp
@@ -124,8 +124,11 @@ void CMDIArea::setMDIArrangementMode( const MDIArrangementMode newArrangementMod
QObject* parent = tab->parent();
if (parent == this) {
tab->setTabsClosable(true);
+// As of version 4.8, Qt does the close for us.
+#if QT_VERSION < 0x040800
disconnect(tab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(tab, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
+#endif
}
}
}
diff --git a/src/frontend/cprinter.cpp b/src/frontend/cprinter.cpp
index 3645472..50ff67d 100644
--- a/src/frontend/cprinter.cpp
+++ b/src/frontend/cprinter.cpp
@@ -110,16 +110,11 @@ QString CPrinter::finishText(const QString &text, const KeyTree &tree) {
CDisplayTemplateMgr::Settings settings;
//settings.modules = modules;
settings.pageCSS_ID = "printer";
- settings.langAbbrev = ( lang && (modules.count() == 1) && lang->isValid() ) ? lang->abbrev() : "unknown";
+ if (modules.count() == 1 && lang->isValid())
+ settings.langAbbrev = lang->abbrev();
- //the previous version gave compiler error for some strange reason
- //(well, I don't like ?: anyway, let alone nested)
- if (modules.count() != 1) {
- settings.pageDirection = QString::null;
- }
- else {
- settings.pageDirection = ( modules.first()->textDirection() == CSwordModuleInfo::LeftToRight ) ? "ltr" : "rtl";
- }
+ if (modules.count() == 1)
+ settings.textDirection = modules.first()->textDirection();
CDisplayTemplateMgr *tMgr = CDisplayTemplateMgr::instance();
return tMgr->fillTemplate(CDisplayTemplateMgr::activeTemplateName(), text, settings);
diff --git a/src/frontend/display/bthtmljsobject.cpp b/src/frontend/display/bthtmljsobject.cpp
index 6b11d5b..aa44865 100644
--- a/src/frontend/display/bthtmljsobject.cpp
+++ b/src/frontend/display/bthtmljsobject.cpp
@@ -9,8 +9,8 @@
#include "frontend/display/bthtmljsobject.h"
+#include <QDrag>
#include <QSharedPointer>
-#include <QObject>
#include "backend/config/cbtconfig.h"
#include "backend/keys/cswordkey.h"
#include "backend/managers/referencemanager.h"
diff --git a/src/frontend/display/bthtmlreaddisplay.cpp b/src/frontend/display/bthtmlreaddisplay.cpp
index d7ee33f..1842178 100644
--- a/src/frontend/display/bthtmlreaddisplay.cpp
+++ b/src/frontend/display/bthtmlreaddisplay.cpp
@@ -247,7 +247,11 @@ void BtHtmlReadDisplay::selectAll() {
// Scroll QWebView to the correct location as specified by the anchor
void BtHtmlReadDisplay::moveToAnchor( const QString& anchor ) {
+#if QT_VERSION >= 0x040700
+ mainFrame()->scrollToAnchor(anchor);
+#else
slotGoToAnchor(anchor);
+#endif
}
// Scroll the QWebView to the correct location specified by anchor
diff --git a/src/frontend/displaywindow/btactioncollection.cpp b/src/frontend/displaywindow/btactioncollection.cpp
index dd36939..55909b7 100644
--- a/src/frontend/displaywindow/btactioncollection.cpp
+++ b/src/frontend/displaywindow/btactioncollection.cpp
@@ -98,7 +98,7 @@ void BtActionCollection::readSettings() {
continue;
QVariant variant = settings->value(key);
- qDebug() << variant << " | " << variant.typeName();
+ // qDebug() << variant << " | " << variant.typeName();
if (variant.type() != QVariant::List
&& variant.type() != QVariant::StringList)
{
@@ -137,7 +137,7 @@ void BtActionCollection::writeSettings() {
varList.append(shortcut.toString());
}
settings->setValue(iter.key(), varList);
- qDebug() << ">>" << settings->value(iter.key()).typeName();
+ // qDebug() << ">>" << settings->value(iter.key()).typeName();
}
settings->endGroup();
diff --git a/src/frontend/searchdialog/btsearchresultarea.cpp b/src/frontend/searchdialog/btsearchresultarea.cpp
index 9986e26..262ff23 100644
--- a/src/frontend/searchdialog/btsearchresultarea.cpp
+++ b/src/frontend/searchdialog/btsearchresultarea.cpp
@@ -454,13 +454,13 @@ QString BtSearchResultArea::highlightSearchedText(const QString& content, const
length = word.length() - 1;
word.replace('*', "\\S*"); //match within a word
findExp = QRegExp(word);
- findExp.setMinimal(TRUE);
+ findExp.setMinimal(true);
}
else if (word.contains("?")) {
length = word.length() - 1;
word.replace('?', "\\S?"); //match within a word
findExp = QRegExp(word);
- findExp.setMinimal(TRUE);
+ findExp.setMinimal(true);
}
else {
length = word.length();
diff --git a/src/frontend/searchdialog/cmoduleresultview.h b/src/frontend/searchdialog/cmoduleresultview.h
index 5940859..526ac16 100644
--- a/src/frontend/searchdialog/cmoduleresultview.h
+++ b/src/frontend/searchdialog/cmoduleresultview.h
@@ -43,7 +43,7 @@ class CModuleResultView : public QTreeWidget {
*/
CSwordModuleInfo* activeModule();
- virtual QSize sizeHint() {
+ virtual QSize sizeHint() const {
return m_size;
}
diff --git a/src/frontend/settingsdialogs/btlanguagesettings.cpp b/src/frontend/settingsdialogs/btlanguagesettings.cpp
index fdbe653..be2dd17 100644
--- a/src/frontend/settingsdialogs/btlanguagesettings.cpp
+++ b/src/frontend/settingsdialogs/btlanguagesettings.cpp
@@ -101,7 +101,7 @@ void BtLanguageSettingsPage::initSwordLocaleCombo() {
const std::list<sword::SWBuf> locales = sword::LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
for (SBLCI it = locales.begin(); it != locales.end(); ++it) {
- const char * abbreviation = sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getName();
+ const char * const abbreviation = sword::LocaleMgr::getSystemLocaleMgr()->getLocale((*it).c_str())->getName();
const CLanguageMgr::Language * const l = CLanguageMgr::instance()->languageForAbbrev(abbreviation);
if (l->isValid()) {
diff --git a/src/frontend/settingsdialogs/btshortcutseditor.cpp b/src/frontend/settingsdialogs/btshortcutseditor.cpp
index d8fdfd8..618e5ed 100644
--- a/src/frontend/settingsdialogs/btshortcutseditor.cpp
+++ b/src/frontend/settingsdialogs/btshortcutseditor.cpp
@@ -204,7 +204,11 @@ QTableWidget* BtShortcutsEditor::createShortcutsTable() {
QStringList headerList;
headerList << tr("Action\nname") << tr("First\nshortcut") << tr("Second\nshortcut");
table->setHorizontalHeaderLabels(headerList);
+#if QT_VERSION < 0x050000
table->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+#else
+ table->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+#endif
table->horizontalHeader()->resizeSection(0, 180);
table->horizontalHeader()->resizeSection(1, 100);
table->horizontalHeader()->setStretchLastSection(true);
@@ -223,7 +227,7 @@ void BtShortcutsEditor::changeRow(int row, int column) {
m_currentRow = row;
QKeySequence defaultKeys = item->getDefaultKeys();
- m_defaultLabelValue->setText(defaultKeys);
+ m_defaultLabelValue->setText(defaultKeys.toString());
QTableWidgetItem* item1 = m_table->item(row, 1);
QString shortcut = item1->text();
@@ -314,8 +318,8 @@ void BtShortcutsEditor::defaultButtonClicked(bool checked) {
QKeySequence defaultKeys = item->getDefaultKeys();
item->deleteHotkeys();
item->setFirstHotkey(defaultKeys);
- m_customPushButton->setText(defaultKeys);
- m_table->item(m_currentRow, 1)->setText(defaultKeys);
+ m_customPushButton->setText(defaultKeys.toString());
+ m_table->item(m_currentRow, 1)->setText(defaultKeys.toString());
m_table->item(m_currentRow, 2)->setText("");
}
@@ -370,7 +374,7 @@ void BtShortcutsEditor::clearConflictWithKeys(const QString& keys) {
}
if (m_table->item(row, 2)->text() == keys) {
m_table->item(row, 2)->setText("");
- item->setSecondHotkey(QKeySequence(""));
+ item->setSecondHotkey(QKeySequence("").toString());
}
}
}
diff --git a/src/frontend/settingsdialogs/cswordsettings.cpp b/src/frontend/settingsdialogs/cswordsettings.cpp
index 42c3833..60c0e7c 100644
--- a/src/frontend/settingsdialogs/cswordsettings.cpp
+++ b/src/frontend/settingsdialogs/cswordsettings.cpp
@@ -30,36 +30,6 @@
StandardWorksTab
*******************************************************************************/
-class StandardWorksTab: public QWidget {
-
- public: /* Methods: */
-
- StandardWorksTab(CSwordSettingsPage *parent);
-
- void save();
-
- protected: /* Methods: */
-
- void retranslateUi();
-
- private: /* Fields: */
-
- QLabel *m_explanationLabel;
-
-#define STANDARD_WORKS_TAB_FIELD(name) \
- QLabel *m_ ## name ## Label; \
- QComboBox *m_ ## name ## Combo
-
- STANDARD_WORKS_TAB_FIELD(standardBible);
- STANDARD_WORKS_TAB_FIELD(standardCommentary);
- STANDARD_WORKS_TAB_FIELD(standardLexicon);
- STANDARD_WORKS_TAB_FIELD(standardDailyDevotional);
- STANDARD_WORKS_TAB_FIELD(standardHebrewStrongsLexicon);
- STANDARD_WORKS_TAB_FIELD(standardGreekStrongsLexicon);
- STANDARD_WORKS_TAB_FIELD(standardHebrewMorphLexicon);
- STANDARD_WORKS_TAB_FIELD(standardGreekMorphLexicon);
-};
-
StandardWorksTab::StandardWorksTab(CSwordSettingsPage *parent)
: QWidget(parent)
{
@@ -264,36 +234,6 @@ void StandardWorksTab::retranslateUi() {
TextFiltersTab
*******************************************************************************/
-class TextFiltersTab: public QWidget {
-
- public: /* Methods: */
-
- TextFiltersTab(CSwordSettingsPage *parent);
-
- void save();
-
- protected: /* Methods: */
-
- void retranslateUi();
-
- private: /* Fields: */
-
- QLabel *m_explanationLabel;
-
-#define TEXT_FILTERS_TAB_FIELD(name) QCheckBox *m_ ## name ## Check
-
- TEXT_FILTERS_TAB_FIELD(lineBreaks);
- TEXT_FILTERS_TAB_FIELD(verseNumbers);
- TEXT_FILTERS_TAB_FIELD(headings);
- TEXT_FILTERS_TAB_FIELD(hebrewPoints);
- TEXT_FILTERS_TAB_FIELD(hebrewCantillation);
- TEXT_FILTERS_TAB_FIELD(morphSegmentation);
- TEXT_FILTERS_TAB_FIELD(greekAccents);
- TEXT_FILTERS_TAB_FIELD(textualVariants);
- TEXT_FILTERS_TAB_FIELD(scriptureReferences);
-
-};
-
TextFiltersTab::TextFiltersTab(CSwordSettingsPage *parent)
: QWidget(parent)
{
@@ -359,6 +299,7 @@ void TextFiltersTab::retranslateUi() {
m_textualVariantsCheck->setText(tr("Use textual variants"));
}
+
/*******************************************************************************
CSwordSettingsPage
*******************************************************************************/
diff --git a/src/frontend/settingsdialogs/cswordsettings.h b/src/frontend/settingsdialogs/cswordsettings.h
index 01f5829..c54630d 100644
--- a/src/frontend/settingsdialogs/cswordsettings.h
+++ b/src/frontend/settingsdialogs/cswordsettings.h
@@ -15,8 +15,89 @@
class CConfigurationDialog;
-class StandardWorksTab;
-class TextFiltersTab;
+class CSwordSettingsPage;
+class QCheckBox;
+class QComboBox;
+class QLabel;
+
+
+/*******************************************************************************
+ StandardWorksTab
+*******************************************************************************/
+
+class StandardWorksTab: public QWidget {
+
+ Q_OBJECT
+
+ public: /* Methods: */
+
+ StandardWorksTab(CSwordSettingsPage *parent);
+
+ void save();
+
+ protected: /* Methods: */
+
+ void retranslateUi();
+
+ private: /* Fields: */
+
+ QLabel *m_explanationLabel;
+
+#define STANDARD_WORKS_TAB_FIELD(name) \
+ QLabel *m_ ## name ## Label; \
+ QComboBox *m_ ## name ## Combo
+
+ STANDARD_WORKS_TAB_FIELD(standardBible);
+ STANDARD_WORKS_TAB_FIELD(standardCommentary);
+ STANDARD_WORKS_TAB_FIELD(standardLexicon);
+ STANDARD_WORKS_TAB_FIELD(standardDailyDevotional);
+ STANDARD_WORKS_TAB_FIELD(standardHebrewStrongsLexicon);
+ STANDARD_WORKS_TAB_FIELD(standardGreekStrongsLexicon);
+ STANDARD_WORKS_TAB_FIELD(standardHebrewMorphLexicon);
+ STANDARD_WORKS_TAB_FIELD(standardGreekMorphLexicon);
+};
+
+
+/*******************************************************************************
+ TextFiltersTab
+*******************************************************************************/
+
+class TextFiltersTab: public QWidget {
+
+ Q_OBJECT
+
+ public: /* Methods: */
+
+ TextFiltersTab(CSwordSettingsPage *parent);
+
+ void save();
+
+ protected: /* Methods: */
+
+ void retranslateUi();
+
+ private: /* Fields: */
+
+ QLabel *m_explanationLabel;
+
+#define TEXT_FILTERS_TAB_FIELD(name) QCheckBox *m_ ## name ## Check
+
+ TEXT_FILTERS_TAB_FIELD(lineBreaks);
+ TEXT_FILTERS_TAB_FIELD(verseNumbers);
+ TEXT_FILTERS_TAB_FIELD(headings);
+ TEXT_FILTERS_TAB_FIELD(hebrewPoints);
+ TEXT_FILTERS_TAB_FIELD(hebrewCantillation);
+ TEXT_FILTERS_TAB_FIELD(morphSegmentation);
+ TEXT_FILTERS_TAB_FIELD(greekAccents);
+ TEXT_FILTERS_TAB_FIELD(textualVariants);
+ TEXT_FILTERS_TAB_FIELD(scriptureReferences);
+
+};
+
+
+/*******************************************************************************
+ CSwordSettingsPage
+*******************************************************************************/
class CSwordSettingsPage: public BtConfigDialog::Page {
diff --git a/src/main.cpp b/src/main.cpp
index 1af6e1a..0f2683c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -137,7 +137,15 @@ struct DebugStreamPtr {
#endif
bool showDebugMessages = false;
-void myMessageOutput( QtMsgType type, const char *msg ) {
+void myMessageOutput(
+ QtMsgType type,
+#if QT_VERSION >= 0x050000
+ const QMessageLogContext&,
+ const QString& message ) {
+ QByteArray msg = message.toLatin1();
+#else
+ const char *msg ) {
+#endif
// We use this messagehandler to switch debugging off in final releases
switch (type) {
case QtDebugMsg:
@@ -223,7 +231,11 @@ int main(int argc, char* argv[]) {
#else
debugStream.reset(new QFile);
debugStream->open(stderr, QIODevice::WriteOnly | QIODevice::Text);
- qInstallMsgHandler(myMessageOutput);
+#if QT_VERSION >= 0x050000
+ qInstallMessageHandler(myMessageOutput);
+#else
+ qInstallMsgHandler(myMessageOutput);
+#endif
#endif
#ifdef Q_WS_WIN
@@ -262,8 +274,6 @@ int main(int argc, char* argv[]) {
dir.setCurrent(homeSwordDir);
#endif
- // This is needed for languagemgr language names to work, they use \uxxxx escape sequences in string literals
- QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
//first install QT's own translations
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name());