00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#include "framestackwidget.h"
00019
#include "jdbparser.h"
00020
00021
#include <klocale.h>
00022
00023
#include <qlistbox.h>
00024
#include <qstrlist.h>
00025
00026
#include <ctype.h>
00027
00028
00029
00030
00031
00032
00033
namespace JAVADebugger
00034 {
00035
00036 FramestackWidget::FramestackWidget(
QWidget *parent,
const char *name)
00037 :
QListBox(parent, name),
00038 currentFrame_(0),
00039 currentList_(0)
00040 {
00041 connect(
this, SIGNAL(highlighted(
int)), SLOT(
slotHighlighted(
int)) );
00042 connect(
this, SIGNAL(selected(
int)), SLOT(
slotHighlighted(
int)) );
00043 }
00044
00045
00046
00047
00048 FramestackWidget::~FramestackWidget()
00049 {
00050
delete currentList_;
00051 }
00052
00053
00054
00055 void FramestackWidget::slotHighlighted(
int frame)
00056 {
00057
00058
00059
00060
currentFrame_ = frame;
00061 emit
selectFrame(frame);
00062 }
00063
00064
00065
00066
00067 void FramestackWidget::slotSelectFrame(
int frame)
00068 {
00069
if (isSelected(frame))
00070
slotHighlighted(frame);
00071
else
00072 setCurrentItem(frame);
00073 }
00074
00075
00076
00077 void FramestackWidget::clearList() {
00078 clear();
00079
delete currentList_;
00080
currentList_ =
new QStrList(
true);
00081
currentList_->setAutoDelete(
true);
00082 }
00083
00084 void FramestackWidget::addItem(
QCString s) {
00085
currentList_->append(s);
00086 }
00087
00088 void FramestackWidget::parseJDBBacktraceList(
char *)
00089 {
00090 }
00091
00092 void FramestackWidget::updateDone()
00093 {
00094
00095 insertStrList(
currentList_);
00096
currentFrame_ = 0;
00097 }
00098
00099
00100
00101 QCString FramestackWidget::getFrameParams(
int frame)
00102 {
00103
if (!
currentList_) {
00104
if (
char *frameData =
currentList_->at(frame)) {
00105
if (
char *paramStart = strchr(frameData,
'(')) {
00106
JDBParser parser;
00107
if (
char *paramEnd = parser.
skipDelim(paramStart,
'(',
')')) {
00108
00109
if (paramEnd == paramStart+2) {
00110
if (*(paramEnd+1) ==
'(') {
00111 paramStart = paramEnd+1;
00112 paramEnd = parser.
skipDelim(paramStart,
'(',
')');
00113
if (!paramEnd)
00114
return QCString();
00115 }
00116 }
00117
00118
00119
if (paramEnd-paramStart > 2)
00120
return QCString (paramStart+1, paramEnd-paramStart-1);
00121 }
00122 }
00123 }
00124 }
00125
00126
return QCString();
00127 }
00128
00129
00130
00131 QString FramestackWidget::getFrameName(
int frame)
00132 {
00133
if (
currentList_) {
00134
if (
char *frameData =
currentList_->at(frame)) {
00135
if (
char *paramStart = strchr(frameData,
'(')) {
00136
char *fnstart = paramStart-2;
00137
while (fnstart > frameData) {
00138
if (isspace(*fnstart))
00139
break;
00140 fnstart--;
00141 }
00142
QString frameName(
QString().sprintf(
"#%d %s(...)", frame,
00143
QCString(fnstart, paramStart-fnstart+1).
data()));
00144
return frameName;
00145 }
00146 }
00147 }
00148
00149
return i18n(
"No stack");
00150 }
00151
00152
00153
00154
00155
00156 }
00157
00158
#include "framestackwidget.moc"