@ -48,8 +48,8 @@
# include <klocale.h>
# include <klocale.h>
// QT
// QT
# include < qstring.h>
# include < nt qstring.h>
# include < qstringlist.h>
# include < nt qstringlist.h>
// Standard C/C++
// Standard C/C++
# include <vector>
# include <vector>
@ -66,32 +66,32 @@ using namespace sword;
namespace KioSword
namespace KioSword
{
{
static const QString prev ( " <li><a href= \" %2 \" accesskey= \" p \" >« %1</a> " ) ;
static const T QString prev ( " <li><a href= \" %2 \" accesskey= \" p \" >« %1</a> " ) ;
static QString makePrevLink ( const QString& caption , const QString& url )
static T QString makePrevLink ( const T QString& caption , const T QString& url )
{
{
return prev . arg ( caption ) . arg ( url ) ;
return prev . arg ( caption ) . arg ( url ) ;
}
}
static const QString next ( " <li><a href= \" %2 \" accesskey= \" n \" >%1 »</a> " ) ;
static const T QString next ( " <li><a href= \" %2 \" accesskey= \" n \" >%1 »</a> " ) ;
static QString makeNextLink ( const QString& caption , const QString& url )
static T QString makeNextLink ( const T QString& caption , const T QString& url )
{
{
return next . arg ( caption ) . arg ( url ) ;
return next . arg ( caption ) . arg ( url ) ;
}
}
static const QString treeup ( " <li><a href= \" %3 \" accesskey= \" u \" >%1 %2</a> " ) ;
static const T QString treeup ( " <li><a href= \" %3 \" accesskey= \" u \" >%1 %2</a> " ) ;
static QString makeTreeUpLink ( const QString& caption1 , const QString& caption2 , const QString& url )
static T QString makeTreeUpLink ( const T QString& caption1 , const T QString& caption2 , const T QString& url )
{
{
return treeup . arg ( caption1 ) . arg ( caption2 ) . arg ( url ) ;
return treeup . arg ( caption1 ) . arg ( caption2 ) . arg ( url ) ;
}
}
static const QString bibleup ( " <li><a href= \" %2 \" accesskey= \" u \" >%1</a> " ) ;
static const T QString bibleup ( " <li><a href= \" %2 \" accesskey= \" u \" >%1</a> " ) ;
static QString makeBibleUpLink ( const QString& caption , const QString& url )
static T QString makeBibleUpLink ( const T QString& caption , const T QString& url )
{
{
return bibleup . arg ( caption ) . arg ( url ) ;
return bibleup . arg ( caption ) . arg ( url ) ;
}
}
static const QString genlink ( " <li><a href= \" %2 \" >%1</a> " ) ;
static const T QString genlink ( " <li><a href= \" %2 \" >%1</a> " ) ;
static QString makeGeneralLink ( const QString& caption , const QString& url )
static T QString makeGeneralLink ( const T QString& caption , const T QString& url )
{
{
return genlink . arg ( caption ) . arg ( url ) ;
return genlink . arg ( caption ) . arg ( url ) ;
}
}
@ -106,7 +106,7 @@ namespace KioSword
{
{
for ( int i = 0 ; i < NUM_MODULE_TYPES ; i + + ) {
for ( int i = 0 ; i < NUM_MODULE_TYPES ; i + + ) {
m_moduleTypes . push_back ( " " ) ;
m_moduleTypes . push_back ( " " ) ;
m_moduleTypeNames . push_back ( QString( " " ) ) ;
m_moduleTypeNames . push_back ( T QString( " " ) ) ;
}
}
m_moduleTypes [ BIBLE ] = " Biblical Texts " ;
m_moduleTypes [ BIBLE ] = " Biblical Texts " ;
@ -156,9 +156,9 @@ namespace KioSword
/** Return an HTML hyperlinked list of all modules,
/** Return an HTML hyperlinked list of all modules,
* categorised , and including descriptions
* categorised , and including descriptions
*/
*/
QString Renderer : : listModules ( const SwordOptions & options ) {
T QString Renderer : : listModules ( const SwordOptions & options ) {
QString output ;
T QString output ;
QString temp ;
T QString temp ;
ModMap : : iterator it ;
ModMap : : iterator it ;
vector < const char * > : : size_type i ;
vector < const char * > : : size_type i ;
SWModule * curMod ;
SWModule * curMod ;
@ -170,16 +170,16 @@ namespace KioSword
return output ;
return output ;
}
}
output + = QString( " <div class='moduleslist'><h1>%1</h1> " )
output + = T QString( " <div class='moduleslist'><h1>%1</h1> " )
. arg ( i18n ( " Modules " ) ) ;
. arg ( i18n ( " Modules " ) ) ;
for ( i = 0 ; i < m_moduleTypes . size ( ) ; i + + ) {
for ( i = 0 ; i < m_moduleTypes . size ( ) ; i + + ) {
output + = QString( " <h2 class='moduletype'>%1</h2> \n "
output + = T QString( " <h2 class='moduletype'>%1</h2> \n "
" <ul> \n " ) . arg ( m_moduleTypeNames [ i ] ) ;
" <ul> \n " ) . arg ( m_moduleTypeNames [ i ] ) ;
for ( it = Modules . begin ( ) ; it ! = Modules . end ( ) ; it + + ) {
for ( it = Modules . begin ( ) ; it ! = Modules . end ( ) ; it + + ) {
curMod = ( * it ) . second ;
curMod = ( * it ) . second ;
if ( ! strcmp ( curMod - > Type ( ) , m_moduleTypes [ i ] ) ) {
if ( ! strcmp ( curMod - > Type ( ) , m_moduleTypes [ i ] ) ) {
output + = QString( " <li class='module'><a class='module' href= \" %3 \" >%1</a> : %2 \n " )
output + = T QString( " <li class='module'><a class='module' href= \" %3 \" >%1</a> : %2 \n " )
. arg ( curMod - > Name ( ) )
. arg ( curMod - > Name ( ) )
. arg ( curMod - > Description ( ) )
. arg ( curMod - > Description ( ) )
. arg ( swordUrl ( curMod - > Name ( ) , options ) ) ;
. arg ( swordUrl ( curMod - > Name ( ) , options ) ) ;
@ -194,14 +194,14 @@ namespace KioSword
/** Return a sorted list of all module names
/** Return a sorted list of all module names
*
*
*/
*/
QStringList Renderer : : moduleList ( ) {
T QStringList Renderer : : moduleList ( ) {
QStringList output ;
T QStringList output ;
ModMap : : iterator it ;
ModMap : : iterator it ;
SWModule * curMod ;
SWModule * curMod ;
for ( it = Modules . begin ( ) ; it ! = Modules . end ( ) ; it + + ) {
for ( it = Modules . begin ( ) ; it ! = Modules . end ( ) ; it + + ) {
curMod = ( * it ) . second ;
curMod = ( * it ) . second ;
output + = QString( curMod - > Name ( ) ) ;
output + = T QString( curMod - > Name ( ) ) ;
}
}
output . sort ( ) ;
output . sort ( ) ;
return output ;
return output ;
@ -318,8 +318,8 @@ namespace KioSword
}
}
void Renderer : : moduleQuery ( const QString & modname , const QString & ref , const SwordOptions & options , Template * tmplt ) {
void Renderer : : moduleQuery ( const T QString & modname , const T QString & ref , const SwordOptions & options , Template * tmplt ) {
QString nav ;
T QString nav ;
SWModule * module = 0 ;
SWModule * module = 0 ;
SWKey * skey = 0 ;
SWKey * skey = 0 ;
KeyType keyt = SWKEY ;
KeyType keyt = SWKEY ;
@ -335,7 +335,7 @@ namespace KioSword
module = getModule ( modname . latin1 ( ) ) ;
module = getModule ( modname . latin1 ( ) ) ;
if ( module = = 0 ) {
if ( module = = 0 ) {
QString output ;
T QString output ;
output + = " <p><span class='error'> "
output + = " <p><span class='error'> "
+ i18n ( " The module '%1' could not be found. " ) . arg ( modname )
+ i18n ( " The module '%1' could not be found. " ) . arg ( modname )
+ " </span></p><hr/> " ;
+ " </span></p><hr/> " ;
@ -360,7 +360,7 @@ namespace KioSword
}
}
modtype = getModuleType ( module ) ;
modtype = getModuleType ( module ) ;
nav + = QString( " <li class='first'>%1 <a href= \" %3 \" >%2</a></li> " )
nav + = T QString( " <li class='first'>%1 <a href= \" %3 \" >%2</a></li> " )
. arg ( i18n ( " Module: " ) )
. arg ( i18n ( " Module: " ) )
. arg ( modname )
. arg ( modname )
. arg ( swordUrl ( modname , options ) ) ;
. arg ( swordUrl ( modname , options ) ) ;
@ -378,12 +378,12 @@ namespace KioSword
return ;
return ;
}
}
QString Renderer : : search ( const QString & modname , const QString & query , const SearchType searchType , const SwordOptions & options ) {
T QString Renderer : : search ( const T QString & modname , const T QString & query , const SearchType searchType , const SwordOptions & options ) {
SWModule * module = 0 ;
SWModule * module = 0 ;
QString output ;
T QString output ;
ListKey lk ;
ListKey lk ;
int stype = SEARCH_WORDS ;
int stype = SEARCH_WORDS ;
QString stypename ;
T QString stypename ;
ModuleType modtype ;
ModuleType modtype ;
setOptions ( options ) ;
setOptions ( options ) ;
@ -413,7 +413,7 @@ namespace KioSword
}
}
output + = " <div class='searchresults'><h1> " + i18n ( " Search results: " ) + " </h1> " ;
output + = " <div class='searchresults'><h1> " + i18n ( " Search results: " ) + " </h1> " ;
output + = QString( " <table><tr><td>%1</td><td><b>%2</b></td></tr><tr><td>%3</td><td><b>%4</b></td></tr><tr><td>%5</td><td><b>%6</b></td></tr></table> " )
output + = T QString( " <table><tr><td>%1</td><td><b>%2</b></td></tr><tr><td>%3</td><td><b>%4</b></td></tr><tr><td>%5</td><td><b>%6</b></td></tr></table> " )
. arg ( i18n ( " Module: " ) )
. arg ( i18n ( " Module: " ) )
. arg ( modname )
. arg ( modname )
. arg ( i18n ( " Query: " ) )
. arg ( i18n ( " Query: " ) )
@ -429,17 +429,17 @@ namespace KioSword
output + = " <p> " + i18n ( " 1 match returned: " , " %1 matches returned: " , lk . Count ( ) ) . arg ( lk . Count ( ) ) ;
output + = " <p> " + i18n ( " 1 match returned: " , " %1 matches returned: " , lk . Count ( ) ) . arg ( lk . Count ( ) ) ;
output + = " <ul> " ;
output + = " <ul> " ;
for ( int i = 0 ; i < lk . Count ( ) ; + + i ) {
for ( int i = 0 ; i < lk . Count ( ) ; + + i ) {
QString ref ;
T QString ref ;
ref = QString: : fromUtf8 ( lk . getElement ( i ) - > getText ( ) ) ;
ref = T QString: : fromUtf8 ( lk . getElement ( i ) - > getText ( ) ) ;
if ( modtype = = BIBLE ) {
if ( modtype = = BIBLE ) {
module - > setKey ( lk . getElement ( i ) ) ;
module - > setKey ( lk . getElement ( i ) ) ;
output + = QString( " <li><a href= \" %3 \" >%1</a>: %2</li> " )
output + = T QString( " <li><a href= \" %3 \" >%1</a>: %2</li> " )
. arg ( ref )
. arg ( ref )
. arg ( renderText ( module ) )
. arg ( renderText ( module ) )
. arg ( swordUrl ( modname , ref , options ) ) ;
. arg ( swordUrl ( modname , ref , options ) ) ;
} else {
} else {
output + = QString( " <li><a href= \" %2 \" >%1</a></li> " )
output + = T QString( " <li><a href= \" %2 \" >%1</a></li> " )
. arg ( ref )
. arg ( ref )
. arg ( swordUrl ( modname , ref , options ) ) ;
. arg ( swordUrl ( modname , ref , options ) ) ;
}
}
@ -450,17 +450,17 @@ namespace KioSword
return output ;
return output ;
}
}
QString Renderer : : renderText ( SWModule * module ) {
T QString Renderer : : renderText ( SWModule * module ) {
return QString: : fromUtf8 ( module - > RenderText ( ) ) ;
return T QString: : fromUtf8 ( module - > RenderText ( ) ) ;
}
}
/** Fill in template with formatted text for the query of a verse based module
/** Fill in template with formatted text for the query of a verse based module
* Links are appended to navlinks .
* Links are appended to navlinks .
*/
*/
void Renderer : : verseQuery ( SWModule * module , const QString & ref , const SwordOptions & options ,
void Renderer : : verseQuery ( SWModule * module , const T QString & ref , const SwordOptions & options ,
ModuleType modtype , Template * tmplt , QString & navlinks ) {
ModuleType modtype , Template * tmplt , T QString & navlinks ) {
QString modname ( module - > Name ( ) ) ;
T QString modname ( module - > Name ( ) ) ;
QString text ;
T QString text ;
bool doindex = false ;
bool doindex = false ;
const char * modtextdir ; // text direction of the module
const char * modtextdir ; // text direction of the module
@ -505,13 +505,13 @@ namespace KioSword
// List books and link for viewing entire book
// List books and link for viewing entire book
SwordOptions options_wholebook ( options ) ;
SwordOptions options_wholebook ( options ) ;
options_wholebook . wholeBook . set ( true ) ; // set just for creating the URL
options_wholebook . wholeBook . set ( true ) ; // set just for creating the URL
text + = QString( " <h2>%1</h2> "
text + = T QString( " <h2>%1</h2> "
" <p>%2</p> "
" <p>%2</p> "
" <p class='chapterlist'>%3</p> " )
" <p class='chapterlist'>%3</p> " )
. arg ( element - > getBookName ( ) )
. arg ( element - > getBookName ( ) )
. arg ( i18n ( " Chapters: " ) )
. arg ( i18n ( " Chapters: " ) )
. arg ( chapterList ( modname , element , options ) )
. arg ( chapterList ( modname , element , options ) )
+ QString( " <p><a href= \" %2 \" >%1</a></p> " )
+ T QString( " <p><a href= \" %2 \" >%1</a></p> " )
. arg ( i18n ( " View entire book. " ) )
. arg ( i18n ( " View entire book. " ) )
. arg ( swordUrl ( module - > Name ( ) , element - > getBookName ( ) , options_wholebook ) ) ;
. arg ( swordUrl ( module - > Name ( ) , element - > getBookName ( ) , options_wholebook ) ) ;
if ( ! upToBookListShown )
if ( ! upToBookListShown )
@ -558,7 +558,7 @@ namespace KioSword
text + = " </div> " ;
text + = " </div> " ;
inDirectionedDiv = false ;
inDirectionedDiv = false ;
}
}
text + = " <h2> " + QString( curvk - > getBookName ( ) ) + " </h2> " ;
text + = " <h2> " + T QString( curvk - > getBookName ( ) ) + " </h2> " ;
chapter = 0 ;
chapter = 0 ;
}
}
if ( curvk - > Chapter ( ) ! = chapter ) {
if ( curvk - > Chapter ( ) ! = chapter ) {
@ -572,12 +572,12 @@ namespace KioSword
}
}
if ( ! inDirectionedDiv ) {
if ( ! inDirectionedDiv ) {
text + = QString( " <div dir='%1'> " ) . arg ( modtextdir ) ;
text + = T QString( " <div dir='%1'> " ) . arg ( modtextdir ) ;
inDirectionedDiv = true ;
inDirectionedDiv = true ;
}
}
if ( options . verseNumbers ( ) & & modtype = = BIBLE ) {
if ( options . verseNumbers ( ) & & modtype = = BIBLE ) {
text + = QString( " <a class= \" versenumber \" href= \" %2 \" >%1</a> " )
text + = T QString( " <a class= \" versenumber \" href= \" %2 \" >%1</a> " )
. arg ( curvk - > Verse ( ) )
. arg ( curvk - > Verse ( ) )
. arg ( swordUrl ( module - > Name ( ) , module - > KeyText ( ) , options ) ) ;
. arg ( swordUrl ( module - > Name ( ) , module - > KeyText ( ) , options ) ) ;
}
}
@ -617,8 +617,8 @@ namespace KioSword
// Single verse
// Single verse
module - > Key ( * lk . GetElement ( i ) ) ;
module - > Key ( * lk . GetElement ( i ) ) ;
element = dynamic_cast < VerseKey * > ( module - > getKey ( ) ) ;
element = dynamic_cast < VerseKey * > ( module - > getKey ( ) ) ;
text + = QString( " <h3>%1</h3> " ) . arg ( module - > KeyText ( ) ) ;
text + = T QString( " <h3>%1</h3> " ) . arg ( module - > KeyText ( ) ) ;
text + = QString( " <div dir='%1'> " ) . arg ( modtextdir ) ;
text + = T QString( " <div dir='%1'> " ) . arg ( modtextdir ) ;
text + = renderText ( module ) ;
text + = renderText ( module ) ;
text + = " </div> " ;
text + = " </div> " ;
if ( lk . Count ( ) = = 1 )
if ( lk . Count ( ) = = 1 )
@ -631,27 +631,27 @@ namespace KioSword
} while ( false ) ;
} while ( false ) ;
// Title: depends on what got printed above
// Title: depends on what got printed above
QString title ;
T QString title ;
if ( doindex ) {
if ( doindex ) {
if ( ! text . isEmpty ( ) ) { // an error message was printed
if ( ! text . isEmpty ( ) ) { // an error message was printed
text = QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) . arg ( ref )
text = T QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) . arg ( ref )
+ text ;
+ text ;
title = " Error - Kio-Sword " ;
title = " Error - Kio-Sword " ;
}
}
else
else
{
{
title = QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ;
title = T QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ;
}
}
} else {
} else {
if ( modtype = = COMMENTARY ) {
if ( modtype = = COMMENTARY ) {
text = QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) )
text = T QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) )
+ text ;
+ text ;
title = QString( " %1 - %2 - Kio-Sword " )
title = T QString( " %1 - %2 - Kio-Sword " )
. arg ( lk . getShortText ( ) )
. arg ( lk . getShortText ( ) )
. arg ( module - > Name ( ) ) ;
. arg ( module - > Name ( ) ) ;
} else if ( modtype = = BIBLE ) {
} else if ( modtype = = BIBLE ) {
text + = QString( " <div class= \" biblename \" >(%1)</div> " ) . arg ( module - > Description ( ) ) ;
text + = T QString( " <div class= \" biblename \" >(%1)</div> " ) . arg ( module - > Description ( ) ) ;
title = QString( " %1 - %2 - Kio-Sword " )
title = T QString( " %1 - %2 - Kio-Sword " )
. arg ( lk . getShortText ( ) )
. arg ( lk . getShortText ( ) )
. arg ( module - > Name ( ) ) ;
. arg ( module - > Name ( ) ) ;
}
}
@ -667,7 +667,7 @@ namespace KioSword
} else {
} else {
SwordOptions options_doindex ( options ) ;
SwordOptions options_doindex ( options ) ;
options_doindex . doBibleIndex . set ( true ) ;
options_doindex . doBibleIndex . set ( true ) ;
text + = QString( " <p><a href= \" %2 \" >%1</a></p> " )
text + = T QString( " <p><a href= \" %2 \" >%1</a></p> " )
. arg ( i18n ( " Index of books " ) )
. arg ( i18n ( " Index of books " ) )
. arg ( swordUrl ( modname , options_doindex ) ) ;
. arg ( swordUrl ( modname , options_doindex ) ) ;
}
}
@ -675,17 +675,17 @@ namespace KioSword
tmplt - > setContent ( text ) ;
tmplt - > setContent ( text ) ;
}
}
void Renderer : : treeQuery ( SWModule * module , const QString & ref , const SwordOptions & options ,
void Renderer : : treeQuery ( SWModule * module , const T QString & ref , const SwordOptions & options ,
ModuleType modtype , Template * tmplt , QString & navlinks ) {
ModuleType modtype , Template * tmplt , T QString & navlinks ) {
QString output ;
T QString output ;
QString modname ( module - > Name ( ) ) ;
T QString modname ( module - > Name ( ) ) ;
bool doindex ;
bool doindex ;
TreeKey * tk = dynamic_cast < TreeKey * > ( module - > getKey ( ) ) ;
TreeKey * tk = dynamic_cast < TreeKey * > ( module - > getKey ( ) ) ;
if ( ! tk )
if ( ! tk )
return ;
return ;
output + = QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) ;
output + = T QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) ;
if ( ref . isEmpty ( ) ) {
if ( ref . isEmpty ( ) ) {
doindex = true ;
doindex = true ;
} else {
} else {
@ -697,17 +697,17 @@ namespace KioSword
output + = " <hr/> " ;
output + = " <hr/> " ;
doindex = true ;
doindex = true ;
} else {
} else {
QString link ;
T QString link ;
output + = renderText ( module ) ;
output + = renderText ( module ) ;
if ( tk - > previousSibling ( ) ) {
if ( tk - > previousSibling ( ) ) {
link = QString: : fromUtf8 ( module - > KeyText ( ) ) ; // FIXME ? local8Bit or utf8
link = T QString: : fromUtf8 ( module - > KeyText ( ) ) ; // FIXME ? local8Bit or utf8
navlinks + = makePrevLink ( shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
navlinks + = makePrevLink ( shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
swordUrl ( modname , link , options ) ) ;
swordUrl ( modname , link , options ) ) ;
tk - > nextSibling ( ) ;
tk - > nextSibling ( ) ;
}
}
SWKey * saved = tk - > clone ( ) ;
SWKey * saved = tk - > clone ( ) ;
if ( tk - > parent ( ) ) {
if ( tk - > parent ( ) ) {
link = QString: : fromUtf8 ( module - > KeyText ( ) ) ;
link = T QString: : fromUtf8 ( module - > KeyText ( ) ) ;
navlinks + = makeTreeUpLink ( i18n ( " Up: " ) ,
navlinks + = makeTreeUpLink ( i18n ( " Up: " ) ,
shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
swordUrl ( modname , link , options ) ) ;
swordUrl ( modname , link , options ) ) ;
@ -715,7 +715,7 @@ namespace KioSword
}
}
delete saved ;
delete saved ;
if ( tk - > nextSibling ( ) ) {
if ( tk - > nextSibling ( ) ) {
link = QString: : fromUtf8 ( module - > KeyText ( ) ) ;
link = T QString: : fromUtf8 ( module - > KeyText ( ) ) ;
navlinks + = makeNextLink ( shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
navlinks + = makeNextLink ( shorten ( link . section ( ' / ' , - 1 , - 1 ) , 20 ) ,
swordUrl ( modname , link , options ) ) ;
swordUrl ( modname , link , options ) ) ;
tk - > previousSibling ( ) ;
tk - > previousSibling ( ) ;
@ -734,35 +734,35 @@ namespace KioSword
if ( options . doFullTreeIndex ( ) ) {
if ( options . doFullTreeIndex ( ) ) {
options_doindex . doFullTreeIndex . set ( false ) ;
options_doindex . doFullTreeIndex . set ( false ) ;
output + = indexTree ( module , options , true , - 1 ) ;
output + = indexTree ( module , options , true , - 1 ) ;
output + = QString( " <p><a href= \" %2 \" >%1</a></p> " )
output + = T QString( " <p><a href= \" %2 \" >%1</a></p> " )
. arg ( i18n ( " View simple index " ) )
. arg ( i18n ( " View simple index " ) )
. arg ( swordUrl ( modname , options_doindex ) ) ;
. arg ( swordUrl ( modname , options_doindex ) ) ;
} else {
} else {
options_doindex . doFullTreeIndex . set ( true ) ;
options_doindex . doFullTreeIndex . set ( true ) ;
output + = indexTree ( module , options , true , 1 ) ;
output + = indexTree ( module , options , true , 1 ) ;
output + = QString( " <p><a href= \" %2 \" >%1</a></p> " )
output + = T QString( " <p><a href= \" %2 \" >%1</a></p> " )
. arg ( i18n ( " View full index " ) )
. arg ( i18n ( " View full index " ) )
. arg ( swordUrl ( modname , options_doindex ) ) ;
. arg ( swordUrl ( modname , options_doindex ) ) ;
}
}
tmplt - > setTitle ( QString( " %1 - %2 - Kio-Sword " ) . arg ( tk - > getShortText ( ) ) . arg ( module - > Name ( ) ) ) ;
tmplt - > setTitle ( T QString( " %1 - %2 - Kio-Sword " ) . arg ( tk - > getShortText ( ) ) . arg ( module - > Name ( ) ) ) ;
}
}
else
else
{
{
tmplt - > setTitle ( QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ) ;
tmplt - > setTitle ( T QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ) ;
}
}
tmplt - > setContent ( output ) ;
tmplt - > setContent ( output ) ;
}
}
void Renderer : : normalQuery ( SWModule * module , const QString & ref , const SwordOptions & options ,
void Renderer : : normalQuery ( SWModule * module , const T QString & ref , const SwordOptions & options ,
ModuleType modtype , Template * tmplt , QString & navlinks ) {
ModuleType modtype , Template * tmplt , T QString & navlinks ) {
QString output ;
T QString output ;
QString modname ( module - > Name ( ) ) ;
T QString modname ( module - > Name ( ) ) ;
bool doindex ;
bool doindex ;
SWKey * skey = module - > getKey ( ) ;
SWKey * skey = module - > getKey ( ) ;
output + = QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) ;
output + = T QString( " <h1 class= \" moduletitle \" >%1</h1> " ) . arg ( module - > Description ( ) ) ;
if ( ref . isEmpty ( ) ) {
if ( ref . isEmpty ( ) ) {
doindex = true ;
doindex = true ;
@ -771,14 +771,14 @@ namespace KioSword
skey - > setText ( ref . utf8 ( ) ) ;
skey - > setText ( ref . utf8 ( ) ) ;
doindex = false ;
doindex = false ;
if ( skey - > Error ( ) ) {
if ( skey - > Error ( ) ) {
output + = " <p class= \" error \" > " + QString( i18n ( " Couldn't find reference '%1'. " ) ) . arg ( ref ) + " </p> " ;
output + = " <p class= \" error \" > " + T QString( i18n ( " Couldn't find reference '%1'. " ) ) . arg ( ref ) + " </p> " ;
output + = " <hr> " ;
output + = " <hr> " ;
doindex = true ;
doindex = true ;
} else {
} else {
output + = QString( " <h3>%1</h3> " ) . arg ( module - > KeyText ( ) ) ;
output + = T QString( " <h3>%1</h3> " ) . arg ( module - > KeyText ( ) ) ;
output + = renderText ( module ) ;
output + = renderText ( module ) ;
module - > decrement ( ) ;
module - > decrement ( ) ;
QString link ;
T QString link ;
if ( ! module - > Error ( ) ) {
if ( ! module - > Error ( ) ) {
link = module - > KeyText ( ) ;
link = module - > KeyText ( ) ;
navlinks + = makePrevLink ( link , swordUrl ( modname , link , options ) ) ;
navlinks + = makePrevLink ( link , swordUrl ( modname , link , options ) ) ;
@ -800,7 +800,7 @@ namespace KioSword
output + = indexBook ( module , options ) ;
output + = indexBook ( module , options ) ;
} else {
} else {
output + = QString( " <form action='%2' method='get'> "
output + = T QString( " <form action='%2' method='get'> "
" %1 <input type='text' name='query'> "
" %1 <input type='text' name='query'> "
" </form> " )
" </form> " )
. arg ( i18n ( " Enter query term: " ) )
. arg ( i18n ( " Enter query term: " ) )
@ -809,15 +809,15 @@ namespace KioSword
SwordOptions options_doindex ( options ) ;
SwordOptions options_doindex ( options ) ;
options_doindex . doDictIndex . set ( true ) ;
options_doindex . doDictIndex . set ( true ) ;
options_doindex . doOtherIndex . set ( true ) ;
options_doindex . doOtherIndex . set ( true ) ;
output + = QString( " <p><a href= \" %2 \" >%1</a></p> " )
output + = T QString( " <p><a href= \" %2 \" >%1</a></p> " )
. arg ( i18n ( " View complete index " ) )
. arg ( i18n ( " View complete index " ) )
. arg ( swordUrl ( modname , options_doindex ) ) ;
. arg ( swordUrl ( modname , options_doindex ) ) ;
}
}
tmplt - > setTitle ( QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ) ;
tmplt - > setTitle ( T QString( " %1 - Kio-Sword " ) . arg ( module - > Name ( ) ) ) ;
}
}
else
else
{
{
tmplt - > setTitle ( QString( " %1 - %2 - Kio-Sword " ) . arg ( skey - > getShortText ( ) ) . arg ( module - > Name ( ) ) ) ;
tmplt - > setTitle ( T QString( " %1 - %2 - Kio-Sword " ) . arg ( skey - > getShortText ( ) ) . arg ( module - > Name ( ) ) ) ;
}
}
tmplt - > setContent ( output ) ;
tmplt - > setContent ( output ) ;
}
}
@ -827,8 +827,8 @@ namespace KioSword
* @ param module The module to retrieve . Must be a Bible / commentary
* @ param module The module to retrieve . Must be a Bible / commentary
*/
*/
QString Renderer : : indexBible ( SWModule * module , const SwordOptions & options ) {
T QString Renderer : : indexBible ( SWModule * module , const SwordOptions & options ) {
QString output ;
T QString output ;
char book ;
char book ;
char testament ;
char testament ;
VerseKey * vk = dynamic_cast < VerseKey * > ( module - > getKey ( ) ) ;
VerseKey * vk = dynamic_cast < VerseKey * > ( module - > getKey ( ) ) ;
@ -847,7 +847,7 @@ namespace KioSword
output + = " <ul> \n " ;
output + = " <ul> \n " ;
while ( vk - > Testament ( ) = = testament ) {
while ( vk - > Testament ( ) = = testament ) {
while ( vk - > Book ( ) = = book & & ! module - > Error ( ) ) {
while ( vk - > Book ( ) = = book & & ! module - > Error ( ) ) {
output + = QString( " <li><a href= \" %2 \" >%1</a> \n " )
output + = T QString( " <li><a href= \" %2 \" >%1</a> \n " )
. arg ( vk - > getBookName ( ) )
. arg ( vk - > getBookName ( ) )
. arg ( swordUrl ( module - > Name ( ) , vk - > getBookName ( ) , options ) ) ;
. arg ( swordUrl ( module - > Name ( ) , vk - > getBookName ( ) , options ) ) ;
vk - > Book ( + + book ) ;
vk - > Book ( + + book ) ;
@ -869,15 +869,15 @@ namespace KioSword
* @ param module The module to retrieve . Must have key type SWKey
* @ param module The module to retrieve . Must have key type SWKey
*/
*/
QString Renderer : : indexBook ( SWModule * module , const SwordOptions & options ) {
T QString Renderer : : indexBook ( SWModule * module , const SwordOptions & options ) {
QString output ;
T QString output ;
QString ref ;
T QString ref ;
module - > setPosition ( sword : : TOP ) ;
module - > setPosition ( sword : : TOP ) ;
output + = " <ul> \n " ;
output + = " <ul> \n " ;
do {
do {
ref = QString: : fromUtf8 ( module - > KeyText ( ) ) ;
ref = T QString: : fromUtf8 ( module - > KeyText ( ) ) ;
output + = QString( " <li><a href= \" %2 \" >%1</a></li> " )
output + = T QString( " <li><a href= \" %2 \" >%1</a></li> " )
. arg ( ref )
. arg ( ref )
. arg ( swordUrl ( module - > Name ( ) , ref , options ) ) ;
. arg ( swordUrl ( module - > Name ( ) , ref , options ) ) ;
( * module ) + + ;
( * module ) + + ;
@ -892,9 +892,9 @@ namespace KioSword
* @ param fromTop If true , get the index from the top level
* @ param fromTop If true , get the index from the top level
* @ param depth How many levels to scan , - 1 for all
* @ param depth How many levels to scan , - 1 for all
*/
*/
QString Renderer : : indexTree ( SWModule * module , const SwordOptions & options , bool fromTop , const int depth ) {
T QString Renderer : : indexTree ( SWModule * module , const SwordOptions & options , bool fromTop , const int depth ) {
QString output ;
T QString output ;
QString ref ;
T QString ref ;
bool gonext ;
bool gonext ;
bool cont ;
bool cont ;
@ -914,8 +914,8 @@ namespace KioSword
gonext = false ;
gonext = false ;
do {
do {
if ( ! gonext ) {
if ( ! gonext ) {
ref = QString: : fromUtf8 ( module - > KeyText ( ) ) ;
ref = T QString: : fromUtf8 ( module - > KeyText ( ) ) ;
output + = QString( " <li><a href= \" %2 \" >%1</a> \n " )
output + = T QString( " <li><a href= \" %2 \" >%1</a> \n " )
. arg ( ref . section ( ' / ' , - 1 ) )
. arg ( ref . section ( ' / ' , - 1 ) )
. arg ( swordUrl ( module - > Name ( ) , ref , options ) ) ;
. arg ( swordUrl ( module - > Name ( ) , ref , options ) ) ;
}
}
@ -951,13 +951,13 @@ namespace KioSword
}
}
QString Renderer : : chapterList ( const QString & modname , const VerseKey * vk , const SwordOptions & options ) {
T QString Renderer : : chapterList ( const T QString & modname , const VerseKey * vk , const SwordOptions & options ) {
VerseKey cp ( vk - > LowerBound ( ) ) ;
VerseKey cp ( vk - > LowerBound ( ) ) ;
QString output ;
T QString output ;
do {
do {
cp . Verse ( 0 ) ;
cp . Verse ( 0 ) ;
if ( ! output . isNull ( ) ) output + = " | " ;
if ( ! output . isNull ( ) ) output + = " | " ;
output + = QString( " <a href= \" %2 \" >%1</a> " )
output + = T QString( " <a href= \" %2 \" >%1</a> " )
. arg ( cp . Chapter ( ) )
. arg ( cp . Chapter ( ) )
. arg ( chapterLink ( modname , & cp , options ) ) ;
. arg ( chapterLink ( modname , & cp , options ) ) ;
cp . Chapter ( cp . Chapter ( ) + 1 ) ;
cp . Chapter ( cp . Chapter ( ) + 1 ) ;
@ -965,63 +965,63 @@ namespace KioSword
return output ;
return output ;
}
}
QString Renderer : : chapterLink ( const QString & modname , const VerseKey * vk , const SwordOptions & options ) {
T QString Renderer : : chapterLink ( const T QString & modname , const VerseKey * vk , const SwordOptions & options ) {
return swordUrl ( modname , bookChapter ( vk ) , options ) ;
return swordUrl ( modname , bookChapter ( vk ) , options ) ;
}
}
QString Renderer : : chapterLink ( const QString & modname , const SWKey * sk , const SwordOptions & options ) {
T QString Renderer : : chapterLink ( const T QString & modname , const SWKey * sk , const SwordOptions & options ) {
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
if ( vk )
if ( vk )
return chapterLink ( modname , vk , options ) ;
return chapterLink ( modname , vk , options ) ;
else
else
return QString: : null ;
return T QString: : null ;
}
}
QString Renderer : : bookLink ( const QString & modname , const VerseKey * vk , const SwordOptions & options ) {
T QString Renderer : : bookLink ( const T QString & modname , const VerseKey * vk , const SwordOptions & options ) {
return swordUrl ( modname , bookName ( vk ) , options ) ;
return swordUrl ( modname , bookName ( vk ) , options ) ;
}
}
QString Renderer : : bookLink ( const QString & modname , const SWKey * sk , const SwordOptions & options ) {
T QString Renderer : : bookLink ( const T QString & modname , const SWKey * sk , const SwordOptions & options ) {
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
if ( vk )
if ( vk )
return bookLink ( modname , vk , options ) ;
return bookLink ( modname , vk , options ) ;
else
else
return QString: : null ;
return T QString: : null ;
}
}
QString Renderer : : bookChapter ( const VerseKey * vk ) {
T QString Renderer : : bookChapter ( const VerseKey * vk ) {
return QString( " %1 %2 " ) . arg ( vk - > getBookName ( ) ) . arg ( vk - > Chapter ( ) ) ;
return T QString( " %1 %2 " ) . arg ( vk - > getBookName ( ) ) . arg ( vk - > Chapter ( ) ) ;
}
}
QString Renderer : : bookChapter ( const SWKey * sk ) {
T QString Renderer : : bookChapter ( const SWKey * sk ) {
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
if ( vk )
if ( vk )
return bookChapter ( vk ) ;
return bookChapter ( vk ) ;
else
else
return QString: : null ;
return T QString: : null ;
}
}
QString Renderer : : bookName ( const VerseKey * vk ) {
T QString Renderer : : bookName ( const VerseKey * vk ) {
return QString( vk - > getBookName ( ) ) ;
return T QString( vk - > getBookName ( ) ) ;
}
}
QString Renderer : : bookName ( const SWKey * sk ) {
T QString Renderer : : bookName ( const SWKey * sk ) {
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
const VerseKey * vk = dynamic_cast < const VerseKey * > ( sk ) ;
if ( vk )
if ( vk )
return bookName ( vk ) ;
return bookName ( vk ) ;
else
else
return QString: : null ;
return T QString: : null ;
}
}
QStringList Renderer : : availableLocales ( )
T QStringList Renderer : : availableLocales ( )
{
{
list < SWBuf > locales = LocaleMgr : : getSystemLocaleMgr ( ) - > getAvailableLocales ( ) ;
list < SWBuf > locales = LocaleMgr : : getSystemLocaleMgr ( ) - > getAvailableLocales ( ) ;
list < SWBuf > : : const_iterator it ;
list < SWBuf > : : const_iterator it ;
list < SWBuf > : : const_iterator it_end = locales . end ( ) ;
list < SWBuf > : : const_iterator it_end = locales . end ( ) ;
QStringList output ;
T QStringList output ;
for ( it = locales . begin ( ) ; it ! = it_end ; it + + )
for ( it = locales . begin ( ) ; it ! = it_end ; it + + )
{
{
output . append ( QString( ( * it ) . c_str ( ) ) ) ;
output . append ( T QString( ( * it ) . c_str ( ) ) ) ;
}
}
return output ;
return output ;
}
}