1
0
Fork 0

GUI: Cache some values in dissassembler; standardize config updates (signals/vtable)

This commit is contained in:
Nukem 2015-11-12 23:59:00 -05:00
parent 5ae3315ece
commit c56f0d4d76
12 changed files with 172 additions and 86 deletions

View File

@ -13,9 +13,6 @@ AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(pare
data.activeButtonIndex = -1; data.activeButtonIndex = -1;
mHeader = data; mHeader = data;
fontsUpdated();
colorsUpdated();
// Paint cell content only when debugger is running // Paint cell content only when debugger is running
setDrawDebugOnly(true); setDrawDebugOnly(true);
@ -41,18 +38,32 @@ AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(pare
mMouseWheelScrollDelta = 4; mMouseWheelScrollDelta = 4;
setMouseTracking(true); setMouseTracking(true);
// Signals/Slots Connections // Slots
connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(vertSliderActionSlot(int))); connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), this, SLOT(vertSliderActionSlot(int)));
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot())); connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(slot_updateColors()));
connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdatedSlot())); connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(slot_updateFonts()));
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(slot_updateShortcuts()));
// todo: try Qt::QueuedConnection to init
Initialize();
} }
void AbstractTableView::colorsUpdatedSlot() /************************************************************************************
Configuration
************************************************************************************/
void AbstractTableView::Initialize()
{ {
colorsUpdated(); // Required to be called by each constructor because
// of VTable changes
//
// Init all other updates once
updateColors();
updateFonts();
updateShortcuts();
} }
void AbstractTableView::colorsUpdated() void AbstractTableView::updateColors()
{ {
backgroundColor = ConfigColor("AbstractTableViewBackgroundColor"); backgroundColor = ConfigColor("AbstractTableViewBackgroundColor");
textColor = ConfigColor("AbstractTableViewTextColor"); textColor = ConfigColor("AbstractTableViewTextColor");
@ -61,16 +72,30 @@ void AbstractTableView::colorsUpdated()
selectionColor = ConfigColor("AbstractTableViewSelectionColor"); selectionColor = ConfigColor("AbstractTableViewSelectionColor");
} }
void AbstractTableView::fontsUpdatedSlot() void AbstractTableView::updateFonts()
{
fontsUpdated();
}
void AbstractTableView::fontsUpdated()
{ {
setFont(ConfigFont("AbstractTableView")); setFont(ConfigFont("AbstractTableView"));
} }
void AbstractTableView::updateShortcuts()
{
}
void AbstractTableView::slot_updateColors()
{
updateColors();
}
void AbstractTableView::slot_updateFonts()
{
updateFonts();
}
void AbstractTableView::slot_updateShortcuts()
{
updateShortcuts();
}
/************************************************************************************ /************************************************************************************
Painting Stuff Painting Stuff
************************************************************************************/ ************************************************************************************/

View File

@ -36,15 +36,18 @@ public:
class AbstractTableView : public QAbstractScrollArea class AbstractTableView : public QAbstractScrollArea
{ {
Q_OBJECT Q_OBJECT
public: public:
enum GuiState_t {NoState, ReadyToResize, ResizeColumnState, HeaderButtonPressed}; enum GuiState_t {NoState, ReadyToResize, ResizeColumnState, HeaderButtonPressed};
// Constructor // Constructor
explicit AbstractTableView(QWidget* parent = 0); explicit AbstractTableView(QWidget* parent = 0);
// Config updates // Configuration
virtual void colorsUpdated(); virtual void Initialize();
virtual void fontsUpdated(); virtual void updateColors();
virtual void updateFonts();
virtual void updateShortcuts();
// Pure Virtual Methods // Pure Virtual Methods
virtual QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h) = 0; virtual QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h) = 0;
@ -116,8 +119,10 @@ signals:
void repainted(); void repainted();
public slots: public slots:
void colorsUpdatedSlot(); // Configuration
void fontsUpdatedSlot(); void slot_updateColors();
void slot_updateFonts();
void slot_updateShortcuts();
// Update/Reload/Refresh/Repaint // Update/Reload/Refresh/Repaint
virtual void reloadData(); virtual void reloadData();
@ -185,13 +190,15 @@ private:
ScrollBar64_t mScrollBarAttributes; ScrollBar64_t mScrollBarAttributes;
protected: protected:
bool mAllowPainting;
bool mDrawDebugOnly;
// Configuration
QColor backgroundColor; QColor backgroundColor;
QColor textColor; QColor textColor;
QColor separatorColor; QColor separatorColor;
QColor headerTextColor; QColor headerTextColor;
QColor selectionColor; QColor selectionColor;
bool mAllowPainting;
bool mDrawDebugOnly;
}; };
#endif // ABSTRACTTABLEVIEW_H #endif // ABSTRACTTABLEVIEW_H

