diff options
Diffstat (limited to 'kicker-applets/math')
-rw-r--r-- | kicker-applets/math/mathapplet.cpp | 62 | ||||
-rw-r--r-- | kicker-applets/math/mathapplet.h | 18 | ||||
-rw-r--r-- | kicker-applets/math/parser.cpp | 36 | ||||
-rw-r--r-- | kicker-applets/math/parser.h | 24 |
4 files changed, 70 insertions, 70 deletions
diff --git a/kicker-applets/math/mathapplet.cpp b/kicker-applets/math/mathapplet.cpp index b4966b2..9d7ca38 100644 --- a/kicker-applets/math/mathapplet.cpp +++ b/kicker-applets/math/mathapplet.cpp @@ -23,11 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ -#include <qlabel.h> -#include <qfont.h> -#include <qstringlist.h> -#include <qpushbutton.h> -#include <qhbox.h> +#include <tqlabel.h> +#include <tqfont.h> +#include <tqstringlist.h> +#include <tqpushbutton.h> +#include <tqhbox.h> #include <kapplication.h> #include <kglobal.h> @@ -49,23 +49,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern "C" { - KDE_EXPORT KPanelApplet* init(QWidget *parent, const QString& configFile) + KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile) { KGlobal::locale()->insertCatalogue("kmathapplet"); return new MathApplet(configFile, KPanelApplet::Stretch, 0, parent, "kmathapplet"); } } -MathApplet::MathApplet(const QString& configFile, Type type, int actions, - QWidget *parent, const char *name) +MathApplet::MathApplet(const TQString& configFile, Type type, int actions, + TQWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name), m_hasFocus(false) { // setBackgroundMode(X11ParentRelative); setBackgroundOrigin( AncestorOrigin ); // setup label - _label = new QLabel(i18n("Evaluate:"), this); - QFont f(_label->font()); + _label = new TQLabel(i18n("Evaluate:"), this); + TQFont f(_label->font()); f.setPixelSize(12); // _label->setBackgroundMode(X11ParentRelative); _label->setBackgroundOrigin( AncestorOrigin ); @@ -73,19 +73,19 @@ MathApplet::MathApplet(const QString& configFile, Type type, int actions, _label->setFont(f); // setup popup button - _btn = new QPushButton(this); + _btn = new TQPushButton(this); f = _btn->font(); f.setPixelSize(12); _btn->setFont(f); - connect(_btn, SIGNAL(clicked()), SLOT(popup_combo())); + connect(_btn, TQT_SIGNAL(clicked()), TQT_SLOT(popup_combo())); // setup history combo _input = new KHistoryCombo(this); _input->setFocus(); _input->clearEdit(); watchForFocus(_input->lineEdit()); - connect(_input, SIGNAL(activated(const QString&)), - SLOT(evaluate(const QString&))); + connect(_input, TQT_SIGNAL(activated(const TQString&)), + TQT_SLOT(evaluate(const TQString&))); initContextMenu(); useDegrees(); @@ -95,14 +95,14 @@ MathApplet::MathApplet(const QString& configFile, Type type, int actions, // restore history and completion list - QStringList list = c->readListEntry("Completion list"); + TQStringList list = c->readListEntry("Completion list"); _input->completionObject()->setItems(list); list = c->readListEntry("History list"); _input->setHistoryItems(list); int mode = c->readNumEntry( "CompletionMode", KGlobalSettings::completionMode() ); _input->setCompletionMode( (KGlobalSettings::Completion) mode ); - _hbox = new QHBox( 0, 0, WStyle_Customize | WType_Popup ); + _hbox = new TQHBox( 0, 0, WStyle_Customize | WType_Popup ); _hbox->setFixedSize(120, 22); @@ -112,8 +112,8 @@ void MathApplet::initContextMenu() { mContextMenu = new KPopupMenu(this); mContextMenu->setCheckable(true); - mContextMenu->insertItem(i18n("Use &Degrees"), this, SLOT(useDegrees()), 0, 0, 0); - mContextMenu->insertItem(i18n("Use &Radians"), this, SLOT(useRadians()), 0, 1, 1); + mContextMenu->insertItem(i18n("Use &Degrees"), this, TQT_SLOT(useDegrees()), 0, 0, 0); + mContextMenu->insertItem(i18n("Use &Radians"), this, TQT_SLOT(useRadians()), 0, 1, 1); setCustomMenu(mContextMenu); } @@ -124,7 +124,7 @@ MathApplet::~MathApplet() c->setGroup("General"); // save history and completion list - QStringList list = _input->completionObject()->items(); + TQStringList list = _input->completionObject()->items(); c->writeEntry("Completion list", list); list = _input->historyItems(); c->writeEntry("History list", list); @@ -149,12 +149,12 @@ void MathApplet::useRadians() { dummy.setAngleMode(0); } -void MathApplet::resizeEvent(QResizeEvent*) +void MathApplet::resizeEvent(TQResizeEvent*) { if(orientation() == Horizontal) { _btn->hide(); - _input->reparent(this, QPoint(0,0), true); + _input->reparent(this, TQPoint(0,0), true); _label->setGeometry(0,0, width(), _label->height()); if(height() >= _input->sizeHint().height() + _label->height()) @@ -185,7 +185,7 @@ void MathApplet::resizeEvent(QResizeEvent*) { _btn->show(); _btn->setFixedSize(width(), 22); - _input->reparent( _hbox, QPoint(0, 0), false); + _input->reparent( _hbox, TQPoint(0, 0), false); _label->hide(); } setButtonText(); @@ -198,7 +198,7 @@ void MathApplet::positionChange(KPanelApplet::Position) void MathApplet::setButtonText() { - QString t; + TQString t; if (position() == pLeft) { @@ -230,19 +230,19 @@ int MathApplet::heightForWidth(int ) const void MathApplet::popup_combo() { - QPoint p; + TQPoint p; if (position() == pLeft) - p = mapToGlobal(QPoint(-_input->width()-1, 0)); + p = mapToGlobal(TQPoint(-_input->width()-1, 0)); else - p = mapToGlobal(QPoint(width()+1, 0)); + p = mapToGlobal(TQPoint(width()+1, 0)); _hbox->move(p); _hbox->show(); _input->setFocus(); } -void MathApplet::evaluate(const QString& command) +void MathApplet::evaluate(const TQString& command) { - QString exec; + TQString exec; Parser evaluator; @@ -251,7 +251,7 @@ void MathApplet::evaluate(const QString& command) _input->addToHistory(command); - QString cmd = command; + TQString cmd = command; // Nothing interesting. Quit! if ( cmd.isEmpty() ){ @@ -260,7 +260,7 @@ void MathApplet::evaluate(const QString& command) } else { double answer = evaluator.eval(command); if (evaluator.errmsg() == 0) { - QString ansAsString = QString::number(answer); + TQString ansAsString = TQString::number(answer); _input->clearEdit(); _input->setEditText(ansAsString); } else { @@ -273,7 +273,7 @@ void MathApplet::evaluate(const QString& command) _hbox->hide(); } -void MathApplet::mousePressEvent(QMouseEvent *e) +void MathApplet::mousePressEvent(TQMouseEvent *e) { if ( e->button() != RightButton ) { diff --git a/kicker-applets/math/mathapplet.h b/kicker-applets/math/mathapplet.h index 1a918c3..8b483f2 100644 --- a/kicker-applets/math/mathapplet.h +++ b/kicker-applets/math/mathapplet.h @@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __mathapplet_h__ #define __mathapplet_h__ -#include <qstring.h> +#include <tqstring.h> #include <kpanelapplet.h> class QLabel; @@ -40,19 +40,19 @@ class MathApplet : public KPanelApplet Q_OBJECT public: - MathApplet(const QString& configFile, Type t = Stretch, int actions = 0, - QWidget *parent = 0, const char *name = 0); + MathApplet(const TQString& configFile, Type t = Stretch, int actions = 0, + TQWidget *parent = 0, const char *name = 0); virtual ~MathApplet(); int widthForHeight(int height) const; int heightForWidth(int width) const; protected: - void resizeEvent(QResizeEvent*); + void resizeEvent(TQResizeEvent*); void positionChange(KPanelApplet::Position); protected slots: - void evaluate(const QString&); + void evaluate(const TQString&); void popup_combo(); void setButtonText(); void useDegrees(); @@ -61,12 +61,12 @@ protected slots: private: void initContextMenu(); - void mousePressEvent(QMouseEvent *e); + void mousePressEvent(TQMouseEvent *e); KHistoryCombo *_input; - QLabel *_label; - QPushButton *_btn; - QHBox *_hbox; + TQLabel *_label; + TQPushButton *_btn; + TQHBox *_hbox; KPopupMenu *mContextMenu; bool m_hasFocus; }; diff --git a/kicker-applets/math/parser.cpp b/kicker-applets/math/parser.cpp index 7d99c87..8a58064 100644 --- a/kicker-applets/math/parser.cpp +++ b/kicker-applets/math/parser.cpp @@ -136,7 +136,7 @@ double Parser::anglemode() { return m_anglemode; } -double Parser::eval(QString str) +double Parser::eval(TQString str) { double erg; stack=new double [stacksize]; @@ -235,7 +235,7 @@ int Parser::getNextIndex() return ix; } -int Parser::addfkt(QString str) +int Parser::addfkt(TQString str) { int ix; @@ -250,11 +250,11 @@ int Parser::addfkt(QString str) //insert '*' when it is needed for(int i=p1+3; i < (int) str.length();i++) { - if( (str.at(i).isNumber() || str.at(i).category()==QChar::Letter_Uppercase )&& ( str.at(i-1).isLetter() || str.at(i-1) == ')' ) ) + if( (str.at(i).isNumber() || str.at(i).category()==TQChar::Letter_Uppercase )&& ( str.at(i-1).isLetter() || str.at(i-1) == ')' ) ) { str.insert(i,'*'); } - else if( (str.at(i).isNumber() || str.at(i) == ')' || str.at(i).category()==QChar::Letter_Uppercase) && ( str.at(i+1).isLetter() || str.at(i+1) == '(' ) ) + else if( (str.at(i).isNumber() || str.at(i) == ')' || str.at(i).category()==TQChar::Letter_Uppercase) && ( str.at(i+1).isLetter() || str.at(i+1) == '(' ) ) { str.insert(i+1,'*'); i++; @@ -316,7 +316,7 @@ int Parser::addfkt(QString str) } -int Parser::delfkt(QString name) +int Parser::delfkt(TQString name) { int ix; ix=getfix(name); @@ -333,7 +333,7 @@ int Parser::delfkt(int ix) } -double Parser::fkt(QString name, double x) +double Parser::fkt(TQString name, double x) { int ix; ix=getfix(name); @@ -632,7 +632,7 @@ int Parser::chkfix(int ix) } -int Parser::getfkt(int ix, QString& name, QString& str) +int Parser::getfkt(int ix, TQString& name, TQString& str) { if(ix<0 || ix>=ufanz) return -1; // ungltiger Index if(ufkt[ix].fname.isEmpty()) return -1; // keine Funktion name=ufkt[ix].fname.copy(); @@ -641,7 +641,7 @@ int Parser::getfkt(int ix, QString& name, QString& str) } -int Parser::getfix(QString name) +int Parser::getfix(TQString name) { int ix; err=0; @@ -656,41 +656,41 @@ int Parser::getfix(QString name) int Parser::errmsg() { switch(err) { case 1: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Syntax error").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Syntax error").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 2: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Missing parenthesis").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Missing parenthesis").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 3: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Function name unknown").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Function name unknown").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 4: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Void function variable").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Void function variable").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 5: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Too many functions").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Too many functions").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 6: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Token-memory overflow").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Token-memory overflow").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 7: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Stack overflow").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Stack overflow").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 8: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "Name of function not free").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "Name of function not free").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 9: KMessageBox::error(0, i18n("Parser error at position %1:\n" - "recursive function not allowed").arg(QString::number(errpos)), i18n("Math Expression Evaluator")); + "recursive function not allowed").arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; - case 10: KMessageBox::error(0, i18n("Could not find a defined constant at position %1" ).arg(QString::number(errpos)), + case 10: KMessageBox::error(0, i18n("Could not find a defined constant at position %1" ).arg(TQString::number(errpos)), i18n("Math Expression Evaluator")); break; case 11: KMessageBox::error(0, i18n("Empty function"), i18n("Math Expression Evaluator")); diff --git a/kicker-applets/math/parser.h b/kicker-applets/math/parser.h index 44e82ba..4ee0e7d 100644 --- a/kicker-applets/math/parser.h +++ b/kicker-applets/math/parser.h @@ -30,8 +30,8 @@ * \brief Contains the parser core class Parser. */ // Qt includes -#include <qstring.h> -#include <qvaluevector.h> +#include <tqstring.h> +#include <tqvaluevector.h> #ifndef parser_included #define parser_included @@ -125,23 +125,23 @@ public: ~Parser(); /// Evaluates the given expression. - double eval(QString); + double eval(TQString); /// Evaluates the function with the given name at the position. - double fkt(QString, double); + double fkt(TQString, double); /// Evaluates the function with the given index at the position. double fkt(int ix, double x) {return ufkt[ix].fkt(x);} /// Adds a user defined function with the given equation. - int addfkt(QString); + int addfkt(TQString); /// Removes the function with the given name. - int delfkt(QString); + int delfkt(TQString); /// Removes the function with the given index. int delfkt(int); /// Returns name and expression of the function with the given index. - int getfkt(int, QString&, QString&); + int getfkt(int, TQString&, TQString&); /// Checks, if at the given index a function is stored. int chkfix(int); /// Returns the index of the function with the given name. - int getfix(QString); + int getfix(TQString); /// Returns the lowest index in the array of user defined functions which is empty, /// or -1, if the array is full. int getNextIndex(); @@ -154,7 +154,7 @@ public: /// sets the angletype. TRUE is radians and FALSE degrees void setAngleMode(int); - QValueVector<Constant> constant; + TQValueVector<Constant> constant; /// Error codes. /** @@ -188,9 +188,9 @@ public: unsigned char *mem; ///< Pointer to the allocated memory for the tokens. unsigned char *mptr; ///< Pointer to the token. QString fname; ///< Name of the function. - QString fvar; ///< Dummy variable. - QString fpar; ///< Parameter. - QString fstr; ///< Function expression. + TQString fvar; ///< Dummy variable. + TQString fpar; ///< Parameter. + TQString fstr; ///< Function expression. int memsize; ///< Size of token memory int stacksize; ///< Size of the stack. double k, ///< Function parameter. |