summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeus Benschop <teusjannette@gmail.com>2018-10-02 14:12:36 +0200
committerTeus Benschop <teusjannette@gmail.com>2018-10-02 14:12:36 +0200
commitfe3bed3869a1278cc274d67c1c34605d9a498140 (patch)
treec581beefe76d6d57358e4756923a3de506c7c5a5 /src
parent6ca84db1f51ce1a5eea260ddf1be7dd99437ce7e (diff)
New upstream version 2.11.2
Diffstat (limited to 'src')
-rw-r--r--src/backend/bookshelfmodel/btbookshelftreemodel.cpp3
-rw-r--r--src/backend/btsourcesthread.h2
-rw-r--r--src/backend/managers/cswordbackend.cpp2
-rw-r--r--src/bibletime_init.cpp2
-rw-r--r--src/frontend/bookshelfwizard/btbookshelftaskpage.cpp4
-rw-r--r--src/frontend/btwebenginepage.cpp9
-rw-r--r--src/frontend/display/bthtml.js5
-rw-r--r--src/frontend/display/bthtmljsobject.cpp3
-rw-r--r--src/frontend/display/btwebengine.js4
-rw-r--r--src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp2
-rw-r--r--src/main.cpp6
-rw-r--r--src/mobile/bibletime.cpp2
-rw-r--r--src/util/directory.cpp6
-rw-r--r--src/util/directory.h2
14 files changed, 35 insertions, 17 deletions
diff --git a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
index 803281f..571141b 100644
--- a/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
+++ b/src/backend/bookshelfmodel/btbookshelftreemodel.cpp
@@ -12,6 +12,7 @@
#include "btbookshelftreemodel.h"
+#include <type_traits>
#include "../../util/btassert.h"
#include "../../util/btconnect.h"
#include "../../util/macros.h"
@@ -597,7 +598,7 @@ QDataStream & operator <<(QDataStream & os,
{
os << o.size();
Q_FOREACH(BtBookshelfTreeModel::Group const g, o)
- os << static_cast<int const>(g);
+ os << static_cast<std::underlying_type<decltype(g)>::type>(g);
return os;
}
diff --git a/src/backend/btsourcesthread.h b/src/backend/btsourcesthread.h
index 3c2300e..ec5af9b 100644
--- a/src/backend/btsourcesthread.h
+++ b/src/backend/btsourcesthread.h
@@ -29,7 +29,7 @@ public: /* Methods: */
, m_finishedSuccessfully(false)
{}
- inline void stop() noexcept { m_stop.store(std::memory_order_release); }
+ void stop() noexcept { m_stop.store(true, std::memory_order_release); }
inline bool finishedSuccessfully() const noexcept
{ return m_finishedSuccessfully.load(std::memory_order_acquire); }
diff --git a/src/backend/managers/cswordbackend.cpp b/src/backend/managers/cswordbackend.cpp
index 7abef64..3e9e51b 100644
--- a/src/backend/managers/cswordbackend.cpp
+++ b/src/backend/managers/cswordbackend.cpp
@@ -422,7 +422,7 @@ void CSwordBackend::reloadModules(const SetupChangedReason reason) {
// Get one or more shared sword config (sword.conf) files
QStringList CSwordBackend::getSharedSwordConfigFiles() const {
#ifdef Q_OS_WIN
- // %ALLUSERSPROFILE%\Sword\sword.conf
+ // %ProgramData%\Sword\sword.conf
return QStringList(util::directory::convertDirSeparators(qgetenv("SWORD_PATH")) += "/Sword/sword.conf");
#else
// /etc/sword.conf, /usr/local/etc/sword.conf
diff --git a/src/bibletime_init.cpp b/src/bibletime_init.cpp
index b959d0d..7516bac 100644
--- a/src/bibletime_init.cpp
+++ b/src/bibletime_init.cpp
@@ -800,7 +800,7 @@ void BibleTime::initConnections() {
void BibleTime::initSwordConfigFile() {
// On Windows the sword.conf must be created before the initialization of sword
// It will contain the LocalePath which is used for sword locales
-// It also contains a DataPath to the %ALLUSERSPROFILE%\Sword directory
+// It also contains a DataPath to the %ProgramData%\Sword directory
// If this is not done here, the sword locales.d won't be found
#ifdef Q_OS_WIN
QString configFile = util::directory::getUserHomeSwordDir().filePath("sword.conf");
diff --git a/src/frontend/bookshelfwizard/btbookshelftaskpage.cpp b/src/frontend/bookshelfwizard/btbookshelftaskpage.cpp
index ca9c936..92d0f47 100644
--- a/src/frontend/bookshelfwizard/btbookshelftaskpage.cpp
+++ b/src/frontend/bookshelfwizard/btbookshelftaskpage.cpp
@@ -8,6 +8,7 @@
**********/
#include "backend/config/btconfig.h"
+#include "backend/managers/cswordbackend.h"
#include "frontend/bookshelfwizard/btbookshelftaskpage.h"
#include <QApplication>
@@ -104,6 +105,9 @@ void BtBookshelfTaskPage::retranslateUi() {
}
static bool timeToUpdate() {
+ BtBookshelfModel *bookshelfModel = CSwordBackend::instance()->model();
+ if (bookshelfModel->moduleList().empty())
+ return true;
QDate const lastDate = btConfig().value<QDate>(lastUpdate);
if (!lastDate.isValid())
return true;
diff --git a/src/frontend/btwebenginepage.cpp b/src/frontend/btwebenginepage.cpp
index c818789..584a6d5 100644
--- a/src/frontend/btwebenginepage.cpp
+++ b/src/frontend/btwebenginepage.cpp
@@ -35,9 +35,12 @@ BtWebEnginePage::BtWebEnginePage(QObject *parent)
}
bool BtWebEnginePage::acceptNavigationRequest(
- const QUrl& url, NavigationType /*type*/, bool /*isMainFrame*/) {
- emit linkClicked(url);
- return false;
+ const QUrl& url, NavigationType type, bool isMainFrame) {
+ if (type == QWebEnginePage::NavigationTypeLinkClicked) {
+ emit linkClicked(url);
+ return false;
+ }
+ return QWebEnginePage::acceptNavigationRequest(url, type, isMainFrame);
}
void BtWebEnginePage::addJavaScriptObject(const QString &name, QObject *object) {
diff --git a/src/frontend/display/bthtml.js b/src/frontend/display/bthtml.js
index 79bffde..ec174d8 100644
--- a/src/frontend/display/bthtml.js
+++ b/src/frontend/display/bthtml.js
@@ -82,6 +82,8 @@ function mouseMoveHandler (mEvent)
if (node.attributes.length > 0)
{
attribList = getNodeAttributes(node);
+ if (attribList == "")
+ attribList = getNodeAttributes(node.parentNode);
btHtmlJsObject.mouseMoveEvent(attribList, x, y, shiftKey);
}
}
@@ -115,6 +117,9 @@ function timerEvent()
if (currentNode != 0 && currentNode == prevNode)
{
var attributes = getNodeAttributes(currentNode);
+ if (
+ attributes == "")
+ attributes = getNodeAttributes(currentNode.parentNode);
btHtmlJsObject.timeOutEvent(attributes);
}
}
diff --git a/src/frontend/display/bthtmljsobject.cpp b/src/frontend/display/bthtmljsobject.cpp
index b2407e3..b09e1b4 100644
--- a/src/frontend/display/bthtmljsobject.cpp
+++ b/src/frontend/display/bthtmljsobject.cpp
@@ -114,9 +114,6 @@ void BtHtmlJsObject::mouseMoveEvent(const QString& attributes, const int& x, con
// called from javascript timerEvent() in bthtml.js
void BtHtmlJsObject::timeOutEvent(const QString & attributes) {
- if (m_prev_attributes != attributes)
- return;
-
m_prev_attributes = "";
Rendering::ListInfoData infoList(Rendering::detectInfo(attributes));
diff --git a/src/frontend/display/btwebengine.js b/src/frontend/display/btwebengine.js
index f0bdfb3..b36080a 100644
--- a/src/frontend/display/btwebengine.js
+++ b/src/frontend/display/btwebengine.js
@@ -82,6 +82,8 @@ function mouseMoveHandler (mEvent)
if (node.attributes.length > 0)
{
attribList = getNodeAttributes(node);
+ if (attribList == "")
+ attribList = getNodeAttributes(node.parentNode);
btHtmlJsObject.mouseMoveEvent(attribList, x, y, shiftKey);
}
}
@@ -116,6 +118,8 @@ function timerEvent()
if (currentNode != 0 && currentNode == prevNode)
{
var attributes = getNodeAttributes(currentNode);
+ if (attributes == "")
+ attributes = getNodeAttributes(currentNode.parentNode);
btHtmlJsObject.timeOutEvent(attributes);
}
}
diff --git a/src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp b/src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp
index 27a1fa3..e64034c 100644
--- a/src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp
+++ b/src/frontend/searchdialog/btsearchsyntaxhelpdialog.cpp
@@ -27,6 +27,8 @@ BtSearchSyntaxHelpDialog::BtSearchSyntaxHelpDialog(QWidget *parent, Qt::WindowFl
QVBoxLayout *l = new QVBoxLayout;
m_webView = new BtWebEngineView(this);
+ BtWebEnginePage * page = new BtWebEnginePage(this);
+ m_webView->setPage(page);
BT_CONNECT(m_webView->btPage(), SIGNAL(linkClicked(QUrl)),
this, SLOT(linkClicked(QUrl)));
l->addWidget(m_webView);
diff --git a/src/main.cpp b/src/main.cpp
index 93750ca..3c2f1c7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -12,6 +12,7 @@
#include <memory>
#include <QDateTime>
#include <QFile>
+#include <QLibraryInfo>
#include <QLocale>
#include <QTextCodec>
#include <QTranslator>
@@ -280,8 +281,9 @@ int main(int argc, char* argv[]) {
//first install QT's own translations
QTranslator qtTranslator;
- qtTranslator.load("qt_" + QLocale::system().name());
- app.installTranslator(&qtTranslator);
+ if (qtTranslator.load("qt_" + QLocale::system().name(),
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ app.installTranslator(&qtTranslator);
//then our own
QTranslator BibleTimeTranslator;
BibleTimeTranslator.load( QString("bibletime_ui_").append(QLocale::system().name()), DU::getLocaleDir().canonicalPath());
diff --git a/src/mobile/bibletime.cpp b/src/mobile/bibletime.cpp
index 3aed555..9f4011f 100644
--- a/src/mobile/bibletime.cpp
+++ b/src/mobile/bibletime.cpp
@@ -61,7 +61,7 @@ void BibleTime::initBackends() {
void BibleTime::initSwordConfigFile() {
// On Windows the sword.conf must be created before the initialization of sword
// It will contain the LocalePath which is used for sword locales
-// It also contains a DataPath to the %ALLUSERSPROFILE%\Sword directory
+// It also contains a DataPath to the %ProgramData%\Sword directory
// If this is not done here, the sword locales.d won't be found
#ifdef Q_OS_WIN
QString configFile = util::directory::getUserHomeSwordDir().filePath("sword.conf");
diff --git a/src/util/directory.cpp b/src/util/directory.cpp
index 64eb624..2596c86 100644
--- a/src/util/directory.cpp
+++ b/src/util/directory.cpp
@@ -107,14 +107,14 @@ bool initDirectoryCache() {
#endif
#if !defined Q_OS_WINCE && !defined BT_MOBILE && !defined Q_OS_WINRT
- cachedSharedSwordDir.reset(new QDir(qgetenv("ALLUSERSPROFILE"))); // sword dir for Windows only
+ cachedSharedSwordDir.reset(new QDir(qgetenv("ProgramData"))); // sword dir for Windows only
if (!cachedSharedSwordDir->cd("Application Data")) {
- qWarning() << "Cannot find ALLUSERSPROFILE\\Application Data";
+ qWarning() << "Cannot find %ProgramData%";
return false;
}
if (!cachedSharedSwordDir->cd(SWORD_DIR)) {
if (!cachedSharedSwordDir->mkdir(SWORD_DIR) || !cachedSharedSwordDir->cd(SWORD_DIR)) {
- qWarning() << "Cannot find ALLUSERSPROFILE\\Application Data\\Sword";
+ qWarning() << "Cannot find %ProgramData%\\Sword";
return false;
}
}
diff --git a/src/util/directory.h b/src/util/directory.h
index 78721f9..b774d6d 100644
--- a/src/util/directory.h
+++ b/src/util/directory.h
@@ -64,7 +64,7 @@ const QDir &getApplicationSwordDir();
#endif
#if defined Q_OS_WIN || defined Q_OS_ANDROID
-/** Return the path to the %ALLUSERSPROFILE%\Sword directory */
+/** Return the path to the shared Sword directory */
const QDir &getSharedSwordDir();
#endif