Index: cmake/FindSword.cmake =================================================================== --- cmake/FindSword.cmake (revision 1010) +++ cmake/FindSword.cmake (working copy) @@ -7,43 +7,33 @@ # It will define the following values # SWORD_INCLUDE_DIR # SWORD_LIBS + SET(TRIAL_LIBRARY_PATHS + $ENV{SWORD_HOME}/lib${LIB_SUFFIX} + ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} + /usr/lib${LIB_SUFFIX} + /usr/local/lib${LIB_SUFFIX} + /sw/lib${LIB_SUFFIX} + ) + SET(TRIAL_INCLUDE_PATHS + $ENV{SWORD_HOME}/include + ${CMAKE_INSTALL_PREFIX}/include + /sw/include + ) -EXECUTE_PROCESS(COMMAND pkg-config --atleast-version=${REQUIRED_SWORD_VERSION} sword - RESULT_VARIABLE SWORD_VERSION_OK -) -EXECUTE_PROCESS(COMMAND pkg-config --atleast-version=${SIMPLE_RENDER_SWORD_VERSION} sword - RESULT_VARIABLE SIMPLE_RENDER_SWORD_OK -) -EXECUTE_PROCESS(COMMAND pkg-config --atleast-version=${MULTIVERSE_SWORD_VERSION} sword - RESULT_VARIABLE MULTIVERSE_SWORD_OK -) -EXECUTE_PROCESS(COMMAND pkg-config --modversion sword - OUTPUT_VARIABLE SWORD_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE -) + FIND_LIBRARY(SWORD_LIBRARY sword + NAMES libsword + PATHS ${TRIAL_LIBRARY_PATHS}) + IF (SWORD_LIBRARY) + MESSAGE(STATUS "Found CLucene library: ${CLUCENE_LIBRARY}") + ENDIF (SWORD_LIBRARY) + FIND_PATH(SWORD_INCLUDE_DIR + NAMES sword/swmgr.h + PATHS ${TRIAL_INCLUDE_PATHS}) -IF (SWORD_VERSION_OK EQUAL 0) + IF (SWORD_INCLUDE_DIR) + MESSAGE(STATUS "Found Sword include dir: ${SWORD_INCLUDE_DIR}") + ENDIF (SWORD_INCLUDE_DIR) - EXECUTE_PROCESS(COMMAND pkg-config --variable=includedir sword - OUTPUT_VARIABLE SWORD_INCLUDE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - MESSAGE(STATUS "Sword version ${SWORD_VERSION} is ok") - - EXECUTE_PROCESS(COMMAND pkg-config --libs sword - OUTPUT_VARIABLE SWORD_LIBS - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - MESSAGE(STATUS "Sword lib linker flags to be used: ${SWORD_LIBS}") - -ELSE (SWORD_VERSION_OK EQUAL 0) - 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) -ENDIF (SWORD_VERSION_OK EQUAL 0) - SET(SWORD_INCLUDE_DIR "${SWORD_INCLUDE_DIR}/sword") MESSAGE(STATUS "Sword include directory is ${SWORD_INCLUDE_DIR}") Index: src/backend/cswordmodulesearch.h =================================================================== --- src/backend/cswordmodulesearch.h (revision 1010) +++ src/backend/cswordmodulesearch.h (working copy) @@ -1,102 +1,101 @@ -/********* -* -* This file is part of BibleTime's source code, http://www.bibletime.info/. -* -* Copyright 1999-2008 by the BibleTime developers. -* The BibleTime source code is licensed under the GNU General Public License version 2.0. -* -**********/ - - - -#ifndef CSWORDMODULESEARCH_H -#define CSWORDMODULESEARCH_H - -//BibleTime - backend -class CSwordModuleInfo; - -//BibleTime - utils -#include "util/cpointers.h" - -//Qt includes -#include -#include - - -//System includes -#include - -//Sword includes -#include - -/** - * CSwordModuleSearch manages the search on Sword modules. It manages the thread(s) - * and manages the different modules. - * - * @author The BibleTime team - * @version $Id: cswordmodulesearch.h,v 1.34 2006/08/08 19:32:48 joachim Exp $ - */ - -class CSwordModuleSearch: public QObject, CPointers { - Q_OBJECT - -public: - CSwordModuleSearch(); - /** - * The destructor of this class. It cleans uop memory before it's deleted. - */ - virtual ~CSwordModuleSearch(); - /** - * Sets the text which should be search in the modules. - */ - void setSearchedText( const QString& ); - /** - * Starts the search for the search text. - */ - bool startSearch(); - /** - * This function sets the modules which should be searched. - */ - void setModules( const QList& ); - /** - * Sets the search scope. - */ - void setSearchScope( const sword::ListKey& scope ); - /** - * Sets the seaech scope back. - */ - void resetSearchScope(); - /** - * @return "true" if in the last search the searcher found items, if no items were found return "false" - */ - bool foundItems() const; - /** - * Returns a copy of the used search scope. - */ - const sword::ListKey& searchScope() const; - - void connectFinished( QObject * receiver, const char * member ); - void searchFinished(); - - /** - * Returns true if all of the specified modules have indices already built. - */ - bool modulesHaveIndices( const QList& ); - -protected: - QString m_searchedText; - sword::ListKey m_searchScope; - QList m_moduleList; - - int m_searchOptions; - - bool m_foundItems; - -signals: - void finished(); - -private: - static CSwordModuleSearch* searcher; -}; - -#endif +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2008 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + + + +#ifndef CSWORDMODULESEARCH_H +#define CSWORDMODULESEARCH_H + +//BibleTime - backend +class CSwordModuleInfo; + +//BibleTime - utils +#include "util/cpointers.h" + +//Qt includes +#include +#include + + +//System includes + +//Sword includes +#include + +/** + * CSwordModuleSearch manages the search on Sword modules. It manages the thread(s) + * and manages the different modules. + * + * @author The BibleTime team + * @version $Id: cswordmodulesearch.h,v 1.34 2006/08/08 19:32:48 joachim Exp $ + */ + +class CSwordModuleSearch: public QObject, CPointers { + Q_OBJECT + +public: + CSwordModuleSearch(); + /** + * The destructor of this class. It cleans uop memory before it's deleted. + */ + virtual ~CSwordModuleSearch(); + /** + * Sets the text which should be search in the modules. + */ + void setSearchedText( const QString& ); + /** + * Starts the search for the search text. + */ + bool startSearch(); + /** + * This function sets the modules which should be searched. + */ + void setModules( const QList& ); + /** + * Sets the search scope. + */ + void setSearchScope( const sword::ListKey& scope ); + /** + * Sets the seaech scope back. + */ + void resetSearchScope(); + /** + * @return "true" if in the last search the searcher found items, if no items were found return "false" + */ + bool foundItems() const; + /** + * Returns a copy of the used search scope. + */ + const sword::ListKey& searchScope() const; + + void connectFinished( QObject * receiver, const char * member ); + void searchFinished(); + + /** + * Returns true if all of the specified modules have indices already built. + */ + bool modulesHaveIndices( const QList& ); + +protected: + QString m_searchedText; + sword::ListKey m_searchScope; + QList m_moduleList; + + int m_searchOptions; + + bool m_foundItems; + +signals: + void finished(); + +private: + static CSwordModuleSearch* searcher; +}; + +#endif Index: src/backend/drivers/cswordmoduleinfo.cpp =================================================================== --- src/backend/drivers/cswordmoduleinfo.cpp (revision 1010) +++ src/backend/drivers/cswordmoduleinfo.cpp (working copy) @@ -237,7 +237,7 @@ // do not use any stop words const TCHAR* stop_words[] = { NULL }; - lucene::analysis::standard::StandardAnalyzer an( stop_words ); + lucene::analysis::standard::StandardAnalyzer an( (const TCHAR**) stop_words ); QString index = getModuleStandardIndexLocation(); QDir dir("/"); @@ -307,13 +307,15 @@ //index the key lucene_utf8towcs(wcharBuffer, key->getText(), BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnIndexed(_T("key"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("key"), wcharBuffer, lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("key"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO))); + // index the main text //at this point we have to make sure we disabled the strongs and the other options //so the plain filters won't include the numbers somehow. lucene_utf8towcs(wcharBuffer, (const char*) textBuffer.append(m_module->StripText()), BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnStored(_T("content"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("content"), wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("content"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + textBuffer.resize(0); //clean up // index attributes @@ -325,7 +327,8 @@ attListI++) { lucene_utf8towcs(wcharBuffer, attListI->second["body"], BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnStored(_T("footnote"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("footnote"), wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("footnote"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + } // for attListI // Headings @@ -334,7 +337,8 @@ attValueI++) { lucene_utf8towcs(wcharBuffer, attValueI->second, BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnStored(_T("heading"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("heading"), wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("heading"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + } // for attValueI // Strongs/Morphs @@ -345,13 +349,15 @@ if (attListI->second["LemmaClass"] == "strong") { lucene_utf8towcs(wcharBuffer, attListI->second["Lemma"], BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnStored(_T("strong"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("strong"), wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("strong"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + //qWarning("Adding strong %s", attListI->second["Lemma"].c_str()); } if (attListI->second.find("Morph") != attListI->second.end()) { lucene_utf8towcs(wcharBuffer, attListI->second["Morph"], BT_MAX_LUCENE_FIELD_LENGTH); //doc->add(*lucene::document::Field::UnStored(_T("morph"), wcharBuffer)); - doc->add(*(new lucene::document::Field(_T("morph"), wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + doc->add(*(new lucene::document::Field( (const TCHAR *)_T("morph"), (const TCHAR *) wcharBuffer, lucene::document::Field::STORE_NO | lucene::document::Field::INDEX_TOKENIZED))); + } } // for attListI @@ -427,7 +433,7 @@ lucene::analysis::standard::StandardAnalyzer analyzer( stop_words ); lucene::search::IndexSearcher searcher(getModuleStandardIndexLocation().toAscii().constData()); lucene_utf8towcs(wcharBuffer, searchedText.toUtf8().constData(), BT_MAX_LUCENE_FIELD_LENGTH); - boost::scoped_ptr q( lucene::queryParser::QueryParser::parse(wcharBuffer, _T("content"), &analyzer) ); + boost::scoped_ptr q( lucene::queryParser::QueryParser::parse( (const TCHAR*) wcharBuffer, (const TCHAR*) _T("content"), &analyzer) ); boost::scoped_ptr h( searcher.search(q.get(), lucene::search::Sort::INDEXORDER) ); @@ -440,7 +446,7 @@ for (int i = 0; i < h->length(); ++i) { doc = &h->doc(i); - lucene_wcstoutf8(utfBuffer, doc->get(_T("key")), BT_MAX_LUCENE_FIELD_LENGTH); + lucene_wcstoutf8(utfBuffer, (const wchar_t *) doc->get((const TCHAR*) _T("key")), BT_MAX_LUCENE_FIELD_LENGTH); swKey->setText(utfBuffer); Index: src/backend/filters/bt_thmlhtml.cpp =================================================================== --- src/backend/filters/bt_thmlhtml.cpp (revision 1010) +++ src/backend/filters/bt_thmlhtml.cpp (working copy) @@ -201,7 +201,7 @@ BT_UserData* myUserData = dynamic_cast(userData); sword::SWModule* myModule = const_cast(myUserData->module); //hack to be able to call stuff like Lang() - if ( tag.getName() && !strcasecmp(tag.getName(), "foreign") ) { // a text part in another language, we have to set the right font + if ( tag.getName() && !stricmp(tag.getName(), "foreign") ) { // a text part in another language, we have to set the right font if (tag.getAttribute("lang")) { const char* abbrev = tag.getAttribute("lang"); @@ -212,15 +212,15 @@ buf.append("\">"); } } - else if (tag.getName() && !strcasecmp(tag.getName(), "sync")) { //lemmas, morph codes or strongs + else if (tag.getName() && !stricmp(tag.getName(), "sync")) { //lemmas, morph codes or strongs - if (tag.getAttribute("type") && (!strcasecmp(tag.getAttribute("type"), "morph") || !strcasecmp(tag.getAttribute("type"), "Strongs") || !strcasecmp(tag.getAttribute("type"), "lemma"))) { // Morph or Strong + if (tag.getAttribute("type") && (!stricmp(tag.getAttribute("type"), "morph") || !stricmp(tag.getAttribute("type"), "Strongs") || !stricmp(tag.getAttribute("type"), "lemma"))) { // Morph or Strong buf.append('<'); buf.append(token); buf.append('>'); } } - else if (tag.getName() && !strcasecmp(tag.getName(), "note")) { // tag + else if (tag.getName() && !stricmp(tag.getName(), "note")) { // tag if (!tag.isEndTag() && !tag.isEmpty()) { //appending is faster than appendFormatted @@ -241,7 +241,7 @@ myUserData->inFootnoteTag = false; } } - else if (tag.getName() && !strcasecmp(tag.getName(), "scripRef")) { // a scripRef + else if (tag.getName() && !stricmp(tag.getName(), "scripRef")) { // a scripRef //scrip refs which are embeded in footnotes may not be displayed! if (!myUserData->inFootnoteTag) { @@ -350,18 +350,18 @@ } } } - else if (tag.getName() && !strcasecmp(tag.getName(), "div")) { + else if (tag.getName() && !stricmp(tag.getName(), "div")) { if (tag.isEndTag()) { buf.append(""); } - else if ( tag.getAttribute("class") && !strcasecmp(tag.getAttribute("class"),"sechead") ) { + else if ( tag.getAttribute("class") && !stricmp(tag.getAttribute("class"),"sechead") ) { buf.append("
"); } - else if (tag.getAttribute("class") && !strcasecmp(tag.getAttribute("class"), "title")) { + else if (tag.getAttribute("class") && !stricmp(tag.getAttribute("class"), "title")) { buf.append("
"); } } - else if (tag.getName() && !strcasecmp(tag.getName(), "img") && tag.getAttribute("src")) { + else if (tag.getName() && !stricmp(tag.getName(), "img") && tag.getAttribute("src")) { const char* value = tag.getAttribute("src"); if (value[0] == '/') { Index: src/backend/keys/cswordkey.cpp =================================================================== --- src/backend/keys/cswordkey.cpp (revision 1010) +++ src/backend/keys/cswordkey.cpp (working copy) @@ -73,7 +73,7 @@ /* In lexicons make sure that our key (e.g. 123) was successfully set to the module, i.e. the module key contains this key (e.g. 0123 contains 123) */ - if ( strcasecmp(m_module->module()->getKey()->getText(), keyBuffer) + if ( stricmp(m_module->module()->getKey()->getText(), keyBuffer) && !strstr(m_module->module()->getKey()->getText(), keyBuffer) ) { qDebug("return an empty key for %s", m_module->module()->getKey()->getText()); Index: src/frontend/cinfodisplay.cpp =================================================================== --- src/frontend/cinfodisplay.cpp (revision 1010) +++ src/frontend/cinfodisplay.cpp (working copy) @@ -236,9 +236,9 @@ Q_ASSERT(key); VerseKey* vk = dynamic_cast(key); - CTextRendering::KeyTreeItem* i = (CTextRendering::KeyTreeItem*)0; //explicit conversion for MS VS + CTextRendering::KeyTreeItem* dummy = (CTextRendering::KeyTreeItem*)0; //explicit conversion for MS VS if (vk && vk->isBoundSet()) { //render a range of keys - i = new CTextRendering::KeyTreeItem( + dummy = new CTextRendering::KeyTreeItem( QString::fromUtf8(vk->LowerBound().getText()), QString::fromUtf8(vk->UpperBound().getText()), module, @@ -246,7 +246,7 @@ ); } else { - i = new CTextRendering::KeyTreeItem( + dummy = new CTextRendering::KeyTreeItem( QString::fromUtf8(key->getText()), QString::fromUtf8(key->getText()), module, @@ -254,9 +254,9 @@ ); } - Q_ASSERT(i); + Q_ASSERT(dummy); - tree.append( i ); + tree.append( dummy ); } } else if (module) { Index: src/main.cpp =================================================================== --- src/main.cpp (revision 1010) +++ src/main.cpp (working copy) @@ -330,10 +330,10 @@ bibletime_ptr->show(); bibletime_ptr->processCommandline(); //must be done after the bibletime window is visible - new BibleTimeDBusAdaptor(bibletime_ptr); + //new BibleTimeDBusAdaptor(bibletime_ptr); // connect to D-Bus and register as an object: - QDBusConnection::sessionBus().registerObject("/BibleTime", bibletime_ptr); + //QDBusConnection::sessionBus().registerObject("/BibleTime", bibletime_ptr); const int ret = app.exec();