GUI: fixed small things + update colors on config change
This commit is contained in:
parent
a61a6e96e0
commit
3738cff3b1
|
@ -1,41 +1,49 @@
|
||||||
#include "BreakpointsViewTable.h"
|
#include "BreakpointsViewTable.h"
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
|
#include "Bridge.h"
|
||||||
BreakpointsViewTable::BreakpointsViewTable(QWidget* parent)
|
|
||||||
: StdTable(parent)
|
BreakpointsViewTable::BreakpointsViewTable(QWidget* parent)
|
||||||
{
|
: StdTable(parent)
|
||||||
BgColor = QColor(Qt::black); // predefined
|
{
|
||||||
TxtColor = QColor(Qt::white); // predefined
|
updateColors();
|
||||||
GetConfigColors();
|
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakpointsViewTable::GetConfigColors()
|
void BreakpointsViewTable::updateColors()
|
||||||
{
|
{
|
||||||
BgColor = ConfigColor("ThreadCurrentBackgroundColor");
|
StdTable::updateColors();
|
||||||
TxtColor = ConfigColor("ThreadCurrentColor");
|
mCipBackgroundColor = ConfigColor("ThreadCurrentBackgroundColor");
|
||||||
}
|
mCipColor = ConfigColor("ThreadCurrentColor");
|
||||||
|
}
|
||||||
duint BreakpointsViewTable::GetCIP() { return DbgValFromString("cip"); }
|
|
||||||
|
void BreakpointsViewTable::disassembleAtSlot(dsint cip, dsint addr)
|
||||||
QString BreakpointsViewTable::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
{
|
||||||
{
|
Q_UNUSED(addr)
|
||||||
duint bpAddr = 0;
|
mCip = cip;
|
||||||
QString ret = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
}
|
||||||
QString bpAddrStr = getCellContent(rowBase + rowOffset, col);
|
|
||||||
|
QString BreakpointsViewTable::paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||||
#ifdef _WIN64
|
{
|
||||||
bpAddr = bpAddrStr.toULongLong(0, 16);
|
QString ret = StdTable::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||||
#else //x86
|
|
||||||
bpAddr = bpAddrStr.toULong(0, 16);
|
if(!col) //address
|
||||||
#endif //_WIN64
|
{
|
||||||
|
QString bpAddrStr = getCellContent(rowBase + rowOffset, col);
|
||||||
if(GetCIP() == bpAddr && !col)
|
bool valid = false;
|
||||||
{
|
#ifdef _WIN64
|
||||||
painter->fillRect(QRect(x, y, w, h), QBrush(BgColor));
|
duint bpAddr = bpAddrStr.toULongLong(&valid, 16);
|
||||||
painter->setPen(QPen(TxtColor));
|
#else //x86
|
||||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, bpAddrStr);
|
duint bpAddr = bpAddrStr.toULong(&valid, 16);
|
||||||
ret = "";
|
#endif //_WIN64
|
||||||
}
|
|
||||||
|
if(valid && bpAddr == mCip)
|
||||||
return ret;
|
{
|
||||||
}
|
painter->fillRect(QRect(x, y, w, h), QBrush(mCipBackgroundColor));
|
||||||
|
painter->setPen(QPen(mCipColor));
|
||||||
|
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, bpAddrStr);
|
||||||
|
ret = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
#ifndef BREAKPOINTSVIEWTABLE_H
|
#ifndef BREAKPOINTSVIEWTABLE_H
|
||||||
#define BREAKPOINTSVIEWTABLE_H
|
#define BREAKPOINTSVIEWTABLE_H
|
||||||
|
|
||||||
#include "StdTable.h"
|
#include "StdTable.h"
|
||||||
|
|
||||||
class BreakpointsViewTable : public StdTable
|
class BreakpointsViewTable : public StdTable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BreakpointsViewTable(QWidget* parent = 0);
|
explicit BreakpointsViewTable(QWidget* parent = 0);
|
||||||
void GetConfigColors();
|
void GetConfigColors();
|
||||||
duint GetCIP();
|
void updateColors() override;
|
||||||
|
|
||||||
protected:
|
public slots:
|
||||||
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
void disassembleAtSlot(dsint cip, dsint addr);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
QColor BgColor;
|
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||||
QColor TxtColor;
|
|
||||||
};
|
private:
|
||||||
|
QColor mCipBackgroundColor;
|
||||||
#endif // BREAKPOINTSVIEWTABLE_H
|
QColor mCipColor;
|
||||||
|
duint mCip;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BREAKPOINTSVIEWTABLE_H
|
||||||
|
|
Loading…
Reference in New Issue