diff options
Diffstat (limited to 'knights/pgn.cpp')
-rw-r--r-- | knights/pgn.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/knights/pgn.cpp b/knights/pgn.cpp index a4de0a6..3723f8a 100644 --- a/knights/pgn.cpp +++ b/knights/pgn.cpp @@ -17,11 +17,11 @@ #include <sys/utsname.h> #include <sys/types.h> -#include <qdatetime.h> -#include <qregexp.h> +#include <tqdatetime.h> +#include <tqregexp.h> #include <kprinter.h> -#include <qfontmetrics.h> -#include <qpaintdevicemetrics.h> +#include <tqfontmetrics.h> +#include <tqpaintdevicemetrics.h> #include "pgn.moc" #include "tabmanager.h" #include "tab_pgnview.h" @@ -34,7 +34,7 @@ pgn::pgn( resource *Rsrc, match_param *param ) if( Param != NULL ) { - connect( Param, SIGNAL( valuesChanged() ), this, SLOT( parseMatchParam() ) ); + connect( Param, TQT_SIGNAL( valuesChanged() ), this, TQT_SLOT( parseMatchParam() ) ); } } pgn::~pgn() @@ -45,7 +45,7 @@ pgn::~pgn() { if( Resource->tabManager->isTab( pgnView ) ) { - Resource->tabManager->removeTab( pgnView ); + Resource->tabManager->removeTab( TQT_TQOBJECT(pgnView) ); } } } @@ -106,16 +106,16 @@ void pgn::parseMatchParam( void ) // pgn::notation // /////////////////////////////////////// -QStringList* pgn::notation( const int format ) +TQStringList* pgn::notation( const int format ) { - QStringList *list; - QString notation; + TQStringList *list; + TQString notation; MoveList::Iterator IT; Annotation *annon; int tmp(0), Line(0); bool showLineNumber( false ); - list = new QStringList; + list = new TQStringList; switch( format ) { @@ -123,7 +123,7 @@ QStringList* pgn::notation( const int format ) /* CAN Raw move data ( ie. for UCI engines ) */ for( IT = Moves.begin(); IT != Moves.end(); ++IT ) { - list->append( QString( (*IT).CAN ) ); + list->append( TQString( (*IT).CAN ) ); } break; @@ -134,11 +134,11 @@ QStringList* pgn::notation( const int format ) Line = ( tmp + 2 ) >> 1; if( ( tmp % 2 ) == 0 ) { - notation = QString( "%1. %2" ).arg( Line ).arg( (*IT).SAN ); + notation = TQString( "%1. %2" ).tqarg( Line ).tqarg( (*IT).SAN ); } else { - notation = QString( "%1... %2" ).arg( Line ).arg( (*IT).SAN ); + notation = TQString( "%1... %2" ).tqarg( Line ).tqarg( (*IT).SAN ); } list->append( notation ); tmp++; @@ -152,37 +152,37 @@ QStringList* pgn::notation( const int format ) Line = ( tmp + 2 ) >> 1; if( ( tmp % 2 ) == 0 ) { - notation = QString( "%1. %2" ).arg( Line ).arg( (*IT).SAN ); + notation = TQString( "%1. %2" ).tqarg( Line ).tqarg( (*IT).SAN ); } else { if( showLineNumber ) { - notation = QString( "%1... %2" ).arg( Line ).arg( (*IT).SAN ); + notation = TQString( "%1... %2" ).tqarg( Line ).tqarg( (*IT).SAN ); } else { - notation = QString( (*IT).SAN ); + notation = TQString( (*IT).SAN ); } } showLineNumber = false; /* Insert NAGs */ if( (*IT).NAG != 0 ) { - notation += QString( " $%1" ).arg( QString::number( (*IT).NAG ) ); + notation += TQString( " $%1" ).tqarg( TQString::number( (*IT).NAG ) ); } /* Insert RAVs */ - annon = RAV.find( tmp ); + annon = RAV.tqfind( tmp ); if( annon != NULL ) { - notation += QString( " (%1)" ).arg( annon->text ); + notation += TQString( " (%1)" ).tqarg( annon->text ); showLineNumber = true; } /* Insert Annotations */ - annon = annotations.find( tmp ); + annon = annotations.tqfind( tmp ); if( annon != NULL ) { - notation += QString( " {%1}" ).arg( annon->text ); + notation += TQString( " {%1}" ).tqarg( annon->text ); showLineNumber = true; } list->append( notation ); @@ -200,11 +200,11 @@ QStringList* pgn::notation( const int format ) // pgn::caption // /////////////////////////////////////// -QString pgn::caption( void ) +TQString pgn::caption( void ) { - QString caption; + TQString caption; - caption = i18n( "%1 vs. %2").arg( TAG_White ).arg( TAG_Black ); + caption = i18n( "%1 vs. %2").tqarg( TAG_White ).tqarg( TAG_Black ); return caption; } /////////////////////////////////////// @@ -279,18 +279,18 @@ void pgn::clearTags( void ) /////////////////////////////////////// void pgn::init( void ) { - QString temp; + TQString temp; struct utsname unamePtr; - QDateTime qdt; + TQDateTime qdt; clear(); parseMatchParam(); uname( &unamePtr ); /* Build Date */ - qdt = QDateTime::currentDateTime(); - TAG_Date = QString("%1.%2.%3").arg(qdt.date().year(),4).arg(qdt.date().month(),2).arg(qdt.date().day(),2); - TAG_Date = TAG_Date.replace( QRegExp("\\s"), QString("0") ); + qdt = TQDateTime::tqcurrentDateTime(); + TAG_Date = TQString("%1.%2.%3").tqarg(qdt.date().year(),4).tqarg(qdt.date().month(),2).tqarg(qdt.date().day(),2); + TAG_Date = TAG_Date.tqreplace( TQRegExp("\\s"), TQString("0") ); TAG_Time = qdt.time().toString(); TAG_Site = unamePtr.nodename; @@ -306,7 +306,7 @@ void pgn::init( void ) int pgn::scan( void ) { register int Section(0); - QChar c; + TQChar c; clearTags(); File_Position = File.at(); @@ -327,7 +327,7 @@ int pgn::scan( void ) return (int)( ( (float)File.at() / (float)File.size() ) * 100.0 ); } c = getch(); - while( c != QChar::null ) + while( c != TQChar::null ) { switch( c ) { @@ -337,12 +337,12 @@ int pgn::scan( void ) break; case '%': /* Fall through */ case ';': - c = QChar::null; + c = TQChar::null; continue; break; default: Section = 1; - c = QChar::null; + c = TQChar::null; continue; break; } @@ -360,9 +360,9 @@ int pgn::scan( void ) /////////////////////////////////////// bool pgn::load( const int pos ) { - QString Token, + TQString Token, Value; - QChar c; + TQChar c; File.at(pos); clear(); @@ -386,15 +386,15 @@ bool pgn::load( const int pos ) } /* Allocate the Tab_PGNView */ pgnView = new tab_pgnView( this, Resource ); - connect( pgnView, SIGNAL( destroyed() ), this, SLOT( childViewDestroyed() ) ); - Resource->tabManager->addTab( pgnView, i18n( "%1 vs. %2" ).arg( TAG_White ).arg( TAG_Black ) ); + connect( pgnView, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( childViewDestroyed() ) ); + Resource->tabManager->addTab( pgnView, i18n( "%1 vs. %2" ).tqarg( TAG_White ).tqarg( TAG_Black ) ); pgnView->init(); File.at( File_Position ); currentLine = ""; return TRUE; } c = getch(); - while( c != QChar::null ) + while( c != TQChar::null ) { Token = ""; Value = ""; @@ -406,7 +406,7 @@ bool pgn::load( const int pos ) if( Value == "KNIGHTS_CMD" ) parseKnightsData(); /* Fall through */ case ';': - c = QChar::null; + c = TQChar::null; continue; break; /* Tag Pair */ @@ -414,7 +414,7 @@ bool pgn::load( const int pos ) parseTag(); break; default: - c = QChar::null; + c = TQChar::null; break; } c = getch(); @@ -430,8 +430,8 @@ bool pgn::load( const int pos ) /////////////////////////////////////// bool pgn::loadNext( void ) { - QChar c; - QString Value; + TQChar c; + TQString Value; ChessMove Move; bool postMove( FALSE ); @@ -444,7 +444,7 @@ bool pgn::loadNext( void ) currentLine = Input.readLine(); } c = getch(); - while( c != QChar::null ) + while( c != TQChar::null ) { Value = ""; switch( c ) @@ -455,7 +455,7 @@ bool pgn::loadNext( void ) if( Value == "KNIGHTS_CMD" ) parseKnightsData(); /* Fall through */ case ';': - c = QChar::null; + c = TQChar::null; continue; /* Tag Pair...next game, so we're done. */ case '[': @@ -463,7 +463,7 @@ bool pgn::loadNext( void ) /* Numeric Annotation Glyph */ case '$': c = getch(); - while( ( c >= '0' ) && ( c <= '9' ) ) + while( ( c.unicode() >= '0' ) && ( c.unicode() <= '9' ) ) { Value += c; c = getch(); @@ -506,7 +506,7 @@ bool pgn::loadNext( void ) return TRUE; } /* Catch Standard Algebraic Notation */ - while( ( c != QChar::null ) && + while( ( c != TQChar::null ) && ( c != ' ' ) && ( c != ';' ) && ( c != '%' ) ) @@ -528,11 +528,11 @@ bool pgn::loadNext( void ) // pgn::save // /////////////////////////////////////// -bool pgn::save( QString URL ) +bool pgn::save( TQString URL ) { - QFile Save( URL ); - QTextStream *Output; - QString Token, + TQFile Save( URL ); + TQTextStream *Output; + TQString Token, Value; close(); @@ -545,7 +545,7 @@ bool pgn::save( QString URL ) { Save.open( IO_WriteOnly ); } - Output = new QTextStream( &Save ); + Output = new TQTextStream( &Save ); (*Output) << "[Event \"" << TAG_Event << "\"]\n"; (*Output) << "[Site \"" << TAG_Site << "\"]\n"; (*Output) << "[Date \"" << TAG_Date << "\"]\n"; @@ -611,7 +611,7 @@ bool pgn::save( QString URL ) (*Output) << "[Annotator \"" << TAG_Annotator << "\"]\n"; if( !TAG_Mode.isEmpty() ) (*Output) << "[Mode \"" << TAG_Mode << "\"]\n"; - TAG_PlyCount = QString().setNum( Moves.count() ); + TAG_PlyCount = TQString().setNum( Moves.count() ); (*Output) << "[PlyCount \"" << TAG_PlyCount << "\"]\n"; /* Save internal data if this game is unfinished */ @@ -658,8 +658,8 @@ bool pgn::save( QString URL ) /* End of internal data save */ (*Output) << "\n"; - QStringList *list = notation(2); - QString SAN = list->join( " " ); + TQStringList *list = notation(2); + TQString SAN = list->join( " " ); delete list; kdWarning() << SAN.right( 20 ) << endl; @@ -670,7 +670,7 @@ bool pgn::save( QString URL ) { while( SAN.at( pos ) != ' ' ) pos--; - SAN = SAN.replace( pos, 1, QString("\n") ); + SAN = SAN.tqreplace( pos, 1, TQString("\n") ); lastPos = pos; pos = lastPos + 80; } @@ -685,9 +685,9 @@ bool pgn::save( QString URL ) // pgn::getch // /////////////////////////////////////// -QChar pgn::getch( void ) +TQChar pgn::getch( void ) { - QChar c; + TQChar c; c = currentLine.at(0); currentLine.remove( 0, 1 ); @@ -698,17 +698,17 @@ QChar pgn::getch( void ) // pgn::getword // /////////////////////////////////////// -QString pgn::getword( void ) +TQString pgn::getword( void ) { - QChar c; - QString word; + TQChar c; + TQString word; do { c = getch(); } while( c == ' ' ); - while( ( c != ' ' ) && ( c != QChar::null ) ) + while( ( c != ' ' ) && ( c != TQChar::null ) ) { word += c; c = getch(); @@ -720,7 +720,7 @@ QString pgn::getword( void ) // pgn::open // /////////////////////////////////////// -bool pgn::open( const QString &URL ) +bool pgn::open( const TQString &URL ) { close(); if( !KIO::NetAccess::download( URL, tempFile ) ) @@ -732,7 +732,7 @@ bool pgn::open( const QString &URL ) close(); return FALSE; } - Input.setDevice( &File ); + Input.setDevice( TQT_TQIODEVICE(&File) ); CurrentURL = URL; File.at(0); return TRUE; @@ -761,9 +761,9 @@ void pgn::close( void ) /////////////////////////////////////// void pgn::parseTag( void ) { - QChar c; - QString Token; - QString Value; + TQChar c; + TQString Token; + TQString Value; c = getch(); while( c == ' ' ) c = getch(); @@ -838,12 +838,12 @@ void pgn::parseTag( void ) void pgn::parseAnnotation( const int fromRAVnum ) { Annotation *annon = new Annotation; - QChar c; + TQChar c; c = getch(); while( c != '}' ) { - if( c == QChar::null ) + if( c == TQChar::null ) { if( Input.eof() ) break; currentLine = Input.readLine(); @@ -865,12 +865,12 @@ void pgn::parseRAV( void ) { int RAVLevel(1); Annotation *annon = new Annotation; - QChar c; + TQChar c; while( RAVLevel ) { c = getch(); - if( c == QChar::null ) + if( c == TQChar::null ) { if( Input.eof() ) break; @@ -899,8 +899,8 @@ void pgn::parseRAV( void ) /////////////////////////////////////// void pgn::parseKnightsData( void ) { - QString Key; - QString Value; + TQString Key; + TQString Value; Key = getword(); if( Key == "DONE" ) @@ -950,8 +950,8 @@ void pgn::print( void ) { /* Allocate the Tab_PGNView */ pgnView = new tab_pgnView( this, Resource ); - Resource->tabManager->addTab( pgnView, i18n( "%1 vs. %2" ).arg( TAG_White ).arg( TAG_Black ) ); - connect( pgnView, SIGNAL( destroyed() ), this, SLOT( childViewDestroyed() ) ); + Resource->tabManager->addTab( pgnView, i18n( "%1 vs. %2" ).tqarg( TAG_White ).tqarg( TAG_Black ) ); + connect( pgnView, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( childViewDestroyed() ) ); pgnView->init(); } pgnView->print(); @@ -970,9 +970,9 @@ void pgn::childViewDestroyed( void ) // pgn::getNAG // /////////////////////////////////////// -QString pgn::getNAG( int num ) +TQString pgn::getNAG( int num ) { - QString Line; + TQString Line; switch( num ) { |