1
0
Fork 0

GUI: Set flag to prevent drawing cells when a process isn't being debugged (#424)

This commit is contained in:
Nukem 2015-11-12 17:26:45 -05:00
parent 1bbc9a998f
commit 5ae3315ece
4 changed files with 35 additions and 11 deletions

View File

@ -16,6 +16,9 @@ AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(pare
fontsUpdated();
colorsUpdated();
// Paint cell content only when debugger is running
setDrawDebugOnly(true);
mRowCount = 0;
mHeaderButtonSytle.setStyleSheet(" QPushButton {\n background-color: rgb(192, 192, 192);\n border-style: outset;\n border-width: 2px;\n border-color: rgb(128, 128, 128);\n }\n QPushButton:pressed {\n background-color: rgb(192, 192, 192);\n border-style: inset;\n }");
@ -152,11 +155,16 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
// Paints cell contents
if(i < mNbrOfLineToPrint)
{
QString wStr = paintContent(&wPainter, mTableOffset, i, j, x, y, getColumnWidth(j), getRowHeight());
if(wStr.length())
// Don't draw cells if the flag is set, and no process is running
if (mDrawDebugOnly && DbgIsDebugging())
{
wPainter.setPen(textColor);
wPainter.drawText(QRect(x + 4, y, getColumnWidth(j) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
QString wStr = paintContent(&wPainter, mTableOffset, i, j, x, y, getColumnWidth(j), getRowHeight());
if(wStr.length())
{
wPainter.setPen(textColor);
wPainter.drawText(QRect(x + 4, y, getColumnWidth(j) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
}
}
}
@ -904,7 +912,21 @@ int AbstractTableView::getCharWidth()
}
/************************************************************************************
Table Offset Management
Content drawing control
************************************************************************************/
bool AbstractTableView::getDrawDebugOnly()
{
return mDrawDebugOnly;
}
void AbstractTableView::setDrawDebugOnly(bool value)
{
mDrawDebugOnly = value;
}
/************************************************************************************
Table offset management
************************************************************************************/
dsint AbstractTableView::getTableOffset()
{

View File

@ -42,7 +42,7 @@ public:
// Constructor
explicit AbstractTableView(QWidget* parent = 0);
//config updates
// Config updates
virtual void colorsUpdated();
virtual void fontsUpdated();
@ -96,7 +96,11 @@ public:
void setShowHeader(bool show);
int getCharWidth();
// Table Offset Management
// Content drawing control
bool getDrawDebugOnly();
void setDrawDebugOnly(bool value);
// Table offset management
dsint getTableOffset();
void setTableOffset(dsint val);
@ -187,6 +191,7 @@ protected:
QColor headerTextColor;
QColor selectionColor;
bool mAllowPainting;
bool mDrawDebugOnly;
};
#endif // ABSTRACTTABLEVIEW_H

View File

@ -240,10 +240,6 @@ void HexDump::mouseReleaseEvent(QMouseEvent* event)
QString HexDump::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
{
// Don't draw if not debugging
if (!DbgIsDebugging())
return "";
// Reset byte offset when base address is reached
if(rowBase == 0 && mByteOffset != 0)
printDumpAt(mMemPage->getBase(), false, false);

View File

@ -24,6 +24,7 @@ AttachDialog::AttachDialog(QWidget* parent) : QDialog(parent), ui(new Ui::Attach
int charwidth = ui->listProcesses->getCharWidth();
ui->listProcesses->addColumnAt(charwidth * sizeof(int) * 2 + 8, "PID", true);
ui->listProcesses->addColumnAt(800, "Path", true);
ui->listProcesses->setDrawDebugOnly(false);
connect(ui->listProcesses, SIGNAL(enterPressedSignal()), this, SLOT(on_btnAttach_clicked()));
connect(ui->listProcesses, SIGNAL(doubleClickedSignal()), this, SLOT(on_btnAttach_clicked()));
connect(ui->listProcesses, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(processListContextMenu(QPoint)));