1
// *************************************************************************
2
// rdboutputwidget.cpp - description
4
// begin : 10th April 2003
5
// copyright : (C) 2003 by John Birch
6
// email : jbb@kdevelop.org
8
// Adapted for ruby debugging
9
// --------------------------
10
// begin : Mon Nov 1 2004
11
// copyright : (C) 2004 by Richard Dale
12
// email : Richard_Dale@tipitina.demon.co.uk
13
// **************************************************************************
15
// **************************************************************************
17
// * This program is free software; you can redistribute it and/or modify *
18
// * it under the terms of the GNU General Public License as published by *
19
// * the Free Software Foundation; either version 2 of the License, or *
20
// * (at your option) any later version. *
22
// **************************************************************************
24
#include "rdboutputwidget.h"
25
#include "dbgcontroller.h"
27
#include <kcombobox.h>
29
#include <kiconloader.h>
34
#include <qtextedit.h>
35
#include <qtoolbutton.h>
38
/***************************************************************************/
39
/***************************************************************************/
40
/***************************************************************************/
45
/***************************************************************************/
47
RDBOutputWidget::RDBOutputWidget( QWidget *parent, const char *name) :
48
QWidget(parent, name),
49
m_userRDBCmdEditor(0),
54
m_rdbView = new QTextEdit (this, name);
55
m_rdbView->setReadOnly(true);
57
QBoxLayout *userRDBCmdEntry = new QHBoxLayout();
58
m_userRDBCmdEditor = new KHistoryCombo (this, "rdb-user-cmd-editor");
60
QLabel *label = new QLabel(i18n("&RDB cmd:"), this);
61
label->setBuddy(m_userRDBCmdEditor);
62
userRDBCmdEntry->addWidget(label);
64
userRDBCmdEntry->addWidget(m_userRDBCmdEditor);
65
userRDBCmdEntry->setStretchFactor(m_userRDBCmdEditor, 1);
67
m_Interrupt = new QToolButton( this, "add breakpoint" );
68
m_Interrupt->setSizePolicy ( QSizePolicy ( (QSizePolicy::SizeType)0,
69
( QSizePolicy::SizeType)0,
72
m_Interrupt->sizePolicy().hasHeightForWidth())
74
m_Interrupt->setPixmap ( SmallIcon ( "player_pause" ) );
75
userRDBCmdEntry->addWidget(m_Interrupt);
76
QToolTip::add ( m_Interrupt, i18n ( "Pause execution of the app to enter rdb commands" ) );
78
QVBoxLayout *topLayout = new QVBoxLayout(this, 2);
79
topLayout->addWidget(m_rdbView, 10);
80
topLayout->addLayout(userRDBCmdEntry);
82
slotDbgStatus( "", s_dbgNotStarted);
84
connect( m_userRDBCmdEditor, SIGNAL(returnPressed()), SLOT(slotRDBCmd()) );
85
connect( m_Interrupt, SIGNAL(clicked()), SIGNAL(breakInto()));
88
/***************************************************************************/
90
RDBOutputWidget::~RDBOutputWidget()
93
delete m_userRDBCmdEditor;
96
/***************************************************************************/
98
void RDBOutputWidget::clear()
104
/***************************************************************************/
106
void RDBOutputWidget::slotReceivedStdout(const char* line)
108
if (strncmp(line, "(rdb:", 5) == 0)
109
m_rdbView->append(QString("<font color=\"blue\">").append( line ).append("</font>") );
111
m_rdbView->append(line);
114
/***************************************************************************/
116
void RDBOutputWidget::slotReceivedStderr(const char* line)
118
m_rdbView->append(QString("<font color=\"red\">").append( line ).append("</font>") );
121
/***************************************************************************/
123
void RDBOutputWidget::slotRDBCmd()
125
QString RDBCmd(m_userRDBCmdEditor->currentText());
126
if (!RDBCmd.isEmpty())
128
m_userRDBCmdEditor->addToHistory(RDBCmd);
129
m_userRDBCmdEditor->clearEdit();
130
emit userRDBCmd(RDBCmd);
134
/***************************************************************************/
136
void RDBOutputWidget::slotDbgStatus(const QString &, int statusFlag)
138
if (statusFlag & s_dbgNotStarted)
140
m_Interrupt->setEnabled(false);
141
m_userRDBCmdEditor->setEnabled(false);
145
if (statusFlag & s_appBusy)
147
m_Interrupt->setEnabled(true);
148
m_userRDBCmdEditor->setEnabled(false);
152
m_Interrupt->setEnabled(false);
153
m_userRDBCmdEditor->setEnabled(true);
157
/***************************************************************************/
159
void RDBOutputWidget::focusInEvent(QFocusEvent */*e*/)
161
m_userRDBCmdEditor->setFocus();
164
/***************************************************************************/
165
/***************************************************************************/
166
/***************************************************************************/
170
#include "rdboutputwidget.moc"