diff options
Diffstat (limited to 'libkdchart/KDChartObjectFactory.cpp')
-rw-r--r-- | libkdchart/KDChartObjectFactory.cpp | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/libkdchart/KDChartObjectFactory.cpp b/libkdchart/KDChartObjectFactory.cpp index 6106390..b1dac73 100644 --- a/libkdchart/KDChartObjectFactory.cpp +++ b/libkdchart/KDChartObjectFactory.cpp @@ -1,67 +1,67 @@ #include "KDChartObjectFactory.h" #include <KDChartParams.h> #include <KDChartTable.h> -#include <qsargument.h> -#include <qdatetime.h> +#include <tqsargument.h> +#include <tqdatetime.h> #include <KDChartEnums.h> -#include <qfont.h> +#include <tqfont.h> #include <KDChartTextPiece.h> -#include <qcolor.h> +#include <tqcolor.h> #include <KDChartWidget.h> #include <KDChartPropertySet.h> -#include "factories/QtFactory.h" -#include "factories/QFontFactory.h" +#include "factories/TQtFactory.h" +#include "factories/TQFontFactory.h" // PENDING(blackie) Clean up code in this file, so it uses the correct getter methods like getBool. KDChartObjectFactory::KDChartObjectFactory() { - registerClass( QString::fromLatin1( "KDChartWidget" ) ); - registerClass( QString::fromLatin1( "KDChartParams" ), new KDChartParams ); - registerClass( QString::fromLatin1( "KDChartTableData" ) ); - registerClass( QString::fromLatin1( "KDChartAxisParams" ), new KDChartAxisParams ); - registerClass( QString::fromLatin1( "KDChartEnums" ), 0, new KDChartEnums ); - registerClass( QString::fromLatin1( "KDChartTextPiece" ) ); - registerClass( QString::fromLatin1( "KDChartCustomBox" ), new KDChartCustomBox ); - registerClass( QString::fromLatin1( "KDChartPropertySet" ), new KDChartPropertySet ); - registerClass( QString::fromLatin1( "KDFrame" ), QString::null, new KDFrame ); - - registerClass( QString::fromLatin1( "Qt" ), QString::null, new QtFactory() ); - registerClass( QString::fromLatin1( "QFont" ), QString::null, new QFontFactory ); + registerClass( TQString::tqfromLatin1( "KDChartWidget" ) ); + registerClass( TQString::tqfromLatin1( "KDChartParams" ), new KDChartParams ); + registerClass( TQString::tqfromLatin1( "KDChartTableData" ) ); + registerClass( TQString::tqfromLatin1( "KDChartAxisParams" ), new KDChartAxisParams ); + registerClass( TQString::tqfromLatin1( "KDChartEnums" ), 0, new KDChartEnums ); + registerClass( TQString::tqfromLatin1( "KDChartTextPiece" ) ); + registerClass( TQString::tqfromLatin1( "KDChartCustomBox" ), new KDChartCustomBox ); + registerClass( TQString::tqfromLatin1( "KDChartPropertySet" ), new KDChartPropertySet ); + registerClass( TQString::tqfromLatin1( "KDFrame" ), TQString(), new KDFrame ); + + registerClass( TQString::tqfromLatin1( "TQt" ), TQString(), new TQtFactory() ); + registerClass( TQString::tqfromLatin1( "TQFont" ), TQString(), new TQFontFactory ); } -QObject* KDChartObjectFactory::create( const QString& className, const QSArgumentList& args, QObject* /*context*/ ) +TQObject* KDChartObjectFactory::create( const TQString& className, const TQSArgumentList& args, TQObject* /*context*/ ) { - if ( className == QString::fromLatin1( "KDChartWidget" ) ) + if ( className == TQString::tqfromLatin1( "KDChartWidget" ) ) return createKDChartWidget( args ); - if ( className == QString::fromLatin1("KDChartParams") ) + if ( className == TQString::tqfromLatin1("KDChartParams") ) return new KDChartParams(); - else if ( className == QString::fromLatin1("KDChartTableData") ) + else if ( className == TQString::tqfromLatin1("KDChartTableData") ) return createKDChartTableData( args ); - else if ( className == QString::fromLatin1("KDChartAxisParams") ) + else if ( className == TQString::tqfromLatin1("KDChartAxisParams") ) return new KDChartAxisParams(); - else if ( className == QString::fromLatin1( "KDChartTextPiece" ) ) + else if ( className == TQString::tqfromLatin1( "KDChartTextPiece" ) ) return createKDChartTextPiece( args ); - else if ( className == QString::fromLatin1( "KDChartCustomBox" ) ) + else if ( className == TQString::tqfromLatin1( "KDChartCustomBox" ) ) return createKDChartCustomBox( args ); - else if ( className == QString::fromLatin1( "KDChartPropertySet" ) ) + else if ( className == TQString::tqfromLatin1( "KDChartPropertySet" ) ) return createKDChartPropertySet( args ); else return 0; } -QObject* KDChartObjectFactory::createKDChartWidget( const QSArgumentList& args ) +TQObject* KDChartObjectFactory::createKDChartWidget( const TQSArgumentList& args ) { if ( !checkArgCount( "KDChartWidget", args.count(), 2, 2 ) ) return 0; - if ( !checkArgsIsQtClass( args, 1, "KDChartParams", "KDChartWidget" ) ) return 0; - if ( !checkArgsIsQtClass( args, 2, "KDChartTableDataBase", "KDChartWidget" ) ) return 0; + if ( !checkArgsIsTQtClass( args, 1, "KDChartParams", "KDChartWidget" ) ) return 0; + if ( !checkArgsIsTQtClass( args, 2, "KDChartTableDataBase", "KDChartWidget" ) ) return 0; KDChartParams* params = static_cast<KDChartParams*>( args[0].qobject() ); KDChartTableDataBase* data = static_cast<KDChartTableDataBase*>( args[1].qobject() ); @@ -69,42 +69,42 @@ QObject* KDChartObjectFactory::createKDChartWidget( const QSArgumentList& args ) } -QObject* KDChartObjectFactory::createKDChartTableData( const QSArgumentList& args ) +TQObject* KDChartObjectFactory::createKDChartTableData( const TQSArgumentList& args ) { if ( args.count() != 2 ) { - throwError( QObject::tr( "wrong number of arguments to KDChartTableData" ) ); + throwError( TQObject::tr( "wrong number of arguments to KDChartTableData" ) ); return 0; } - QSArgument arg1 = args[0]; - QSArgument arg2 = args[1]; + TQSArgument arg1 = args[0]; + TQSArgument arg2 = args[1]; - if ( arg1.type() != QSArgument::Variant || !isNumber(arg1.variant()) ) { - throwError( QObject::tr( "wrong type for argument 1 of KDChartTableData" ) ); + if ( arg1.type() != TQSArgument::Variant || !isNumber(arg1.variant()) ) { + throwError( TQObject::tr( "wrong type for argument 1 of KDChartTableData" ) ); return 0; } - if ( arg2.type() != QSArgument::Variant || !isNumber(arg2.variant() ) ) { - throwError( QObject::tr( "wrong type for argument 2 of KDChartTableData" ) ); + if ( arg2.type() != TQSArgument::Variant || !isNumber(arg2.variant() ) ) { + throwError( TQObject::tr( "wrong type for argument 2 of KDChartTableData" ) ); return 0; } return new KDChartTableData( arg1.variant().toUInt(), arg2.variant().toUInt() ); } -QObject* KDChartObjectFactory::createKDChartTextPiece( const QSArgumentList& args ) +TQObject* KDChartObjectFactory::createKDChartTextPiece( const TQSArgumentList& args ) { if ( !checkArgCount( "KDChartTextPiece", args.count(), 2, 2 ) ) return 0; - QSArgument arg1 = args[0]; - QSArgument arg2 = args[1]; + TQSArgument arg1 = args[0]; + TQSArgument arg2 = args[1]; - QString str; + TQString str; if ( !getString( args, 1, &str, "KDChartTextPiece" ) ) return 0; - if ( !checkIsQtVariant( args, 2, QVariant::Font, QString::fromLatin1( "QFont" ), "KDChartTextPiece" ) ) return 0; - QFont font = args[1].variant().toFont(); + if ( !checkIsTQtVariant( args, 2, TQVariant::Font, TQString::tqfromLatin1( "TQFont" ), "KDChartTextPiece" ) ) return 0; + TQFont font = args[1].variant().toFont(); return new KDChartTextPiece( str, font ); } -QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& args ) +TQObject* KDChartObjectFactory::createKDChartCustomBox( const TQSArgumentList& args ) { int tmp; @@ -112,16 +112,16 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg return new KDChartCustomBox(); - if ( args[0].type() == QSArgument::Variant && isNumber( args[0].variant() ) ) { + if ( args[0].type() == TQSArgument::Variant && isNumber( args[0].variant() ) ) { if ( args.count() < 8 ) { - throwError( QObject::tr( "Too few arguments to KDChartCustomBox" ) ); + throwError( TQObject::tr( "Too few arguments to KDChartCustomBox" ) ); return 0; } int rotation; if ( !getNumber( args, 1, &rotation, "KDChartCustomBox" ) ) return 0; - if (!checkArgsIsQtClass( args, 2, "KDChartTextPiece", "KDChartCustomBox" )) return 0; + if (!checkArgsIsTQtClass( args, 2, "KDChartTextPiece", "KDChartCustomBox" )) return 0; KDChartTextPiece* content = static_cast<KDChartTextPiece*>( args[1].qobject() ); int fontSize; @@ -143,15 +143,15 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg int height; if ( !getNumber( args, 8, &height, "KDChartCustomBox" ) ) return 0; - QColor color = Qt::black; + TQColor color = TQt::black; if ( args.count() >= 9 ) { - if ( !checkIsQtVariant( args, 9, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartCustomBox" ) ) return 0; + if ( !checkIsTQtVariant( args, 9, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartCustomBox" ) ) return 0; color = args[8].variant().toColor(); } - QBrush paper = Qt::NoBrush; + TQBrush paper = TQt::NoBrush; if ( args.count() >= 10 ) { - if ( !checkIsQtVariant( args, 10, QVariant::Brush, QString::fromLatin1( "QBrush" ), "KDChartCustomBox" ) ) return 0; + if ( !checkIsTQtVariant( args, 10, TQVariant::Brush, TQString::tqfromLatin1( "TQBrush" ), "KDChartCustomBox" ) ) return 0; paper = args[9].variant().toBrush(); } @@ -166,7 +166,7 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg position = (KDChartEnums::PositionFlag) tmp; } - uint align = Qt::AlignTop + Qt::AlignLeft; + uint align = TQt::AlignTop + TQt::AlignLeft; if ( args.count() >= 13 ) { if ( !getNumber( args, 13, &align, "KDChartCustomBox" ) ) return 0; } @@ -201,11 +201,11 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg dataCol, data3rd, deltaAlign, deltaScaleGlobal ); } - if (!checkArgsIsQtClass( args, 1, "KDChartTextPiece", "KDChartCustomBox" )) return 0; + if (!checkArgsIsTQtClass( args, 1, "KDChartTextPiece", "KDChartCustomBox" )) return 0; KDChartTextPiece* content = static_cast<KDChartTextPiece*>( args[0].qobject() ); if ( args.count() < 2 ) { - throwError( QObject::tr( "Too few arguments to KDChartCustomBox" ) ); + throwError( TQObject::tr( "Too few arguments to KDChartCustomBox" ) ); return 0; } @@ -233,15 +233,15 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg if ( !getNumber( args, 7, &height, "KDChartCustomBox" ) ) return 0; - QColor color = Qt::black; + TQColor color = TQt::black; if ( args.count() >= 8 ) { - if ( !checkIsQtVariant( args, 8, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartCustomBox" ) ) return 0; + if ( !checkIsTQtVariant( args, 8, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartCustomBox" ) ) return 0; color = args[7].variant().toColor(); } - QBrush paper = Qt::NoBrush; + TQBrush paper = TQt::NoBrush; if ( args.count() >= 9 ) { - if ( !checkIsQtVariant( args, 9, QVariant::Brush, QString::fromLatin1( "QBrush" ), "KDChartCustomBox" ) ) return 0; + if ( !checkIsTQtVariant( args, 9, TQVariant::Brush, TQString::tqfromLatin1( "TQBrush" ), "KDChartCustomBox" ) ) return 0; paper = args[8].variant().toBrush(); } @@ -256,7 +256,7 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg position = (KDChartEnums::PositionFlag) tmp; } - uint align = Qt::AlignTop + Qt::AlignLeft; + uint align = TQt::AlignTop + TQt::AlignLeft; if ( args.count() >= 12 ) { if ( !getNumber( args, 12, &align, "KDChartCustomBox" ) ) return 0; } @@ -291,12 +291,12 @@ QObject* KDChartObjectFactory::createKDChartCustomBox( const QSArgumentList& arg paper, area, position, align, dataRow, dataCol, data3rd, deltaAlign, deltaScaleGlobal ); } -QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& args ) +TQObject* KDChartObjectFactory::createKDChartPropertySet(const TQSArgumentList& args ) { if ( args.count() == 0 ) return new KDChartPropertySet(); - QString name; + TQString name; if ( !getString( args, 1, &name, "KDChartPropertySet" ) ) return 0; if ( args.count() == 1 ) @@ -318,8 +318,8 @@ QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& ar if ( !getNumber( args, 4,&idLineColor, "KDChartPropertySet" ) ) return 0; - if ( !checkIsQtVariant( args, 5, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartPropertySet" ) ) return 0; - QColor lineColor = args[4].variant().toColor(); + if ( !checkIsTQtVariant( args, 5, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartPropertySet" ) ) return 0; + TQColor lineColor = args[4].variant().toColor(); int idLineStyle; if ( !getNumber( args, 6,&idLineStyle, "KDChartPropertySet" ) ) return 0; @@ -362,8 +362,8 @@ QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& ar int idExtraLinesColor; if ( !getNumber( args, 18,&idExtraLinesColor, "KDChartPropertySet" ) ) return 0; - if ( !checkIsQtVariant( args, 19, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartPropertySet" ) ) return 0; - QColor extraLinesColor = args[18].variant().toColor(); + if ( !checkIsTQtVariant( args, 19, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartPropertySet" ) ) return 0; + TQColor extraLinesColor = args[18].variant().toColor(); int idExtraLinesStyle; if ( !getNumber( args, 20,&idExtraLinesStyle, "KDChartPropertySet" ) ) return 0; @@ -380,14 +380,14 @@ QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& ar int idExtraMarkersSize; if ( !getNumber( args, 24,&idExtraMarkersSize, "KDChartPropertySet" ) ) return 0; - if ( !checkIsQtVariant( args, 25, QVariant::Size, QString::fromLatin1( "QSize" ), "KDChartPropertySet" ) ) return 0; - QSize extraMarkersSize = args[24].variant().toSize(); + if ( !checkIsTQtVariant( args, 25, TQVariant::Size, TQString::tqfromLatin1( "TQSize" ), "KDChartPropertySet" ) ) return 0; + TQSize extraMarkersSize = args[24].variant().toSize(); int idExtraMarkersColor; if ( !getNumber( args, 26,&idExtraMarkersColor, "KDChartPropertySet" ) ) return 0; - if ( !checkIsQtVariant( args, 27, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartPropertySet" ) ) return 0; - QColor extraMarkersColor = args[26].variant().toColor(); + if ( !checkIsTQtVariant( args, 27, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartPropertySet" ) ) return 0; + TQColor extraMarkersColor = args[26].variant().toColor(); int idExtraMarkersStyle; if ( !getNumber( args, 28,&idExtraMarkersStyle, "KDChartPropertySet" ) ) return 0; @@ -404,8 +404,8 @@ QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& ar int idBarColor; if ( !getNumber( args, 32,&idBarColor, "KDChartPropertySet" ) ) return 0; - if ( !checkIsQtVariant( args, 33, QVariant::Color, QString::fromLatin1( "QColor" ), "KDChartPropertySet" ) ) return 0; - QColor barColor = args[32].variant().toColor(); + if ( !checkIsTQtVariant( args, 33, TQVariant::Color, TQString::tqfromLatin1( "TQColor" ), "KDChartPropertySet" ) ) return 0; + TQColor barColor = args[32].variant().toColor(); KDChartPropertySet* set = new KDChartPropertySet; set->setName( name ); @@ -429,42 +429,42 @@ QObject* KDChartObjectFactory::createKDChartPropertySet(const QSArgumentList& ar } -bool KDChartObjectFactory::isNumber( const QVariant& v ) +bool KDChartObjectFactory::isNumber( const TQVariant& v ) { - return ( v.type() == QVariant::Int || v.type() == QVariant::UInt || v.type() == QVariant::Double ); + return ( v.type() == TQVariant::Int || v.type() == TQVariant::UInt || v.type() == TQVariant::Double ); } // PENDING(blackie) rework order of parameters so it matches the other methods -bool KDChartObjectFactory::checkArgCount( const QString& className, int count, int min, int max ) +bool KDChartObjectFactory::checkArgCount( const TQString& className, int count, int min, int max ) { if ( count < min ) { - throwError( QObject::tr( "Too few arguments when creating %1 object." ).arg( className ) ); + throwError( TQObject::tr( "Too few arguments when creating %1 object." ).tqarg( className ) ); return false; } if ( count > max ) { - throwError( QObject::tr( "Too many arguments when creating %1 object." ).arg( className ) ); + throwError( TQObject::tr( "Too many arguments when creating %1 object." ).tqarg( className ) ); return false; } return true; } -bool KDChartObjectFactory::checkArgsIsQtClass( const QSArgumentList& args, int index, const char* expected, const char* constructing ) +bool KDChartObjectFactory::checkArgsIsTQtClass( const TQSArgumentList& args, int index, const char* expected, const char* constructing ) { - const QSArgument& arg = args[index-1]; - if ( arg.type() != QSArgument::QObjectPtr || !arg.qobject()->inherits( expected ) ) { - throwError( QObject::tr( "Invalid type for argument no %1 to %2, must be a %3" ).arg(index).arg(constructing).arg(expected) ); + const TQSArgument& arg = args[index-1]; + if ( arg.type() != TQSArgument::TQObjectPtr || !arg.qobject()->inherits( expected ) ) { + throwError( TQObject::tr( "Invalid type for argument no %1 to %2, must be a %3" ).tqarg(index).tqarg(constructing).tqarg(expected) ); return false; } return true; } -bool KDChartObjectFactory::getString( const QSArgumentList& args, int index, QString* str, const char* constructing ) +bool KDChartObjectFactory::getString( const TQSArgumentList& args, int index, TQString* str, const char* constructing ) { - const QSArgument& arg = args[index-1]; - if ( arg.type() != QSArgument::Variant || arg.variant().type() != QVariant::String ) { - throwError( QObject::tr( "Invalid type for argument %1 to %2, must be a string" ).arg(index).arg(constructing) ); + const TQSArgument& arg = args[index-1]; + if ( arg.type() != TQSArgument::Variant || arg.variant().type() != TQVariant::String ) { + throwError( TQObject::tr( "Invalid type for argument %1 to %2, must be a string" ).tqarg(index).tqarg(constructing) ); return false; } else { @@ -473,11 +473,11 @@ bool KDChartObjectFactory::getString( const QSArgumentList& args, int index, QSt } } -bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, double* number, const char* constructing ) +bool KDChartObjectFactory::getNumber( const TQSArgumentList& args, int index, double* number, const char* constructing ) { - const QSArgument& arg = args[index-1]; - if ( arg.type() != QSArgument::Variant || !isNumber(arg.variant()) ) { - throwError( QObject::tr( "Invalid type for argument %1 to %2, must be a number" ).arg(index).arg( constructing ) ); + const TQSArgument& arg = args[index-1]; + if ( arg.type() != TQSArgument::Variant || !isNumber(arg.variant()) ) { + throwError( TQObject::tr( "Invalid type for argument %1 to %2, must be a number" ).tqarg(index).tqarg( constructing ) ); return false; } else { @@ -486,7 +486,7 @@ bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, dou } } -bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, int* number, const char* constructing ) +bool KDChartObjectFactory::getNumber( const TQSArgumentList& args, int index, int* number, const char* constructing ) { double tmp; bool ok = getNumber( args, index, &tmp, constructing ); @@ -494,7 +494,7 @@ bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, int return ok; } -bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, uint* number, const char* constructing ) +bool KDChartObjectFactory::getNumber( const TQSArgumentList& args, int index, uint* number, const char* constructing ) { double tmp; bool ok = getNumber( args, index, &tmp, constructing ); @@ -504,11 +504,11 @@ bool KDChartObjectFactory::getNumber( const QSArgumentList& args, int index, uin -bool KDChartObjectFactory::getBool( const QSArgumentList& args, int index, bool* b, const char* constructing ) +bool KDChartObjectFactory::getBool( const TQSArgumentList& args, int index, bool* b, const char* constructing ) { - const QSArgument& arg = args[index-1]; - if ( arg.type() != QSArgument::Variant || arg.variant().type() != QVariant::Bool ) { - throwError( QObject::tr( "Invalid type for argument %1 to %2, must be a boolean" ).arg(index).arg( constructing ) ); + const TQSArgument& arg = args[index-1]; + if ( arg.type() != TQSArgument::Variant || arg.variant().type() != TQVariant::Bool ) { + throwError( TQObject::tr( "Invalid type for argument %1 to %2, must be a boolean" ).tqarg(index).tqarg( constructing ) ); return false; } else { @@ -517,11 +517,11 @@ bool KDChartObjectFactory::getBool( const QSArgumentList& args, int index, bool* } } -bool KDChartObjectFactory::checkIsQtVariant( const QSArgumentList& args, int index, QVariant::Type expected, const QString& variantName, const char* constructing ) +bool KDChartObjectFactory::checkIsTQtVariant( const TQSArgumentList& args, int index, TQVariant::Type expected, const TQString& variantName, const char* constructing ) { - const QSArgument& arg = args[index-1]; - if ( arg.type() != QSArgument::Variant || arg.variant().type() != expected ) { - throwError( QObject::tr( "Invalid type for argument %1 to %2, must be a %3").arg(index).arg(constructing).arg(variantName) ); + const TQSArgument& arg = args[index-1]; + if ( arg.type() != TQSArgument::Variant || arg.variant().type() != expected ) { + throwError( TQObject::tr( "Invalid type for argument %1 to %2, must be a %3").tqarg(index).tqarg(constructing).tqarg(variantName) ); return false; } else |