View File

@ -2,10 +2,8 @@
#include "Configuration.h" #include "Configuration.h"
#include "Bridge.h" #include "Bridge.h"
Disassembly::Disassembly(QWidget* parent) Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent)
: AbstractTableView(parent)
{ {
fontsUpdated();
mMemPage = new MemoryPage(0, 0); mMemPage = new MemoryPage(0, 0);
mInstBuffer.clear(); mInstBuffer.clear();
@ -32,6 +30,9 @@ Disassembly::Disassembly(QWidget* parent)
mGuiState = Disassembly::NoState; mGuiState = Disassembly::NoState;
// Update fonts immediately because they are used in calculations
updateFonts();
setRowCount(mMemPage->getSize()); setRowCount(mMemPage->getSize());
addColumnAt(getCharWidth() * 2 * sizeof(dsint) + 8, "", false); //address addColumnAt(getCharWidth() * 2 * sizeof(dsint) + 8, "", false); //address
@ -43,18 +44,41 @@ Disassembly::Disassembly(QWidget* parent)
backgroundColor = ConfigColor("DisassemblyBackgroundColor"); backgroundColor = ConfigColor("DisassemblyBackgroundColor");
// Slots
connect(Bridge::getBridge(), SIGNAL(repaintGui()), this, SLOT(reloadData())); connect(Bridge::getBridge(), SIGNAL(repaintGui()), this, SLOT(reloadData()));
connect(Bridge::getBridge(), SIGNAL(updateDump()), this, SLOT(reloadData()));
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), this, SLOT(debugStateChanged(DBGSTATE)));
Initialize();
} }
void Disassembly::colorsUpdated() void Disassembly::updateColors()
{ {
AbstractTableView::colorsUpdated(); AbstractTableView::updateColors();
backgroundColor = ConfigColor("DisassemblyBackgroundColor"); backgroundColor = ConfigColor("DisassemblyBackgroundColor");
mInstructionHighlightColor = ConfigColor("InstructionHighlightColor");
mSelectionColor = ConfigColor("DisassemblySelectionColor");
mCipBackgroundColor = ConfigColor("DisassemblyCipBackgroundColor");
mBreakpointBackgroundColor = ConfigColor("DisassemblyBreakpointBackgroundColor");
mBreakpointColor = ConfigColor("DisassemblyBreakpointColor");
mCipColor = ConfigColor("DisassemblyCipColor");
mHardwareBreakpointBackgroundColor = ConfigColor("DisassemblyHardwareBreakpointBackgroundColor");
mHardwareBreakpointColor = ConfigColor("DisassemblyHardwareBreakpointColor");
mBookmarkBackgroundColor = ConfigColor("DisassemblyBookmarkBackgroundColor");
mBookmarkColor = ConfigColor("DisassemblyBookmarkColor");
mLabelColor = ConfigColor("DisassemblyLabelColor");
mLabelBackgroundColor = ConfigColor("DisassemblyLabelBackgroundColor");
mSelectedAddressBackgroundColor = ConfigColor("DisassemblySelectedAddressBackgroundColor");
mSelectedAddressColor = ConfigColor("DisassemblySelectedAddressColor");
mAddressBackgroundColor = ConfigColor("DisassemblyAddressBackgroundColor");
mAddressColor = ConfigColor("DisassemblyAddressColor");
CapstoneTokenizer::UpdateColors(); CapstoneTokenizer::UpdateColors();
mDisasm->UpdateConfig(); mDisasm->UpdateConfig();
} }
void Disassembly::fontsUpdated() void Disassembly::updateFonts()
{ {
setFont(ConfigFont("Disassembly")); setFont(ConfigFont("Disassembly"));
} }
@ -83,7 +107,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
if(mHighlightingMode) if(mHighlightingMode)
{ {
QPen pen(ConfigColor("InstructionHighlightColor")); QPen pen(mInstructionHighlightColor);
pen.setWidth(2); pen.setWidth(2);
painter->setPen(pen); painter->setPen(pen);
QRect rect = viewport()->rect(); QRect rect = viewport()->rect();
@ -95,7 +119,7 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
// Highlight if selected // Highlight if selected
if(wIsSelected) if(wIsSelected)
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblySelectionColor"))); painter->fillRect(QRect(x, y, w, h), QBrush(mSelectionColor));
switch(col) switch(col)
{ {
@ -108,39 +132,39 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
bool isbookmark = DbgGetBookmarkAt(cur_addr); bool isbookmark = DbgGetBookmarkAt(cur_addr);
if(mInstBuffer.at(rowOffset).rva == mCipRva && !mIsRunning) //cip + not running if(mInstBuffer.at(rowOffset).rva == mCipRva && !mIsRunning) //cip + not running
{ {
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyCipBackgroundColor"))); painter->fillRect(QRect(x, y, w, h), QBrush(mCipBackgroundColor));
if(!isbookmark) //no bookmark if(!isbookmark) //no bookmark
{ {
if(bpxtype & bp_normal) //normal breakpoint if(bpxtype & bp_normal) //normal breakpoint
{ {
QColor bpColor = ConfigColor("DisassemblyBreakpointBackgroundColor"); QColor& bpColor = mBreakpointBackgroundColor;
if(!bpColor.alpha()) //we don't want transparent text if(!bpColor.alpha()) //we don't want transparent text
bpColor = ConfigColor("DisassemblyBreakpointColor"); bpColor = mBreakpointColor;
if(bpColor == ConfigColor("DisassemblyCipBackgroundColor")) if(bpColor == mCipBackgroundColor)
bpColor = ConfigColor("DisassemblyCipColor"); bpColor = mCipColor;
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 = mHardwareBreakpointBackgroundColor;
if(!hwbpColor.alpha()) //we don't want transparent text if(!hwbpColor.alpha()) //we don't want transparent text
hwbpColor = ConfigColor("DisassemblyHardwareBreakpointColor"); hwbpColor = mHardwareBreakpointColor;
if(hwbpColor == ConfigColor("DisassemblyCipBackgroundColor")) if(hwbpColor == mCipBackgroundColor)
hwbpColor = ConfigColor("DisassemblyCipColor"); hwbpColor = mCipColor;
painter->setPen(hwbpColor); painter->setPen(hwbpColor);
} }
else //no breakpoint else //no breakpoint
{ {
painter->setPen(QPen(ConfigColor("DisassemblyCipColor"))); painter->setPen(QPen(mCipColor));
} }
} }
else //bookmark else //bookmark
{ {
QColor bookmarkColor = ConfigColor("DisassemblyBookmarkBackgroundColor"); QColor bookmarkColor = mBookmarkBackgroundColor;
if(!bookmarkColor.alpha()) //we don't want transparent text if(!bookmarkColor.alpha()) //we don't want transparent text
bookmarkColor = ConfigColor("DisassemblyBookmarkColor"); bookmarkColor = mBookmarkColor;
if(bookmarkColor == ConfigColor("DisassemblyCipBackgroundColor")) if(bookmarkColor == mCipBackgroundColor)
bookmarkColor = ConfigColor("DisassemblyCipColor"); bookmarkColor = mCipColor;
painter->setPen(QPen(bookmarkColor)); painter->setPen(QPen(bookmarkColor));
} }
} }
@ -152,25 +176,25 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
{ {
if(bpxtype == bp_none) //label only if(bpxtype == bp_none) //label only
{ {
painter->setPen(QPen(ConfigColor("DisassemblyLabelColor"))); //red -> address + label text painter->setPen(QPen(mLabelColor)); //red -> address + label text
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyLabelBackgroundColor"))); //fill label background painter->fillRect(QRect(x, y, w, h), QBrush(mLabelBackgroundColor)); //fill label background
} }
else //label+breakpoint else //label+breakpoint
{ {
if(bpxtype & bp_normal) //label + normal breakpoint if(bpxtype & bp_normal) //label + normal breakpoint
{ {
painter->setPen(QPen(ConfigColor("DisassemblyBreakpointColor"))); painter->setPen(QPen(mBreakpointColor));
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyBreakpointBackgroundColor"))); //fill red painter->fillRect(QRect(x, y, w, h), QBrush(mBreakpointBackgroundColor)); //fill red
} }
else if(bpxtype & bp_hardware) //label + hardware breakpoint only else if(bpxtype & bp_hardware) //label + hardware breakpoint only
{ {
painter->setPen(QPen(ConfigColor("DisassemblyHardwareBreakpointColor"))); painter->setPen(QPen(mHardwareBreakpointColor));
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyHardwareBreakpointBackgroundColor"))); //fill ? painter->fillRect(QRect(x, y, w, h), QBrush(mHardwareBreakpointBackgroundColor)); //fill ?
} }
else //other cases -> do as normal else //other cases -> do as normal
{ {
painter->setPen(QPen(ConfigColor("DisassemblyLabelColor"))); //red -> address + label text painter->setPen(QPen(mLabelColor)); //red -> address + label text
painter->fillRect(QRect(x, y, w, h), QBrush(ConfigColor("DisassemblyLabelBackgroundColor"))); //fill label background painter->fillRect(QRect(x, y, w, h), QBrush(mLabelBackgroundColor)); //fill label background
} }
} }
} }
@ -181,13 +205,13 @@ QString Disassembly::paintContent(QPainter* painter, dsint rowBase, int rowOffse
QColor background; QColor background;
if(wIsSelected) if(wIsSelected)
{ {
background = ConfigColor("DisassemblySelectedAddressBackgroundColor"); background = mSelectedAddressBackgroundColor;
painter->setPen(QPen(ConfigColor("DisassemblySelectedAddressColor"))); //black address (DisassemblySelectedAddressColor) painter->setPen(QPen(mSelectedAddressColor)); //black address (DisassemblySelectedAddressColor)
} }
else else
{ {
background = ConfigColor("DisassemblyAddressBackgroundColor"); background = mAddressBackgroundColor;
painter->setPen(QPen(ConfigColor("DisassemblyAddressColor"))); //DisassemblyAddressColor painter->setPen(QPen(mAddressColor)); //DisassemblyAddressColor
} }
if(background.alpha()) if(background.alpha())
painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background painter->fillRect(QRect(x, y, w, h), QBrush(background)); //fill background

View File

@ -10,8 +10,10 @@ class Disassembly : public AbstractTableView
Q_OBJECT Q_OBJECT
public: public:
explicit Disassembly(QWidget* parent = 0); explicit Disassembly(QWidget* parent = 0);
void colorsUpdated();
void fontsUpdated(); // Configuration
virtual void updateColors();
virtual void updateFonts();
// Reimplemented Functions // Reimplemented Functions
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h); QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
@ -135,6 +137,24 @@ private:
CapstoneTokenizer::SingleToken mHighlightToken; CapstoneTokenizer::SingleToken mHighlightToken;
protected: protected:
// Configuration
QColor mInstructionHighlightColor;
QColor mSelectionColor;
QColor mCipBackgroundColor;
QColor mBreakpointBackgroundColor;
QColor mBreakpointColor;
QColor mCipColor;
QColor mHardwareBreakpointBackgroundColor;
QColor mHardwareBreakpointColor;
QColor mBookmarkBackgroundColor;
QColor mBookmarkColor;
QColor mLabelColor;
QColor mLabelBackgroundColor;
QColor mSelectedAddressBackgroundColor;
QColor mSelectedAddressColor;
QColor mAddressBackgroundColor;
QColor mAddressColor;
bool mRvaDisplayEnabled; bool mRvaDisplayEnabled;
duint mRvaDisplayBase; duint mRvaDisplayBase;
dsint mRvaDisplayPageBase; dsint mRvaDisplayPageBase;

View File

@ -5,7 +5,6 @@
HexDump::HexDump(QWidget* parent) : AbstractTableView(parent) HexDump::HexDump(QWidget* parent) : AbstractTableView(parent)
{ {
fontsUpdated();
SelectionData_t data; SelectionData_t data;
memset(&data, 0, sizeof(SelectionData_t)); memset(&data, 0, sizeof(SelectionData_t));
mSelection = data; mSelection = data;
@ -25,20 +24,24 @@ HexDump::HexDump(QWidget* parent) : AbstractTableView(parent)
mRvaDisplayEnabled = false; mRvaDisplayEnabled = false;
// Slots
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)));
Initialize();
} }
void HexDump::colorsUpdated() void HexDump::updateColors()
{ {
AbstractTableView::colorsUpdated(); AbstractTableView::updateColors();
backgroundColor = ConfigColor("HexDumpBackgroundColor"); backgroundColor = ConfigColor("HexDumpBackgroundColor");
textColor = ConfigColor("HexDumpTextColor"); textColor = ConfigColor("HexDumpTextColor");
selectionColor = ConfigColor("HexDumpSelectionColor"); selectionColor = ConfigColor("HexDumpSelectionColor");
reloadData(); reloadData();
} }
void HexDump::fontsUpdated() void HexDump::updateFonts()
{ {
setFont(ConfigFont("HexDump")); setFont(ConfigFont("HexDump"));
} }

View File

@ -77,8 +77,10 @@ public:
} ColumnDescriptor_t; } ColumnDescriptor_t;
explicit HexDump(QWidget* parent = 0); explicit HexDump(QWidget* parent = 0);
void colorsUpdated();
void fontsUpdated(); // Configuration
virtual void updateColors();
virtual void updateFonts();
//QString getStringToPrint(int rowBase, int rowOffset, int col); //QString getStringToPrint(int rowBase, int rowOffset, int col);
void mouseMoveEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event);

