GUI: more highlighting options
This commit is contained in:
parent
cb3a174f2c
commit
c9ca7ff411
|
@ -53,7 +53,7 @@ SOURCES += \
|
|||
Src/Utils/Breakpoints.cpp \
|
||||
Src/Gui/CPUInfoBox.cpp \
|
||||
Src/Gui/CPUDump.cpp \
|
||||
Src/BasicView/ScriptView.cpp \
|
||||
Src/Gui/ScriptView.cpp \
|
||||
Src/Gui/CPUStack.cpp \
|
||||
Src/Gui/SymbolView.cpp \
|
||||
Src/Gui/RegistersView.cpp \
|
||||
|
@ -104,7 +104,7 @@ HEADERS += \
|
|||
Src/Utils/Breakpoints.h \
|
||||
Src/Gui/CPUInfoBox.h \
|
||||
Src/Gui/CPUDump.h \
|
||||
Src/BasicView/ScriptView.h \
|
||||
Src/Gui/ScriptView.h \
|
||||
Src/Gui/CPUStack.h \
|
||||
Src/Gui/SymbolView.h \
|
||||
Src/BasicView/SearchListView.h \
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "AbstractTableView.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
AbstractTableView::AbstractTableView(QWidget *parent) : QAbstractScrollArea(parent)
|
||||
{
|
||||
|
@ -20,7 +19,11 @@ AbstractTableView::AbstractTableView(QWidget *parent) : QAbstractScrollArea(pare
|
|||
font.setStyleHint(QFont::Monospace);
|
||||
this->setFont(font);
|
||||
|
||||
backgroundColor=QColor(ConfigColor("AbstractTableViewBackgroundColor"));
|
||||
backgroundColor=ConfigColor("AbstractTableViewBackgroundColor");
|
||||
textColor=ConfigColor("AbstractTableViewTextColor");
|
||||
separatorColor=ConfigColor("AbstractTableViewSeparatorColor");
|
||||
headerTextColor=ConfigColor("AbstractTableViewHeaderTextColor");
|
||||
selectionColor=ConfigColor("AbstractTableViewSelectionColor");
|
||||
|
||||
int wRowsHeight = QFontMetrics(this->font()).height();
|
||||
wRowsHeight = (wRowsHeight * 105) / 100;
|
||||
|
@ -47,8 +50,22 @@ AbstractTableView::AbstractTableView(QWidget *parent) : QAbstractScrollArea(pare
|
|||
|
||||
// Signals/Slots Connections
|
||||
connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(vertSliderActionSlot(int)));
|
||||
connect(Configuration::instance(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
|
||||
}
|
||||
|
||||
void AbstractTableView::colorsUpdatedSlot()
|
||||
{
|
||||
colorsUpdated();
|
||||
}
|
||||
|
||||
void AbstractTableView::colorsUpdated()
|
||||
{
|
||||
backgroundColor=ConfigColor("AbstractTableViewBackgroundColor");
|
||||
textColor=ConfigColor("AbstractTableViewTextColor");
|
||||
separatorColor=ConfigColor("AbstractTableViewSeparatorColor");
|
||||
headerTextColor=ConfigColor("AbstractTableViewHeaderTextColor");
|
||||
selectionColor=ConfigColor("AbstractTableViewSelectionColor");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
Painting Stuff
|
||||
|
@ -86,7 +103,6 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
for(int i = 0; i < getColumnCount(); i++)
|
||||
{
|
||||
QStyleOptionButton wOpt;
|
||||
|
||||
if((mColumnList[i].header.isPressed == true) && (mColumnList[i].header.isMouseOver == true))
|
||||
wOpt.state = QStyle::State_Sunken;
|
||||
else
|
||||
|
@ -96,7 +112,10 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
|
||||
mHeaderButtonSytle.style()->drawControl(QStyle::CE_PushButton, &wOpt, &wPainter,&mHeaderButtonSytle);
|
||||
|
||||
wPainter.save();
|
||||
wPainter.setPen(headerTextColor);
|
||||
wPainter.drawText(QRect(x + 4, y, getColumnWidth(i) - 8, getHeaderHeight()), Qt::AlignVCenter | Qt::AlignLeft, mColumnList[i].title);
|
||||
wPainter.restore();
|
||||
|
||||
x += getColumnWidth(i);
|
||||
}
|
||||
|
@ -114,12 +133,17 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
{
|
||||
QString wStr = paintContent(&wPainter, mTableOffset, i, j, x, y, getColumnWidth(j), getRowHeight());
|
||||
if(wStr.length())
|
||||
{
|
||||
wPainter.save();
|
||||
wPainter.setPen(textColor);
|
||||
wPainter.drawText(QRect(x + 4, y, getColumnWidth(j) - 4, getRowHeight()), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||
wPainter.restore();
|
||||
}
|
||||
}
|
||||
|
||||
// Paints cell right borders
|
||||
wPainter.save();
|
||||
wPainter.setPen(ConfigColor("AbstractTableViewSeparatorColor"));
|
||||
wPainter.setPen(separatorColor);
|
||||
wPainter.drawLine(x + getColumnWidth(j) - 1, y, x + getColumnWidth(j) - 1, y + getRowHeight() - 1);
|
||||
wPainter.restore();
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QScrollBar>
|
||||
#include <qdebug.h>
|
||||
#include <NewTypes.h>
|
||||
#include <Configuration.h>
|
||||
|
||||
class AbstractTableView : public QAbstractScrollArea
|
||||
{
|
||||
|
@ -19,6 +20,9 @@ public:
|
|||
// Constructor
|
||||
explicit AbstractTableView(QWidget *parent = 0);
|
||||
|
||||
//color updates
|
||||
virtual void colorsUpdated();
|
||||
|
||||
// Pure Virtual Methods
|
||||
virtual QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h) = 0;
|
||||
|
||||
|
@ -82,6 +86,8 @@ signals:
|
|||
void repainted();
|
||||
|
||||
public slots:
|
||||
void colorsUpdatedSlot();
|
||||
|
||||
// Update/Reload/Refresh/Repaint
|
||||
virtual void reloadData();
|
||||
void repaint();
|
||||
|
@ -149,6 +155,10 @@ private:
|
|||
|
||||
protected:
|
||||
QColor backgroundColor;
|
||||
QColor textColor;
|
||||
QColor separatorColor;
|
||||
QColor headerTextColor;
|
||||
QColor selectionColor;
|
||||
};
|
||||
|
||||
#endif // ABSTRACTTABLEVIEW_H
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "Disassembly.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
Disassembly::Disassembly(QWidget *parent) : AbstractTableView(parent)
|
||||
{
|
||||
|
@ -40,6 +39,12 @@ Disassembly::Disassembly(QWidget *parent) : AbstractTableView(parent)
|
|||
connect(Bridge::getBridge(), SIGNAL(repaintGui()), this, SLOT(reloadData()));
|
||||
}
|
||||
|
||||
void Disassembly::colorsUpdated()
|
||||
{
|
||||
AbstractTableView::colorsUpdated();
|
||||
backgroundColor=ConfigColor("DisassemblyBackgroundColor");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
Reimplemented Functions
|
||||
************************************************************************************/
|
||||
|
@ -125,14 +130,14 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
{
|
||||
QColor bpColor=ConfigColor("DisassemblyBreakpointBackgroundColor");
|
||||
if(!bpColor.alpha()) //we don't want transparent text
|
||||
bpColor=ConfigColor("DisassemblyCipColor");
|
||||
bpColor=ConfigColor("DisassemblyBreakpointColor");
|
||||
painter->setPen(QPen(bpColor));
|
||||
}
|
||||
else if(bpxtype&bp_hardware) //hardware breakpoint only
|
||||
{
|
||||
QColor hwbpColor=ConfigColor("DisassemblyHardwareBreakpointBackgroundColor");
|
||||
if(!hwbpColor.alpha()) //we don't want transparent text
|
||||
hwbpColor=ConfigColor("DisassemblyCipColor");
|
||||
hwbpColor=ConfigColor("DisassemblyHardwareBreakpointColor");
|
||||
painter->setPen(hwbpColor);
|
||||
}
|
||||
else //no breakpoint
|
||||
|
@ -144,7 +149,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
{
|
||||
QColor bookmarkColor=ConfigColor("DisassemblyBookmarkBackgroundColor");
|
||||
if(!bookmarkColor.alpha()) //we don't want transparent text
|
||||
bookmarkColor=ConfigColor("DisassemblyCipColor");
|
||||
bookmarkColor=ConfigColor("DisassemblyBookmarkColor");
|
||||
painter->setPen(QPen(bookmarkColor));
|
||||
}
|
||||
}
|
||||
|
@ -182,11 +187,20 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
{
|
||||
if(bpxtype==bp_none) //no label, no breakpoint
|
||||
{
|
||||
QColor background;
|
||||
if(wIsSelected)
|
||||
{
|
||||
background=ConfigColor("DisassemblySelectedAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblySelectedAddressColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
}
|
||||
else
|
||||
{
|
||||
background=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyAddressColor"))); //DisassemblyAddressColor
|
||||
}
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background
|
||||
}
|
||||
else //breakpoint only
|
||||
{
|
||||
if(bpxtype&bp_normal) //normal breakpoint
|
||||
|
@ -201,10 +215,19 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
}
|
||||
else //other cases (memory breakpoint in disassembly) -> do as normal
|
||||
{
|
||||
QColor background;
|
||||
if(wIsSelected)
|
||||
{
|
||||
background=ConfigColor("DisassemblySelectedAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblySelectedAddressColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
}
|
||||
else
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyAddressColor"))); //DisassemblyAddressColor
|
||||
{
|
||||
background=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyAddressColor")));
|
||||
}
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +261,7 @@ QString Disassembly::paintContent(QPainter* painter, int_t rowBase, int rowOffse
|
|||
{
|
||||
if(bpxtype==bp_none) //bookmark only
|
||||
{
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyBookmarkColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyBookmarkColor"))); //black address
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyBookmarkBackgroundColor"))); //fill bookmark color
|
||||
}
|
||||
else //bookmark + breakpoint
|
||||
|
|
|
@ -15,6 +15,7 @@ class Disassembly : public AbstractTableView
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit Disassembly(QWidget *parent = 0);
|
||||
void colorsUpdated();
|
||||
|
||||
// Reimplemented Functions
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
|
|
|
@ -17,12 +17,22 @@ HexDump::HexDump(QWidget *parent) : AbstractTableView(parent)
|
|||
|
||||
clearDescriptors();
|
||||
|
||||
backgroundColor=QColor("#FFFBF0"); //HexDumpBackgroundColor
|
||||
backgroundColor=ConfigColor("HexDumpBackgroundColor");
|
||||
textColor=ConfigColor("HexDumpTextColor");
|
||||
selectionColor=ConfigColor("HexDumpSelectionColor");
|
||||
|
||||
connect(Bridge::getBridge(), SIGNAL(updateDump()), this, SLOT(reloadData()));
|
||||
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(debugStateChanged(DBGSTATE)));
|
||||
}
|
||||
|
||||
void HexDump::colorsUpdated()
|
||||
{
|
||||
AbstractTableView::colorsUpdated();
|
||||
backgroundColor=ConfigColor("HexDumpBackgroundColor");
|
||||
textColor=ConfigColor("HexDumpTextColor");
|
||||
selectionColor=ConfigColor("HexDumpSelectionColor");
|
||||
}
|
||||
|
||||
void HexDump::printDumpAt(int_t parVA, bool select)
|
||||
{
|
||||
int_t wBase = DbgMemFindBaseAddr(parVA, 0); //get memory base
|
||||
|
@ -210,8 +220,8 @@ void HexDump::printSelected(QPainter* painter, int_t rowBase, int rowOffset, int
|
|||
wSelectionX = x + wI * wItemPixWidth;
|
||||
wSelectionWidth = wItemPixWidth > w - (wSelectionX - x) ? w - (wSelectionX - x) : wItemPixWidth;
|
||||
wSelectionWidth = wSelectionWidth < 0 ? 0 : wSelectionWidth;
|
||||
|
||||
painter->fillRect(QRect(wSelectionX, y, wSelectionWidth, h), QBrush(QColor("#C0C0C0"))); //HexDumpSelectionColor
|
||||
painter->setPen(textColor);
|
||||
painter->fillRect(QRect(wSelectionX, y, wSelectionWidth, h), QBrush(selectionColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
} ColumnDescriptor_t;
|
||||
|
||||
explicit HexDump(QWidget *parent = 0);
|
||||
void colorsUpdated();
|
||||
|
||||
//QString getStringToPrint(int rowBase, int rowOffset, int col);
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
|
|
|
@ -23,7 +23,7 @@ StdTable::StdTable(QWidget *parent) : AbstractTableView(parent)
|
|||
QString StdTable::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
if(isSelected(rowBase, rowOffset) == true)
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#C0C0C0")));
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(selectionColor));
|
||||
|
||||
//return "c " + QString::number(col) + " r " + QString::number(rowBase + rowOffset);
|
||||
return mData->at(col)->at(rowBase + rowOffset);
|
||||
|
|
|
@ -59,8 +59,6 @@ private:
|
|||
|
||||
bool mIsMultiSelctionAllowed;
|
||||
|
||||
|
||||
|
||||
QList< QList<QString>* >* mData;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "AppearanceDialog.h"
|
||||
#include "ui_AppearanceDialog.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
AppearanceDialog::AppearanceDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AppearanceDialog)
|
||||
{
|
||||
|
@ -306,7 +307,7 @@ void AppearanceDialog::on_buttonSave_clicked()
|
|||
{
|
||||
Configuration::instance()->Colors=colorMap;
|
||||
Configuration::instance()->writeColors();
|
||||
QMessageBox msg(QMessageBox::Information, "Information", "Settings saved (you may have to restart)!");
|
||||
QMessageBox msg(QMessageBox::Information, "Information", "Settings saved!");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
|
@ -393,8 +394,11 @@ void AppearanceDialog::colorInfoListInit()
|
|||
colorInfoList.clear();
|
||||
//list entries
|
||||
colorInfoListAppend("AbstractTableView:", "", "");
|
||||
colorInfoListAppend("Text", "AbstractTableViewTextColor", "");
|
||||
colorInfoListAppend("Header Text", "AbstractTableViewHeaderTextColor", "");
|
||||
colorInfoListAppend("Background", "AbstractTableViewBackgroundColor", "");
|
||||
colorInfoListAppend("Separator", "AbstractTableViewSeparatorColor", "");
|
||||
colorInfoListAppend("Separators", "AbstractTableViewSeparatorColor", "");
|
||||
colorInfoListAppend("Selection", "AbstractTableViewSelectionColor", "");
|
||||
|
||||
colorInfoListAppend("Disassembly:", "", "");
|
||||
#ifdef _WIN64
|
||||
|
@ -407,12 +411,12 @@ void AppearanceDialog::colorInfoListInit()
|
|||
colorInfoListAppend("Bookmarks", "DisassemblyBookmarkColor", "DisassemblyBookmarkBackgroundColor");
|
||||
colorInfoListAppend("Comments", "DisassemblyCommentColor", "DisassemblyCommentBackgroundColor");
|
||||
colorInfoListAppend("Labels", "DisassemblyLabelColor", "DisassemblyLabelBackgroundColor");
|
||||
colorInfoListAppend("Addresses", "DisassemblyAddressColor", "");
|
||||
colorInfoListAppend("Addresses", "DisassemblyAddressColor", "DisassemblyAddressBackgroundColor");
|
||||
colorInfoListAppend("Selected Addresses", "DisassemblySelectedAddressColor", "DisassemblySelectedAddressBackgroundColor");
|
||||
colorInfoListAppend("Bytes", "DisassemblyBytesColor", "");
|
||||
colorInfoListAppend("Conditional Jump Lines (jump)", "DisassemblyConditionalJumpLineTrueColor", "");
|
||||
colorInfoListAppend("Conditional Jump Lines (no jump)", "DisassemblyConditionalJumpLineFalseColor", "");
|
||||
colorInfoListAppend("Unconditional Jump Lines", "DisassemblyUnconditionalJumpLineColor", "");
|
||||
colorInfoListAppend("Selected Address Text", "DisassemblySelectedAddressColor", "");
|
||||
colorInfoListAppend("Selection", "DisassemblySelectionColor", "");
|
||||
colorInfoListAppend("Background", "DisassemblyBackgroundColor", "");
|
||||
|
||||
|
@ -467,6 +471,30 @@ void AppearanceDialog::colorInfoListInit()
|
|||
colorInfoListAppend("Memory Scales", "InstructionMemoryScaleColor", "InstructionMemoryScaleBackgroundColor");
|
||||
colorInfoListAppend("Memory Operators (+/-/*)", "InstructionMemoryOperatorColor", "InstructionMemoryOperatorBackgroundColor");
|
||||
|
||||
colorInfoListAppend("HexDump:", "", "");
|
||||
colorInfoListAppend("Text", "HexDumpTextColor", "");
|
||||
colorInfoListAppend("Background", "HexDumpBackgroundColor", "");
|
||||
colorInfoListAppend("Addresses", "HexDumpAddressColor", "HexDumpAddressBackgroundColor");
|
||||
colorInfoListAppend("Labels", "HexDumpLabelColor", "HexDumpLabelBackgroundColor");
|
||||
colorInfoListAppend("Selection", "HexDumpSelectionColor", "");
|
||||
|
||||
colorInfoListAppend("Stack:", "", "");
|
||||
colorInfoListAppend("Text", "StackTextColor", "");
|
||||
colorInfoListAppend("Inactive Text", "StackInactiveTextColor", "");
|
||||
colorInfoListAppend("Background", "StackBackgroundColor", "");
|
||||
colorInfoListAppend("Selection", "StackSelectionColor", "");
|
||||
#ifdef _WIN64
|
||||
colorInfoListAppend("RSP", "StackCspColor", "StackCspBackgroundColor");
|
||||
#else //x86
|
||||
colorInfoListAppend("CSP", "StackCspColor", "StackCspBackgroundColor");
|
||||
#endif //_WIN64
|
||||
colorInfoListAppend("Addresses", "StackAddressColor", "StackAddressBackgroundColor");
|
||||
colorInfoListAppend("Selected Addresses", "StackSelectedAddressColor", "StackSelectedAddressBackgroundColor");
|
||||
colorInfoListAppend("Labels", "StackLabelColor", "StackLabelBackgroundColor");
|
||||
|
||||
colorInfoListAppend("Other:", "", "");
|
||||
colorInfoListAppend("Current Thread", "ThreadCurrentColor", "ThreadCurrentBackgroundColor");
|
||||
|
||||
//dev helper
|
||||
const QMap<QString, QColor>* Colors=&Configuration::instance()->defaultColors;
|
||||
QString notFound;
|
||||
|
@ -488,7 +516,7 @@ void AppearanceDialog::colorInfoListInit()
|
|||
if(notFound.length())
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Warning, "NOT FOUND IN CONFIG!", notFound);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/information.png"));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Text Color</string>
|
||||
<string>Color</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
|
|
|
@ -15,6 +15,13 @@ CPUDump::CPUDump(QWidget *parent) : HexDump(parent)
|
|||
|
||||
void CPUDump::setupContextMenu()
|
||||
{
|
||||
//Label
|
||||
mSetLabelAction = new QAction("Set Label", this);
|
||||
mSetLabelAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
mSetLabelAction->setShortcut(QKeySequence(":"));
|
||||
this->addAction(mSetLabelAction);
|
||||
connect(mSetLabelAction, SIGNAL(triggered()), this, SLOT(setLabelSlot()));
|
||||
|
||||
//Goto menu
|
||||
mGotoMenu = new QMenu("&Goto", this);
|
||||
//Goto->Expression
|
||||
|
@ -131,18 +138,47 @@ void CPUDump::setupContextMenu()
|
|||
//Disassembly
|
||||
mDisassemblyAction = new QAction("&Disassembly", this);
|
||||
this->addAction(mDisassemblyAction);
|
||||
|
||||
mSetLabelAction = new QAction("Set Label", this);
|
||||
this->addAction(mSetLabelAction);
|
||||
|
||||
connect(mDisassemblyAction, SIGNAL(triggered()), this, SLOT(disassemblySlot()));
|
||||
connect(mSetLabelAction, SIGNAL(triggered()), this, SLOT(setLabelSlot()));
|
||||
}
|
||||
|
||||
QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
QString wStr = "";
|
||||
if(col && mDescriptor.at(col - 1).isData == false && mDescriptor.at(col -1).itemCount == 1) //print comments
|
||||
if(!col) //address
|
||||
{
|
||||
char label[MAX_LABEL_SIZE]="";
|
||||
QString addrText="";
|
||||
int_t curAddr = (rowBase + rowOffset) * getBytePerRowCount() - mByteOffset + this->mBase;
|
||||
addrText = QString("%1").arg(curAddr, sizeof(int_t)*2, 16, QChar('0')).toUpper();
|
||||
if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label
|
||||
{
|
||||
char module[MAX_MODULE_SIZE]="";
|
||||
if(DbgGetModuleAt(curAddr, module))
|
||||
addrText+=" <"+QString(module)+"."+QString(label)+">";
|
||||
else
|
||||
addrText+=" <"+QString(label)+">";
|
||||
}
|
||||
else
|
||||
*label=0;
|
||||
painter->save();
|
||||
if(*label) //label
|
||||
{
|
||||
QColor background=ConfigColor("HexDumpLabelBackgroundColor");
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill bookmark color
|
||||
painter->setPen(ConfigColor("HexDumpLabelColor")); //TODO: config
|
||||
}
|
||||
else
|
||||
{
|
||||
QColor background=ConfigColor("HexDumpAddressBackgroundColor");
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill bookmark color
|
||||
painter->setPen(ConfigColor("HexDumpAddressColor")); //TODO: config
|
||||
}
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, addrText);
|
||||
painter->restore();
|
||||
}
|
||||
else if(col && mDescriptor.at(col - 1).isData == false && mDescriptor.at(col -1).itemCount == 1) //print comments
|
||||
{
|
||||
uint_t data=0;
|
||||
int_t wRva = (rowBase + rowOffset) * getBytePerRowCount() - mByteOffset;
|
||||
|
@ -151,8 +187,10 @@ QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, i
|
|||
if(DbgGetLabelAt(data, SEG_DEFAULT, label_text))
|
||||
wStr=QString(label_text);
|
||||
}
|
||||
else
|
||||
else //data
|
||||
{
|
||||
wStr = HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
}
|
||||
return wStr;
|
||||
}
|
||||
|
||||
|
@ -161,7 +199,9 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
|||
if(!DbgIsDebugging())
|
||||
return;
|
||||
QMenu* wMenu = new QMenu(this); //create context menu
|
||||
wMenu->addAction(mSetLabelAction);
|
||||
wMenu->addMenu(mGotoMenu);
|
||||
|
||||
wMenu->addMenu(mHexMenu);
|
||||
wMenu->addMenu(mTextMenu);
|
||||
wMenu->addMenu(mIntegerMenu);
|
||||
|
@ -169,13 +209,33 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
|||
wMenu->addAction(mAddressAction);
|
||||
wMenu->addAction(mDisassemblyAction);
|
||||
|
||||
//if(mSelection.firstSelectedIndex)
|
||||
|
||||
wMenu->addAction(mSetLabelAction);
|
||||
|
||||
wMenu->exec(event->globalPos()); //execute context menu
|
||||
}
|
||||
|
||||
void CPUDump::setLabelSlot()
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
uint_t wVA = getSelectionStart() + this->mBase;
|
||||
LineEditDialog mLineEdit(this);
|
||||
QString addr_text=QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
char label_text[MAX_COMMENT_SIZE]="";
|
||||
if(DbgGetLabelAt((duint)wVA, SEG_DEFAULT, label_text))
|
||||
mLineEdit.setText(QString(label_text));
|
||||
mLineEdit.setWindowTitle("Add label at " + addr_text);
|
||||
if(mLineEdit.exec()!=QDialog::Accepted)
|
||||
return;
|
||||
if(!DbgSetLabelAt(wVA, mLineEdit.editText.toUtf8().constData()))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "Error!", "DbgSetLabelAt failed!");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUDump::gotoExpressionSlot()
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
|
@ -596,30 +656,6 @@ void CPUDump::disassemblySlot()
|
|||
msg.exec();
|
||||
}
|
||||
|
||||
void CPUDump::setLabelSlot()
|
||||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
uint_t wVA = getSelectionStart() + this->mBase;
|
||||
LineEditDialog mLineEdit(this);
|
||||
QString addr_text=QString("%1").arg(wVA, sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
char label_text[MAX_COMMENT_SIZE]="";
|
||||
if(DbgGetLabelAt((duint)wVA, SEG_DEFAULT, label_text))
|
||||
mLineEdit.setText(QString(label_text));
|
||||
mLineEdit.setWindowTitle("Add label at " + addr_text);
|
||||
if(mLineEdit.exec()!=QDialog::Accepted)
|
||||
return;
|
||||
if(!DbgSetLabelAt(wVA, mLineEdit.editText.toUtf8().constData()))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "Error!", "DbgSetLabelAt failed!");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.setParent(this, Qt::Dialog);
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void CPUDump::selectionGet(SELECTIONDATA* selection)
|
||||
{
|
||||
selection->start=getSelectionStart() + mBase;
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
public slots:
|
||||
void setLabelSlot();
|
||||
void gotoExpressionSlot();
|
||||
|
||||
void hexAsciiSlot();
|
||||
|
@ -46,7 +47,6 @@ public slots:
|
|||
|
||||
void addressSlot();
|
||||
void disassemblySlot();
|
||||
void setLabelSlot();
|
||||
|
||||
void selectionGet(SELECTIONDATA* selection);
|
||||
void selectionSet(const SELECTIONDATA* selection);
|
||||
|
|
|
@ -32,6 +32,18 @@ CPUStack::CPUStack(QWidget *parent) : HexDump(parent)
|
|||
setupContextMenu();
|
||||
|
||||
mGoto = 0;
|
||||
|
||||
backgroundColor=ConfigColor("StackBackgroundColor");
|
||||
textColor=ConfigColor("StackTextColor");
|
||||
selectionColor=ConfigColor("StackSelectionColor");
|
||||
}
|
||||
|
||||
void CPUStack::colorsUpdated()
|
||||
{
|
||||
HexDump::colorsUpdated();
|
||||
backgroundColor=ConfigColor("StackBackgroundColor");
|
||||
textColor=ConfigColor("StackTextColor");
|
||||
selectionColor=ConfigColor("StackSelectionColor");
|
||||
}
|
||||
|
||||
void CPUStack::setupContextMenu()
|
||||
|
@ -70,8 +82,6 @@ void CPUStack::setupContextMenu()
|
|||
|
||||
QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
{
|
||||
QString wStr=HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
|
||||
// Compute RVA
|
||||
int wBytePerRowCount = getBytePerRowCount();
|
||||
int_t wRva = (rowBase + rowOffset) * wBytePerRowCount - mByteOffset;
|
||||
|
@ -79,7 +89,7 @@ QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset,
|
|||
|
||||
bool wIsSelected=isSelected(wRva);
|
||||
if(wIsSelected) //highlight if selected
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#C0C0C0")));
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(selectionColor));
|
||||
|
||||
bool wActiveStack=true;
|
||||
if(wVa<mCsp) //inactive stack
|
||||
|
@ -90,48 +100,85 @@ QString CPUStack::paintContent(QPainter* painter, int_t rowBase, int rowOffset,
|
|||
if(col == 0) // paint stack address
|
||||
{
|
||||
painter->save();
|
||||
char label[MAX_LABEL_SIZE]="";
|
||||
QString addrText="";
|
||||
int_t curAddr = (rowBase + rowOffset) * getBytePerRowCount() - mByteOffset + this->mBase;
|
||||
addrText = QString("%1").arg(curAddr, sizeof(int_t)*2, 16, QChar('0')).toUpper();
|
||||
if(DbgGetLabelAt(curAddr, SEG_DEFAULT, label)) //has label
|
||||
{
|
||||
char module[MAX_MODULE_SIZE]="";
|
||||
if(DbgGetModuleAt(curAddr, module))
|
||||
addrText+=" <"+QString(module)+"."+QString(label)+">";
|
||||
else
|
||||
addrText+=" <"+QString(label)+">";
|
||||
}
|
||||
else
|
||||
*label=0;
|
||||
QColor background;
|
||||
if(*label) //label
|
||||
{
|
||||
if(wVa==mCsp) //CSP
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000")));
|
||||
painter->setPen(QPen(QColor("#FFFBF0")));
|
||||
background=ConfigColor("StackCspBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackCspColor")));
|
||||
}
|
||||
else if(wIsSelected)
|
||||
painter->setPen(QPen(QColor("#000000"))); //black address
|
||||
else
|
||||
painter->setPen(QPen(QColor("#808080")));
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||
else //no CSP
|
||||
{
|
||||
background=ConfigColor("StackLabelBackgroundColor");
|
||||
painter->setPen(ConfigColor("StackLabelColor"));
|
||||
}
|
||||
}
|
||||
else //no label
|
||||
{
|
||||
if(wVa==mCsp) //CSP
|
||||
{
|
||||
background=ConfigColor("StackCspBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackCspColor")));
|
||||
}
|
||||
else if(wIsSelected) //selected normal address
|
||||
{
|
||||
background=ConfigColor("StackSelectedAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackSelectedAddressColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
}
|
||||
else //normal address
|
||||
{
|
||||
background=ConfigColor("StackAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("StackAddressColor")));
|
||||
}
|
||||
}
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background when defined
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, addrText);
|
||||
painter->restore();
|
||||
wStr = "";
|
||||
}
|
||||
else if(mDescriptor.at(col - 1).isData == true) //paint stack data
|
||||
{
|
||||
QString wStr=HexDump::paintContent(painter, rowBase, rowOffset, col, x, y, w, h);
|
||||
painter->save();
|
||||
if(wActiveStack)
|
||||
painter->setPen(QPen(QColor("#000000")));
|
||||
painter->setPen(QPen(textColor));
|
||||
else
|
||||
painter->setPen(QPen(QColor("#808080")));
|
||||
painter->setPen(QPen(ConfigColor("StackInactiveTextColor")));
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||
painter->restore();
|
||||
wStr = "";
|
||||
}
|
||||
else if(DbgStackCommentGet(mMemPage->getBase()+wRva, &comment)) //paint stack comments
|
||||
{
|
||||
wStr = QString(comment.comment);
|
||||
QString wStr = QString(comment.comment);
|
||||
painter->save();
|
||||
if(wActiveStack)
|
||||
{
|
||||
if(*comment.color)
|
||||
painter->setPen(QPen(QColor(QString(comment.color))));
|
||||
else
|
||||
painter->setPen(QPen(QColor("#000000")));
|
||||
painter->setPen(QPen(textColor));
|
||||
}
|
||||
else
|
||||
painter->setPen(QPen(QColor("#808080")));
|
||||
painter->setPen(QPen(ConfigColor("StackInactiveTextColor")));
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, wStr);
|
||||
painter->restore();
|
||||
wStr = "";
|
||||
}
|
||||
return wStr;
|
||||
return "";
|
||||
}
|
||||
|
||||
void CPUStack::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
|
|
@ -15,6 +15,7 @@ class CPUStack : public HexDump
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit CPUStack(QWidget *parent = 0);
|
||||
void colorsUpdated();
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
|
|
|
@ -24,6 +24,16 @@ ScriptView::ScriptView(StdTable *parent) : StdTable(parent)
|
|||
connect(Bridge::getBridge(), SIGNAL(scriptEnableHighlighting(bool)), this, SLOT(enableHighlighting(bool)));
|
||||
|
||||
setupContextMenu();
|
||||
|
||||
selectionColor=ConfigColor("DisassemblySelectionColor");
|
||||
backgroundColor=ConfigColor("DisassemblyBackgroundColor");
|
||||
}
|
||||
|
||||
void ScriptView::colorsUpdated()
|
||||
{
|
||||
StdTable::colorsUpdated();
|
||||
selectionColor=ConfigColor("DisassemblySelectionColor");
|
||||
backgroundColor=ConfigColor("DisassemblyBackgroundColor");
|
||||
}
|
||||
|
||||
QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h)
|
||||
|
@ -31,7 +41,7 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
bool wIsSelected=isSelected(rowBase, rowOffset);
|
||||
// Highlight if selected
|
||||
if(wIsSelected)
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#C0C0C0"))); //ScriptViewSelectionColor
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(selectionColor)); //ScriptViewSelectionColor
|
||||
QString returnString;
|
||||
int line=rowBase+rowOffset+1;
|
||||
SCRIPTLINETYPE linetype=DbgScriptGetLineType(line);
|
||||
|
@ -43,23 +53,37 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
painter->save();
|
||||
if(line==mIpLine) //IP
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000"))); //ScriptViewIpColor
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyCipBackgroundColor")));
|
||||
if(DbgScriptBpGet(line)) //breakpoint
|
||||
painter->setPen(QPen(QColor("#FF0000"))); //red address (ScriptViewMainBpColor)
|
||||
{
|
||||
QColor bpColor=ConfigColor("DisassemblyBreakpointBackgroundColor");
|
||||
if(!bpColor.alpha()) //we don't want transparent text
|
||||
bpColor=ConfigColor("DisassemblyBreakpointColor");
|
||||
painter->setPen(QPen(bpColor));
|
||||
}
|
||||
else
|
||||
painter->setPen(QPen(QColor("#FFFFFF"))); //white address (ScriptViewIpTextColor)
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyCipColor"))); //white address (ScriptViewIpTextColor)
|
||||
}
|
||||
else if(DbgScriptBpGet(line)) //breakpoint
|
||||
{
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#FF0000"))); //ScriptViewMainBpColor
|
||||
painter->setPen(QPen(QColor("#000000"))); //black address //ScripViewMainBpTextColor
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyBreakpointBackgroundColor")));
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyBreakpointBackgroundColor"))); //black address //ScripViewMainBpTextColor
|
||||
}
|
||||
else
|
||||
{
|
||||
QColor background;
|
||||
if(linetype==linecommand || linetype==linebranch)
|
||||
painter->setPen(QPen(QColor("#000000"))); //black address (ScriptViewMainTextColor)
|
||||
{
|
||||
background=ConfigColor("DisassemblySelectedAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblySelectedAddressColor"))); //black address (DisassemblySelectedAddressColor)
|
||||
}
|
||||
else
|
||||
painter->setPen(QPen(QColor("#808080"))); //grey address (ScriptViewOtherTextColor)
|
||||
{
|
||||
background=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
painter->setPen(QPen(ConfigColor("DisassemblyAddressColor"))); //grey address
|
||||
}
|
||||
if(background.alpha())
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background
|
||||
}
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, returnString);
|
||||
painter->restore();
|
||||
|
@ -98,21 +122,26 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
{
|
||||
if(isScriptCommand(command, "ret"))
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionRetColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionRetBackgroundColor");
|
||||
newRichText.text="ret";
|
||||
richText.push_back(newRichText);
|
||||
QString remainder=command.right(command.length()-3);
|
||||
if(remainder.length())
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagNone;
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionUncategorizedColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionUncategorizedBackgroundColor");
|
||||
newRichText.text=remainder;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagNone;
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionUncategorizedColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionUncategorizedBackgroundColor");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
|
@ -128,8 +157,9 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
switch(branchinfo.type)
|
||||
{
|
||||
case scriptjmp: //unconditional jumps
|
||||
newRichText.flags=RichTextPainter::FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionUnconditionalJumpColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionUnconditionalJumpBackgroundColor");
|
||||
break;
|
||||
|
||||
case scriptjnejnz: //conditional jumps
|
||||
|
@ -139,17 +169,20 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
case scriptjbejle:
|
||||
case scriptjaejge:
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.textColor=QColor("#FF0000");
|
||||
newRichText.textColor=ConfigColor("InstructionConditionalJumpColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionConditionalJumpBackgroundColor");
|
||||
break;
|
||||
|
||||
case scriptcall: //calls
|
||||
newRichText.flags=RichTextPainter::FlagBackground;
|
||||
newRichText.textBackground=QColor("#00FFFF");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionCallColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionCallBackgroundColor");
|
||||
break;
|
||||
|
||||
default:
|
||||
newRichText.flags=RichTextPainter::FlagNone;
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionUncategorizedColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionUncategorizedBackgroundColor");
|
||||
break;
|
||||
}
|
||||
newRichText.text=command.left(i);
|
||||
|
@ -160,15 +193,17 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
richText.push_back(newRichText);
|
||||
//label
|
||||
QString label=branchinfo.branchlabel;
|
||||
newRichText.flags=RichTextPainter::FlagBackground;
|
||||
newRichText.textBackground=QColor("#FFFF00");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("InstructionAddressColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionAddressBackgroundColor");
|
||||
newRichText.text=label;
|
||||
richText.push_back(newRichText);
|
||||
//remainder
|
||||
QString remainder=command.right(command.length()-command.indexOf(label)-label.length());
|
||||
if(remainder.length())
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagNone;
|
||||
newRichText.textColor=ConfigColor("InstructionUncategorizedColor");
|
||||
newRichText.textBackground=ConfigColor("InstructionUncategorizedBackgroundColor");
|
||||
newRichText.text=remainder;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
|
@ -177,8 +212,9 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
|
||||
case linelabel:
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("DisassemblyAddressColor");
|
||||
newRichText.textBackground=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
painter->drawLine(QPoint(x+xadd+2, y+h-2), QPoint(x+w-4, y+h-2));
|
||||
|
@ -187,8 +223,9 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
|
||||
case linecomment:
|
||||
{
|
||||
newRichText.flags=RichTextPainter::FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("DisassemblyAddressColor");
|
||||
newRichText.textBackground=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
newRichText.text=command;
|
||||
richText.push_back(newRichText);
|
||||
}
|
||||
|
@ -207,8 +244,9 @@ QString ScriptView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
newRichText.flags=RichTextPainter::FlagNone;
|
||||
newRichText.text=" ";
|
||||
richText.push_back(newRichText); //space
|
||||
newRichText.flags=RichTextPainter::FlagColor;
|
||||
newRichText.textColor=QColor("#808080");
|
||||
newRichText.flags=RichTextPainter::FlagAll;
|
||||
newRichText.textColor=ConfigColor("DisassemblyAddressColor");
|
||||
newRichText.textBackground=ConfigColor("DisassemblyAddressBackgroundColor");
|
||||
newRichText.text=comment;
|
||||
richText.push_back(newRichText); //comment
|
||||
}
|
|
@ -15,6 +15,7 @@ class ScriptView : public StdTable
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit ScriptView(StdTable *parent = 0);
|
||||
void colorsUpdated();
|
||||
|
||||
// Reimplemented Functions
|
||||
QString paintContent(QPainter* painter, int_t rowBase, int rowOffset, int col, int x, int y, int w, int h);
|
|
@ -200,8 +200,8 @@ QString ThreadView::paintContent(QPainter* painter, int_t rowBase, int rowOffset
|
|||
if(rowBase+rowOffset==mCurrentThread && !col)
|
||||
{
|
||||
painter->save();
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(QColor("#000000")));
|
||||
painter->setPen(QPen(QColor("#FFFFFF"))); //white text
|
||||
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("ThreadCurrentBackgroundColor")));
|
||||
painter->setPen(QPen(ConfigColor("ThreadCurrentColor"))); //white text
|
||||
painter->drawText(QRect(x + 4, y , w - 4 , h), Qt::AlignVCenter | Qt::AlignLeft, ret);
|
||||
painter->restore();
|
||||
ret="";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "Configuration.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
Configuration* Configuration::mPtr = NULL;
|
||||
|
||||
|
||||
Configuration::Configuration()
|
||||
Configuration::Configuration() : QObject()
|
||||
{
|
||||
load();
|
||||
mPtr = this;
|
||||
|
@ -30,6 +30,9 @@ void Configuration::readColors()
|
|||
QMap<QString, QColor> defaultColorMap;
|
||||
defaultColorMap.insert("AbstractTableViewSeparatorColor", QColor("#808080"));
|
||||
defaultColorMap.insert("AbstractTableViewBackgroundColor", QColor("#FFFBF0"));
|
||||
defaultColorMap.insert("AbstractTableViewTextColor", QColor("#000000"));
|
||||
defaultColorMap.insert("AbstractTableViewHeaderTextColor", QColor("#000000"));
|
||||
defaultColorMap.insert("AbstractTableViewSelectionColor", QColor("#C0C0C0"));
|
||||
|
||||
defaultColorMap.insert("DisassemblyCipColor", QColor("#FFFFFF"));
|
||||
defaultColorMap.insert("DisassemblyCipBackgroundColor", QColor("#000000"));
|
||||
|
@ -44,7 +47,9 @@ void Configuration::readColors()
|
|||
defaultColorMap.insert("DisassemblyBackgroundColor", QColor("#FFFBF0"));
|
||||
defaultColorMap.insert("DisassemblySelectionColor", QColor("#C0C0C0"));
|
||||
defaultColorMap.insert("DisassemblyAddressColor", QColor("#808080"));
|
||||
defaultColorMap.insert("DisassemblyAddressBackgroundColor", Qt::transparent);
|
||||
defaultColorMap.insert("DisassemblySelectedAddressColor", QColor("#000000"));
|
||||
defaultColorMap.insert("DisassemblySelectedAddressBackgroundColor", Qt::transparent);
|
||||
defaultColorMap.insert("DisassemblyConditionalJumpLineTrueColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("DisassemblyConditionalJumpLineFalseColor", QColor("#808080"));
|
||||
defaultColorMap.insert("DisassemblyUnconditionalJumpLineColor", QColor("#FF0000"));
|
||||
|
@ -120,6 +125,30 @@ void Configuration::readColors()
|
|||
defaultColorMap.insert("InstructionSseRegisterColor", QColor("#000080"));
|
||||
defaultColorMap.insert("InstructionSseRegisterBackgroundColor", Qt::transparent);
|
||||
|
||||
defaultColorMap.insert("HexDumpTextColor", QColor("#000000"));
|
||||
defaultColorMap.insert("HexDumpBackgroundColor", QColor("#FFFBF0"));
|
||||
defaultColorMap.insert("HexDumpSelectionColor", QColor("#C0C0C0"));
|
||||
defaultColorMap.insert("HexDumpAddressColor", QColor("#000000"));
|
||||
defaultColorMap.insert("HexDumpAddressBackgroundColor", Qt::transparent);
|
||||
defaultColorMap.insert("HexDumpLabelColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("HexDumpLabelBackgroundColor", Qt::transparent);
|
||||
|
||||
defaultColorMap.insert("StackTextColor", QColor("#808080"));
|
||||
defaultColorMap.insert("StackInactiveTextColor", QColor("#000000"));
|
||||
defaultColorMap.insert("StackBackgroundColor", QColor("#FFFBF0"));
|
||||
defaultColorMap.insert("StackSelectionColor", QColor("#C0C0C0"));
|
||||
defaultColorMap.insert("StackCspColor", QColor("#FFFFFF"));
|
||||
defaultColorMap.insert("StackCspBackgroundColor", QColor("#000000"));
|
||||
defaultColorMap.insert("StackAddressColor", QColor("#808080"));
|
||||
defaultColorMap.insert("StackAddressBackgroundColor", Qt::transparent);
|
||||
defaultColorMap.insert("StackSelectedAddressColor", QColor("#000000"));
|
||||
defaultColorMap.insert("StackSelectedAddressBackgroundColor", Qt::transparent);
|
||||
defaultColorMap.insert("StackLabelColor", QColor("#FF0000"));
|
||||
defaultColorMap.insert("StackLabelBackgroundColor", Qt::transparent);
|
||||
|
||||
defaultColorMap.insert("ThreadCurrentColor", QColor("#FFFFFF"));
|
||||
defaultColorMap.insert("ThreadCurrentBackgroundColor", QColor("#000000"));
|
||||
|
||||
Colors = defaultColors = defaultColorMap;
|
||||
//read config
|
||||
for(int i=0; i<Colors.size(); i++)
|
||||
|
@ -137,6 +166,7 @@ void Configuration::writeColors()
|
|||
QString id=Colors.keys().at(i);
|
||||
colorToConfig(id, Colors[id]);
|
||||
}
|
||||
emit colorsUpdated();
|
||||
}
|
||||
|
||||
const QList<QString> Configuration::ApiFingerprints()
|
||||
|
@ -154,6 +184,10 @@ const QColor Configuration::color(QString id)
|
|||
{
|
||||
if(Colors.contains(id))
|
||||
return Colors.constFind(id).value();
|
||||
QMessageBox msg(QMessageBox::Warning, "NOT FOUND IN CONFIG!", id);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png"));
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
#include <QColor>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
#include "Bridge.h"
|
||||
#include <QObject>
|
||||
|
||||
#define ConfigColor(x) (Configuration::instance()->color(x))
|
||||
|
||||
class Configuration
|
||||
class Configuration : public QObject
|
||||
{
|
||||
static Configuration* mPtr;
|
||||
Q_OBJECT
|
||||
public:
|
||||
static Configuration* mPtr;
|
||||
Configuration();
|
||||
static Configuration* instance();
|
||||
void load();
|
||||
|
@ -27,6 +28,9 @@ public:
|
|||
QMap<QString, QColor> Colors;
|
||||
QMap<QString, QColor> defaultColors;
|
||||
|
||||
signals:
|
||||
void colorsUpdated();
|
||||
|
||||
private:
|
||||
QColor colorFromConfig(const QString id);
|
||||
bool colorToConfig(const QString id, const QColor color);
|
||||
|
|
Loading…
Reference in New Issue