KDevelop API Documentation

memviewdlg.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           memview.cpp  -  description
00003                              -------------------
00004     begin                : Tue Oct 5 1999
00005     copyright            : (C) 1999 by John Birch
00006     email                : jbb@kdevelop.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "memviewdlg.h"
00019 
00020 #include <kbuttonbox.h>
00021 #include <klineedit.h>
00022 #include <kglobalsettings.h>
00023 #include <klocale.h>
00024 #include <kstdguiitem.h>
00025 #include <kdeversion.h>
00026 
00027 #include <qlabel.h>
00028 #include <qlayout.h>
00029 #include <qmultilineedit.h>
00030 #include <qpushbutton.h>
00031 
00032 // **************************************************************************
00033 //
00034 // Dialog allows the user to enter
00035 //  - A starting address
00036 //  - An ending address
00037 //
00038 //  this can be in the form
00039 //            functiom/method name
00040 //            variable address (ie &Var, str)
00041 //            Memory address 0x8040abc
00042 //
00043 //  When disassembling and you enter a method name without an
00044 //  ending address then the whole method is disassembled.
00045 //  No data means disassemble the method we're curently in.(from the
00046 //  start of the method)
00047 //
00048 // click ok buton to send the request to jdb
00049 // the output is returned (some time later) in the raw data slot
00050 // and displayed as is, so it's rather crude, but it works!
00051 // **************************************************************************
00052 
00053 namespace JAVADebugger
00054 {
00055 
00056 MemoryViewDialog::MemoryViewDialog(QWidget *parent, const char *name)
00057     : KDialog(parent, name, true),      // modal
00058       start_(new KLineEdit(this)),
00059       end_(new KLineEdit(this)),
00060       output_(new QMultiLineEdit(this))
00061 {
00062     setCaption(i18n("Memory/Misc Viewer"));
00063     // Make the top-level layout; a vertical box to contain all widgets
00064     // and sub-layouts.
00065     QBoxLayout *topLayout = new QVBoxLayout(this, 5);
00066 
00067     QGridLayout *grid = new QGridLayout(2, 2, 5);
00068     topLayout->addLayout(grid);
00069 
00070     QLabel *label = new QLabel(start_, i18n("the beginning", "Start:"), this);
00071     grid->addWidget(label, 0, 0);
00072     grid->setRowStretch(0, 0);
00073     grid->addWidget(start_, 1, 0);
00074     grid->setRowStretch(1, 0);
00075 
00076     label = new QLabel(end_, i18n("Amount/End address (memory/disassemble):"), this);
00077     grid->addWidget(label, 0, 1);
00078     grid->addWidget(end_, 1, 1);
00079 
00080     label = new QLabel(i18n("MemoryView:"), this);
00081     topLayout->addWidget(label, 0);
00082     topLayout->addWidget(output_, 5);
00083     output_->setFont(KGlobalSettings::fixedFont());
00084 
00085     KButtonBox *buttonbox = new KButtonBox(this, Horizontal, 5);
00086     QPushButton *memoryDump = buttonbox->addButton(i18n("Memory"));
00087     QPushButton *disassemble = buttonbox->addButton(i18n("Disassemble"));
00088     QPushButton *registers = buttonbox->addButton(i18n("Registers"));
00089     QPushButton *libraries = buttonbox->addButton(i18n("Libraries"));
00090 #if KDE_IS_VERSION( 3, 2, 90 )
00091     QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
00092 #else
00093     QPushButton *cancel = buttonbox->addButton(i18n("Cancel"));
00094 #endif
00095     memoryDump->setDefault(true);
00096     buttonbox->layout();
00097     topLayout->addWidget(buttonbox);
00098 
00099     connect(memoryDump, SIGNAL(clicked()), SLOT(slotMemoryDump()));
00100     connect(disassemble, SIGNAL(clicked()), SLOT(slotDisassemble()));
00101     connect(registers, SIGNAL(clicked()), SIGNAL(registers()));
00102     connect(libraries, SIGNAL(clicked()), SIGNAL(libraries()));
00103     connect(cancel, SIGNAL(clicked()), SLOT(reject()));
00104 }
00105 
00106 // **************************************************************************
00107 
00108 MemoryViewDialog::~MemoryViewDialog()
00109 {
00110 }
00111 
00112 // **************************************************************************
00113 
00114 void MemoryViewDialog::slotRawJDBMemoryView(char *buf)
00115 {
00116     // just display the resultant output from JDB in the edit box
00117     output_->clear();
00118     output_->insertLine(buf);
00119     output_->setCursorPosition(0,0);
00120 }
00121 
00122 // **************************************************************************
00123 
00124 // get jdb to supply the disassembled data.
00125 void MemoryViewDialog::slotDisassemble()
00126 {
00127     QString start(start_->text());
00128     QString end(end_->text());
00129     emit disassemble(start, end);
00130 }
00131 
00132 // **************************************************************************
00133 
00134 void MemoryViewDialog::slotMemoryDump()
00135 {
00136     QString start(start_->text());
00137     QString size(end_->text());
00138     emit memoryDump(start, size);
00139 }
00140 
00141 // **************************************************************************
00142 // **************************************************************************
00143 // **************************************************************************
00144 
00145 }
00146 
00147 #include "memviewdlg.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:29 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003