2 // allwatchbrowser.cpp - All Watch
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
9 // --- ---------- -----------------------------------------------------------
10 // JPM 12/07/2017 Created this file
14 // Better presentation
17 #include "debugger/allwatchbrowser.h"
19 #include "debugger/DBGManager.h"
23 AllWatchBrowserWindow::AllWatchBrowserWindow(QWidget
* parent
/*= 0*/) : QWidget(parent
, Qt::Dialog
),
24 layout(new QVBoxLayout
), text(new QTextBrowser
),
28 setWindowTitle(tr("All Watch"));
30 QFont
fixedFont("Lucida Console", 8, QFont::Normal
);
31 fixedFont
.setStyleHint(QFont::TypeWriter
);
32 text
->setFont(fixedFont
);
35 layout
->addWidget(text
);
40 AllWatchBrowserWindow::~AllWatchBrowserWindow(void)
47 void AllWatchBrowserWindow::Reset(void)
56 void AllWatchBrowserWindow::RefreshContents(void)
67 if (NbWatch
= DBGManager_GetNbGlobalVariables())
69 PtrWatchInfo
= (WatchInfo
*)calloc(NbWatch
, sizeof(WatchInfo
));
71 for (uint32_t i
= 0; i
< NbWatch
; i
++)
73 PtrWatchInfo
[i
].PtrVariableName
= DBGManager_GetGlobalVariableName(i
+ 1);
74 PtrWatchInfo
[i
].addr
= DBGManager_GetGlobalVariableAdr(i
+ 1);
75 PtrWatchInfo
[i
].TypeTag
= DBGManager_GetGlobalVariableTypeTag(i
+ 1);
76 if (!strlen(PtrWatchInfo
[i
].PtrVariableBaseTypeName
= DBGManager_GetGlobalVariableTypeName(i
+ 1)))
78 PtrWatchInfo
[i
].PtrVariableBaseTypeName
= (char *)"<font color='#ff0000'>N/A</font>";
84 for (uint32_t i
= 0; i
< NbWatch
; i
++)
86 if (PtrWatchInfo
[i
].PtrVariableName
&& PtrWatchInfo
[i
].PtrVariableBaseTypeName
)
88 sprintf(string
, "%i : %s | %s | 0x%06X | %s", (i
+ 1), PtrWatchInfo
[i
].PtrVariableBaseTypeName
, PtrWatchInfo
[i
].PtrVariableName
, (unsigned int)PtrWatchInfo
[i
].addr
, (PtrWatchInfo
[i
].TypeTag
& 0x8) ? "" : DBGManager_GetGlobalVariableValue(i
+ 1));
89 WatchAll
+= QString(string
);
90 sprintf(string
, "<br>");
91 WatchAll
+= QString(string
);
95 text
->setText(WatchAll
);
101 void AllWatchBrowserWindow::keyPressEvent(QKeyEvent
* e
)
103 if (e
->key() == Qt::Key_Escape
)