View File

@ -54,7 +54,7 @@ SearchListView::SearchListView(QWidget* parent) :
mSearchAction = new QAction("Search...", this); mSearchAction = new QAction("Search...", this);
connect(mSearchAction, SIGNAL(triggered()), this, SLOT(searchSlot())); connect(mSearchAction, SIGNAL(triggered()), this, SLOT(searchSlot()));
// Setup signals // Slots
connect(mList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*))); connect(mList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
connect(mList, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(listContextMenu(QPoint))); connect(mList, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(listContextMenu(QPoint)));
connect(mList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot())); connect(mList, SIGNAL(doubleClickedSignal()), this, SLOT(doubleClickedSlot()));

View File

@ -52,8 +52,8 @@ private:
QList<Instruction_t>* InstrBuffer; QList<Instruction_t>* InstrBuffer;
REGDUMP regDump; REGDUMP regDump;
// Configuration
private: private:
// Configuration
QColor mBackgroundColor; QColor mBackgroundColor;
QColor mConditionalJumpLineFalseColor; QColor mConditionalJumpLineFalseColor;

View File

@ -7,7 +7,6 @@
CPUStack::CPUStack(QWidget* parent) : HexDump(parent) CPUStack::CPUStack(QWidget* parent) : HexDump(parent)
{ {
fontsUpdated();
setShowHeader(false); setShowHeader(false);
int charwidth = getCharWidth(); int charwidth = getCharWidth();
ColumnDescriptor_t wColDesc; ColumnDescriptor_t wColDesc;
@ -35,28 +34,28 @@ CPUStack::CPUStack(QWidget* parent) : HexDump(parent)
wColDesc.data = dDesc; wColDesc.data = dDesc;
appendDescriptor(2000, "Comments", false, wColDesc); appendDescriptor(2000, "Comments", false, wColDesc);
connect(Bridge::getBridge(), SIGNAL(stackDumpAt(duint, duint)), this, SLOT(stackDumpAt(duint, duint)));
connect(Bridge::getBridge(), SIGNAL(selectionStackGet(SELECTIONDATA*)), this, SLOT(selectionGet(SELECTIONDATA*)));
connect(Bridge::getBridge(), SIGNAL(selectionStackSet(const SELECTIONDATA*)), this, SLOT(selectionSet(const SELECTIONDATA*)));
setupContextMenu(); setupContextMenu();
mGoto = 0; mGoto = 0;
backgroundColor = ConfigColor("StackBackgroundColor"); // Slots
textColor = ConfigColor("StackTextColor"); connect(Bridge::getBridge(), SIGNAL(stackDumpAt(duint, duint)), this, SLOT(stackDumpAt(duint, duint)));
selectionColor = ConfigColor("StackSelectionColor"); connect(Bridge::getBridge(), SIGNAL(selectionStackGet(SELECTIONDATA*)), this, SLOT(selectionGet(SELECTIONDATA*)));
connect(Bridge::getBridge(), SIGNAL(selectionStackSet(const SELECTIONDATA*)), this, SLOT(selectionSet(const SELECTIONDATA*)));
Initialize();
} }
void CPUStack::colorsUpdated() void CPUStack::updateColors()
{ {
HexDump::colorsUpdated(); HexDump::updateColors();
backgroundColor = ConfigColor("StackBackgroundColor"); backgroundColor = ConfigColor("StackBackgroundColor");
textColor = ConfigColor("StackTextColor"); textColor = ConfigColor("StackTextColor");
selectionColor = ConfigColor("StackSelectionColor"); selectionColor = ConfigColor("StackSelectionColor");
} }
void CPUStack::fontsUpdated() void CPUStack::updateFonts()
{ {
setFont(ConfigFont("Stack")); setFont(ConfigFont("Stack"));
} }

