diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/devices/gui/memory_editor.cpp | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/devices/gui/memory_editor.cpp')
-rw-r--r-- | src/devices/gui/memory_editor.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/devices/gui/memory_editor.cpp b/src/devices/gui/memory_editor.cpp index 175f011..4504e6b 100644 --- a/src/devices/gui/memory_editor.cpp +++ b/src/devices/gui/memory_editor.cpp @@ -9,12 +9,12 @@ ***************************************************************************/ #include "memory_editor.h" -#include <qlabel.h> -#include <qscrollbar.h> -#include <qlayout.h> -#include <qgrid.h> -#include <qtimer.h> -#include <qpopupmenu.h> +#include <tqlabel.h> +#include <tqscrollbar.h> +#include <tqlayout.h> +#include <tqgrid.h> +#include <tqtimer.h> +#include <tqpopupmenu.h> #include <klocale.h> #include <kpushbutton.h> #include <kaction.h> @@ -28,17 +28,17 @@ #include "libgui/gui_prog_manager.h" //----------------------------------------------------------------------------- -Device::MemoryEditor::MemoryEditor(Device::Memory *memory, QWidget *parent, const char *name) - : QFrame(parent, name), _memory(memory) +Device::MemoryEditor::MemoryEditor(Device::Memory *memory, TQWidget *tqparent, const char *name) + : TQFrame(tqparent, name), _memory(memory) { - _top = new QVBoxLayout(this, 5, 10); + _top = new TQVBoxLayout(this, 5, 10); } //----------------------------------------------------------------------------- Device::MemoryRangeEditor::MemoryRangeEditor(Device::Memory &memory, uint nbLines, uint nbCols, uint offset, int nb, - QWidget *parent, const char *name) - : MemoryEditor(&memory, parent, name), + TQWidget *tqparent, const char *name) + : MemoryEditor(&memory, tqparent, name), _nbLines(nbLines), _nbCols(nbCols), _offset(offset), _nb(nb) {} @@ -48,60 +48,60 @@ void Device::MemoryRangeEditor::init() uint totalNbLines = _nb / _nbCols; if ( (_nb % _nbCols)!=0 ) totalNbLines++; - QHBoxLayout *hbox = new QHBoxLayout(_top); + TQHBoxLayout *hbox = new TQHBoxLayout(_top); - QVBoxLayout *vbox = new QVBoxLayout(hbox); - QFrame *frame = new QFrame(this); - frame->setFrameStyle(QFrame::Panel | QFrame::Raised); + TQVBoxLayout *vbox = new TQVBoxLayout(hbox); + TQFrame *frame = new TQFrame(this); + frame->setFrameStyle(TQFrame::Panel | TQFrame::Raised); frame->setMargin(5); vbox->addWidget(frame); vbox->addStretch(1); - QHBoxLayout *fbox = new QHBoxLayout(frame, 5, 5); - QGrid *grid = new QGrid(3+_nbCols, QGrid::Horizontal, frame, "memory_range_editor_grid"); + TQHBoxLayout *fbox = new TQHBoxLayout(frame, 5, 5); + TQGrid *grid = new TQGrid(3+_nbCols, Qt::Horizontal, frame, "memory_range_editor_grid"); fbox->addWidget(grid); grid->setSpacing(0); grid->setMargin(3); - QFont f("courier", font().pointSize()); + TQFont f("courier", font().pointSize()); grid->setFont(f); for (uint k=0; k<_nbLines; ++k) { // addresses - QWidget *w = new QWidget(grid); + TQWidget *w = new TQWidget(grid); w->setFixedWidth(10); _blocks.append(w); - QLabel *label = new QLabel(toHex(0, 2*_memory->device().nbBytesAddress()), grid, "address_label"); + TQLabel *label = new TQLabel(toHex(0, 2*_memory->device().nbBytesAddress()), grid, "address_label"); _addresses.append(label); - label = new QLabel(":", grid); + label = new TQLabel(":", grid); // memory for (uint i = 0; i<_nbCols; ++i) { HexWordEditor *h = createHexWordEditor(grid); _editors.append(h); - connect(h, SIGNAL(modified()), SIGNAL(modified())); - connect(h, SIGNAL(moveNext()), SLOT(moveNext())); - connect(h, SIGNAL(movePrev()), SLOT(movePrev())); - connect(h, SIGNAL(moveFirst()), SLOT(moveFirst())); - connect(h, SIGNAL(moveLast()), SLOT(moveLast())); - connect(h, SIGNAL(moveUp()), SLOT(moveUp())); - connect(h, SIGNAL(moveDown()), SLOT(moveDown())); - connect(h, SIGNAL(moveNextPage()), SLOT(moveNextPage())); - connect(h, SIGNAL(movePrevPage()), SLOT(movePrevPage())); + connect(h, TQT_SIGNAL(modified()), TQT_SIGNAL(modified())); + connect(h, TQT_SIGNAL(moveNext()), TQT_SLOT(moveNext())); + connect(h, TQT_SIGNAL(movePrev()), TQT_SLOT(movePrev())); + connect(h, TQT_SIGNAL(moveFirst()), TQT_SLOT(moveFirst())); + connect(h, TQT_SIGNAL(moveLast()), TQT_SLOT(moveLast())); + connect(h, TQT_SIGNAL(moveUp()), TQT_SLOT(moveUp())); + connect(h, TQT_SIGNAL(moveDown()), TQT_SLOT(moveDown())); + connect(h, TQT_SIGNAL(moveNextPage()), TQT_SLOT(moveNextPage())); + connect(h, TQT_SIGNAL(movePrevPage()), TQT_SLOT(movePrevPage())); } } // scrollbar if there are more lines to display than visible - _scrollbar = new QScrollBar(0, QMAX(_nbLines, totalNbLines)-_nbLines, 1, _nbLines, 0, - QScrollBar::Vertical, frame, "memory_range_editor_scrollbar"); - connect(_scrollbar, SIGNAL(valueChanged(int)), SLOT(setIndex(int))) ; + _scrollbar = new TQScrollBar(0, TQMAX(_nbLines, totalNbLines)-_nbLines, 1, _nbLines, 0, + Qt::Vertical, frame, "memory_range_editor_scrollbar"); + connect(_scrollbar, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(setIndex(int))) ; if ( totalNbLines<=_nbLines ) _scrollbar->hide(); fbox->addWidget(_scrollbar); fbox->addStretch(1); vbox->addStretch(1); - QVBoxLayout *vboxc = new QVBoxLayout(hbox); + TQVBoxLayout *vboxc = new TQVBoxLayout(hbox); vboxc->setSpacing(0); - _comment = new QLabel(this); + _comment = new TQLabel(this); _comment->hide(); vboxc->addWidget(_comment); - _spacer = new QLabel(this); + _spacer = new TQLabel(this); _spacer->setFixedHeight(10); _spacer->hide(); vboxc->addWidget(_spacer); @@ -113,7 +113,7 @@ void Device::MemoryRangeEditor::init() setIndex(0); } -void Device::MemoryRangeEditor::setComment(const QString &text) +void Device::MemoryRangeEditor::setComment(const TQString &text) { _comment->setText(text); _comment->show(); @@ -167,7 +167,7 @@ void Device::MemoryRangeEditor::setIndex(int index) void Device::MemoryRangeEditor::moveNext() { - QValueList<HexWordEditor *>::iterator it = _editors.find((HexWordEditor *)sender()); + TQValueList<HexWordEditor *>::iterator it = _editors.tqfind((HexWordEditor *)sender()); ++it; if ( it==_editors.end() || (*it)->offset()==-1 ) { if ( current()==uint(_scrollbar->maxValue()) ) return; // at end @@ -178,7 +178,7 @@ void Device::MemoryRangeEditor::moveNext() void Device::MemoryRangeEditor::movePrev() { - QValueList<HexWordEditor *>::iterator it = _editors.find((HexWordEditor *)sender()); + TQValueList<HexWordEditor *>::iterator it = _editors.tqfind((HexWordEditor *)sender()); if ( it==_editors.begin() ) { if ( current()==0 ) return; // at beginning setIndex(current()-1); @@ -209,7 +209,7 @@ void Device::MemoryRangeEditor::moveLast() void Device::MemoryRangeEditor::moveUp() { - int i = _editors.findIndex((HexWordEditor *)sender()); + int i = _editors.tqfindIndex((HexWordEditor *)sender()); uint line = i / _nbCols; if ( line==0 ) { if ( current()==0 ) return; // on first line @@ -220,7 +220,7 @@ void Device::MemoryRangeEditor::moveUp() void Device::MemoryRangeEditor::moveDown() { - int i = _editors.findIndex((HexWordEditor *)sender()); + int i = _editors.tqfindIndex((HexWordEditor *)sender()); uint line = i / _nbCols; if ( line+1==_nbLines ) { if ( current()==uint(_scrollbar->maxValue()) ) return; // on last line @@ -232,7 +232,7 @@ void Device::MemoryRangeEditor::moveDown() void Device::MemoryRangeEditor::moveNextPage() { - int i = _editors.findIndex((HexWordEditor *)sender()); + int i = _editors.tqfindIndex((HexWordEditor *)sender()); if ( _nbLines>(uint(_scrollbar->maxValue()) - current()) ) i = (_nbLines-1) * _nbCols + (i % _nbCols); else setIndex(current()+_nbLines); if ( _editors[i]->offset()==-1 ) _editors[i-_nbCols]->setFocus(); @@ -241,20 +241,20 @@ void Device::MemoryRangeEditor::moveNextPage() void Device::MemoryRangeEditor::movePrevPage() { - int i = _editors.findIndex((HexWordEditor *)sender()); + int i = _editors.tqfindIndex((HexWordEditor *)sender()); if ( current()<_nbLines ) i = (i % _nbCols); else setIndex(current()-_nbLines); _editors[i]->setFocus(); } //----------------------------------------------------------------------------- -Device::MemoryEditorGroup::MemoryEditorGroup(Device::Memory *memory, QWidget *parent, const char *name) - : MemoryEditor(memory, parent, name) +Device::MemoryEditorGroup::MemoryEditorGroup(Device::Memory *memory, TQWidget *tqparent, const char *name) + : MemoryEditor(memory, tqparent, name) {} void Device::MemoryEditorGroup::addEditor(MemoryEditor *editor) { - connect(editor, SIGNAL(modified()), SIGNAL(modified())); + connect(editor, TQT_SIGNAL(modified()), TQT_SIGNAL(modified())); _editors.append(editor); } @@ -284,8 +284,8 @@ const Device::ActionData Device::ACTION_DATA[Nb_Actions] = { }; Device::MemoryTypeEditor::MemoryTypeEditor(const HexView *hexview, Device::Memory &memory, - QWidget *parent, const char *name) - : MemoryEditorGroup(&memory, parent, name), + TQWidget *tqparent, const char *name) + : MemoryEditorGroup(&memory, tqparent, name), _title(0), _comment(0), _hexview(hexview) { for (uint i=0; i<Nb_Actions; i++) _actions[i] = 0; @@ -294,13 +294,13 @@ Device::MemoryTypeEditor::MemoryTypeEditor(const HexView *hexview, Device::Memor void Device::MemoryTypeEditor::init(bool first) { if ( !first ) _top->addWidget(new SeparatorWidget(this)); - QHBoxLayout *hbox = new QHBoxLayout(_top); + TQHBoxLayout *hbox = new TQHBoxLayout(_top); _title = new PopupButton(this); for (uint i=0; i<Nb_Actions; i++) { if ( hasAction(Action(i)) ) { _actions[i] = new KAction(i18n(ACTION_DATA[i].label), ACTION_DATA[i].icon, 0, - this, SLOT(doAction()), Main::toplevel().actionCollection()); + TQT_TQOBJECT(this), TQT_SLOT(doAction()), Main::toplevel().actionCollection()); addAction(_actions[i]); } if ( ACTION_DATA[i].properties & SeparatorAfter ) _title->appendSeparator(); @@ -308,11 +308,11 @@ void Device::MemoryTypeEditor::init(bool first) _title->appendSeparator(); hbox->addWidget(_title); - _comment = new QLabel(this); + _comment = new TQLabel(this); hbox->addWidget(_comment); hbox->addStretch(1); - connect(&Main::toplevel(), SIGNAL(stateChanged()), SLOT(stateChanged())); + connect(&Main::toplevel(), TQT_SIGNAL(stateChanged()), TQT_SLOT(stateChanged())); } void Device::MemoryTypeEditor::addAction(KAction *action) |