summaryrefslogtreecommitdiffstats
path: root/keduca/libkeduca/fileread.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:44:41 +0000
commita374efce3a207b39514be3c52264091400ce297e (patch)
tree77bdf654b55826d4f59b53a5621310206bcaead1 /keduca/libkeduca/fileread.cpp
parentf81a494f3957d5cf38c787973415597941934727 (diff)
downloadtdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz
tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'keduca/libkeduca/fileread.cpp')
-rw-r--r--keduca/libkeduca/fileread.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/keduca/libkeduca/fileread.cpp b/keduca/libkeduca/fileread.cpp
index 7632b6fd..1fb03518 100644
--- a/keduca/libkeduca/fileread.cpp
+++ b/keduca/libkeduca/fileread.cpp
@@ -29,8 +29,8 @@
#include <tqpixmap.h>
#include <tqbuffer.h>
-FileRead::FileRead( TQObject *parent, const char *name )
- :TQObject(parent, name),
+FileRead::FileRead( TQObject *tqparent, const char *name )
+ :TQObject(tqparent, name),
_changed(false),
_tmpfile(0)
{
@@ -79,7 +79,7 @@ bool FileRead::loadFile(const TQString &filename)
}
else
{
- doc.setContent(qUncompress(file.readAll()));
+ doc.setContent(tqUncompress(file.readAll()));
}
TQDomElement docElem = doc.documentElement();
@@ -118,21 +118,21 @@ bool FileRead::loadFile(const TQString &filename)
insertQuestion();
// --------------------- QUESTION ATTRIBUTE------------------------
TQDomElement elementNODE = dnList.item(i).toElement();
- setQuestion( QF_TYPE, elementNODE.attribute( "type", "1" ).toInt() );
- setQuestion( QF_PICTURE, elementNODE.attribute( "image", "" ) );
- setQuestion( QF_TIME, elementNODE.attribute( "time", "0" ).toInt() );
- setQuestion( QF_POINTS, elementNODE.attribute( "points", "0" ).toInt() );
+ setQuestion( TQF_TYPE, elementNODE.attribute( "type", "1" ).toInt() );
+ setQuestion( TQF_PICTURE, elementNODE.attribute( "image", "" ) );
+ setQuestion( TQF_TIME, elementNODE.attribute( "time", "0" ).toInt() );
+ setQuestion( TQF_POINTS, elementNODE.attribute( "points", "0" ).toInt() );
TQDomNodeList quList = elementNODE.childNodes();
for( unsigned int x = 0; x < quList.count(); ++x)
{
// --------------------- QUESTION AND RESPONSES------------------
TQDomElement element = quList.item(x).toElement();
- if( element.tagName() == "text" ) setQuestion( QF_TEXT, element.text() );
+ if( element.tagName() == "text" ) setQuestion( TQF_TEXT, element.text() );
if( element.tagName() == "true" ) setAnswer( element.text(), true, element.attribute( "points", "0" ).toInt() );
if( element.tagName() == "false" ) setAnswer( element.text(), false,element.attribute( "points", "0" ).toInt() );
- if( element.tagName() == "tip" ) setQuestion( QF_TIP, element.text() );
- if( element.tagName() == "explain" ) setQuestion( QF_EXPLAIN, element.text() );
+ if( element.tagName() == "tip" ) setQuestion( TQF_TIP, element.text() );
+ if( element.tagName() == "explain" ) setQuestion( TQF_EXPLAIN, element.text() );
}
}
@@ -164,19 +164,19 @@ bool FileRead::loadFile(const TQString &filename)
void FileRead::setQuestion( QuestionField field, const TQString& text)
{
-// QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain
+// TQF_text, TQF_picture, TQF_type, TQF_time, TQF_tip, TQF_explain
switch( field )
{
- case QF_TEXT:
+ case TQF_TEXT:
(*_recordQuestions).text = text;
break;
- case QF_PICTURE:
+ case TQF_PICTURE:
(*_recordQuestions).picture = text;
break;
- case QF_TIP:
+ case TQF_TIP:
(*_recordQuestions).tip = text;
break;
- case QF_EXPLAIN:
+ case TQF_EXPLAIN:
(*_recordQuestions).explain = text;
break;
default:
@@ -190,13 +190,13 @@ void FileRead::setQuestion( QuestionField field, int value )
{
switch( field )
{
- case QF_TYPE:
+ case TQF_TYPE:
(*_recordQuestions).type = value;
break;
- case QF_TIME:
+ case TQF_TIME:
(*_recordQuestions).time = value;
break;
- case QF_POINTS:
+ case TQF_POINTS:
(*_recordQuestions).points = value;
break;
default:
@@ -208,7 +208,7 @@ void FileRead::setQuestion( QuestionField field, int value )
void FileRead::setResult( ResultField field, const TQString& text)
{
-// RS_text, QF_picture
+// RS_text, TQF_picture
switch( field )
{
case RS_TEXT:
@@ -407,26 +407,26 @@ unsigned int FileRead::recordAnswerCount()
TQString FileRead::getQuestion( QuestionField field )
{
-// QF_text, QF_picture, QF_type, QF_time, QF_tip, QF_explain
+// TQF_text, TQF_picture, TQF_type, TQF_time, TQF_tip, TQF_explain
switch( field )
{
- case QF_TEXT:
+ case TQF_TEXT:
return (*_recordQuestions).text;
break;
- case QF_PICTURE:
+ case TQF_PICTURE:
// return getPictureLocal( (*_recordQuestions).picture );
return( (*_recordQuestions).picture );
break;
- case QF_POINTS:
+ case TQF_POINTS:
return TQString().setNum( (*_recordQuestions).points );
break;
- case QF_TIME:
+ case TQF_TIME:
return TQString().setNum( (*_recordQuestions).time );
break;
- case QF_TIP:
+ case TQF_TIP:
return (*_recordQuestions).tip;
break;
- case QF_EXPLAIN:
+ case TQF_EXPLAIN:
return (*_recordQuestions).explain;
break;
default:
@@ -440,13 +440,13 @@ int FileRead::getQuestionInt( QuestionField field )
{
switch( field )
{
- case QF_TYPE:
+ case TQF_TYPE:
return (*_recordQuestions).type;
break;
- case QF_TIME:
+ case TQF_TIME:
return (*_recordQuestions).time;
break;
- case QF_POINTS:
+ case TQF_POINTS:
return (*_recordQuestions).points;
break;
default:
@@ -559,8 +559,8 @@ TQString FileRead::getPicture()
{
TQString picture;
- if( !getQuestion(QF_PICTURE).isEmpty() )
- picture = getQuestion(QF_PICTURE);
+ if( !getQuestion(TQF_PICTURE).isEmpty() )
+ picture = getQuestion(TQF_PICTURE);
else if( !(_header["image"]).isEmpty() )
picture = _header["image"];
else
@@ -689,7 +689,7 @@ bool FileRead::saveFile( const TQString &filename, bool copyimages, bool saveCom
TQFile file(filename);
TQStringList copyJOB;
- stream.setDevice(&buffer);
+ stream.setDevice(TQT_TQIODEVICE(&buffer));
if ( (!file.open(IO_WriteOnly)) || (!buffer.open(IO_WriteOnly)) )
{
@@ -750,20 +750,20 @@ bool FileRead::saveFile( const TQString &filename, bool copyimages, bool saveCom
while ( !recordEOF() )
{
TQDomElement question = doc.createElement("question");
- if( !getQuestion( QF_PICTURE ).isEmpty() )
+ if( !getQuestion( TQF_PICTURE ).isEmpty() )
{
if( copyimages )
{
- copyJOB.append( getQuestion( QF_PICTURE ) );
- question.setAttribute("image", TQFileInfo( getQuestion( QF_PICTURE ) ).fileName() );
+ copyJOB.append( getQuestion( TQF_PICTURE ) );
+ question.setAttribute("image", TQFileInfo( getQuestion( TQF_PICTURE ) ).fileName() );
} else {
- question.setAttribute("image", getQuestion( QF_PICTURE ) );
+ question.setAttribute("image", getQuestion( TQF_PICTURE ) );
}
}
- question.setAttribute( "type", getQuestionInt( QF_TYPE ) );
- if( getQuestionInt( QF_POINTS ) > 0 ) question.setAttribute( "points", getQuestion( QF_POINTS ) );
- if( getQuestionInt( QF_TIME ) > 0 ) question.setAttribute( "time", getQuestion( QF_TIME ) );
- insertXML( doc, question, "text", getQuestion( QF_TEXT ) );
+ question.setAttribute( "type", getQuestionInt( TQF_TYPE ) );
+ if( getQuestionInt( TQF_POINTS ) > 0 ) question.setAttribute( "points", getQuestion( TQF_POINTS ) );
+ if( getQuestionInt( TQF_TIME ) > 0 ) question.setAttribute( "time", getQuestion( TQF_TIME ) );
+ insertXML( doc, question, "text", getQuestion( TQF_TEXT ) );
recordAnswerFirst();
while( !recordAnswerEOF() )
@@ -786,8 +786,8 @@ bool FileRead::saveFile( const TQString &filename, bool copyimages, bool saveCom
recordAnswerNext();
};
- if( !getQuestion( QF_TIP ).isEmpty() ) insertXML( doc, question, "tip", getQuestion( QF_TIP ) );
- if( !getQuestion( QF_EXPLAIN ).isEmpty() ) insertXML( doc, question, "explain", getQuestion( QF_EXPLAIN ) );
+ if( !getQuestion( TQF_TIP ).isEmpty() ) insertXML( doc, question, "tip", getQuestion( TQF_TIP ) );
+ if( !getQuestion( TQF_EXPLAIN ).isEmpty() ) insertXML( doc, question, "explain", getQuestion( TQF_EXPLAIN ) );
NodeData.appendChild( question );
recordNext();
@@ -796,7 +796,7 @@ bool FileRead::saveFile( const TQString &filename, bool copyimages, bool saveCom
doc.save( stream, 4);
buffer.close();
if ( saveCompressed )
- file.writeBlock(qCompress(data));
+ file.writeBlock(tqCompress(data));
else
file.writeBlock(data);
file.close();
@@ -862,7 +862,7 @@ bool FileRead::saveResults( const TQString &filename, const TQString &results )
TQFile file(filename);
TQStringList copyJOB;
- stream.setDevice(&file);
+ stream.setDevice(TQT_TQIODEVICE(&file));
if(!file.open(IO_WriteOnly))
{
@@ -875,20 +875,20 @@ bool FileRead::saveResults( const TQString &filename, const TQString &results )
}
/** Insert xml format data */
-void FileRead::insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &tagName, const TQString &data)
+void FileRead::insertXML( TQDomDocument &doc, TQDomElement &tqparent, const TQString &tagName, const TQString &data)
{
TQDomElement domELEMENT = doc.createElement( tagName );
TQDomText DATAelement = doc.createTextNode( data );
- parent.appendChild( domELEMENT );
+ tqparent.appendChild( domELEMENT );
domELEMENT.appendChild( DATAelement );
}
/** Insert xml data format */
-void FileRead::insertXML( TQDomDocument &doc, TQDomElement &parent, const TQString &data)
+void FileRead::insertXML( TQDomDocument &doc, TQDomElement &tqparent, const TQString &data)
{
TQDomText DATAelement = doc.createTextNode( data );
- parent.appendChild( DATAelement );
+ tqparent.appendChild( DATAelement );
}
/** Get Header */
@@ -905,7 +905,7 @@ void FileRead::setHeader( const TQString field, const TQString value)
if( (_header[field]).isEmpty() )
_header.insert( field, value );
else
- _header.replace( field, value );
+ _header.tqreplace( field, value );
}
/** is Multi Answer */