View File

@ -9,8 +9,11 @@ class CPUStack : public HexDump
Q_OBJECT Q_OBJECT
public: public:
explicit CPUStack(QWidget* parent = 0); explicit CPUStack(QWidget* parent = 0);
void colorsUpdated();
void fontsUpdated(); // Configuration
virtual void updateColors();
virtual void updateFonts();
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h); QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);
void contextMenuEvent(QContextMenuEvent* event); void contextMenuEvent(QContextMenuEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event); void mouseDoubleClickEvent(QMouseEvent* event);

View File

@ -20,6 +20,9 @@ ScriptView::ScriptView(StdTable* parent) : StdTable(parent)
setIp(0); //no IP setIp(0); //no IP
setupContextMenu();
// Slots
connect(Bridge::getBridge(), SIGNAL(scriptAdd(int, const char**)), this, SLOT(add(int, const char**))); connect(Bridge::getBridge(), SIGNAL(scriptAdd(int, const char**)), this, SLOT(add(int, const char**)));
connect(Bridge::getBridge(), SIGNAL(scriptClear()), this, SLOT(clear())); connect(Bridge::getBridge(), SIGNAL(scriptClear()), this, SLOT(clear()));
connect(Bridge::getBridge(), SIGNAL(scriptSetIp(int)), this, SLOT(setIp(int))); connect(Bridge::getBridge(), SIGNAL(scriptSetIp(int)), this, SLOT(setIp(int)));
@ -31,15 +34,13 @@ 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)));
connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint))); connect(this, SIGNAL(contextMenuSignal(QPoint)), this, SLOT(contextMenuSlot(QPoint)));
setupContextMenu(); Initialize();
selectionColor = ConfigColor("DisassemblySelectionColor");
backgroundColor = ConfigColor("DisassemblyBackgroundColor");
} }
void ScriptView::colorsUpdated() void ScriptView::updateColors()
{ {
StdTable::colorsUpdated(); StdTable::updateColors();
selectionColor = ConfigColor("DisassemblySelectionColor"); selectionColor = ConfigColor("DisassemblySelectionColor");
backgroundColor = ConfigColor("DisassemblyBackgroundColor"); backgroundColor = ConfigColor("DisassemblyBackgroundColor");
} }

View File

@ -8,7 +8,9 @@ class ScriptView : public StdTable
Q_OBJECT Q_OBJECT
public: public:
explicit ScriptView(StdTable* parent = 0); explicit ScriptView(StdTable* parent = 0);
void colorsUpdated();
// Configuration
void updateColors();
// Reimplemented Functions // Reimplemented Functions
QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h); QString paintContent(QPainter* painter, dsint rowBase, int rowOffset, int col, int x, int y, int w, int h);