diff options
Diffstat (limited to 'kivio/kiviopart/kiviosdk/kivio_common.cpp')
-rw-r--r-- | kivio/kiviopart/kiviosdk/kivio_common.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/kivio/kiviopart/kiviosdk/kivio_common.cpp b/kivio/kiviopart/kiviosdk/kivio_common.cpp index 8de8e1e0..e43c9fda 100644 --- a/kivio/kiviopart/kiviosdk/kivio_common.cpp +++ b/kivio/kiviopart/kiviosdk/kivio_common.cpp @@ -19,29 +19,29 @@ #include "kivio_common.h" #include "kivio_connector_point.h" #include <kdebug.h> -#include <qstringlist.h> +#include <tqstringlist.h> #include <math.h> #include <KoPoint.h> #include <KoRect.h> /** - * Read a floating point value from a @ref QDomElement. + * Read a floating point value from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read a floating point attribute from a @ref QDomElement, and + * This will read a floating point attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -float XmlReadFloat( const QDomElement &e, const QString &att, const float &def) +float XmlReadFloat( const TQDomElement &e, const TQString &att, const float &def) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att ); + TQString val = e.attribute( att ); bool ok=false; // Make sure it is a floating point value. If not, return the default @@ -58,38 +58,38 @@ float XmlReadFloat( const QDomElement &e, const QString &att, const float &def) /** - * Write a floating point value to a @ref QDomElement + * Write a floating point value to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write a floating point value to a @ref QDomElement. + * This will write a floating point value to a @ref TQDomElement. */ -void XmlWriteFloat( QDomElement &e, const QString &att, const float &val ) +void XmlWriteFloat( TQDomElement &e, const TQString &att, const float &val ) { e.setAttribute( att, (double)val ); } /** - * Read an int value from a @ref QDomElement. + * Read an int value from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read an int attribute from a @ref QDomElement, and + * This will read an int attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -int XmlReadInt( const QDomElement &e, const QString &att, const int &def) +int XmlReadInt( const TQDomElement &e, const TQString &att, const int &def) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att, "1" ); + TQString val = e.attribute( att, "1" ); bool ok=false; // Make sure it is a floating point value. If not, return the default @@ -106,38 +106,38 @@ int XmlReadInt( const QDomElement &e, const QString &att, const int &def) /** - * Write a int value to a @ref QDomElement + * Write a int value to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write an int value to a @ref QDomElement. + * This will write an int value to a @ref TQDomElement. */ -void XmlWriteInt( QDomElement &e, const QString &att, const int &val ) +void XmlWriteInt( TQDomElement &e, const TQString &att, const int &val ) { e.setAttribute( att, (int)val ); } /** - * Read an uint value from a @ref QDomElement. + * Read an uint value from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read an uint attribute from a @ref QDomElement, and + * This will read an uint attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -uint XmlReadUInt( const QDomElement &e, const QString &att, const uint &def) +uint XmlReadUInt( const TQDomElement &e, const TQString &att, const uint &def) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att, "1" ); + TQString val = e.attribute( att, "1" ); bool ok=false; // Make sure it is a floating point value. If not, return the default @@ -154,77 +154,77 @@ uint XmlReadUInt( const QDomElement &e, const QString &att, const uint &def) /** - * Write an uint value to a @ref QDomElement + * Write an uint value to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write an uint value to a @ref QDomElement. + * This will write an uint value to a @ref TQDomElement. */ -void XmlWriteUInt( QDomElement &e, const QString &att, const uint &val ) +void XmlWriteUInt( TQDomElement &e, const TQString &att, const uint &val ) { e.setAttribute( att, (uint)val ); } /** - * Read a @ref QString from a @ref QDomElement. + * Read a @ref TQString from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read a QString attribute from a @ref QDomElement, and + * This will read a TQString attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -QString XmlReadString( const QDomElement &e, const QString &att, const QString &def ) +TQString XmlReadString( const TQDomElement &e, const TQString &att, const TQString &def ) { // Check if the attribute exists, if not, return the default if( e.hasAttribute( att )==false ) - return QString(def); + return TQString(def); // Otherwise return the attribute else return e.attribute( att ); } /** - * Write a QString to a @ref QDomElement + * Write a TQString to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write a QString to a @ref QDomElement. + * This will write a TQString to a @ref TQDomElement. */ -void XmlWriteString( QDomElement &e, const QString &att, const QString &val ) +void XmlWriteString( TQDomElement &e, const TQString &att, const TQString &val ) { e.setAttribute( att, val ); } /** - * Read a QColor value from a @ref QDomElement. + * Read a TQColor value from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read a QColor attribute from a @ref QDomElement, and + * This will read a TQColor attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -QColor XmlReadColor( const QDomElement &e, const QString &att, const QColor &def) +TQColor XmlReadColor( const TQDomElement &e, const TQString &att, const TQColor &def) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att, "1" ); + TQString val = e.attribute( att, "1" ); bool ok=false; - QColor newColor; + TQColor newColor; - if( val.contains("#") ) // Is it #RRGGBB format? + if( val.tqcontains("#") ) // Is it #RRGGBB format? { newColor.setNamedColor(val); return newColor; @@ -235,25 +235,25 @@ QColor XmlReadColor( const QDomElement &e, const QString &att, const QColor &def uint iVal = val.toUInt( &ok ); if( !ok ) { - kdDebug(43000) << "Invalid XML-value read for " << att.ascii() << ", expected QColor" << endl; + kdDebug(43000) << "Invalid XML-value read for " << att.ascii() << ", expected TQColor" << endl; return 1; } // Return the value - return QColor(iVal); + return TQColor(iVal); } /** - * Write a QColor value to a @ref QDomElement + * Write a TQColor value to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write a QColor value to a @ref QDomElement. + * This will write a TQColor value to a @ref TQDomElement. */ -void XmlWriteColor( QDomElement &e, const QString &att, const QColor &val ) +void XmlWriteColor( TQDomElement &e, const TQString &att, const TQColor &val ) { // Write it out in #RRGGBB format e.setAttribute( att, val.name() ); @@ -261,23 +261,23 @@ void XmlWriteColor( QDomElement &e, const QString &att, const QColor &val ) /** - * Read a double value from a @ref QDomElement. + * Read a double value from a @ref TQDomElement. * - * @param e The @ref QDomElement to read from + * @param e The @ref TQDomElement to read from * @param att The attribute to locate * @param def The default value to return if the attribute is not found * - * This will read a double attribute from a @ref QDomElement, and + * This will read a double attribute from a @ref TQDomElement, and * if it is not found, return the default value. */ -double XmlReadDouble( const QDomElement &e, const QString &att, const double &def) +double XmlReadDouble( const TQDomElement &e, const TQString &att, const double &def) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att, "1.0" ); + TQString val = e.attribute( att, "1.0" ); bool ok=false; // Make sure it is a floating point value. If not, return the default @@ -294,21 +294,21 @@ double XmlReadDouble( const QDomElement &e, const QString &att, const double &de /** - * Write a double value to a @ref QDomElement + * Write a double value to a @ref TQDomElement * - * @param e The @ref QDomElement to write to + * @param e The @ref TQDomElement to write to * @param att The attribute to write * @param val The value of the attribute to write * - * This will write a double value to a @ref QDomElement. + * This will write a double value to a @ref TQDomElement. */ -void XmlWriteDouble( QDomElement &e, const QString &att, const double &val ) +void XmlWriteDouble( TQDomElement &e, const TQString &att, const double &val ) { e.setAttribute( att, (double)val ); } -#define WHICH_QUAD( vertex, hitPos ) \ +#define WHICH_TQUAD( vertex, hitPos ) \ ( (vertex.x() > hitPos->x()) ? ((vertex.y() > hitPos->y()) ? 1 : 4 ) : ((vertex.y() > hitPos->y())?2:3)) #define X_INTERCEPT( point1, point2, hitY ) \ @@ -330,7 +330,7 @@ void XmlWriteDouble( QDomElement &e, const QString &att, const double &val ) * across two quadrants, you need to determine which side of the test point it crossed, and then * either add or subtract 2. * - * Quad layout: + * Quad tqlayout: * 1 2 * 4 3 */ @@ -341,13 +341,13 @@ bool PointInPoly( KoPoint *points, int numPoints, KoPoint *hitPos ) edge = 0; - quad = WHICH_QUAD( points[ edge ], hitPos ); + quad = WHICH_TQUAD( points[ edge ], hitPos ); total = 0; // count of absolute sectors crossed // Loop through all the vertices do { next = (edge + 1) % numPoints; - next_quad = WHICH_QUAD( points[ next ], hitPos ); + next_quad = WHICH_TQUAD( points[ next ], hitPos ); // Calculate how many quads have been crossed delta = next_quad - quad; @@ -384,19 +384,19 @@ bool PointInPoly( KoPoint *points, int numPoints, KoPoint *hitPos ) return false; } -KoRect XmlReadRect( const QDomElement &e, const QString &att, const KoRect &def ) +KoRect XmlReadRect( const TQDomElement &e, const TQString &att, const KoRect &def ) { // Check if this value exists, if not, return the default if( e.hasAttribute( att )==false ) return def; // Read the attribute - QString val = e.attribute( att ); + TQString val = e.attribute( att ); - if (val.find("[") == 0 && val.find("]") == (int)val.length()-1) { + if (val.tqfind("[") == 0 && val.tqfind("]") == (int)val.length()-1) { val.remove(0,1); val.remove(val.length()-1,1); - QStringList vlist = QStringList::split(",",val); + TQStringList vlist = TQStringList::split(",",val); if (vlist.count() == 4) { bool allOk = true; bool ok = false; @@ -421,9 +421,9 @@ KoRect XmlReadRect( const QDomElement &e, const QString &att, const KoRect &def return def; } -void XmlWriteRect( QDomElement &e, const QString &att, const KoRect &val ) +void XmlWriteRect( TQDomElement &e, const TQString &att, const KoRect &val ) { - e.setAttribute( att, QString("[%1,%2,%3,%4]").arg(val.x()).arg(val.y()).arg(val.width()).arg(val.height()) ); + e.setAttribute( att, TQString("[%1,%2,%3,%4]").tqarg(val.x()).tqarg(val.y()).tqarg(val.width()).tqarg(val.height()) ); } |