From f4f8ac034fa04404e2fcd5029ba050c537c07d7a Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 9 May 2011 19:45:27 +0000 Subject: TQt4 port Abakus This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/abakus@1231045 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/SConscript | 2 +- src/abakus.cpp | 2 +- src/abakuscommon.h | 6 +- src/abakuslistview.cpp | 80 +++++++------- src/abakuslistview.h | 39 +++---- src/dcopIface.h | 4 +- src/dragsupport.cpp | 46 ++++---- src/dragsupport.h | 8 +- src/editor.cpp | 260 ++++++++++++++++++++++---------------------- src/editor.h | 50 ++++----- src/evaluator.cpp | 42 ++++---- src/evaluator.h | 28 ++--- src/function.cpp | 54 +++++----- src/function.h | 45 ++++---- src/hmath.cpp | 8 +- src/hmath.h | 4 +- src/lexer.ll | 4 +- src/mainwindow.cpp | 262 ++++++++++++++++++++++----------------------- src/mainwindow.h | 55 +++++----- src/node.cpp | 26 ++--- src/node.h | 28 ++--- src/number.c | 4 +- src/numerictypes.cpp | 40 +++---- src/numerictypes.h | 16 +-- src/parser.yy | 40 +++---- src/result.cpp | 2 +- src/result.h | 8 +- src/resultlistview.cpp | 46 ++++---- src/resultlistview.h | 17 +-- src/resultlistviewtext.cpp | 48 ++++----- src/resultlistviewtext.h | 24 ++--- src/rpnmuncher.cpp | 38 +++---- src/rpnmuncher.h | 12 +-- src/valuemanager.cpp | 40 +++---- src/valuemanager.h | 35 +++--- 35 files changed, 716 insertions(+), 707 deletions(-) (limited to 'src') diff --git a/src/SConscript b/src/SConscript index 28ef0f3..3110f98 100644 --- a/src/SConscript +++ b/src/SConscript @@ -66,7 +66,7 @@ myenv.Append(CXXFLAGS = '-Wno-non-virtual-dtor -I/usr/include/tqt -include tqt.h myenv.KDEaddpaths_includes('#/src/ #/') ## Necessary libraries to link against -myenv.KDEaddlibs( 'qt-mt kio kdecore kdeprint kdeui' ) +myenv.KDEaddlibs( 'kio kdecore kdeprint kdeui' ) ############################# ## Data to install diff --git a/src/abakus.cpp b/src/abakus.cpp index a071007..94f9c6d 100644 --- a/src/abakus.cpp +++ b/src/abakus.cpp @@ -66,7 +66,7 @@ int main(int argc, char **argv) MainWindow *win = new MainWindow; app.setMainWidget(win); - app.connect(&app, SIGNAL(lastWindowClosed()), SLOT(quit())); + app.connect(&app, TQT_SIGNAL(lastWindowClosed()), TQT_SLOT(quit())); win->show(); win->resize(500, 300); diff --git a/src/abakuscommon.h b/src/abakuscommon.h index 83a71f2..6c97267 100644 --- a/src/abakuscommon.h +++ b/src/abakuscommon.h @@ -11,9 +11,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "function.h" #include "node.h" diff --git a/src/abakuslistview.cpp b/src/abakuslistview.cpp index 06d2418..43fce29 100644 --- a/src/abakuslistview.cpp +++ b/src/abakuslistview.cpp @@ -20,38 +20,38 @@ #include #include -#include -#include -#include +#include +#include +#include #include "dragsupport.h" #include "abakuslistview.h" #include "valuemanager.h" #include "function.h" -ListView::ListView(QWidget *parent, const char *name) : - KListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0), +ListView::ListView(TQWidget *tqparent, const char *name) : + KListView(tqparent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0), m_removeAllId(0) { setResizeMode(LastColumn); setDragEnabled(true); - connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)), - SLOT(rightClicked(QListViewItem *, const QPoint &))); + connect(this, TQT_SIGNAL(contextMenuRequested(TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(rightClicked(TQListViewItem *, const TQPoint &))); } -QDragObject *ListView::dragObject() +TQDragObject *ListView::dragObject() { - QPoint viewportPos = viewport()->mapFromGlobal(QCursor::pos()); - QListViewItem *item = itemAt(viewportPos); + TQPoint viewportPos = viewport()->mapFromGlobal(TQCursor::pos()); + TQListViewItem *item = itemAt(viewportPos); if(!item) return 0; int column = header()->sectionAt(viewportPos.x()); - QString dragText = item->text(column); + TQString dragText = item->text(column); - QDragObject *drag = new QTextDrag(dragText, this, "list item drag"); + TQDragObject *drag = new TQTextDrag(dragText, this, "list item drag"); drag->setPixmap(DragSupport::makePixmap(dragText, font())); return drag; @@ -70,8 +70,8 @@ void ListView::enablePopupHandler(bool enable) m_menu = new KPopupMenu(this); - m_removeSingleId = m_menu->insertItem(removeItemString(), this, SLOT(removeSelected())); - m_removeAllId = m_menu->insertItem("Placeholder", this, SLOT(removeAllItems())); + m_removeSingleId = m_menu->insertItem(removeItemString(), this, TQT_SLOT(removeSelected())); + m_removeAllId = m_menu->insertItem("Placeholder", this, TQT_SLOT(removeAllItems())); } else { delete m_menu; @@ -79,19 +79,19 @@ void ListView::enablePopupHandler(bool enable) } } -QString ListView::removeItemString() const +TQString ListView::removeItemString() const { - return QString(); + return TQString(); } -QString ListView::removeAllItemsString(unsigned count) const +TQString ListView::removeAllItemsString(unsigned count) const { Q_UNUSED(count); - return QString(); + return TQString(); } -void ListView::removeSelectedItem(QListViewItem *item) +void ListView::removeSelectedItem(TQListViewItem *item) { Q_UNUSED(item); } @@ -100,14 +100,14 @@ void ListView::removeAllItems() { } -bool ListView::isItemRemovable(QListViewItem *item) const +bool ListView::isItemRemovable(TQListViewItem *item) const { Q_UNUSED(item); return false; } -void ListView::rightClicked(QListViewItem *item, const QPoint &pt) +void ListView::rightClicked(TQListViewItem *item, const TQPoint &pt) { if(!m_usePopup) return; @@ -122,7 +122,7 @@ void ListView::removeSelected() removeSelectedItem(selectedItem()); } -ValueListViewItem::ValueListViewItem(QListView *listView, const QString &name, +ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name, const Abakus::number_t &value) : KListViewItem(listView, name), m_value(value) { @@ -132,7 +132,7 @@ ValueListViewItem::ValueListViewItem(QListView *listView, const QString &name, void ValueListViewItem::valueChanged() { setText(1, m_value.toString()); - repaint(); + tqrepaint(); } void ValueListViewItem::valueChanged(const Abakus::number_t &newValue) @@ -147,25 +147,25 @@ Abakus::number_t ValueListViewItem::itemValue() const return m_value; } -VariableListView::VariableListView(QWidget *parent, const char *name) : - ListView(parent, name) +VariableListView::VariableListView(TQWidget *tqparent, const char *name) : + ListView(tqparent, name) { enablePopupHandler(true); } -QString VariableListView::removeItemString() const +TQString VariableListView::removeItemString() const { return i18n("Remove selected variable"); } -QString VariableListView::removeAllItemsString(unsigned count) const +TQString VariableListView::removeAllItemsString(unsigned count) const { // count is unreliable because not all of the elements in the list view // can be removed. count = 0; - QStringList values = ValueManager::instance()->valueNames(); + TQStringList values = ValueManager::instance()->valueNames(); - for(QStringList::ConstIterator value = values.constBegin(); value != values.constEnd(); ++value) + for(TQStringList::ConstIterator value = values.constBegin(); value != values.constEnd(); ++value) if(!ValueManager::instance()->isValueReadOnly(*value)) ++count; @@ -174,12 +174,12 @@ QString VariableListView::removeAllItemsString(unsigned count) const count); } -bool VariableListView::isItemRemovable(QListViewItem *item) const +bool VariableListView::isItemRemovable(TQListViewItem *item) const { return !ValueManager::instance()->isValueReadOnly(item->text(0)); } -void VariableListView::removeSelectedItem(QListViewItem *item) +void VariableListView::removeSelectedItem(TQListViewItem *item) { ValueManager::instance()->removeValue(item->text(0)); } @@ -189,43 +189,43 @@ void VariableListView::removeAllItems() ValueManager::instance()->slotRemoveUserVariables(); } -FunctionListView::FunctionListView(QWidget *parent, const char *name) : - ListView(parent, name) +FunctionListView::FunctionListView(TQWidget *tqparent, const char *name) : + ListView(tqparent, name) { enablePopupHandler(true); } -QString FunctionListView::removeItemString() const +TQString FunctionListView::removeItemString() const { return i18n("Remove selected function"); } -QString FunctionListView::removeAllItemsString(unsigned count) const +TQString FunctionListView::removeAllItemsString(unsigned count) const { return i18n("Remove all functions (1 function)", "Remove all functions (%n functions)", count); } -bool FunctionListView::isItemRemovable(QListViewItem *item) const +bool FunctionListView::isItemRemovable(TQListViewItem *item) const { return true; } -void FunctionListView::removeSelectedItem(QListViewItem *item) +void FunctionListView::removeSelectedItem(TQListViewItem *item) { // Use section to get the beginning of the string up to (and not // including) the first ( - QString name = item->text(0).section('(', 0, 0); + TQString name = item->text(0).section('(', 0, 0); FunctionManager::instance()->removeFunction(name); } void FunctionListView::removeAllItems() { - QStringList fns = FunctionManager::instance()->functionList(FunctionManager::UserDefined); + TQStringList fns = FunctionManager::instance()->functionList(FunctionManager::UserDefined); - for(QStringList::ConstIterator fn = fns.constBegin(); fn != fns.constEnd(); ++fn) + for(TQStringList::ConstIterator fn = fns.constBegin(); fn != fns.constEnd(); ++fn) FunctionManager::instance()->removeFunction(*fn); } diff --git a/src/abakuslistview.h b/src/abakuslistview.h index f0b9c4c..190c198 100644 --- a/src/abakuslistview.h +++ b/src/abakuslistview.h @@ -28,12 +28,13 @@ class KPopupMenu; class ListView : public KListView { Q_OBJECT + TQ_OBJECT public: - ListView(QWidget *parent, const char *name = 0); + ListView(TQWidget *tqparent, const char *name = 0); protected: - virtual QDragObject *dragObject(); + virtual TQDragObject *dragObject(); /** * Used to enable fancy popup handling support in subclasses. Subclasses @@ -47,7 +48,7 @@ class ListView : public KListView * If using the popup menu handling, the subclass needs to return a * translated string of the form "Remove selected ". */ - virtual QString removeItemString() const; + virtual TQString removeItemString() const; /** * If using the popup menu handling, the subclass needs to return a @@ -55,7 +56,7 @@ class ListView : public KListView * also appending a " (%n s), which you can use the @p count * parameter for. */ - virtual QString removeAllItemsString(unsigned count) const; + virtual TQString removeAllItemsString(unsigned count) const; protected slots: /** @@ -63,7 +64,7 @@ class ListView : public KListView * function to remove the selected item, which is passed in as a * parameter. */ - virtual void removeSelectedItem(QListViewItem *item); + virtual void removeSelectedItem(TQListViewItem *item); /** * If using the popup menu handling, the subclass needs to reimplement this @@ -75,10 +76,10 @@ class ListView : public KListView * If using the popup menu handling, this function may be called to * determine whether the selected item given by @p item is removable. */ - virtual bool isItemRemovable(QListViewItem *item) const; + virtual bool isItemRemovable(TQListViewItem *item) const; private slots: - void rightClicked(QListViewItem *item, const QPoint &pt); + void rightClicked(TQListViewItem *item, const TQPoint &pt); void removeSelected(); private: @@ -92,7 +93,7 @@ class ListView : public KListView class ValueListViewItem : public KListViewItem { public: - ValueListViewItem (QListView *listView, const QString &name, const Abakus::number_t &value); + ValueListViewItem (TQListView *listView, const TQString &name, const Abakus::number_t &value); // Will cause the list item to rethink the text. void valueChanged(); @@ -110,17 +111,18 @@ class ValueListViewItem : public KListViewItem class VariableListView : public ListView { Q_OBJECT + TQ_OBJECT public: - VariableListView(QWidget *parent, const char *name = 0); + VariableListView(TQWidget *tqparent, const char *name = 0); protected: - virtual QString removeItemString() const; - virtual QString removeAllItemsString(unsigned count) const; - virtual bool isItemRemovable(QListViewItem *item) const; + virtual TQString removeItemString() const; + virtual TQString removeAllItemsString(unsigned count) const; + virtual bool isItemRemovable(TQListViewItem *item) const; protected slots: - virtual void removeSelectedItem(QListViewItem *item); + virtual void removeSelectedItem(TQListViewItem *item); virtual void removeAllItems(); }; @@ -130,17 +132,18 @@ class VariableListView : public ListView class FunctionListView : public ListView { Q_OBJECT + TQ_OBJECT public: - FunctionListView(QWidget *parent, const char *name = 0); + FunctionListView(TQWidget *tqparent, const char *name = 0); protected: - virtual QString removeItemString() const; - virtual QString removeAllItemsString(unsigned count) const; - virtual bool isItemRemovable(QListViewItem *item) const; + virtual TQString removeItemString() const; + virtual TQString removeAllItemsString(unsigned count) const; + virtual bool isItemRemovable(TQListViewItem *item) const; protected slots: - virtual void removeSelectedItem(QListViewItem *item); + virtual void removeSelectedItem(TQListViewItem *item); virtual void removeAllItems(); }; diff --git a/src/dcopIface.h b/src/dcopIface.h index 949cbab..844e80d 100644 --- a/src/dcopIface.h +++ b/src/dcopIface.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include "mainwindow.h" #include "numerictypes.h" @@ -37,7 +37,7 @@ class AbakusIface : virtual public DCOPObject } k_dcop: - virtual double evaluate(const QString &expr) + virtual double evaluate(const TQString &expr) { Abakus::number_t result = parseString(expr.latin1()); return result.asDouble(); diff --git a/src/dragsupport.cpp b/src/dragsupport.cpp index e20207f..f597022 100644 --- a/src/dragsupport.cpp +++ b/src/dragsupport.cpp @@ -17,42 +17,42 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include "dragsupport.h" namespace DragSupport { -QPixmap makePixmap(const QString &text, const QFont &font) +TQPixmap makePixmap(const TQString &text, const TQFont &font) { - QColor background(234, 178, 230); - QFontMetrics fm(font); + TQColor background(234, 178, 230); + TQFontMetrics fm(font); int height = 2 * fm.height(); - QSize bonusSize (height, 0); - QSize size(fm.width(text), height); - QImage image(size + bonusSize, 32); + TQSize bonusSize (height, 0); + TQSize size(fm.width(text), height); + TQImage image(size + bonusSize, 32); image.setAlphaBuffer(false); image.fill(0); // All transparent pixels image.setAlphaBuffer(true); - QPixmap pix(size + bonusSize); - pix.fill(Qt::magenta); // Watch for incoming hacks + TQPixmap pix(size + bonusSize); + pix.fill(TQt::magenta); // Watch for incoming hacks - QPainter painter(&pix); + TQPainter painter(&pix); painter.setFont(font); // Outline black, background white - painter.setPen(Qt::black); + painter.setPen(TQt::black); painter.setBrush(background); // roundRect is annoying in that the four "pies" in each corner aren't @@ -64,19 +64,19 @@ QPixmap makePixmap(const QString &text, const QFont &font) int textLeft = height / 2; // Draw text - painter.setPen(Qt::black); + painter.setPen(TQt::black); painter.drawText(textLeft, height / 4, size.width(), size.height(), 0, text); - QImage overlay(pix.convertToImage()); + TQImage overlay(pix.convertToImage()); // The images should have the same size, copy pixels from overlay to the // bottom unless the pixel is called magenta. The pixels we don't copy - // are transparent in the QImage, and will remain transparent when - // converted to a QPixmap. + // are transparent in the TQImage, and will remain transparent when + // converted to a TQPixmap. for(int i = 0; i < image.width(); ++i) for(int j = 0; j < image.height(); ++j) { - if(QColor(overlay.pixel(i, j)) != Qt::magenta) + if(TQColor(overlay.pixel(i, j)) != TQt::magenta) image.setPixel(i, j, overlay.pixel(i, j)); } diff --git a/src/dragsupport.h b/src/dragsupport.h index 1b63e1f..ff0d7a6 100644 --- a/src/dragsupport.h +++ b/src/dragsupport.h @@ -19,13 +19,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -class QPixmap; -class QString; -class QFont; +class TQPixmap; +class TQString; +class TQFont; namespace DragSupport { - QPixmap makePixmap(const QString &text, const QFont &font); + TQPixmap makePixmap(const TQString &text, const TQFont &font); } #endif diff --git a/src/editor.cpp b/src/editor.cpp index 186294b..ec83878 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -25,23 +25,23 @@ #include "evaluator.h" #include "result.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include // netwm.h includes X11 headers which conflict with qevent -#include +#include #include @@ -50,26 +50,26 @@ // XXX: QT 4: Replace this with qBinaryFind(). using std::binary_search; -class CalcResultLabel : public QLabel +class CalcResultLabel : public TQLabel { public: - CalcResultLabel(QWidget *parent, const char *name, int WFlags) : - QLabel(parent, name, WFlags) + CalcResultLabel(TQWidget *tqparent, const char *name, int WFlags) : + TQLabel(tqparent, name, WFlags) { } protected: - virtual void mousePressEvent(QMouseEvent *) + virtual void mousePressEvent(TQMouseEvent *) { hide(); } }; -class EditorHighlighter : public QSyntaxHighlighter +class EditorHighlighter : public TQSyntaxHighlighter { public: EditorHighlighter( Editor* ); - int highlightParagraph ( const QString & text, int ); + int highlightParagraph ( const TQString & text, int ); private: Editor* editor; @@ -79,50 +79,50 @@ class Editor::Private { public: Evaluator* eval; - QStringList history; + TQStringList history; int index; bool autoCompleteEnabled; EditorCompletion* completion; - QTimer* completionTimer; + TQTimer* completionTimer; bool autoCalcEnabled; char format; int decimalDigits; - QTimer* autoCalcTimer; - QLabel* autoCalcLabel; + TQTimer* autoCalcTimer; + TQLabel* autoCalcLabel; bool syntaxHighlightEnabled; EditorHighlighter* highlighter; - QMap highlightColors; - QTimer* matchingTimer; + TQMap highlightColors; + TQTimer* matchingTimer; }; class EditorCompletion::Private { public: Editor* editor; - QVBox *completionPopup; - QListBox *completionListBox; + TQVBox *completionPopup; + TQListBox *completionListBox; }; -class ChoiceItem: public QListBoxText +class ChoiceItem: public TQListBoxText { public: - ChoiceItem( QListBox*, const QString& ); + ChoiceItem( TQListBox*, const TQString& ); void setMinNameWidth (int w) { minNameWidth = w; } int nameWidth() const; protected: - void paint( QPainter* p ); + void paint( TQPainter* p ); private: - QString item; - QString desc; + TQString item; + TQString desc; int minNameWidth; }; -ChoiceItem::ChoiceItem( QListBox* listBox, const QString& text ): - QListBoxText( listBox, text ), minNameWidth(0) +ChoiceItem::ChoiceItem( TQListBox* listBox, const TQString& text ): + TQListBoxText( listBox, text ), minNameWidth(0) { - QStringList list = QStringList::split( ':', text ); + TQStringList list = TQStringList::split( ':', text ); if( list.count() ) item = list[0]; if( list.count()>1 ) desc = list[1]; } @@ -133,48 +133,48 @@ int ChoiceItem::nameWidth() const if(item.isEmpty()) return 0; - QFontMetrics fm = listBox()->fontMetrics(); + TQFontMetrics fm = listBox()->fontMetrics(); return fm.width( item ); } -void ChoiceItem::paint( QPainter* painter ) +void ChoiceItem::paint( TQPainter* painter ) { int itemHeight = height( listBox() ); - QFontMetrics fm = painter->fontMetrics(); + TQFontMetrics fm = painter->fontMetrics(); int yPos = ( ( itemHeight - fm.height() ) / 2 ) + fm.ascent(); painter->drawText( 3, yPos, item ); //int xPos = fm.width( item ); - int xPos = QMAX(fm.width(item), minNameWidth); + int xPos = TQMAX(fm.width(item), minNameWidth); if( !isSelected() ) - painter->setPen( listBox()->palette().disabled().text().dark() ); + painter->setPen( listBox()->tqpalette().disabled().text().dark() ); painter->drawText( 10 + xPos, yPos, desc ); } EditorHighlighter::EditorHighlighter( Editor* e ): - QSyntaxHighlighter( e ) + TQSyntaxHighlighter( e ) { editor = e; } -int EditorHighlighter::highlightParagraph ( const QString & text, int ) +int EditorHighlighter::highlightParagraph ( const TQString & text, int ) { if( !editor->isSyntaxHighlightEnabled() ) { - setFormat( 0, text.length(), editor->colorGroup().text() ); + setFormat( 0, text.length(), editor->tqcolorGroup().text() ); return 0; } - QStringList fnames = FunctionManager::instance()->functionList(FunctionManager::All); + TQStringList fnames = FunctionManager::instance()->functionList(FunctionManager::All); fnames.sort(); // Sort list so we can bin search it. Tokens tokens = Evaluator::scan( text ); for( unsigned i = 0; i < tokens.count(); i++ ) { Token& token = tokens[i]; - QString text = token.text().lower(); - QFont font = editor->font(); - QColor color = Qt::black; + TQString text = token.text().lower(); + TQFont font = editor->font(); + TQColor color = TQt::black; switch( token.type() ) { case Token::Number: @@ -204,22 +204,22 @@ int EditorHighlighter::highlightParagraph ( const QString & text, int ) -Editor::Editor( QWidget* parent, const char* name ): - QTextEdit( parent, name ) +Editor::Editor( TQWidget* tqparent, const char* name ): + TQTextEdit( tqparent, name ) { d = new Private; d->eval = 0; d->index = 0; d->autoCompleteEnabled = true; d->completion = new EditorCompletion( this ); - d->completionTimer = new QTimer( this ); + d->completionTimer = new TQTimer( this ); d->autoCalcEnabled = true; d->syntaxHighlightEnabled = true; d->highlighter = new EditorHighlighter( this ); - d->autoCalcTimer = new QTimer( this ); - d->matchingTimer = new QTimer( this ); + d->autoCalcTimer = new TQTimer( this ); + d->matchingTimer = new TQTimer( this ); - setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ); setWordWrap( NoWrap ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); @@ -228,26 +228,26 @@ Editor::Editor( QWidget* parent, const char* name ): setTabChangesFocus( true ); setLinkUnderline( false ); - connect( d->completion, SIGNAL( selectedCompletion( const QString& ) ), - SLOT( autoComplete( const QString& ) ) ); - connect( this, SIGNAL( textChanged() ), SLOT( checkAutoComplete() ) ); - connect( d->completionTimer, SIGNAL( timeout() ), SLOT( triggerAutoComplete() ) ); + connect( d->completion, TQT_SIGNAL( selectedCompletion( const TQString& ) ), + TQT_SLOT( autoComplete( const TQString& ) ) ); + connect( this, TQT_SIGNAL( textChanged() ), TQT_SLOT( checkAutoComplete() ) ); + connect( d->completionTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( triggerAutoComplete() ) ); - connect( this, SIGNAL( textChanged() ), SLOT( checkMatching() ) ); - connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingLeft() ) ); - connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingRight() ) ); - connect( this, SIGNAL( textChanged() ), SLOT( checkAutoCalc() ) ); - connect( d->autoCalcTimer, SIGNAL( timeout() ), SLOT( autoCalc() ) ); + connect( this, TQT_SIGNAL( textChanged() ), TQT_SLOT( checkMatching() ) ); + connect( d->matchingTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( doMatchingLeft() ) ); + connect( d->matchingTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( doMatchingRight() ) ); + connect( this, TQT_SIGNAL( textChanged() ), TQT_SLOT( checkAutoCalc() ) ); + connect( d->autoCalcTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( autoCalc() ) ); d->autoCalcLabel = new CalcResultLabel( 0, "autocalc", WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); - d->autoCalcLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); - d->autoCalcLabel->setPalette( QToolTip::palette() ); + d->autoCalcLabel->setFrameStyle( TQFrame::Plain | TQFrame::Box ); + d->autoCalcLabel->setPalette( TQToolTip::palette() ); d->autoCalcLabel->hide(); - setHighlightColor( Number, QColor(0,0,127) ); - setHighlightColor( FunctionName, QColor(85,0,0) ); - setHighlightColor( Variable, QColor(0,85,0) ); - setHighlightColor( MatchedPar, QColor(255,255,183) ); + setHighlightColor( Number, TQColor(0,0,127) ); + setHighlightColor( FunctionName, TQColor(85,0,0) ); + setHighlightColor( Variable, TQColor(0,85,0) ); + setHighlightColor( MatchedPar, TQColor(255,255,183) ); } Editor::~Editor() @@ -256,24 +256,24 @@ Editor::~Editor() delete d; } -QSize Editor::sizeHint() const +TQSize Editor::tqsizeHint() const { constPolish(); - QFontMetrics fm = fontMetrics(); - int h = QMAX(fm.lineSpacing(), 14); + TQFontMetrics fm = fontMetrics(); + int h = TQMAX(fm.lineSpacing(), 14); int w = fm.width( 'x' ) * 20; int m = frameWidth() * 2; - return( style().sizeFromContents(QStyle::CT_LineEdit, this, - QSize( w + m, h + m + 4 ). - expandedTo(QApplication::globalStrut()))); + return( tqstyle().tqsizeFromContents(TQStyle::CT_LineEdit, this, + TQSize( w + m, h + m + 4 ). + expandedTo(TQApplication::globalStrut()))); } -QStringList Editor::history() const +TQStringList Editor::history() const { return d->history; } -void Editor::setHistory( const QStringList& h ) +void Editor::setHistory( const TQStringList& h ) { d->history = h; d->index = d->history.count(); @@ -309,11 +309,11 @@ void Editor::setDecimalDigits( int digits ) d->decimalDigits = digits; } -void Editor::appendHistory( const QString& text ) +void Editor::appendHistory( const TQString& text ) { if( text.isEmpty() ) return; - QString lastText; + TQString lastText; if( d->history.count() ) lastText = d->history[ d->history.count()-1 ]; if( text == lastText ) return; @@ -333,9 +333,9 @@ void Editor::squelchNextAutoCalc() d->autoCalcTimer->stop(); } -void Editor::setText(const QString &txt) +void Editor::setText(const TQString &txt) { - QTextEdit::setText(txt); + TQTextEdit::setText(txt); squelchNextAutoCalc(); } @@ -374,7 +374,7 @@ void Editor::doMatchingLeft() getCursorPosition( ¶, &curPos ); // check for right par - QString subtext = text().left( curPos ); + TQString subtext = text().left( curPos ); Tokens tokens = Evaluator::scan( subtext ); if( !tokens.valid() ) return; if( tokens.count()<1 ) return; @@ -423,7 +423,7 @@ void Editor::doMatchingRight() getCursorPosition( ¶, &curPos ); // check for left par - QString subtext = text().right( text().length() - curPos ); + TQString subtext = text().right( text().length() - curPos ); Tokens tokens = Evaluator::scan( subtext ); if( !tokens.valid() ) return; if( tokens.count()<1 ) return; @@ -472,7 +472,7 @@ void Editor::triggerAutoComplete() // faster now that it uses flex. ;) int para = 0, curPos = 0; getCursorPosition( ¶, &curPos ); - QString subtext = text().left( curPos ); + TQString subtext = text().left( curPos ); Tokens tokens = Evaluator::scan( subtext ); if(!tokens.valid()) { @@ -489,18 +489,18 @@ void Editor::triggerAutoComplete() if( !lastToken.isIdentifier() ) return; - QString id = lastToken.text(); + TQString id = lastToken.text(); if( id.isEmpty() ) return; // find matches in function names - QStringList fnames = FunctionManager::instance()->functionList(FunctionManager::All); - QStringList choices; + TQStringList fnames = FunctionManager::instance()->functionList(FunctionManager::All); + TQStringList choices; for( unsigned i=0; ifunction( str ); if( f && !f->description.isEmpty() ) @@ -512,17 +512,17 @@ void Editor::triggerAutoComplete() choices.sort(); // find matches in variables names - QStringList vchoices; - QStringList values = ValueManager::instance()->valueNames(); + TQStringList vchoices; + TQStringList values = ValueManager::instance()->valueNames(); - for(QStringList::ConstIterator it = values.begin(); it != values.end(); ++it) - if( (*it).startsWith( id, false ) ) + for(TQStringList::ConstIterator it = values.begin(); it != values.end(); ++it) + if( (*it).tqstartsWith( id, false ) ) { - QString choice = ValueManager::description(*it); + TQString choice = ValueManager::description(*it); if(choice.isEmpty()) choice = ValueManager::instance()->value(*it).toString(); - vchoices.append( QString("%1:%2").arg( *it, choice ) ); + vchoices.append( TQString("%1:%2").tqarg( *it, choice ) ); } vchoices.sort(); @@ -534,7 +534,7 @@ void Editor::triggerAutoComplete() // one match, complete it for the user if( choices.count()==1 ) { - QString str = QStringList::split( ':', choices[0] )[0]; + TQString str = TQStringList::split( ':', choices[0] )[0]; // single perfect match, no need to give choices. if(str == id.lower()) @@ -554,7 +554,7 @@ void Editor::triggerAutoComplete() d->completion->showCompletion( choices ); } -void Editor::autoComplete( const QString& item ) +void Editor::autoComplete( const TQString& item ) { if( !d->autoCompleteEnabled || item.isEmpty() ) return; @@ -562,7 +562,7 @@ void Editor::autoComplete( const QString& item ) int para = 0, curPos = 0; getCursorPosition( ¶, &curPos ); - QString subtext = text().left( curPos ); + TQString subtext = text().left( curPos ); Tokens tokens = Evaluator::scan( subtext ); if( !tokens.valid() || tokens.count() < 1 ) @@ -572,7 +572,7 @@ void Editor::autoComplete( const QString& item ) if( !lastToken.isIdentifier() ) return; - QStringList str = QStringList::split( ':', item ); + TQStringList str = TQStringList::split( ':', item ); blockSignals( true ); setSelection( 0, lastToken.pos(), 0, lastToken.pos()+lastToken.text().length() ); @@ -585,7 +585,7 @@ void Editor::autoCalc() if( !d->autoCalcEnabled ) return; - QString str = Evaluator::autoFix( text() ); + TQString str = Evaluator::autoFix( text() ); if( str.isEmpty() ) return; @@ -595,8 +595,8 @@ void Editor::autoCalc() return; // If we're using set for a function don't try. - QRegExp setFn("\\s*set.*\\(.*="); - if( str.find(setFn) != -1 ) + TQRegExp setFn("\\s*set.*\\(.*="); + if( str.tqfind(setFn) != -1 ) return; // strip off assignment operator, e.g. "x=1+2" becomes "1+2" only @@ -622,19 +622,19 @@ void Editor::autoCalc() Abakus::number_t result = parseString(str.latin1()); if( Result::lastResult()->type() == Result::Value ) { - QString ss = QString("Result: %2").arg(result.toString()); + TQString ss = TQString("Result: %2").tqarg(result.toString()); d->autoCalcLabel->setText( ss ); d->autoCalcLabel->adjustSize(); // reposition nicely - QPoint pos = mapToGlobal( QPoint( 0, 0 ) ); + TQPoint pos = mapToGlobal( TQPoint( 0, 0 ) ); pos.setY( pos.y() - d->autoCalcLabel->height() - 1 ); d->autoCalcLabel->move( pos ); d->autoCalcLabel->show(); d->autoCalcLabel->raise(); // do not show it forever - QTimer::singleShot( 5000, d->autoCalcLabel, SLOT( hide()) ); + TQTimer::singleShot( 5000, d->autoCalcLabel, TQT_SLOT( hide()) ); } else { @@ -643,7 +643,7 @@ void Editor::autoCalc() } } -QString Editor::formatNumber( const Abakus::number_t &value ) const +TQString Editor::formatNumber( const Abakus::number_t &value ) const { return value.toString(); } @@ -678,7 +678,7 @@ void Editor::historyForward() ensureCursorVisible(); } -void Editor::keyPressEvent( QKeyEvent* e ) +void Editor::keyPressEvent( TQKeyEvent* e ) { if( e->key() == Key_Up ) { @@ -708,10 +708,10 @@ void Editor::keyPressEvent( QKeyEvent* e ) checkMatching(); } - QTextEdit::keyPressEvent( e ); + TQTextEdit::keyPressEvent( e ); } -void Editor::wheelEvent( QWheelEvent *e ) +void Editor::wheelEvent( TQWheelEvent *e ) { if( e->delta() > 0 ) historyBack(); @@ -732,7 +732,7 @@ bool Editor::isSyntaxHighlightEnabled() const return d->syntaxHighlightEnabled; } -void Editor::setHighlightColor( ColorType type, QColor color ) +void Editor::setHighlightColor( ColorType type, TQColor color ) { d->highlightColors[ type ] = color; @@ -742,26 +742,26 @@ void Editor::setHighlightColor( ColorType type, QColor color ) d->highlighter->rehighlight(); } -QColor Editor::highlightColor( ColorType type ) +TQColor Editor::highlightColor( ColorType type ) { return d->highlightColors[ type ]; } -EditorCompletion::EditorCompletion( Editor* editor ): QObject( editor ) +EditorCompletion::EditorCompletion( Editor* editor ): TQObject( editor ) { d = new Private; d->editor = editor; - d->completionPopup = new QVBox( editor->topLevelWidget(), 0, WType_Popup ); - d->completionPopup->setFrameStyle( QFrame::Box | QFrame::Plain ); + d->completionPopup = new TQVBox( editor->tqtopLevelWidget(), 0, WType_Popup ); + d->completionPopup->setFrameStyle( TQFrame::Box | TQFrame::Plain ); d->completionPopup->setLineWidth( 1 ); d->completionPopup->installEventFilter( this ); - d->completionPopup->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum); + d->completionPopup->tqsetSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum); - d->completionListBox = new QListBox( d->completionPopup ); + d->completionListBox = new TQListBox( d->completionPopup ); d->completionPopup->setFocusProxy( d->completionListBox ); - d->completionListBox->setFrameStyle( QFrame::NoFrame ); + d->completionListBox->setFrameStyle( TQFrame::NoFrame ); d->completionListBox->setVariableWidth( true ); d->completionListBox->installEventFilter( this ); } @@ -771,14 +771,14 @@ EditorCompletion::~EditorCompletion() delete d; } -bool EditorCompletion::eventFilter( QObject *obj, QEvent *ev ) +bool EditorCompletion::eventFilter( TQObject *obj, TQEvent *ev ) { - if ( obj == d->completionPopup || obj == d->completionListBox ) + if ( TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->completionPopup) || TQT_BASE_OBJECT(obj) == TQT_BASE_OBJECT(d->completionListBox) ) { - if ( ev->type() == QEvent::KeyPress ) + if ( ev->type() == TQEvent::KeyPress ) { - QKeyEvent *ke = (QKeyEvent*)ev; + TQKeyEvent *ke = (TQKeyEvent*)ev; if ( ke->key() == Key_Enter || ke->key() == Key_Return ) { doneCompletion(); @@ -792,11 +792,11 @@ bool EditorCompletion::eventFilter( QObject *obj, QEvent *ev ) d->completionPopup->close(); d->editor->setFocus(); - QApplication::sendEvent( d->editor, ev ); + TQApplication::sendEvent( d->editor, ev ); return true; } - if ( ev->type() == QEvent::MouseButtonDblClick ) + if ( ev->type() == TQEvent::MouseButtonDblClick ) { doneCompletion(); return true; @@ -814,7 +814,7 @@ void EditorCompletion::doneCompletion() emit selectedCompletion( d->completionListBox->currentText() ); } -void EditorCompletion::showCompletion( const QStringList &choices ) +void EditorCompletion::showCompletion( const TQStringList &choices ) { static bool shown = false; if( !choices.count() ) return; @@ -838,14 +838,14 @@ void EditorCompletion::showCompletion( const QStringList &choices ) // size of the pop-up d->completionPopup->setMaximumHeight( 120 ); - d->completionPopup->resize( d->completionListBox->sizeHint() + - QSize( d->completionListBox->verticalScrollBar()->width() + 4, + d->completionPopup->resize( d->completionListBox->tqsizeHint() + + TQSize( d->completionListBox->verticalScrollBar()->width() + 4, d->completionListBox->horizontalScrollBar()->height() + 4 ) ); if(!shown) { d->completionPopup->show(); - QTimer::singleShot ( 0, this, SLOT(moveCompletionPopup()) ); + TQTimer::singleShot ( 0, this, TQT_SLOT(moveCompletionPopup()) ); } else { @@ -860,14 +860,14 @@ void EditorCompletion::moveCompletionPopup() int w = d->completionListBox->width(); // position, reference is editor's cursor position in global coord - QFontMetrics fm( d->editor->font() ); + TQFontMetrics fm( d->editor->font() ); int para = 0, curPos = 0; d->editor->getCursorPosition( ¶, &curPos ); int pixelsOffset = fm.width( d->editor->text(), curPos ); pixelsOffset -= d->editor->contentsX(); - QPoint pos = d->editor->mapToGlobal( QPoint( pixelsOffset, d->editor->height() ) ); + TQPoint pos = d->editor->mapToGlobal( TQPoint( pixelsOffset, d->editor->height() ) ); // if popup is partially invisible, move to other position NETRootInfo info(d->completionPopup->x11Display(), @@ -876,7 +876,7 @@ void EditorCompletion::moveCompletionPopup() info.activate(); // wtf is this needed for? NETRect NETarea = info.workArea(info.currentDesktop()); - QRect area(NETarea.pos.x, NETarea.pos.y, NETarea.size.width, NETarea.size.height); + TQRect area(NETarea.pos.x, NETarea.pos.y, NETarea.size.width, NETarea.size.height); if( pos.y() + h > area.y() + area.height() ) pos.setY( pos.y() - h - d->editor->height() ); diff --git a/src/editor.h b/src/editor.h index bb81f97..30fd43e 100644 --- a/src/editor.h +++ b/src/editor.h @@ -23,20 +23,21 @@ #ifndef ABAKUS_EDITOR_H #define ABAKUS_EDITOR_H -#include -#include -#include +#include +#include +#include #include "hmath.h" -class QEvent; -class QKeyEvent; -class QWidget; +class TQEvent; +class TQKeyEvent; +class TQWidget; class Evaluator; -class Editor : public QTextEdit +class Editor : public TQTextEdit { Q_OBJECT + TQ_OBJECT public: @@ -45,14 +46,14 @@ class Editor : public QTextEdit Number, FunctionName, Variable, MatchedPar } ColorType; - Editor( QWidget* parent = 0, const char* name = 0 ); + Editor( TQWidget* tqparent = 0, const char* name = 0 ); ~Editor(); - QSize sizeHint() const; - QSize xminimumSizeHint() const; + TQSize tqsizeHint() const; + TQSize xtqminimumSizeHint() const; - QStringList history() const; - void setHistory( const QStringList& history ); + TQStringList history() const; + void setHistory( const TQStringList& history ); bool autoCompleteEnabled() const; void setAutoCompleteEnabled( bool enable ); @@ -64,22 +65,22 @@ class Editor : public QTextEdit void setSyntaxHighlight( bool enable ); bool isSyntaxHighlightEnabled() const; - void setHighlightColor( ColorType type, QColor color ); - QColor highlightColor( ColorType type ); + void setHighlightColor( ColorType type, TQColor color ); + TQColor highlightColor( ColorType type ); public slots: - void appendHistory( const QString& text ); + void appendHistory( const TQString& text ); void clearHistory(); // Stop the timer from going off. void squelchNextAutoCalc(); - void setText(const QString &txt); + void setText(const TQString &txt); protected slots: void checkAutoComplete(); void triggerAutoComplete(); - void autoComplete( const QString& item ); + void autoComplete( const TQString& item ); void checkAutoCalc(); void autoCalc(); void checkMatching(); @@ -89,9 +90,9 @@ class Editor : public QTextEdit void historyForward(); protected: - void keyPressEvent( QKeyEvent* ); - void wheelEvent( QWheelEvent* ); - QString formatNumber( const Abakus::number_t &value ) const; + void keyPressEvent( TQKeyEvent* ); + void wheelEvent( TQWheelEvent* ); + TQString formatNumber( const Abakus::number_t &value ) const; private: class Private; @@ -101,23 +102,24 @@ class Editor : public QTextEdit }; -class EditorCompletion : public QObject +class EditorCompletion : public TQObject { Q_OBJECT + TQ_OBJECT public: EditorCompletion( Editor* editor ); ~EditorCompletion(); - bool eventFilter( QObject *o, QEvent *e ); + bool eventFilter( TQObject *o, TQEvent *e ); void doneCompletion(); - void showCompletion( const QStringList &choices ); + void showCompletion( const TQStringList &choices ); protected slots: void moveCompletionPopup(); signals: - void selectedCompletion( const QString& item ); + void selectedCompletion( const TQString& item ); private: class Private; diff --git a/src/evaluator.cpp b/src/evaluator.cpp index 138e12f..68a21a6 100644 --- a/src/evaluator.cpp +++ b/src/evaluator.cpp @@ -24,11 +24,11 @@ #include "node.h" // For parser_yacc.hpp below #include "parser_yacc.hpp" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include @@ -44,15 +44,15 @@ Evaluator::~Evaluator() { } -void Evaluator::setExpression(const QString &expr) +void Evaluator::setExpression(const TQString &expr) { kdError() << k_funcinfo << " not implemented.\n"; } -QString Evaluator::expression() const +TQString Evaluator::expression() const { kdError() << k_funcinfo << " not implemented.\n"; - return QString(); + return TQString(); } void Evaluator::clear() @@ -72,7 +72,7 @@ Tokens Evaluator::tokens() const return Tokens(); } -Tokens Evaluator::scan(const QString &expr) +Tokens Evaluator::scan(const TQString &expr) { Lexer l(expr); Tokens tokens; @@ -118,7 +118,7 @@ Tokens Evaluator::scan(const QString &expr) return tokens; } -QString Evaluator::error() const +TQString Evaluator::error() const { kdError() << k_funcinfo << " not implemented.\n"; return "No Error Yet"; @@ -133,14 +133,14 @@ const Token Token::null; // helper function: return operator of given token text // e.g. "*" yields Operator::Asterisk, and so on -static Token::Op matchOperator( const QString& text ) +static Token::Op matchOperator( const TQString& text ) { Token::Op result = Token::InvalidOp; if( text.length() == 1 ) { - QChar p = text[0]; - switch( p.unicode() ) + TQChar p = text[0]; + switch( p.tqunicode() ) { case '+': result = Token::Plus; break; case '-': result = Token::Minus; break; @@ -165,7 +165,7 @@ static Token::Op matchOperator( const QString& text ) } // creates a token -Token::Token( Type type, const QString& text, int pos ) +Token::Token( Type type, const TQString& text, int pos ) { m_type = type; m_text = text; @@ -203,9 +203,9 @@ Token::Op Token::asOperator() const else return InvalidOp; } -QString Token::description() const +TQString Token::description() const { - QString desc; + TQString desc; switch (m_type ) { @@ -217,24 +217,24 @@ QString Token::description() const while( desc.length() < 10 ) desc.prepend( ' ' ); desc.prepend( " " ); - desc.prepend( QString::number( m_pos ) ); + desc.prepend( TQString::number( m_pos ) ); desc.append( " : " ).append( m_text ); return desc; } -QString Evaluator::autoFix( const QString& expr ) +TQString Evaluator::autoFix( const TQString& expr ) { int par = 0; - QString result; + TQString result; // strip off all funny characters for( unsigned c = 0; c < expr.length(); c++ ) - if( expr[c] >= QChar(32) ) + if( expr[c] >= TQChar(32) ) result.append( expr[c] ); - // automagically close all parenthesis + // automagically close all tqparenthesis Tokens tokens = Evaluator::scan( result ); for( unsigned i=0; i -#include +#include +#include #include "numerictypes.h" @@ -53,13 +53,13 @@ public: Equal // variable assignment } Op; - Token( Type type = Unknown, const QString& text = QString::null, int pos = -1 ); + Token( Type type = Unknown, const TQString& text = TQString(), int pos = -1 ); Token( const Token& ); Token& operator=( const Token& ); Type type() const { return m_type; } - QString text() const { return m_text; } + TQString text() const { return m_text; } int pos() const { return m_pos; }; bool isNumber() const { return m_type == Number; } @@ -69,21 +69,21 @@ public: Abakus::number_t asNumber() const; Op asOperator() const; - QString description() const; + TQString description() const; static const Token null; protected: Type m_type; - QString m_text; + TQString m_text; int m_pos; }; -class Tokens: public QValueVector +class Tokens: public TQValueVector { public: - Tokens(): QValueVector(), m_valid(true) {}; + Tokens(): TQValueVector(), m_valid(true) {}; bool valid() const { return m_valid; } void setValid( bool v ) { m_valid = v; } @@ -95,7 +95,7 @@ protected: class Variable { public: - QString name; + TQString name; Abakus::number_t value; }; @@ -105,20 +105,20 @@ public: Evaluator(); ~Evaluator(); - void setExpression( const QString& expr ); - QString expression() const; + void setExpression( const TQString& expr ); + TQString expression() const; void clear(); bool isValid() const; Tokens tokens() const; - static Tokens scan( const QString& expr ); + static Tokens scan( const TQString& expr ); - QString error() const; + TQString error() const; // Abakus::number_t eval(); - static QString autoFix( const QString& expr ); + static TQString autoFix( const TQString& expr ); private: Evaluator( const Evaluator& ); diff --git a/src/function.cpp b/src/function.cpp index 742bdd3..a61b8f9 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -20,9 +20,9 @@ #include -#include -#include -#include +#include +#include +#include #include @@ -35,7 +35,7 @@ class DupFinder : public NodeFunctor { public: - DupFinder(const QString &nameToFind) : + DupFinder(const TQString &nameToFind) : m_name(nameToFind), m_valid(true) { } @@ -55,7 +55,7 @@ class DupFinder : public NodeFunctor } private: - QString m_name; + TQString m_name; bool m_valid; }; @@ -70,27 +70,27 @@ FunctionManager *FunctionManager::instance() return m_manager; } -FunctionManager::FunctionManager(QObject *parent, const char *name) : - QObject(parent, name) +FunctionManager::FunctionManager(TQObject *tqparent, const char *name) : + TQObject(tqparent, name) { m_dict.setAutoDelete(true); } // Dummy return value to enable static initialization in the DECL_*() // macros. -bool FunctionManager::addFunction(const QString &name, function_t fn, const QString &desc) +bool FunctionManager::addFunction(const TQString &name, function_t fn, const TQString &desc) { Function *newFn = new Function; - QRegExp returnTrigRE("^a(cos|sin|tan)"); - QRegExp needsTrigRE("^(cos|sin|tan)"); - QString fnName(name); + TQRegExp returnTrigRE("^a(cos|sin|tan)"); + TQRegExp needsTrigRE("^(cos|sin|tan)"); + TQString fnName(name); newFn->name = name; newFn->description = desc; newFn->fn = fn; newFn->userDefined = false; - newFn->returnsTrig = fnName.contains(returnTrigRE); - newFn->needsTrig = fnName.contains(needsTrigRE); + newFn->returnsTrig = fnName.tqcontains(returnTrigRE); + newFn->needsTrig = fnName.tqcontains(needsTrigRE); m_dict.insert(name, newFn); @@ -135,24 +135,24 @@ DECLARE_FUNC1(floor, "Nearest lesser integer"); DECLARE_FUNC2(int, integer, "Integral part of number"); DECLARE_FUNC1(frac, "Fractional part of number"); -Function *FunctionManager::function(const QString &name) +Function *FunctionManager::function(const TQString &name) { return m_dict[name]; } // Returns true if the named identifier is a function, false otherwise. -bool FunctionManager::isFunction(const QString &name) +bool FunctionManager::isFunction(const TQString &name) { return function(name) != 0; } -bool FunctionManager::isFunctionUserDefined(const QString &name) +bool FunctionManager::isFunctionUserDefined(const TQString &name) { const Function *fn = function(name); return (fn != 0) && (fn->userDefined); } -bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) +bool FunctionManager::addFunction(BaseFunction *fn, const TQString &dependantVar) { // First see if this function is recursive DupFinder dupFinder(fn->name()); @@ -168,7 +168,7 @@ bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) UserFunction *newFn = new UserFunction; newFn->sequenceNumber = m_dict.count(); newFn->fn = fn; - newFn->varName = QString(dependantVar); + newFn->varName = TQString(dependantVar); // Now setup the Function data structure that holds the information // we need to access and call the function later. @@ -179,16 +179,16 @@ bool FunctionManager::addFunction(BaseFunction *fn, const QString &dependantVar) fnTabEntry->needsTrig = false; fnTabEntry->userDefined = true; - if(m_dict.find(fn->name())) + if(m_dict.tqfind(fn->name())) emit signalFunctionRemoved(fn->name()); - m_dict.replace(fn->name(), fnTabEntry); + m_dict.tqreplace(fn->name(), fnTabEntry); emit signalFunctionAdded(fn->name()); return true; } -void FunctionManager::removeFunction(const QString &name) +void FunctionManager::removeFunction(const TQString &name) { Function *fn = function(name); @@ -205,7 +205,7 @@ void FunctionManager::removeFunction(const QString &name) fn->userFn = 0; m_dict.remove(name); - QDictIterator it(m_dict); + TQDictIterator it(m_dict); for (; it.current(); ++it) { UserFunction *userFn = it.current()->userDefined ? it.current()->userFn : 0; if(userFn && userFn->sequenceNumber > savedSeqNum) @@ -214,10 +214,10 @@ void FunctionManager::removeFunction(const QString &name) } } -QStringList FunctionManager::functionList(FunctionManager::FunctionType type) +TQStringList FunctionManager::functionList(FunctionManager::FunctionType type) { - QDictIterator it(m_dict); - QStringList functions; + TQDictIterator it(m_dict); + TQStringList functions; switch(type) { case Builtin: @@ -230,8 +230,8 @@ QStringList FunctionManager::functionList(FunctionManager::FunctionType type) // We want to return the function names in the order they were // added. { - QValueVector fnTable(m_dict.count(), 0); - QValueVector sequenceNumberTable(m_dict.count(), -1); + TQValueVector fnTable(m_dict.count(), 0); + TQValueVector sequenceNumberTable(m_dict.count(), -1); // First find out what sequence numbers we have. for(; it.current(); ++it) diff --git a/src/function.h b/src/function.h index ab66637..2bf7b2d 100644 --- a/src/function.h +++ b/src/function.h @@ -21,11 +21,11 @@ #include "numerictypes.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include @@ -35,15 +35,15 @@ struct UserFunction { int sequenceNumber; BaseFunction *fn; - QString varName; + TQString varName; }; // Ugly pointer-to-member typedef ahead typedef Abakus::number_t (Abakus::number_t::*function_t)() const; struct Function { - QString name; - QString description; + TQString name; + TQString description; // A function is either builtin or user defined, this union is // used for both cases. @@ -61,33 +61,34 @@ struct Function { void setTrigMode(Abakus::TrigMode mode); Abakus::TrigMode trigMode(); -class FunctionManager : public QObject +class FunctionManager : public TQObject { Q_OBJECT + TQ_OBJECT public: - typedef QDict functionDict; + typedef TQDict functionDict; static FunctionManager *instance(); - Function *function(const QString &name); + Function *function(const TQString &name); - bool isFunction(const QString &name); - bool isFunctionUserDefined(const QString &name); + bool isFunction(const TQString &name); + bool isFunctionUserDefined(const TQString &name); - bool addFunction(BaseFunction *fn, const QString &dependantVar); - bool addFunction(const QString &name, function_t fn, const QString &desc); - void removeFunction(const QString &name); + bool addFunction(BaseFunction *fn, const TQString &dependantVar); + bool addFunction(const TQString &name, function_t fn, const TQString &desc); + void removeFunction(const TQString &name); typedef enum { Builtin, UserDefined, All } FunctionType; - QStringList functionList(FunctionType type); + TQStringList functionList(FunctionType type); signals: - void signalFunctionAdded(const QString &name); - void signalFunctionRemoved(const QString &name); + void signalFunctionAdded(const TQString &name); + void signalFunctionRemoved(const TQString &name); private: - FunctionManager(QObject *parent = 0, const char *name = "function manager"); + FunctionManager(TQObject *tqparent = 0, const char *name = "function manager"); static FunctionManager *m_manager; functionDict m_dict; @@ -102,7 +103,7 @@ Abakus::number_t parseString(const char *str); class Lexer { public: - Lexer(const QString &expr); + Lexer(const TQString &expr); ~Lexer(); bool hasNext() const; @@ -112,7 +113,7 @@ public: // Can call this after nextType to find the associated string value of the // token. - QString tokenValue() const; + TQString tokenValue() const; private: class Private; diff --git a/src/hmath.cpp b/src/hmath.cpp index 1c4dfa3..736b241 100644 --- a/src/hmath.cpp +++ b/src/hmath.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include // internal number of decimal digits #define HMATH_MAX_PREC 150 @@ -224,7 +224,7 @@ static bc_num h_div( bc_num n1, bc_num n2 ) return r; } -// find 10 raise to num +// tqfind 10 raise to num // e.g.: when num is 5, it results 100000 static bc_num h_raise10( int n ) { @@ -692,10 +692,10 @@ char* HMath::formatGeneral( const HNumber& hn, int prec ) return str; } -QString HMath::formatGenString( const HNumber &n, int prec ) +TQString HMath::formatGenString( const HNumber &n, int prec ) { char *foo = formatGeneral(n, prec); - QString s(foo); + TQString s(foo); free(foo); return s; diff --git a/src/hmath.h b/src/hmath.h index e54af35..a143f29 100644 --- a/src/hmath.h +++ b/src/hmath.h @@ -165,7 +165,7 @@ private: Private* d; }; -class QString; +class TQString; class HMath { @@ -195,7 +195,7 @@ public: */ static char* formatGeneral( const HNumber&n, int prec = -1 ); - static QString formatGenString( const HNumber &n, int prec = -1 ); + static TQString formatGenString( const HNumber &n, int prec = -1 ); /*! * Returns the constant pi. diff --git a/src/lexer.ll b/src/lexer.ll index e1b72ab..f83b142 100644 --- a/src/lexer.ll +++ b/src/lexer.ll @@ -146,7 +146,7 @@ public: /* Declared in function.h, implemented here in lexer.l since this is where * all the yy_*() functions and types are defined. */ -Lexer::Lexer(const QString &expr) : +Lexer::Lexer(const TQString &expr) : m_private(new Private) { const char *exprString = expr.latin1(); @@ -193,7 +193,7 @@ int Lexer::nextType() return m_private->lastToken; } -QString Lexer::tokenValue() const +TQString Lexer::tokenValue() const { return m_private->lastTokenData; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cd7de9f..60e77bd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -31,12 +31,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "editor.h" #include "evaluator.h" @@ -52,61 +52,61 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_insert(false) { - m_mainSplitter = new QSplitter(this); - QWidget *box = new QWidget(m_mainSplitter); - QVBoxLayout *layout = new QVBoxLayout(box); - m_layout = layout; - layout->setSpacing(6); - layout->setMargin(6); + m_mainSplitter = new TQSplitter(this); + TQWidget *box = new TQWidget(m_mainSplitter); + TQVBoxLayout *tqlayout = new TQVBoxLayout(box); + m_layout = tqlayout; + tqlayout->setSpacing(6); + tqlayout->setMargin(6); - QWidget *configBox = new QWidget(box); - layout->addWidget(configBox); + TQWidget *configBox = new TQWidget(box); + tqlayout->addWidget(configBox); - QHBoxLayout *configLayout = new QHBoxLayout(configBox); + TQHBoxLayout *configLayout = new TQHBoxLayout(configBox); - configLayout->addWidget(new QWidget(configBox)); + configLayout->addWidget(new TQWidget(configBox)); - QLabel *label = new QLabel(i18n("History: "), configBox); - label->setAlignment(AlignCenter); + TQLabel *label = new TQLabel(i18n("History: "), configBox); + label->tqsetAlignment(AlignCenter); configLayout->addWidget(label); - QButtonGroup *buttonGroup = new QButtonGroup(0); + TQButtonGroup *buttonGroup = new TQButtonGroup(0); - QWidget *buttonGroupBox = new QWidget(configBox); - QHBoxLayout *buttonGroupLayout = new QHBoxLayout(buttonGroupBox); + TQWidget *buttonGroupBox = new TQWidget(configBox); + TQHBoxLayout *buttonGroupLayout = new TQHBoxLayout(buttonGroupBox); buttonGroupLayout->addStretch(0); configLayout->addWidget(buttonGroupBox); - m_degrees = new QRadioButton(i18n("&Degrees"), buttonGroupBox); + m_degrees = new TQRadioButton(i18n("&Degrees"), buttonGroupBox); buttonGroup->insert(m_degrees); buttonGroupLayout->addWidget(m_degrees); slotDegrees(); - connect(m_degrees, SIGNAL(clicked()), SLOT(slotDegrees())); + connect(m_degrees, TQT_SIGNAL(clicked()), TQT_SLOT(slotDegrees())); - m_radians = new QRadioButton(i18n("&Radians"), buttonGroupBox); + m_radians = new TQRadioButton(i18n("&Radians"), buttonGroupBox); buttonGroup->insert(m_radians); buttonGroupLayout->addWidget(m_radians); - connect(m_radians, SIGNAL(clicked()), SLOT(slotRadians())); + connect(m_radians, TQT_SIGNAL(clicked()), TQT_SLOT(slotRadians())); - m_history = new QVBox(box); - layout->addWidget(m_history); + m_history = new TQVBox(box); + tqlayout->addWidget(m_history); m_history->setSpacing(6); m_history->setMargin(0); m_result = new ResultListView(m_history); - m_result->setSelectionMode(QListView::NoSelection); + m_result->setSelectionMode(TQListView::NoSelection); m_result->setHScrollBarMode(ResultListView::AlwaysOff); - connect(m_result, SIGNAL(signalEntrySelected(const QString &)), - SLOT(slotEntrySelected(const QString &))); - connect(m_result, SIGNAL(signalResultSelected(const QString &)), - SLOT(slotResultSelected(const QString &))); + connect(m_result, TQT_SIGNAL(signalEntrySelected(const TQString &)), + TQT_SLOT(slotEntrySelected(const TQString &))); + connect(m_result, TQT_SIGNAL(signalResultSelected(const TQString &)), + TQT_SLOT(slotResultSelected(const TQString &))); m_history->setStretchFactor(m_result, 1); - layout->setStretchFactor(m_history, 1); + tqlayout->setStretchFactor(m_history, 1); - QHBox *editBox = new QHBox(box); - layout->addWidget(editBox); + TQHBox *editBox = new TQHBox(box); + tqlayout->addWidget(editBox); editBox->setSpacing(6); m_edit = new Editor(editBox); @@ -115,12 +115,12 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in KPushButton *evalButton = new KPushButton(i18n("&Evaluate"), editBox); - connect(evalButton, SIGNAL(clicked()), SLOT(slotEvaluate())); + connect(evalButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotEvaluate())); - connect(m_edit, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); - connect(m_edit, SIGNAL(textChanged()), SLOT(slotTextChanged())); + connect(m_edit, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed())); + connect(m_edit, TQT_SIGNAL(textChanged()), TQT_SLOT(slotTextChanged())); - m_listSplitter = new QSplitter(Vertical, m_mainSplitter); + m_listSplitter = new TQSplitter(Qt::Vertical, m_mainSplitter); m_fnList = new FunctionListView(m_listSplitter); m_fnList->addColumn("Functions"); m_fnList->addColumn("Value"); @@ -129,24 +129,24 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in m_varList->addColumn("Variables"); m_varList->addColumn("Value"); - connect(FunctionManager::instance(), SIGNAL(signalFunctionAdded(const QString &)), - this, SLOT(slotNewFunction(const QString &))); - connect(FunctionManager::instance(), SIGNAL(signalFunctionRemoved(const QString &)), - this, SLOT(slotRemoveFunction(const QString &))); + connect(FunctionManager::instance(), TQT_SIGNAL(signalFunctionAdded(const TQString &)), + this, TQT_SLOT(slotNewFunction(const TQString &))); + connect(FunctionManager::instance(), TQT_SIGNAL(signalFunctionRemoved(const TQString &)), + this, TQT_SLOT(slotRemoveFunction(const TQString &))); - connect(ValueManager::instance(), SIGNAL(signalValueAdded(const QString &, Abakus::number_t)), - this, SLOT(slotNewValue(const QString &, Abakus::number_t))); - connect(ValueManager::instance(), SIGNAL(signalValueChanged(const QString &, Abakus::number_t)), - this, SLOT(slotChangeValue(const QString &, Abakus::number_t))); - connect(ValueManager::instance(), SIGNAL(signalValueRemoved(const QString &)), - this, SLOT(slotRemoveValue(const QString &))); + connect(ValueManager::instance(), TQT_SIGNAL(signalValueAdded(const TQString &, Abakus::number_t)), + this, TQT_SLOT(slotNewValue(const TQString &, Abakus::number_t))); + connect(ValueManager::instance(), TQT_SIGNAL(signalValueChanged(const TQString &, Abakus::number_t)), + this, TQT_SLOT(slotChangeValue(const TQString &, Abakus::number_t))); + connect(ValueManager::instance(), TQT_SIGNAL(signalValueRemoved(const TQString &)), + this, TQT_SLOT(slotRemoveValue(const TQString &))); setupLayout(); setCentralWidget(m_mainSplitter); #if KDE_IS_VERSION(3,4,89) - setupGUI(QSize(450, 400), Keys | StatusBar | Save | Create); + setupGUI(TQSize(450, 400), Keys | StatusBar | Save | Create); #else setupGUI(Keys | StatusBar | Save | Create); #endif @@ -159,7 +159,7 @@ bool MainWindow::inRPNMode() const return action("toggleExpressionMode")->isChecked(); } -bool MainWindow::eventFilter(QObject *o, QEvent *e) +bool MainWindow::eventFilter(TQObject *o, TQEvent *e) { return KMainWindow::eventFilter(o, e); } @@ -170,7 +170,7 @@ bool MainWindow::queryExit() return KMainWindow::queryExit(); } -void MainWindow::contextMenuEvent(QContextMenuEvent *e) +void MainWindow::contextMenuEvent(TQContextMenuEvent *e) { static KPopupMenu *popup = 0; @@ -191,9 +191,9 @@ void MainWindow::polish() void MainWindow::slotReturnPressed() { - QString text = m_edit->text(); + TQString text = m_edit->text(); - text.replace("\n", ""); + text.tqreplace("\n", ""); m_edit->appendHistory(text); @@ -201,9 +201,9 @@ void MainWindow::slotReturnPressed() ResultListViewText *after = m_result->lastItem(); // Expand $foo references. - QString str = interpolateExpression(text, after); + TQString str = interpolateExpression(text, after); - QString resultVal; + TQString resultVal; ResultListViewText *item; if(str.isNull()) @@ -222,13 +222,13 @@ void MainWindow::slotReturnPressed() } else { m_insert = false; - resultVal = i18n("Error: %1").arg(RPNParser::errorString()); + resultVal = i18n("Error: %1").tqarg(RPNParser::errorString()); } // Skip creating list view items if in compact mode. if(!m_history->isShown()) { m_edit->setText(resultVal); - QTimer::singleShot(0, m_edit, SLOT(selectAll())); + TQTimer::singleShot(0, m_edit, TQT_SLOT(selectAll())); return; } @@ -241,7 +241,7 @@ void MainWindow::slotReturnPressed() if(FunctionManager::instance()->isFunction(str)) str += " ans"; - // Add right parentheses as needed to balance out the expression. + // Add right tqparentheses as needed to balance out the expression. int parenLevel = getParenthesesLevel(str); for(int i = 0; i < parenLevel; ++i) str += ')'; @@ -276,7 +276,7 @@ void MainWindow::slotReturnPressed() // Skip creating list view items if in compact mode. if(compact) { m_edit->setText(resultVal); - QTimer::singleShot(0, m_edit, SLOT(selectAll())); + TQTimer::singleShot(0, m_edit, TQT_SLOT(selectAll())); return; } @@ -287,12 +287,12 @@ void MainWindow::slotReturnPressed() m_result->setCurrentItem(item); m_result->ensureItemVisible(item); - QTimer::singleShot(0, m_edit, SLOT(selectAll())); + TQTimer::singleShot(0, m_edit, TQT_SLOT(selectAll())); } void MainWindow::slotTextChanged() { - QString str = m_edit->text(); + TQString str = m_edit->text(); if(str.length() == 1 && m_insert) { m_insert = false; @@ -301,9 +301,9 @@ void MainWindow::slotTextChanged() if(inRPNMode()) return; - if(str.find(QRegExp("^[-+*/^]")) != -1) { + if(str.tqfind(TQRegExp("^[-+*/^]")) != -1) { m_edit->setText("ans " + str + " "); - m_edit->moveCursor(QTextEdit::MoveEnd, false); + m_edit->moveCursor(TQTextEdit::MoveEnd, false); } } } @@ -315,10 +315,10 @@ void MainWindow::slotEvaluate() void MainWindow::slotUpdateSize() { - if(m_newSize != QSize(0, 0)) + if(m_newSize != TQSize(0, 0)) resize(m_newSize); else - resize(width(), minimumSize().height()); + resize(width(), tqminimumSize().height()); } void MainWindow::slotDegrees() @@ -337,7 +337,7 @@ void MainWindow::slotRadians() action("setRadiansMode")->setChecked(true); } -int MainWindow::getParenthesesLevel(const QString &str) +int MainWindow::getParenthesesLevel(const TQString &str) { int level = 0; @@ -355,7 +355,7 @@ void MainWindow::loadConfig() { KConfigGroup config(KGlobal::config(), "Settings"); - QString mode = config.readEntry("Trigonometric mode", "Degrees"); + TQString mode = config.readEntry("Trigonometric mode", "Degrees"); if(mode == "Degrees") { setTrigMode(Abakus::Degrees); m_degrees->setChecked(true); @@ -379,9 +379,9 @@ void MainWindow::loadConfig() { KConfigGroup config(KGlobal::config(), "Variables"); - QStringList list = config.readListEntry("Saved Variables"); - for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { - QStringList values = QStringList::split('=', *it); + TQStringList list = config.readListEntry("Saved Variables"); + for(TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { + TQStringList values = TQStringList::split('=', *it); if(values.count() != 2) { kdWarning() << "Your configuration file has somehow been corrupted!\n"; continue; @@ -411,14 +411,14 @@ void MainWindow::loadConfig() action("toggleCompactMode")->setChecked(compactMode); if(compactMode) - QTimer::singleShot(0, this, SLOT(slotToggleCompactMode())); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode())); } { KConfigGroup config(KGlobal::config(), "Functions"); - QStringList fnList = config.readListEntry("FunctionList"); - for(QStringList::ConstIterator it = fnList.begin(); it != fnList.end(); ++it) + TQStringList fnList = config.readListEntry("FunctionList"); + for(TQStringList::ConstIterator it = fnList.begin(); it != fnList.end(); ++it) parseString(*it); // Run the function definitions through the parser } @@ -442,9 +442,9 @@ void MainWindow::saveConfig() { KConfigGroup config(KGlobal::config(), "Variables"); - QStringList list; - QStringList values = ValueManager::instance()->valueNames(); - QStringList::ConstIterator it = values.begin(); + TQStringList list; + TQStringList values = ValueManager::instance()->valueNames(); + TQStringList::ConstIterator it = values.begin(); // Set precision to max for most accuracy Abakus::m_prec = 75; @@ -453,9 +453,9 @@ void MainWindow::saveConfig() if(ValueManager::instance()->isValueReadOnly(*it)) continue; - list += QString("%1=%2") - .arg(*it) - .arg(ValueManager::instance()->value(*it).toString()); + list += TQString("%1=%2") + .tqarg(*it) + .tqarg(ValueManager::instance()->value(*it).toString()); } config.writeEntry("Saved Variables", list); @@ -484,15 +484,15 @@ void MainWindow::saveConfig() FunctionManager *manager = FunctionManager::instance(); - QStringList userFunctions = manager->functionList(FunctionManager::UserDefined); - QStringList saveList; + TQStringList userFunctions = manager->functionList(FunctionManager::UserDefined); + TQStringList saveList; - for(QStringList::ConstIterator it = userFunctions.begin(); it != userFunctions.end(); ++it) { + for(TQStringList::ConstIterator it = userFunctions.begin(); it != userFunctions.end(); ++it) { UnaryFunction *fn = dynamic_cast(manager->function(*it)->userFn->fn); - QString var = manager->function(*it)->userFn->varName; - QString expr = fn->operand()->infixString(); + TQString var = manager->function(*it)->userFn->varName; + TQString expr = fn->operand()->infixString(); - saveList += QString("set %1(%2) = %3").arg(*it).arg(var).arg(expr); + saveList += TQString("set %1(%2) = %3").tqarg(*it).tqarg(var).tqarg(expr); } config.writeEntry("FunctionList", saveList); @@ -503,65 +503,65 @@ void MainWindow::setupLayout() { KActionCollection *ac = actionCollection(); - KStdAction::quit(kapp, SLOT(quit()), ac); - KStdAction::showMenubar(this, SLOT(slotToggleMenuBar()), ac); + KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), ac); + KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(slotToggleMenuBar()), ac); - KToggleAction *ta = new KToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, this, SLOT(slotDegrees()), ac, "setDegreesMode"); + KToggleAction *ta = new KToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, TQT_TQOBJECT(this), TQT_SLOT(slotDegrees()), ac, "setDegreesMode"); ta->setExclusiveGroup("TrigMode"); ta->setChecked(trigMode() == Abakus::Degrees); - ta = new KToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, this, SLOT(slotRadians()), ac, "setRadiansMode"); + ta = new KToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, TQT_TQOBJECT(this), TQT_SLOT(slotRadians()), ac, "setRadiansMode"); ta->setExclusiveGroup("TrigMode"); ta->setChecked(trigMode() == Abakus::Radians); - ta = new KToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, this, SLOT(slotToggleHistoryList()), ac, "toggleHistoryList"); + ta = new KToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, TQT_TQOBJECT(this), TQT_SLOT(slotToggleHistoryList()), ac, "toggleHistoryList"); ta->setChecked(true); - ta = new KToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, this, SLOT(slotToggleVariableList()), ac, "toggleVariableList"); + ta = new KToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, TQT_TQOBJECT(this), TQT_SLOT(slotToggleVariableList()), ac, "toggleVariableList"); ta->setChecked(true); - ta = new KToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, this, SLOT(slotToggleFunctionList()), ac, "toggleFunctionList"); + ta = new KToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFunctionList()), ac, "toggleFunctionList"); ta->setChecked(true); - ta = new KToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, this, SLOT(slotToggleCompactMode()), ac, "toggleCompactMode"); + ta = new KToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()), ac, "toggleCompactMode"); ta->setChecked(false); - ta = new KToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, this, SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode"); + ta = new KToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode"); ta->setChecked(false); // Precision actions. - ta = new KToggleAction(i18n("&Automatic Precision"), 0, this, SLOT(slotPrecisionAuto()), ac, "precisionAuto"); + ta = new KToggleAction(i18n("&Automatic Precision"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionAuto()), ac, "precisionAuto"); ta->setExclusiveGroup("Precision"); ta->setChecked(true); - ta = new KToggleAction(i18n("&3 Decimal Digits"), 0, this, SLOT(slotPrecision3()), ac, "precision3"); + ta = new KToggleAction(i18n("&3 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision3()), ac, "precision3"); ta->setExclusiveGroup("Precision"); ta->setChecked(false); - ta = new KToggleAction(i18n("&8 Decimal Digits"), 0, this, SLOT(slotPrecision8()), ac, "precision8"); + ta = new KToggleAction(i18n("&8 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision8()), ac, "precision8"); ta->setExclusiveGroup("Precision"); ta->setChecked(false); - ta = new KToggleAction(i18n("&15 Decimal Digits"), 0, this, SLOT(slotPrecision15()), ac, "precision15"); + ta = new KToggleAction(i18n("&15 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision15()), ac, "precision15"); ta->setExclusiveGroup("Precision"); ta->setChecked(false); - ta = new KToggleAction(i18n("&50 Decimal Digits"), 0, this, SLOT(slotPrecision50()), ac, "precision50"); + ta = new KToggleAction(i18n("&50 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision50()), ac, "precision50"); ta->setExclusiveGroup("Precision"); ta->setChecked(false); - ta = new KToggleAction(i18n("C&ustom Precision..."), 0, this, SLOT(slotPrecisionCustom()), ac, "precisionCustom"); + ta = new KToggleAction(i18n("C&ustom Precision..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionCustom()), ac, "precisionCustom"); ta->setExclusiveGroup("Precision"); ta->setChecked(false); - new KAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, m_result, SLOT(clear()), ac, "clearHistory"); + new KAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, TQT_TQOBJECT(m_result), TQT_SLOT(clear()), ac, "clearHistory"); - new KAction(i18n("Select Editor"), "goto", Key_F6, m_edit, SLOT(setFocus()), ac, "select_edit"); + new KAction(i18n("Select Editor"), "goto", Key_F6, TQT_TQOBJECT(m_edit), TQT_SLOT(setFocus()), ac, "select_edit"); } void MainWindow::populateListViews() { - QStringList values = ValueManager::instance()->valueNames(); + TQStringList values = ValueManager::instance()->valueNames(); Abakus::number_t value = ValueManager::instance()->value("pi"); new ValueListViewItem(m_varList, "pi", value); @@ -575,13 +575,13 @@ KAction *MainWindow::action(const char *key) const return actionCollection()->action(key); } -void MainWindow::slotEntrySelected(const QString &text) +void MainWindow::slotEntrySelected(const TQString &text) { m_edit->setText(text); - m_edit->moveCursor(QTextEdit::MoveEnd, false); + m_edit->moveCursor(TQTextEdit::MoveEnd, false); } -void MainWindow::slotResultSelected(const QString &text) +void MainWindow::slotResultSelected(const TQString &text) { m_edit->insert(text); } @@ -627,42 +627,42 @@ void MainWindow::slotToggleHistoryList() action("toggleCompactMode")->setChecked(false); } -void MainWindow::slotNewFunction(const QString &name) +void MainWindow::slotNewFunction(const TQString &name) { UserFunction *userFn = FunctionManager::instance()->function(name)->userFn; UnaryFunction *fn = dynamic_cast(userFn->fn); - QString fnName = QString("%1(%2)").arg(name, userFn->varName); - QString expr = fn->operand()->infixString(); + TQString fnName = TQString("%1(%2)").tqarg(name, userFn->varName); + TQString expr = fn->operand()->infixString(); new KListViewItem(m_fnList, fnName, expr); } -void MainWindow::slotRemoveFunction(const QString &name) +void MainWindow::slotRemoveFunction(const TQString &name) { UserFunction *userFn = FunctionManager::instance()->function(name)->userFn; - QString fnName = QString("%1(%2)").arg(name, userFn->varName); + TQString fnName = TQString("%1(%2)").tqarg(name, userFn->varName); - QListViewItem *item = 0; - while((item = m_fnList->findItem(fnName, 0)) != 0) + TQListViewItem *item = 0; + while((item = m_fnList->tqfindItem(fnName, 0)) != 0) delete item; } -void MainWindow::slotNewValue(const QString &name, Abakus::number_t value) +void MainWindow::slotNewValue(const TQString &name, Abakus::number_t value) { new ValueListViewItem(m_varList, name, value); } -void MainWindow::slotChangeValue(const QString &name, Abakus::number_t value) +void MainWindow::slotChangeValue(const TQString &name, Abakus::number_t value) { - ValueListViewItem *item = static_cast(m_varList->findItem(name, 0)); + ValueListViewItem *item = static_cast(m_varList->tqfindItem(name, 0)); if(item) item->valueChanged(value); } -void MainWindow::slotRemoveValue(const QString &name) +void MainWindow::slotRemoveValue(const TQString &name) { - delete m_varList->findItem(name, 0); + delete m_varList->tqfindItem(name, 0); } void MainWindow::slotToggleCompactMode() @@ -681,8 +681,8 @@ void MainWindow::slotToggleCompactMode() action("toggleHistoryList")->setChecked(false); m_oldSize = size(); - m_newSize = QSize(0, 0); - QTimer::singleShot(0, this, SLOT(slotUpdateSize())); + m_newSize = TQSize(0, 0); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotUpdateSize())); } else { m_fnList->setShown(m_wasFnShown); @@ -694,7 +694,7 @@ void MainWindow::slotToggleCompactMode() action("toggleHistoryList")->setChecked(m_wasHistoryShown); m_newSize = m_oldSize; - QTimer::singleShot(0, this, SLOT(slotUpdateSize())); + TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotUpdateSize())); } } @@ -702,23 +702,23 @@ void MainWindow::slotToggleExpressionMode() { } -QString MainWindow::interpolateExpression(const QString &text, ResultListViewText *after) +TQString MainWindow::interpolateExpression(const TQString &text, ResultListViewText *after) { - QString str(text); - QRegExp stackRE("\\$\\d+"); + TQString str(text); + TQRegExp stackRE("\\$\\d+"); int pos; while((pos = stackRE.search(str)) != -1) { - QString stackStr = stackRE.cap(); + TQString stackStr = stackRE.cap(); Abakus::number_t value; unsigned numPos = stackStr.mid(1).toUInt(); if(!m_result->getStackValue(numPos, value)) { - new ResultListViewText(m_result, text, i18n("Marker %1 isn't set").arg(stackStr), after, true); - return QString::null; + new ResultListViewText(m_result, text, i18n("Marker %1 isn't set").tqarg(stackStr), after, true); + return TQString(); } - str.replace(pos, stackStr.length(), value.toString()); + str.tqreplace(pos, stackStr.length(), value.toString()); } return str; @@ -770,14 +770,14 @@ void MainWindow::slotPrecisionCustom() void MainWindow::redrawResults() { - QListViewItemIterator it(m_result); + TQListViewItemIterator it(m_result); while(it.current()) { static_cast(it.current())->precisionChanged(); ++it; } - it = QListViewItemIterator (m_varList); + it = TQListViewItemIterator (m_varList); while(it.current()) { static_cast(it.current())->valueChanged(); diff --git a/src/mainwindow.h b/src/mainwindow.h index bd6fecb..5ff9c95 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -23,14 +23,14 @@ #include "numerictypes.h" -class QPoint; -class QVBox; -class QCheckBox; -class QRadioButton; -class QBoxLayout; -class QListViewItem; -class QSplitter; -class QTimer; +class TQPoint; +class TQVBox; +class TQCheckBox; +class TQRadioButton; +class TQBoxLayout; +class TQListViewItem; +class TQSplitter; +class TQTimer; //class KComboBox; class Editor; @@ -42,18 +42,19 @@ class ResultListViewText; class AbakusIface; -// Main window class, handles events and layout and stuff +// Main window class, handles events and tqlayout and stuff class MainWindow : public KMainWindow { Q_OBJECT + TQ_OBJECT public: MainWindow(); bool inRPNMode() const; protected: - virtual void contextMenuEvent(QContextMenuEvent *e); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual void contextMenuEvent(TQContextMenuEvent *e); + virtual bool eventFilter(TQObject *o, TQEvent *e); virtual bool queryExit(); virtual void polish(); @@ -74,8 +75,8 @@ class MainWindow : public KMainWindow void slotDegrees(); void slotRadians(); - void slotEntrySelected(const QString &text); - void slotResultSelected(const QString &text); + void slotEntrySelected(const TQString &text); + void slotResultSelected(const TQString &text); void slotToggleMenuBar(); void slotToggleFunctionList(); @@ -84,15 +85,15 @@ class MainWindow : public KMainWindow void slotToggleCompactMode(); void slotToggleExpressionMode(); - void slotNewValue(const QString &name, Abakus::number_t value); - void slotChangeValue(const QString &name, Abakus::number_t value); - void slotRemoveValue(const QString &name); + void slotNewValue(const TQString &name, Abakus::number_t value); + void slotChangeValue(const TQString &name, Abakus::number_t value); + void slotRemoveValue(const TQString &name); - void slotNewFunction(const QString &name); - void slotRemoveFunction(const QString &name); + void slotNewFunction(const TQString &name); + void slotRemoveFunction(const TQString &name); private: - int getParenthesesLevel(const QString &str); + int getParenthesesLevel(const TQString &str); void redrawResults(); void selectCorrectPrecisionAction(); @@ -101,7 +102,7 @@ class MainWindow : public KMainWindow void saveConfig(); void setupLayout(); void populateListViews(); - QString interpolateExpression(const QString &text, ResultListViewText *after); + TQString interpolateExpression(const TQString &text, ResultListViewText *after); // Donated via JuK KAction *action(const char *key) const; @@ -112,17 +113,17 @@ class MainWindow : public KMainWindow } private: - QVBox *m_history; - QRadioButton *m_degrees; - QRadioButton *m_radians; + TQVBox *m_history; + TQRadioButton *m_degrees; + TQRadioButton *m_radians; Editor *m_edit; KPopupMenu *m_popup; ResultListView *m_result; - QString m_lastError; - QBoxLayout *m_layout; + TQString m_lastError; + TQBoxLayout *m_layout; KListView *m_fnList, *m_varList; - QSplitter *m_mainSplitter, *m_listSplitter; - QSize m_newSize, m_oldSize; + TQSplitter *m_mainSplitter, *m_listSplitter; + TQSize m_newSize, m_oldSize; AbakusIface *m_dcopInterface; diff --git a/src/node.cpp b/src/node.cpp index 0686f1d..556bde3 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -62,9 +62,9 @@ void UnaryFunction::applyMap(NodeFunctor &fn) const fn(this); } -QString UnaryFunction::infixString() const +TQString UnaryFunction::infixString() const { - return QString("%1(%2)").arg(name(), operand()->infixString()); + return TQString("%1(%2)").tqarg(name(), operand()->infixString()); } BuiltinFunction::BuiltinFunction(const char *name, Node *operand) : @@ -208,9 +208,9 @@ void DerivativeFunction::applyMap(NodeFunctor &fn) const fn(this); } -QString DerivativeFunction::infixString() const +TQString DerivativeFunction::infixString() const { - return QString("deriv(%1, %2)").arg(m_operand->infixString(), m_where->infixString()); + return TQString("deriv(%1, %2)").tqarg(m_operand->infixString(), m_where->infixString()); } UnaryOperator::UnaryOperator(Type type, Node *operand) @@ -230,12 +230,12 @@ void UnaryOperator::applyMap(NodeFunctor &fn) const fn(this); } -QString UnaryOperator::infixString() const +TQString UnaryOperator::infixString() const { if(dynamic_cast(operand())) - return QString("-(%1)").arg(operand()->infixString()); + return TQString("-(%1)").tqarg(operand()->infixString()); - return QString("-%1").arg(operand()->infixString()); + return TQString("-%1").tqarg(operand()->infixString()); } Abakus::number_t UnaryOperator::derivative() const @@ -283,9 +283,9 @@ void BinaryOperator::applyMap(NodeFunctor &fn) const fn(this); } -QString BinaryOperator::infixString() const +TQString BinaryOperator::infixString() const { - QString op; + TQString op; switch(type()) { case Addition: @@ -312,10 +312,10 @@ QString BinaryOperator::infixString() const op = "Error"; } - QString left = QString(isSimpleNode(leftNode()) ? "%1" : "(%1)").arg(leftNode()->infixString()); - QString right = QString(isSimpleNode(rightNode()) ? "%1" : "(%1)").arg(rightNode()->infixString()); + TQString left = TQString(isSimpleNode(leftNode()) ? "%1" : "(%1)").tqarg(leftNode()->infixString()); + TQString right = TQString(isSimpleNode(rightNode()) ? "%1" : "(%1)").tqarg(rightNode()->infixString()); - return QString("%1 %2 %3").arg(left, op, right); + return TQString("%1 %2 %3").tqarg(left, op, right); } Abakus::number_t BinaryOperator::derivative() const @@ -411,7 +411,7 @@ void Identifier::applyMap(NodeFunctor &fn) const fn(this); } -QString NumericValue::infixString() const +TQString NumericValue::infixString() const { return value().toString(); } diff --git a/src/node.h b/src/node.h index b3c6011..b62e9c0 100644 --- a/src/node.h +++ b/src/node.h @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include "numerictypes.h" @@ -31,7 +31,7 @@ typedef SharedPtr NodePtr; /** * A class that operates on a Node. Called recursively on a node and all - * of its children. + * of its tqchildren. */ class NodeFunctor { @@ -50,11 +50,11 @@ class Node // typically read-only. virtual void deleteNode(Node *node); - // Calls functor() on all subchildren and this. + // Calls functor() on all subtqchildren and this. virtual void applyMap(NodeFunctor &fn) const = 0; // Returns an infix representation of the expression. - virtual QString infixString() const = 0; + virtual TQString infixString() const = 0; // Returns the derivative of the node. virtual Abakus::number_t derivative() const = 0; @@ -65,11 +65,11 @@ class BaseFunction : public Node public: BaseFunction(const char *name); - virtual QString name() const { return m_name; } + virtual TQString name() const { return m_name; } virtual const Function *function() const; private: - QString m_name; + TQString m_name; const Function *m_function; }; @@ -83,7 +83,7 @@ class UnaryFunction : public BaseFunction virtual void setOperand(Node *operand); virtual void applyMap(NodeFunctor &fn) const; - virtual QString infixString() const; + virtual TQString infixString() const; private: Node *m_node; @@ -102,7 +102,7 @@ class DerivativeFunction : public Node virtual void applyMap(NodeFunctor &fn) const; // Returns an infix representation of the expression. - virtual QString infixString() const; + virtual TQString infixString() const; virtual Abakus::number_t derivative() const; @@ -138,7 +138,7 @@ class UnaryOperator : public Node virtual ~UnaryOperator(); virtual void applyMap(NodeFunctor &fn) const; - virtual QString infixString() const; + virtual TQString infixString() const; virtual Abakus::number_t value() const; virtual Abakus::number_t derivative() const; @@ -160,7 +160,7 @@ class BinaryOperator : public Node virtual ~BinaryOperator(); virtual void applyMap(NodeFunctor &fn) const; - virtual QString infixString() const; + virtual TQString infixString() const; virtual Abakus::number_t value() const; virtual Abakus::number_t derivative() const; @@ -182,7 +182,7 @@ class Identifier : public Node Identifier(const char *name); virtual void applyMap(NodeFunctor &fn) const; - virtual QString infixString() const { return name(); } + virtual TQString infixString() const { return name(); } virtual Abakus::number_t value() const; virtual Abakus::number_t derivative() const @@ -193,10 +193,10 @@ class Identifier : public Node return "0"; } - virtual QString name() const { return m_name; } + virtual TQString name() const { return m_name; } private: - QString m_name; + TQString m_name; }; class NumericValue : public Node @@ -205,7 +205,7 @@ class NumericValue : public Node NumericValue(const Abakus::number_t value) : m_value(value) { } virtual void applyMap(NodeFunctor &fn) const { fn(this); } - virtual QString infixString() const; + virtual TQString infixString() const; virtual Abakus::number_t value() const { return m_value; } virtual Abakus::number_t derivative() const { return "0"; } diff --git a/src/number.c b/src/number.c index 07aea62..72370fb 100644 --- a/src/number.c +++ b/src/number.c @@ -938,7 +938,7 @@ _one_mult (num, size, digit, result) /* The full division routine. This computes N1 / N2. It returns - 0 if the division is ok and the result is in QUOT. The number of + 0 if the division is ok and the result is in TQUOT. The number of digits after the decimal point is SCALE. It returns -1 if division by zero is tried. The algorithm is found in Knuth Vol 2. p237. */ @@ -1134,7 +1134,7 @@ bc_divide (n1, n2, quot, scale) /* Division *and* modulo for numbers. This computes both NUM1 / NUM2 and - NUM1 % NUM2 and puts the results in QUOT and REM, except that if QUOT + NUM1 % NUM2 and puts the results in TQUOT and REM, except that if TQUOT is NULL then that store will be omitted. */ diff --git a/src/numerictypes.cpp b/src/numerictypes.cpp index 8b32c9f..c75268e 100644 --- a/src/numerictypes.cpp +++ b/src/numerictypes.cpp @@ -32,13 +32,13 @@ int Abakus::m_prec = -1; namespace Abakus { -QString convertToString(const mpfr_ptr &number) +TQString convertToString(const mpfr_ptr &number) { char *str = 0; - QRegExp zeroKiller ("0*$"); + TQRegExp zeroKiller ("0*$"); mp_exp_t exp; int desiredPrecision = Abakus::m_prec; - QString decimalSymbol = KGlobal::locale()->decimalSymbol(); + TQString decimalSymbol = KGlobal::locale()->decimalSymbol(); if(desiredPrecision < 0) desiredPrecision = 8; @@ -54,10 +54,10 @@ QString convertToString(const mpfr_ptr &number) if(exp < -2 || exp > desiredPrecision) { // Use exponential notation. - QString numbers (str); + TQString numbers (str); mpfr_free_str(str); - QString sign, l, r; + TQString sign, l, r; if(numbers[0] == '-') { sign = "-"; @@ -72,13 +72,13 @@ QString convertToString(const mpfr_ptr &number) // Remove trailing zeroes. if(Abakus::m_prec < 0) - r.replace(zeroKiller, ""); + r.tqreplace(zeroKiller, ""); // But don't display numbers like 2.e10 either. if(r.isEmpty()) r = "0"; - r.append(QString("e%1").arg(exp - 1)); + r.append(TQString("e%1").tqarg(exp - 1)); return sign + l + decimalSymbol + r; } @@ -91,12 +91,12 @@ QString convertToString(const mpfr_ptr &number) str = mpfr_get_str (0, &exp, 10, exp + desiredPrecision, number, GMP_RNDN); } - QString result = str; + TQString result = str; mpfr_free_str(str); str = 0; int position = exp; - QString l, r, sign; + TQString l, r, sign; if(position < 0) { // Number < 0.1 l.fill('0', -position); @@ -124,7 +124,7 @@ QString convertToString(const mpfr_ptr &number) } // Remove trailing zeroes. - r.replace(zeroKiller, ""); + r.tqreplace(zeroKiller, ""); // Don't display numbers of the form .23 if(l.isEmpty()) @@ -172,25 +172,25 @@ const Abakus::number_t::value_type Abakus::number_t::E = setupExponential(); namespace Abakus { -QString convertToString(const HNumber &num) +TQString convertToString(const HNumber &num) { - QString str = HMath::formatGenString(num, m_prec); - QString decimalSymbol = KGlobal::locale()->decimalSymbol(); - str.replace('.', decimalSymbol); + TQString str = HMath::formatGenString(num, m_prec); + TQString decimalSymbol = KGlobal::locale()->decimalSymbol(); + str.tqreplace('.', decimalSymbol); - QStringList parts = QStringList::split("e", str); - QRegExp zeroKiller("(" + QRegExp::escape(decimalSymbol) + + TQStringList parts = TQStringList::split("e", str); + TQRegExp zeroKiller("(" + TQRegExp::escape(decimalSymbol) + "\\d*[1-9])0*$"); // Remove trailing zeroes. - QRegExp zeroKiller2("(" + QRegExp::escape(decimalSymbol) + ")0*$"); + TQRegExp zeroKiller2("(" + TQRegExp::escape(decimalSymbol) + ")0*$"); str = parts[0]; - str.replace(zeroKiller, "\\1"); - str.replace(zeroKiller2, "\\1"); + str.tqreplace(zeroKiller, "\\1"); + str.tqreplace(zeroKiller2, "\\1"); if(str.endsWith(decimalSymbol)) str.truncate(str.length() - 1); // Remove trailing period. if(parts.count() > 1 && parts[1] != "0") - str += QString("e%1").arg(parts[1]); + str += TQString("e%1").tqarg(parts[1]); return str; } diff --git a/src/numerictypes.h b/src/numerictypes.h index 12880a2..7277aea 100644 --- a/src/numerictypes.h +++ b/src/numerictypes.h @@ -22,9 +22,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "hmath.h" #include "config.h" @@ -158,7 +158,7 @@ public: /// @return Textual representation of the number, adjusted to the user's /// current precision. - QString toString() const; + TQString toString() const; /// @return Our value. T value() const; @@ -209,7 +209,7 @@ inline number operator/(const number &l, const number &r) * @return The number converted to a string, in US Decimal format at this time. * @see number<>::toString() */ -QString convertToString(const mpfr_ptr &number); +TQString convertToString(const mpfr_ptr &number); /** * This is a specialization of the number<> template for the MPFR numeric type. @@ -443,7 +443,7 @@ public: // Note that this can be used dangerously, be careful. value_type value() const { return m_t; } - QString toString() const + TQString toString() const { // Move this to .cpp to avoid recompiling as I fix it. return convertToString(m_t); @@ -507,7 +507,7 @@ inline number operator/(const number &l, const numbername())); + TQString s(i18n("You can't assign to function %1").tqarg($1->name())); Result::setLastResult(s); YYABORT; @@ -116,14 +116,14 @@ ASSIGN: '(' { --gCheckIdents; } IDENT ')' '=' { // since normally functions and variables with the same name can coexist, but // I don't want to duplicate code all over the place. S: SET DERIV { - QString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv")); + TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv")); Result::setLastResult(s); YYABORT; } S: DERIV '=' { - QString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv")); + TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv")); Result::setLastResult(s); YYABORT; @@ -134,12 +134,12 @@ S: SET FUNC ASSIGN EXP { // We're trying to reassign an already defined function, make sure it's // not a built-in. - QString funcName = $2->name(); - QString ident = $3->name(); + TQString funcName = $2->name(); + TQString ident = $3->name(); FunctionManager *manager = FunctionManager::instance(); if(manager->isFunction(funcName) && !manager->isFunctionUserDefined(funcName)) { - QString s(i18n("Function %1 is built-in and cannot be overridden.").arg(funcName)); + TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg(funcName)); Result::setLastResult(s); YYABORT; @@ -150,7 +150,7 @@ S: SET FUNC ASSIGN EXP { BaseFunction *newFn = new UserDefinedFunction(funcName, $4); if(!manager->addFunction(newFn, ident)) { - QString s(i18n("Unable to define function %1 because it is recursive.").arg(funcName)); + TQString s(i18n("Unable to define function %1 because it is recursive.").tqarg(funcName)); Result::setLastResult(s); YYABORT; @@ -165,8 +165,8 @@ S: SET FUNC ASSIGN EXP { S: SET IDENT ASSIGN EXP { ++gCheckIdents; - QString funcName = $2->name(); - QString ident = $3->name(); + TQString funcName = $2->name(); + TQString ident = $3->name(); // No need to check if the function is already defined, because the // lexer checked for us before returning the IDENT token. @@ -188,14 +188,14 @@ S: REMOVE FUNC '(' ')' { // Can't remove an ident using remove-func syntax. S: REMOVE IDENT '(' ')' { // This is an error - Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name()))); + Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name()))); YYABORT; } // This happens when the user tries to remove a function that's not defined. S: REMOVE IDENT '(' IDENT ')' { // This is an error - Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name()))); + Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name()))); YYABORT; } @@ -209,11 +209,11 @@ S: REMOVE IDENT { YYACCEPT; } else { - QString s; + TQString s; if(manager->isValueSet($2->name())) - s = i18n("Can't remove predefined variable %1.").arg($2->name()); + s = i18n("Can't remove predefined variable %1.").tqarg($2->name()); else - s = i18n("Can't remove undefined variable %1.").arg($2->name()); + s = i18n("Can't remove undefined variable %1.").tqarg($2->name()); Result::setLastResult(s); @@ -228,7 +228,7 @@ S: SET IDENT '=' EXP { if($2->name() == "pi" && $4->value() == Abakus::number_t("3.0")) Result::setLastResult(i18n("This isn't Indiana, you can't just change pi")); else - Result::setLastResult(i18n("%1 is a constant").arg($2->name())); + Result::setLastResult(i18n("%1 is a constant").tqarg($2->name())); YYABORT; } @@ -247,7 +247,7 @@ S: IDENT '=' EXP { if($1->name() == "pi" && $3->value() == Abakus::number_t("3.0")) Result::setLastResult(i18n("This isn't Indiana, you can't just change pi")); else - Result::setLastResult(i18n("%1 is a constant").arg($1->name())); + Result::setLastResult(i18n("%1 is a constant").tqarg($1->name())); YYABORT; } @@ -259,13 +259,13 @@ S: IDENT '=' EXP { } S: NUMBER '=' { - Result::setLastResult(i18n("Can't assign to %1").arg($1->value().toString())); + Result::setLastResult(i18n("Can't assign to %1").tqarg($1->value().toString())); YYABORT; } // Can't call this as a function. TERM: IDENT '(' { - Result::setLastResult(i18n("%1 isn't a function (or operator expected)").arg($1->name())); + Result::setLastResult(i18n("%1 isn't a function (or operator expected)").tqarg($1->name())); YYABORT; } @@ -351,7 +351,7 @@ TERM: NUMBER '(' EXP ')' { TERM: NUMBER IDENT { if(gCheckIdents > 0 && !ValueManager::instance()->isValueSet($2->name())) { - Result::setLastResult(i18n("Unknown variable %1").arg($2->name())); + Result::setLastResult(i18n("Unknown variable %1").tqarg($2->name())); YYABORT; } @@ -362,7 +362,7 @@ VALUE: IDENT { if(gCheckIdents <= 0 || ValueManager::instance()->isValueSet($1->name())) $$ = $1; else { - Result::setLastResult(i18n("Unknown variable %1").arg($1->name())); + Result::setLastResult(i18n("Unknown variable %1").tqarg($1->name())); YYABORT; } } diff --git a/src/result.cpp b/src/result.cpp index 557d516..cfc1007 100644 --- a/src/result.cpp +++ b/src/result.cpp @@ -20,7 +20,7 @@ Result *Result::m_lastResult = new Result; -Result::Result(const QString &message) : m_type(Error), m_message(message) +Result::Result(const TQString &message) : m_type(Error), m_message(message) { } diff --git a/src/result.h b/src/result.h index 7c541da..49936f5 100644 --- a/src/result.h +++ b/src/result.h @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include "node.h" #include "sharedptr.h" @@ -37,7 +37,7 @@ public: /** * Default constructor, which constructs a "failed" Result. */ - Result(const QString &message = ""); + Result(const TQString &message = ""); /** * Node constructor, which constructs a "succeeded" result. @@ -54,7 +54,7 @@ public: Type type() const { return m_type; } - QString message() const { return m_message; } + TQString message() const { return m_message; } const NodePtr result() const { return m_node; } NodePtr result() { return m_node; } @@ -68,7 +68,7 @@ public: private: NodePtr m_node; Type m_type; - QString m_message; + TQString m_message; static Result *m_lastResult; }; diff --git a/src/resultlistview.cpp b/src/resultlistview.cpp index eda1acc..031f61c 100644 --- a/src/resultlistview.cpp +++ b/src/resultlistview.cpp @@ -20,12 +20,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "resultlistview.h" #include "resultlistviewtext.h" @@ -34,11 +34,11 @@ using DragSupport::makePixmap; using namespace ResultList; -ResultListView::ResultListView(QWidget *parent, const char *name) : - KListView(parent, name), m_itemRightClicked(0) +ResultListView::ResultListView(TQWidget *tqparent, const char *name) : + KListView(tqparent, name), m_itemRightClicked(0) { - connect(this, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), - SLOT(slotDoubleClicked(QListViewItem *, const QPoint &, int))); + connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(slotDoubleClicked(TQListViewItem *, const TQPoint &, int))); addColumn(i18n("Expression")); addColumn(i18n("Result")); @@ -57,7 +57,7 @@ ResultListView::ResultListView(QWidget *parent, const char *name) : bool ResultListView::getStackValue(unsigned stackPosition, Abakus::number_t &result) { - QListViewItem *it = firstChild(); + TQListViewItem *it = firstChild(); for(; it; it = it->itemBelow()) { ResultListViewText *resultItem = dynamic_cast(it); if(!resultItem->wasError() && resultItem->stackPosition() == stackPosition) { @@ -69,20 +69,20 @@ bool ResultListView::getStackValue(unsigned stackPosition, Abakus::number_t &res return false; } -QDragObject *ResultListView::dragObject() +TQDragObject *ResultListView::dragObject() { - QPoint viewportPos = viewport()->mapFromGlobal(QCursor::pos()); + TQPoint viewportPos = viewport()->mapFromGlobal(TQCursor::pos()); ResultListViewText *item = itemUnderCursor(); if(item) { - QString text = item->resultText(); + TQString text = item->resultText(); int column = header()->sectionAt(viewportPos.x()); if(column == ExpressionColumn) text = item->expressionText(); - QDragObject *drag = new QTextDrag(text, this); + TQDragObject *drag = new TQTextDrag(text, this); drag->setPixmap(makePixmap(text, font())); return drag; @@ -91,7 +91,7 @@ QDragObject *ResultListView::dragObject() return 0; } -void ResultListView::contextMenuEvent(QContextMenuEvent *e) +void ResultListView::contextMenuEvent(TQContextMenuEvent *e) { m_itemRightClicked = itemUnderCursor(); KPopupMenu *menu = constructPopupMenu(m_itemRightClicked); @@ -99,7 +99,7 @@ void ResultListView::contextMenuEvent(QContextMenuEvent *e) menu->popup(e->globalPos()); } -void ResultListView::slotDoubleClicked(QListViewItem *item, const QPoint &, int c) +void ResultListView::slotDoubleClicked(TQListViewItem *item, const TQPoint &, int c) { ResultListViewText *textItem = dynamic_cast(item); if(!textItem) @@ -115,9 +115,9 @@ KPopupMenu *ResultListView::constructPopupMenu(const ResultListViewText *item) { KPopupMenu *menu = new KPopupMenu(this, "list view context menu"); - menu->insertItem(i18n("Clear &History"), this, SLOT(clear()), ALT+Key_R); + menu->insertItem(i18n("Clear &History"), this, TQT_SLOT(clear()), ALT+Key_R); - int id = menu->insertItem(i18n("Copy Result to Clipboard"), this, SLOT(slotCopyResult())); + int id = menu->insertItem(i18n("Copy Result to Clipboard"), this, TQT_SLOT(slotCopyResult())); if(!item || item->wasError()) menu->setItemEnabled(id, false); @@ -129,9 +129,9 @@ void ResultListView::slotCopyResult() if(!m_itemRightClicked) return; - QClipboard *clipboard = QApplication::clipboard(); + TQClipboard *clipboard = TQApplication::tqclipboard(); - clipboard->setText(m_itemRightClicked->resultText(), QClipboard::Clipboard); + clipboard->setText(m_itemRightClicked->resultText(), TQClipboard::Clipboard); } ResultListViewText *ResultListView::lastItem() const @@ -141,8 +141,8 @@ ResultListViewText *ResultListView::lastItem() const ResultListViewText *ResultListView::itemUnderCursor() const { - QPoint viewportPos = viewport()->mapFromGlobal(QCursor::pos()); - QListViewItem *underCursor = itemAt(viewportPos); + TQPoint viewportPos = viewport()->mapFromGlobal(TQCursor::pos()); + TQListViewItem *underCursor = itemAt(viewportPos); return static_cast(underCursor); } diff --git a/src/resultlistview.h b/src/resultlistview.h index c5ec724..3657b8b 100644 --- a/src/resultlistview.h +++ b/src/resultlistview.h @@ -23,8 +23,8 @@ #include "numerictypes.h" class KPopupMenu; -class QLabel; -class QDragObject; +class TQLabel; +class TQDragObject; class ResultListViewText; namespace ResultList { @@ -34,24 +34,25 @@ namespace ResultList { class ResultListView : public KListView { Q_OBJECT + TQ_OBJECT public: - ResultListView(QWidget *parent = 0, const char *name = "result list view"); + ResultListView(TQWidget *tqparent = 0, const char *name = "result list view"); bool getStackValue(unsigned stackPosition, Abakus::number_t &result); ResultListViewText *lastItem() const; protected: - virtual void contextMenuEvent(QContextMenuEvent *e); - virtual QDragObject *dragObject(); + virtual void contextMenuEvent(TQContextMenuEvent *e); + virtual TQDragObject *dragObject(); signals: - void signalEntrySelected(const QString &text); - void signalResultSelected(const QString &text); + void signalEntrySelected(const TQString &text); + void signalResultSelected(const TQString &text); private slots: - void slotDoubleClicked(QListViewItem *item, const QPoint & /* Ignored */, int c); + void slotDoubleClicked(TQListViewItem *item, const TQPoint & /* Ignored */, int c); void slotCopyResult(); private: diff --git a/src/resultlistviewtext.cpp b/src/resultlistviewtext.cpp index 3957f61..946dc82 100644 --- a/src/resultlistviewtext.cpp +++ b/src/resultlistviewtext.cpp @@ -18,19 +18,19 @@ */ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "resultlistviewtext.h" using namespace ResultList; ResultListViewText::ResultListViewText(KListView *listView, - const QString &text, - const QString &result, + const TQString &text, + const TQString &result, ResultListViewText *after, bool isError) : KListViewItem(listView, after, text, result), m_text(text), @@ -41,7 +41,7 @@ ResultListViewText::ResultListViewText(KListView *listView, } ResultListViewText::ResultListViewText(KListView *listView, - const QString &text, + const TQString &text, const Abakus::number_t &result, ResultListViewText *after, bool isError) @@ -54,7 +54,7 @@ ResultListViewText::ResultListViewText(KListView *listView, for (; item && item != this; item = static_cast(item->itemBelow())) { if(!item->wasError()) { item->setStackPosition(item->stackPosition() + 1); - item->repaint(); + item->tqrepaint(); } } } @@ -67,7 +67,7 @@ ResultListViewText::ResultListViewText(KListView *listView, void ResultListViewText::setStackPosition(unsigned pos) { - setText(ShortcutColumn, QString("$%1").arg(pos)); + setText(ShortcutColumn, TQString("$%1").tqarg(pos)); m_stackPosition = pos; } @@ -80,51 +80,51 @@ void ResultListViewText::precisionChanged() setText(ResultColumn, m_result); } -void ResultListViewText::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align) +void ResultListViewText::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { - QColorGroup group(cg); + TQColorGroup group(cg); - // XXX: The Qt::red may not provide good contrast with weird color schemes. + // XXX: The TQt::red may not provide good contrast with weird color schemes. // If so I apologize. if(m_wasError && column == ResultColumn) - group.setColor(QColorGroup::Text, m_result == "OK" ? cg.link() : Qt::red); + group.setColor(TQColorGroup::Text, m_result == "OK" ? cg.link() : TQt::red); if(column == ResultColumn) { - QFont f = p->font(); + TQFont f = p->font(); f.setBold(true); p->setFont(f); } if(column == ShortcutColumn) { - QFont f = p->font(); + TQFont f = p->font(); f.setItalic(true); - f.setPointSize(QMIN(f.pointSize() * 9 / 11, 10)); + f.setPointSize(TQMIN(f.pointSize() * 9 / 11, 10)); p->setFont(f); } KListViewItem::paintCell(p, group, column, width, align); } -int ResultListViewText::width(const QFontMetrics &fm, const QListView *lv, int c) const +int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int c) const { // Simulate painting the text to get accurate results. if(c == ResultColumn) { - QFont f = lv->font(); + TQFont f = lv->font(); f.setBold(true); - return KListViewItem::width(QFontMetrics(f), lv, c); + return KListViewItem::width(TQFontMetrics(f), lv, c); } if(c == ShortcutColumn) { - QFont f = lv->font(); + TQFont f = lv->font(); f.setItalic(true); - f.setPointSize(QMIN(f.pointSize() * 9 / 11, 10)); - return KListViewItem::width(QFontMetrics(f), lv, c); + f.setPointSize(TQMIN(f.pointSize() * 9 / 11, 10)); + return KListViewItem::width(TQFontMetrics(f), lv, c); } return KListViewItem::width(fm, lv, c); } -void ResultListViewText::setText(int column, const QString &text) +void ResultListViewText::setText(int column, const TQString &text) { if(!m_wasError && column == ResultColumn) { KListViewItem::setText(column, m_value.toString()); diff --git a/src/resultlistviewtext.h b/src/resultlistviewtext.h index 9a3587d..088f9e5 100644 --- a/src/resultlistviewtext.h +++ b/src/resultlistviewtext.h @@ -22,28 +22,28 @@ #include "resultlistview.h" #include "numerictypes.h" -class QPainter; -class QColorGroup; -class QFontMetrics; +class TQPainter; +class TQColorGroup; +class TQFontMetrics; // This class shows the results shown in the MainWindow result pane. class ResultListViewText : public KListViewItem { public: ResultListViewText(KListView *listView, - const QString &text, - const QString &result, + const TQString &text, + const TQString &result, ResultListViewText *after, bool isError = false); ResultListViewText(KListView *listView, - const QString &text, + const TQString &text, const Abakus::number_t &result, ResultListViewText *after, bool isError = false); - QString expressionText() const { return m_text; } - QString resultText() const { return m_result; } + TQString expressionText() const { return m_text; } + TQString resultText() const { return m_result; } bool wasError() const { return m_wasError; } unsigned stackPosition() const { return m_stackPosition; } @@ -54,14 +54,14 @@ class ResultListViewText : public KListViewItem void precisionChanged(); // Reimplemented from KListViewItem - virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align); - virtual int width(const QFontMetrics &fm, const QListView *lv, int c) const; + virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align); + virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const; // Reimplemented to remove trailing zeroes from results. - virtual void setText(int column, const QString &text); + virtual void setText(int column, const TQString &text); private: - QString m_text, m_result; + TQString m_text, m_result; bool m_wasError; unsigned m_stackPosition; Abakus::number_t m_value; diff --git a/src/rpnmuncher.cpp b/src/rpnmuncher.cpp index 191196a..94cbd92 100644 --- a/src/rpnmuncher.cpp +++ b/src/rpnmuncher.cpp @@ -21,10 +21,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "rpnmuncher.h" #include "valuemanager.h" @@ -37,7 +37,7 @@ class Operand { public: Operand() : m_isValue(true), m_value(0) { } - Operand(const QString &ident) : m_isValue(false), m_text(ident) { } + Operand(const TQString &ident) : m_isValue(false), m_text(ident) { } Operand(Abakus::number_t value) : m_isValue(true), m_value(value) { } Abakus::number_t value() const @@ -53,19 +53,19 @@ class Operand return value(); } - QString text() const { return m_text; } + TQString text() const { return m_text; } private: bool m_isValue; - QString m_text; + TQString m_text; Abakus::number_t m_value; }; typedef enum { Number = 256, Func, Ident, Power, Set, Remove, Pop, Clear, Unknown } Token; -static int tokenize (const QString &token); +static int tokenize (const TQString &token); -QString RPNParser::m_errorStr; +TQString RPNParser::m_errorStr; bool RPNParser::m_error(false); OperandStack RPNParser::m_stack; @@ -77,9 +77,9 @@ struct Counter } }; -Abakus::number_t RPNParser::rpnParseString(const QString &text) +Abakus::number_t RPNParser::rpnParseString(const TQString &text) { - QStringList tokens = QStringList::split(QRegExp("\\s"), text); + TQStringList tokens = TQStringList::split(TQRegExp("\\s"), text); Counter counter; // Will update stack count when we leave proc. (void) counter; // Avoid warnings about it being unused. @@ -89,9 +89,9 @@ Abakus::number_t RPNParser::rpnParseString(const QString &text) Function *fn = 0; m_error = false; - m_errorStr = QString::null; + m_errorStr = TQString(); - for(QStringList::ConstIterator it = tokens.begin(); it != tokens.end(); ++it) { + for(TQStringList::ConstIterator it = tokens.begin(); it != tokens.end(); ++it) { switch(tokenize(*it)) { case Number: @@ -115,7 +115,7 @@ Abakus::number_t RPNParser::rpnParseString(const QString &text) case Func: if(m_stack.count() < 1) { m_error = true; - m_errorStr = i18n("Insufficient operands for function %1").arg(*it); + m_errorStr = i18n("Insufficient operands for function %1").tqarg(*it); return Abakus::number_t::nan(); } @@ -150,7 +150,7 @@ Abakus::number_t RPNParser::rpnParseString(const QString &text) case Unknown: m_error = true; - m_errorStr = i18n("Unknown token %1").arg(*it); + m_errorStr = i18n("Unknown token %1").tqarg(*it); return Abakus::number_t::nan(); break; @@ -226,7 +226,7 @@ Abakus::number_t RPNParser::rpnParseString(const QString &text) return m_stack.top(); } -static int tokenize (const QString &token) +static int tokenize (const TQString &token) { bool isOK; @@ -252,13 +252,13 @@ static int tokenize (const QString &token) if(token.lower() == "remove") return Remove; - if(QRegExp("^\\w+$").search(token) != -1 && - QRegExp("\\d").search(token) == -1) + if(TQRegExp("^\\w+$").search(token) != -1 && + TQRegExp("\\d").search(token) == -1) { return Ident; } - if(QRegExp("^[-+*/=]$").search(token) != -1) + if(TQRegExp("^[-+*/=]$").search(token) != -1) return token[0]; return Unknown; diff --git a/src/rpnmuncher.h b/src/rpnmuncher.h index 4f5e69f..9ac74f2 100644 --- a/src/rpnmuncher.h +++ b/src/rpnmuncher.h @@ -19,24 +19,24 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -class QString; +class TQString; class Operand; -template class QValueStack; -typedef QValueStack OperandStack; +template class TQValueStack; +typedef TQValueStack OperandStack; #include "numerictypes.h" class RPNParser { public: - static Abakus::number_t rpnParseString(const QString &text); + static Abakus::number_t rpnParseString(const TQString &text); static bool wasError() { return m_error; } - static QString errorString() { return m_errorStr; } + static TQString errorString() { return m_errorStr; } static OperandStack &stack() { return m_stack; } private: - static QString m_errorStr; + static TQString m_errorStr; static bool m_error; static OperandStack m_stack; }; diff --git a/src/valuemanager.cpp b/src/valuemanager.cpp index 93cfa77..afb72dd 100644 --- a/src/valuemanager.cpp +++ b/src/valuemanager.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include "numerictypes.h" #include "valuemanager.h" @@ -34,43 +34,43 @@ ValueManager *ValueManager::instance() return m_manager; } -ValueManager::ValueManager(QObject *parent, const char *name) : - QObject(parent, name) +ValueManager::ValueManager(TQObject *tqparent, const char *name) : + TQObject(tqparent, name) { m_values.insert("pi", Abakus::number_t::PI); m_values.insert("e", Abakus::number_t::E); } -Abakus::number_t ValueManager::value(const QString &name) const +Abakus::number_t ValueManager::value(const TQString &name) const { return m_values[name]; } -bool ValueManager::isValueSet(const QString &name) const +bool ValueManager::isValueSet(const TQString &name) const { - return m_values.contains(name); + return m_values.tqcontains(name); } -bool ValueManager::isValueReadOnly(const QString &name) const +bool ValueManager::isValueReadOnly(const TQString &name) const { - QRegExp readOnlyValues("^(ans|pi|e|stackCount)$"); + TQRegExp readOnlyValues("^(ans|pi|e|stackCount)$"); - return name.find(readOnlyValues) != -1; + return name.tqfind(readOnlyValues) != -1; } -void ValueManager::setValue(const QString &name, const Abakus::number_t value) +void ValueManager::setValue(const TQString &name, const Abakus::number_t value) { - if(m_values.contains(name) && this->value(name) != value) + if(m_values.tqcontains(name) && this->value(name) != value) emit signalValueChanged(name, value); - else if(!m_values.contains(name)) + else if(!m_values.tqcontains(name)) emit signalValueAdded(name, value); - m_values.replace(name, value); + m_values.tqreplace(name, value); } -void ValueManager::removeValue(const QString &name) +void ValueManager::removeValue(const TQString &name) { - if(m_values.contains(name)) + if(m_values.tqcontains(name)) emit signalValueRemoved(name); m_values.remove(name); @@ -78,26 +78,26 @@ void ValueManager::removeValue(const QString &name) void ValueManager::slotRemoveUserVariables() { - QStringList vars = valueNames(); + TQStringList vars = valueNames(); - for(QStringList::ConstIterator var = vars.constBegin(); var != vars.constEnd(); ++var) + for(TQStringList::ConstIterator var = vars.constBegin(); var != vars.constEnd(); ++var) if(!isValueReadOnly(*var)) removeValue(*var); } -QStringList ValueManager::valueNames() const +TQStringList ValueManager::valueNames() const { return m_values.keys(); } -QString ValueManager::description(const QString &valueName) +TQString ValueManager::description(const TQString &valueName) { if(valueName == "e") return i18n("Natural exponential base - 2.7182818"); if(valueName == "pi") return i18n("pi (π) - 3.1415926"); - return QString(); + return TQString(); } #include "valuemanager.moc" diff --git a/src/valuemanager.h b/src/valuemanager.h index a0c3007..8233dc5 100644 --- a/src/valuemanager.h +++ b/src/valuemanager.h @@ -19,46 +19,47 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include -#include +#include +#include +#include +#include #include "numerictypes.h" -class ValueManager : public QObject +class ValueManager : public TQObject { Q_OBJECT + TQ_OBJECT public: - typedef QMap valueMap; + typedef TQMap valueMap; static ValueManager *instance(); - Abakus::number_t value(const QString &name) const; + Abakus::number_t value(const TQString &name) const; - bool isValueSet(const QString &name) const; - bool isValueReadOnly(const QString &name) const; + bool isValueSet(const TQString &name) const; + bool isValueReadOnly(const TQString &name) const; - void setValue(const QString &name, const Abakus::number_t value); - void removeValue(const QString &name); + void setValue(const TQString &name, const Abakus::number_t value); + void removeValue(const TQString &name); - QStringList valueNames() const; + TQStringList valueNames() const; /** * Returns a textual description of a constant built-into abakus. */ - static QString description(const QString &valueName); + static TQString description(const TQString &valueName); signals: - void signalValueAdded(const QString &name, Abakus::number_t value); - void signalValueRemoved(const QString &name); - void signalValueChanged(const QString &name, Abakus::number_t newValue); + void signalValueAdded(const TQString &name, Abakus::number_t value); + void signalValueRemoved(const TQString &name); + void signalValueChanged(const TQString &name, Abakus::number_t newValue); public slots: void slotRemoveUserVariables(); private: - ValueManager(QObject *parent = 0, const char *name = "value manager"); + ValueManager(TQObject *tqparent = 0, const char *name = "value manager"); static ValueManager *m_manager; valueMap m_values; -- cgit v1.2.1