Just a quick hack. this assumes you've done a 'make install' for the sword libraries so you have them available for programming (headers in something like /usr/include/sword), or have installed an rpm like sword-devel. You'll probably have to change some paths in the make system. Hope this helps. Blessings on your project.
-Troy.
from within biblememorizer-0.1 top level dir, run:
patch -p1 < patch.addsword
diff -Pru biblememorizer-0.1.orig/src/filtercategory.h biblememorizer-0.1/src/filtercategory.h --- biblememorizer-0.1.orig/src/filtercategory.h 2005-03-18 16:54:18.000000000 -0700 +++ biblememorizer-0.1/src/filtercategory.h 2005-03-23 16:35:23.354847192 -0700 @@ -51,7 +51,7 @@ public: FilterCategory(const QString&); - ~FilterCategory(); + virtual ~FilterCategory(); virtual bool allows(Verse*); private: diff -Pru biblememorizer-0.1.orig/src/src.pro biblememorizer-0.1/src/src.pro --- biblememorizer-0.1.orig/src/src.pro 2005-03-21 19:58:03.000000000 -0700 +++ biblememorizer-0.1/src/src.pro 2005-03-23 16:42:18.341759592 -0700 @@ -23,7 +23,16 @@ filterallowall.cpp \ watchermainact.cpp \ filtercategory.cpp +INCLUDEPATH += /usr/include/sword LIBS += -lqassistantclient + +# for basic sword engine +LIBS += -lsword +# if sword engine was build to use lucene searching +LIBS += -lclucene +#if sword enging was build to use ICU Unicode library +LIBS += -licui18n -licuuc -licudata -lpthread -licuio + DEFINES = USE_SWORD TARGET = ../bin/biblememorizer CONFIG += release \ diff -Pru biblememorizer-0.1.orig/src/verseact.cpp biblememorizer-0.1/src/verseact.cpp --- biblememorizer-0.1.orig/src/verseact.cpp 2005-03-18 15:16:30.000000000 -0700 +++ biblememorizer-0.1/src/verseact.cpp 2005-03-23 17:30:40.900503592 -0700 @@ -50,10 +50,16 @@ #include <qtextedit.h> #include <qtabwidget.h> #include <qstringlist.h> +#include <swmgr.h> +#include <versekey.h> +#include <listkey.h> + +using namespace sword; VerseAct::VerseAct(Verse *verse, const QStringList &categories, PageType whatPage, QTabWidget *tabParent, QWidget *parent, const char *name) :VerseUI(parent, name)/*, VerseWatcher()*/ { + library = new SWMgr(); mStopRecursion = false; mVerse = verse; mVerse->addWatcher(this); @@ -61,6 +67,11 @@ mModeComboBox->insertItem(tr("View"),VIEW); mModeComboBox->insertItem(tr("Edit"),EDIT); mModeComboBox->insertItem(tr("Quiz"),QUIZ); + + for (ModMap::iterator it = library->Modules.begin(); it != library->Modules.end(); it++) { + if (!strcmp(it->second->Type(), "Biblical Texts")) + mTranslationComboBox->insertItem(it->second->Name()); + } mCategoryListBox->clear(); mCategoryListBox->insertStringList(categories); choosePage(whatPage); @@ -84,9 +95,11 @@ } mCategoriesLabel->setText(vCategories.join("; ")); mStopRecursion = false; -#ifndef USE_SWORD +#ifndef USE_SWORD mSwordButton->hide(); +#else + mSwordButton->setEnabled(true); #endif } @@ -178,6 +191,7 @@ { mVerse->removeWatcher(this); } + delete library; } void VerseAct::mBookComboBox_textChanged(const QString& newBook) @@ -251,6 +265,35 @@ } } +void VerseAct::mSwordButton_clicked() +{ + SWModule *book = library->getModule(mTranslationComboBox->currentText()); + if (book) { + QString key = mBookComboBox->currentText(); + key += mVersesEdit->text(); + + // simple 1 verse + //book->setKey((const char *)key); + + // but we need to call sword's verse parses + // to handle ranges and other stuff + VerseKey parser; + ListKey verses = parser.ParseVerseList((const char *)key, parser, true); + + // maybe remove Book, Verses separate boxes and use the following + // text to set back into a single verses reference box + qWarning(QString("Parsed verse text to: %1").arg(verses.getRangeText())); + + QString versesText = ""; + for (verses = TOP; !verses.Error(); verses++) { + book->setKey((const char *)verses); + versesText += QString::fromUtf8(book->StripText()); // StripText is no markup or frills + } + mTextEdit->setText(versesText); + } +} + + void VerseAct::mCloseButton_clicked() { closeMe(); diff -Pru biblememorizer-0.1.orig/src/verseact.h biblememorizer-0.1/src/verseact.h --- biblememorizer-0.1.orig/src/verseact.h 2005-03-18 11:18:20.000000000 -0700 +++ biblememorizer-0.1/src/verseact.h 2005-03-23 16:58:31.245855688 -0700 @@ -44,6 +44,7 @@ #include "VerseUI.h" #include "versewatcher.h" #include <qstringlist.h> +#include <swmgr.h> class Verse; class VerseAct: public VerseUI, public VerseWatcher { @@ -68,6 +69,7 @@ virtual void mTranslationComboBox_textChanged(const QString&); virtual void mVersesEdit_textChanged(const QString&); virtual void mCloseButton_clicked(); + virtual void mSwordButton_clicked(); protected: Verse *mVerse; QTabWidget *mTabWidget; @@ -75,7 +77,9 @@ inline void closeMe(bool verseDying = false); private: bool mStopRecursion; + sword::SWMgr *library; inline void updateReference(); + }; #endif diff -Pru biblememorizer-0.1.orig/src/VerseUI.ui biblememorizer-0.1/src/VerseUI.ui --- biblememorizer-0.1.orig/src/VerseUI.ui 2005-03-18 11:52:33.000000000 -0700 +++ biblememorizer-0.1/src/VerseUI.ui 2005-03-23 16:53:12.611295504 -0700 @@ -393,6 +393,12 @@ <receiver>VerseUI</receiver> <slot>mCloseButton_clicked()</slot> </connection> + <connection> + <sender>mSwordButton</sender> + <signal>clicked()</signal> + <receiver>VerseUI</receiver> + <slot>mSwordButton_clicked()</slot> + </connection> </connections> <tabstops> <tabstop>mModeComboBox</tabstop> @@ -412,6 +418,7 @@ <slot>mCategoriesListBox_selectionChanged()</slot> <slot>mTextEdit_textChanged()</slot> <slot>mCloseButton_clicked()</slot> + <slot>mSwordButton_clicked()</slot> <slot>mModeComboBox_textChanged(const QString&)</slot> </slots> <layoutdefaults spacing="6" margin="11"/>
_______________________________________________ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page