summaryrefslogtreecommitdiff
path: root/src/backend/keys/cswordversekey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/keys/cswordversekey.cpp')
-rw-r--r--src/backend/keys/cswordversekey.cpp45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/backend/keys/cswordversekey.cpp b/src/backend/keys/cswordversekey.cpp
index 5ea1455..de4fd0e 100644
--- a/src/backend/keys/cswordversekey.cpp
+++ b/src/backend/keys/cswordversekey.cpp
@@ -81,8 +81,8 @@ QString CSwordVerseKey::book( const QString& newBook ) {
const CSBMI *bible = dynamic_cast<const CSBMI*>(module());
if (bible != 0) {
- const bool hasOT = bible->hasTestament(CSBMI::OldTestament);
- const bool hasNT = bible->hasTestament(CSBMI::NewTestament);
+ const bool hasOT = bible->hasOldTestament();
+ const bool hasNT = bible->hasNewTestament();
if (hasOT && hasNT) {
min = 0;
@@ -106,7 +106,7 @@ QString CSwordVerseKey::book( const QString& newBook ) {
setBookName(newBook.toUtf8().constData());
}
- if ( (Testament() >= min + 1) && (Testament() <= max + 1) && (Book() <= BMAX[min]) ) {
+ if ((getTestament() >= min + 1) && (getTestament() <= max + 1) && (getBook() <= BMAX[min])) {
return QString::fromUtf8( getBookName() );
}
@@ -135,12 +135,15 @@ bool CSwordVerseKey::setKey(const char *newKey) {
/// \todo Is this check necessary?
// Check if empty string:
if (*newKey != '\0') {
+ QString newKeyStr = newKey;
+ emitBeforeChanged();
positionFrom(newKey);
} else {
const CSwordModuleInfo *m = module();
if (m->type() == CSwordModuleInfo::Bible) {
Q_ASSERT(dynamic_cast<const CSBMI*>(m) != 0);
const CSBMI *bible = static_cast<const CSBMI*>(m);
+ emitBeforeChanged();
positionFrom(bible->lowerBound().key().toUtf8().constData());
}
}
@@ -160,24 +163,24 @@ bool CSwordVerseKey::next( const JumpType type ) {
switch (type) {
case UseBook: {
- const int currentTestament = Testament();
- const int currentBook = Book();
+ const int currentTestament = getTestament();
+ const int currentBook = getBook();
if ((currentTestament == 2) && (currentBook >= BMAX[currentTestament-1])) { //Revelation, i.e. end of navigation
return false;
}
else if ((currentTestament == 1) && (currentBook >= BMAX[currentTestament-1])) { //Malachi, switch to the NT
- Testament(currentTestament + 1);
- Book(1);
+ setTestament(currentTestament + 1);
+ setBook(1);
}
else {
- Book(Book() + 1);
+ setBook(getBook() + 1);
}
break;
}
case UseChapter: {
- Chapter(Chapter() + 1);
+ setChapter(getChapter() + 1);
break;
}
@@ -198,7 +201,7 @@ bool CSwordVerseKey::next( const JumpType type ) {
m_module->module()->setSkipConsecutiveLinks(oldStatus);
if (!m_module->module()->Error()) {
- setKey(QString::fromUtf8(m_module->module()->KeyText()));
+ setKey(QString::fromUtf8(m_module->module()->getKeyText()));
}
else {
// Verse(Verse()+1);
@@ -210,7 +213,7 @@ bool CSwordVerseKey::next( const JumpType type ) {
}
else {
- Verse(Verse() + 1);
+ setVerse(getVerse() + 1);
}
break;
@@ -223,11 +226,13 @@ bool CSwordVerseKey::next( const JumpType type ) {
const CSBMI *bible = dynamic_cast<const CSBMI*>(module());
if (bible != 0) {
if (_compare(bible->lowerBound()) < 0 ) {
+ emitBeforeChanged();
setKey(bible->lowerBound());
ret = false;
}
if (_compare(bible->upperBound()) > 0 ) {
+ emitBeforeChanged();
setKey(bible->upperBound());
ret = false;
}
@@ -251,22 +256,22 @@ bool CSwordVerseKey::previous( const JumpType type ) {
switch (type) {
case UseBook: {
- if ( (Book() == 1) && (Testament() == 1) ) { //Genesis
+ if ((getBook() == 1) && (getTestament() == 1)) { //Genesis
return false;
}
- else if ( (Book() == 1) && (Testament() == 2) ) { //Matthew
- Testament(1);
- Book(BMAX[0]);
+ else if ((getBook() == 1) && (getTestament() == 2)) { //Matthew
+ setTestament(1);
+ setBook(BMAX[0]);
}
else {
- Book( Book() - 1 );
+ setBook(getBook() - 1);
}
break;
}
case UseChapter: {
- Chapter(Chapter() - 1);
+ setChapter(getChapter() - 1);
break;
}
@@ -285,7 +290,7 @@ bool CSwordVerseKey::previous( const JumpType type ) {
m_module->module()->setSkipConsecutiveLinks(oldStatus);
if (!m_module->module()->Error()) {
- setKey(QString::fromUtf8(m_module->module()->KeyText()));//don't use fromUtf8
+ setKey(QString::fromUtf8(m_module->module()->getKeyText())); // don't use fromUtf8
}
else {
ret = false;
@@ -294,7 +299,7 @@ bool CSwordVerseKey::previous( const JumpType type ) {
}
}
else {
- Verse(Verse() - 1);
+ setVerse(getVerse() - 1);
}
break;
@@ -307,11 +312,13 @@ bool CSwordVerseKey::previous( const JumpType type ) {
const CSBMI *bible = dynamic_cast<const CSBMI*>(module());
if (bible != 0) {
if (_compare(bible->lowerBound()) < 0 ) {
+ emitBeforeChanged();
setKey(bible->lowerBound());
ret = false;
}
if (_compare(bible->upperBound()) > 0 ) {
+ emitBeforeChanged();
setKey(bible->upperBound());
ret = false;
}