From 1a90be3b4b0807f036442eb4aba7aad33db7d92e Mon Sep 17 00:00:00 2001 From: James Hogan Date: Sat, 20 Jun 2009 17:24:20 +0100 Subject: [PATCH] Update SWORD integration to work with sword 1.6.0 (which is now required for sword integration, because the sword API has changed) --- cmake/modules/FindSword.cmake | 16 ++++++++++------ kworship/bible/biblegateway/CMakeLists.txt | 4 +--- kworship/bible/sword/KwBibleModuleSword.cpp | 15 +++++++++++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/cmake/modules/FindSword.cmake b/cmake/modules/FindSword.cmake index a5f231b..7de9f2a 100644 --- a/cmake/modules/FindSword.cmake +++ b/cmake/modules/FindSword.cmake @@ -1,4 +1,4 @@ -SET (REQUIRED_SWORD_VERSION 1.5.9) +SET (REQUIRED_SWORD_VERSION 1.6.0) # This module looks for installed sword # It is copied from the bibletime cmake/modules directory @@ -45,10 +45,14 @@ IF (SWORD_VERSION_OK EQUAL 0) ELSE (SWORD_VERSION_OK EQUAL 0) IF (SWORD_FIND_REQUIRED) - IF (SWORD_VERSION) - MESSAGE(FATAL_ERROR "Sword version ${SWORD_VERSION} does not match the required ${REQUIRED_SWORD_VERSION}") - ELSE (SWORD_VERSION) - MESSAGE(FATAL_ERROR "Sword not found") - ENDIF (SWORD_VERSION) + SET (SWORD_MESSAGE_TYPE FATAL_ERROR) + ELSE (SWORD_FIND_REQUIRED) + SET (SWORD_MESSAGE_TYPE STATUS) ENDIF (SWORD_FIND_REQUIRED) + + IF (SWORD_VERSION) + MESSAGE(${SWORD_MESSAGE_TYPE} "Sword version ${SWORD_VERSION} does not match the required ${REQUIRED_SWORD_VERSION}") + ELSE (SWORD_VERSION) + MESSAGE(${SWORD_MESSAGE_TYPE} "Sword not found") + ENDIF (SWORD_VERSION) ENDIF (SWORD_VERSION_OK EQUAL 0) diff --git a/kworship/bible/biblegateway/CMakeLists.txt b/kworship/bible/biblegateway/CMakeLists.txt index d72c9d1..3d27707 100644 --- a/kworship/bible/biblegateway/CMakeLists.txt +++ b/kworship/bible/biblegateway/CMakeLists.txt @@ -2,15 +2,13 @@ project(kworship_bible_biblegateway) find_package(KDE4 REQUIRED) include (KDE4Defaults) -find_package(Sword REQUIRED) set(kworship_bible_biblegateway_SRCS KwBibleManagerBibleGateway.cpp KwBibleModuleBibleGateway.cpp ) -include_directories(${SWORD_INCLUDE_DIR} - ..) +include_directories(..) kde4_add_plugin(kworship_bible_biblegateway ${kworship_bible_biblegateway_SRCS}) diff --git a/kworship/bible/sword/KwBibleModuleSword.cpp b/kworship/bible/sword/KwBibleModuleSword.cpp index 4d5122c..7c44bfb 100644 --- a/kworship/bible/sword/KwBibleModuleSword.cpp +++ b/kworship/bible/sword/KwBibleModuleSword.cpp @@ -91,7 +91,9 @@ int KwBibleModuleSword::numChapters(int book) if (testament >= 0) { sword::VerseKey key = m_module->getKey(); - return key.books[testament][testamentBook].chapmax; + key.Testament(1+testament); + key.Book(1+testamentBook); + return key.getChapterMax(); } return 0; } @@ -105,9 +107,12 @@ int KwBibleModuleSword::numVerses(int book, int chapter) if (testament >= 0) { sword::VerseKey key = m_module->getKey(); - if (chapter < key.books[testament][testamentBook].chapmax) + key.Testament(1+testament); + key.Book(1+testamentBook); + if (chapter < key.getChapterMax()) { - return key.books[testament][testamentBook].versemax[chapter]; + key.Chapter(1+chapter); + return key.getVerseMax(); } } } @@ -157,7 +162,9 @@ void KwBibleModuleSword::obtainBooks() int testamentBook; int testament = bibleToTestamentBook(bibleIndex, &testamentBook); Q_ASSERT(testament >= 0); - books << QString::fromUtf8(key.books[testament][testamentBook].name); + key.Testament(1+testament); + key.Book(1+testamentBook); + books << QString::fromUtf8(key.getBookName()); } setBooks(books); } -- 2.11.4.GIT