Rename getSelText to getSelectionText for better code readability
This commit is contained in:
parent
0c9c2c0fd0
commit
8fad3bc3d7
|
@ -213,7 +213,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
|
||||||
if(!DbgIsDebugging())
|
if(!DbgIsDebugging())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
duint selectedAddr = getSelAddr();
|
duint selectedAddr = getSelectionAddr();
|
||||||
|
|
||||||
QMenu wMenu(this); //create context menu
|
QMenu wMenu(this); //create context menu
|
||||||
wMenu.addAction(mFollowDisassembly);
|
wMenu.addAction(mFollowDisassembly);
|
||||||
|
@ -287,7 +287,7 @@ QString MemoryMapView::paintContent(QPainter* painter, dsint rowBase, int rowOff
|
||||||
if(col == 0) //address
|
if(col == 0) //address
|
||||||
{
|
{
|
||||||
QString wStr = getCellContent(rowBase + rowOffset, col);
|
QString wStr = getCellContent(rowBase + rowOffset, col);
|
||||||
duint addr = getSelAddr();
|
duint addr = getSelectionAddr();
|
||||||
QColor color = mTextColor;
|
QColor color = mTextColor;
|
||||||
QColor backgroundColor = Qt::transparent;
|
QColor backgroundColor = Qt::transparent;
|
||||||
bool isBp = (DbgGetBpxTypeAt(addr) & bp_memory) == bp_memory;
|
bool isBp = (DbgGetBpxTypeAt(addr) & bp_memory) == bp_memory;
|
||||||
|
@ -507,22 +507,22 @@ void MemoryMapView::stateChangedSlot(DBGSTATE state)
|
||||||
|
|
||||||
void MemoryMapView::followDumpSlot()
|
void MemoryMapView::followDumpSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExecDirect(QString("dump %1").arg(getSelText()));
|
DbgCmdExecDirect(QString("dump %1").arg(getSelectionText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::followDisassemblerSlot()
|
void MemoryMapView::followDisassemblerSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("disasm %1").arg(getSelText()));
|
DbgCmdExec(QString("disasm %1").arg(getSelectionText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::followSymbolsSlot()
|
void MemoryMapView::followSymbolsSlot()
|
||||||
{
|
{
|
||||||
DbgCmdExec(QString("symfollow %1").arg(getSelText()));
|
DbgCmdExec(QString("symfollow %1").arg(getSelectionText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryMapView::doubleClickedSlot()
|
void MemoryMapView::doubleClickedSlot()
|
||||||
{
|
{
|
||||||
auto addr = DbgValFromString(getSelText().toUtf8().constData());
|
auto addr = DbgValFromString(getSelectionText().toUtf8().constData());
|
||||||
if(!addr)
|
if(!addr)
|
||||||
return;
|
return;
|
||||||
if(DbgFunctions()->MemIsCodePage(addr, false))
|
if(DbgFunctions()->MemIsCodePage(addr, false))
|
||||||
|
@ -539,7 +539,7 @@ void MemoryMapView::memoryExecuteSingleshootToggleSlot()
|
||||||
for(int i : getSelection())
|
for(int i : getSelection())
|
||||||
{
|
{
|
||||||
QString addr_text = getCellContent(i, ColAddress);
|
QString addr_text = getCellContent(i, ColAddress);
|
||||||
duint selectedAddr = getSelAddr();
|
duint selectedAddr = getSelectionAddr();
|
||||||
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
|
if((DbgGetBpxTypeAt(selectedAddr) & bp_memory) == bp_memory) //memory breakpoint set
|
||||||
DbgCmdExec(QString("bpmc ") + addr_text);
|
DbgCmdExec(QString("bpmc ") + addr_text);
|
||||||
else
|
else
|
||||||
|
@ -551,7 +551,7 @@ void MemoryMapView::pageMemoryRights()
|
||||||
{
|
{
|
||||||
PageMemoryRights PageMemoryRightsDialog(this);
|
PageMemoryRights PageMemoryRightsDialog(this);
|
||||||
connect(&PageMemoryRightsDialog, SIGNAL(refreshMemoryMap()), this, SLOT(refreshMap()));
|
connect(&PageMemoryRightsDialog, SIGNAL(refreshMemoryMap()), this, SLOT(refreshMap()));
|
||||||
duint addr = getSelAddr();
|
duint addr = getSelectionAddr();
|
||||||
duint size = getCellUserdata(getInitialSelection(), ColSize);
|
duint size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
PageMemoryRightsDialog.RunAddrSize(addr, size, getCellContent(getInitialSelection(), ColCurProtect));
|
PageMemoryRightsDialog.RunAddrSize(addr, size, getCellContent(getInitialSelection(), ColCurProtect));
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ void MemoryMapView::findPatternSlot()
|
||||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||||
if(hexEdit.exec() != QDialog::Accepted)
|
if(hexEdit.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
duint addr = getSelAddr();
|
duint addr = getSelectionAddr();
|
||||||
entireBlockEnabled = hexEdit.entireBlock();
|
entireBlockEnabled = hexEdit.entireBlock();
|
||||||
BridgeSettingSetUint("Gui", "MemoryMapEntireBlock", entireBlockEnabled);
|
BridgeSettingSetUint("Gui", "MemoryMapEntireBlock", entireBlockEnabled);
|
||||||
if(entireBlockEnabled)
|
if(entireBlockEnabled)
|
||||||
|
@ -637,7 +637,7 @@ void MemoryMapView::dumpMemory()
|
||||||
auto modname = mainModuleName();
|
auto modname = mainModuleName();
|
||||||
if(!modname.isEmpty())
|
if(!modname.isEmpty())
|
||||||
modname += '_';
|
modname += '_';
|
||||||
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, getSelText());
|
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, getSelectionText());
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
||||||
|
|
||||||
if(fileName.length())
|
if(fileName.length())
|
||||||
|
@ -652,7 +652,7 @@ void MemoryMapView::loadMemory()
|
||||||
auto modname = mainModuleName();
|
auto modname = mainModuleName();
|
||||||
if(!modname.isEmpty())
|
if(!modname.isEmpty())
|
||||||
modname += '_';
|
modname += '_';
|
||||||
auto addr = getSelText();
|
auto addr = getSelectionText();
|
||||||
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, addr);
|
QString defaultFile = QString("%1/%2%3.bin").arg(QDir::currentPath(), modname, addr);
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Load Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Load Memory Region"), defaultFile, tr("Binary files (*.bin);;All files (*.*)"));
|
||||||
|
|
||||||
|
@ -691,7 +691,7 @@ void MemoryMapView::gotoExpressionSlot()
|
||||||
if(!mGoto)
|
if(!mGoto)
|
||||||
mGoto = new GotoDialog(this);
|
mGoto = new GotoDialog(this);
|
||||||
mGoto->setWindowTitle(tr("Enter the address to find..."));
|
mGoto->setWindowTitle(tr("Enter the address to find..."));
|
||||||
mGoto->setInitialExpression(ToPtrString(getSelAddr()));
|
mGoto->setInitialExpression(ToPtrString(getSelectionAddr()));
|
||||||
if(mGoto->exec() == QDialog::Accepted)
|
if(mGoto->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
selectAddress(DbgValFromString(mGoto->expressionText.toUtf8().constData()));
|
selectAddress(DbgValFromString(mGoto->expressionText.toUtf8().constData()));
|
||||||
|
@ -700,7 +700,7 @@ void MemoryMapView::gotoExpressionSlot()
|
||||||
|
|
||||||
void MemoryMapView::addVirtualModSlot()
|
void MemoryMapView::addVirtualModSlot()
|
||||||
{
|
{
|
||||||
auto base = getSelAddr();
|
auto base = getSelectionAddr();
|
||||||
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
VirtualModDialog mDialog(this);
|
VirtualModDialog mDialog(this);
|
||||||
mDialog.setData("", base, size);
|
mDialog.setData("", base, size);
|
||||||
|
@ -714,7 +714,7 @@ void MemoryMapView::addVirtualModSlot()
|
||||||
|
|
||||||
void MemoryMapView::findReferencesSlot()
|
void MemoryMapView::findReferencesSlot()
|
||||||
{
|
{
|
||||||
auto base = getSelAddr();
|
auto base = getSelectionAddr();
|
||||||
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
auto size = getCellUserdata(getInitialSelection(), ColSize);
|
||||||
DbgCmdExec(QString("reffindrange %1, %2, dis.sel()").arg(ToPtrString(base)).arg(ToPtrString(base + size)));
|
DbgCmdExec(QString("reffindrange %1, %2, dis.sel()").arg(ToPtrString(base)).arg(ToPtrString(base + size)));
|
||||||
emit showReferences();
|
emit showReferences();
|
||||||
|
@ -736,7 +736,7 @@ void MemoryMapView::disassembleAtSlot(dsint va, dsint cip)
|
||||||
|
|
||||||
void MemoryMapView::commentSlot()
|
void MemoryMapView::commentSlot()
|
||||||
{
|
{
|
||||||
duint wVA = getSelAddr();
|
duint wVA = getSelectionAddr();
|
||||||
LineEditDialog mLineEdit(this);
|
LineEditDialog mLineEdit(this);
|
||||||
QString addr_text = ToPtrString(wVA);
|
QString addr_text = ToPtrString(wVA);
|
||||||
char comment_text[MAX_COMMENT_SIZE] = "";
|
char comment_text[MAX_COMMENT_SIZE] = "";
|
||||||
|
|
|
@ -53,14 +53,17 @@ private:
|
||||||
ColCurProtect,
|
ColCurProtect,
|
||||||
ColAllocProtect
|
ColAllocProtect
|
||||||
};
|
};
|
||||||
inline duint getSelAddr()
|
|
||||||
|
inline duint getSelectionAddr()
|
||||||
{
|
{
|
||||||
return getCellUserdata(getInitialSelection(), ColAddress);
|
return getCellUserdata(getInitialSelection(), ColAddress);
|
||||||
}
|
}
|
||||||
inline QString getSelText()
|
|
||||||
|
inline QString getSelectionText()
|
||||||
{
|
{
|
||||||
return getCellContent(getInitialSelection(), ColAddress);
|
return getCellContent(getInitialSelection(), ColAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* makeCommandAction(QAction* action, const QString & command);
|
QAction* makeCommandAction(QAction* action, const QString & command);
|
||||||
|
|
||||||
GotoDialog* mGoto = nullptr;
|
GotoDialog* mGoto = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue