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