Fix the issue with column resizing (#753)
* Fix the issue with column resizing. * Add an icon for the message box. * UI for allocating & freeing memory * UI for allocating & freeing memory * Add missing "emit" statement * Upload translation for new GUI operations
This commit is contained in:
parent
38a1626fe8
commit
4b405cd18e
|
@ -171,6 +171,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
|
|||
{
|
||||
if(!mAllowPainting)
|
||||
return;
|
||||
|
||||
if(getColumnCount()) //make sure the last column is never smaller than the window
|
||||
{
|
||||
int totalWidth = 0;
|
||||
|
@ -348,11 +349,11 @@ void AbstractTableView::mouseMoveEvent(QMouseEvent* event)
|
|||
case AbstractTableView::ResizeColumnState:
|
||||
{
|
||||
int delta = event->x() - mColResizeData.lastPosX;
|
||||
bool bCanResize = (getColumnWidth(mColResizeData.index) + delta) >= 20;
|
||||
bool bCanResize = (getColumnWidth(mColumnOrder[mColResizeData.index]) + delta) >= 20;
|
||||
if(bCanResize)
|
||||
{
|
||||
int wNewSize = getColumnWidth(mColResizeData.index) + delta;
|
||||
setColumnWidth(mColResizeData.index, wNewSize);
|
||||
int wNewSize = getColumnWidth(mColumnOrder[mColResizeData.index]) + delta;
|
||||
setColumnWidth(mColumnOrder[mColResizeData.index], wNewSize);
|
||||
mColResizeData.lastPosX = event->x();
|
||||
updateViewport();
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ void ColumnReorderDialog::on_okButton_clicked()
|
|||
if(ui->listDisplayed->count() == 0)
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Warning, tr("Error"), tr("There isn't anything to display yet!"));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "MemoryMapView.h"
|
||||
#include "Configuration.h"
|
||||
|
@ -7,6 +8,7 @@
|
|||
#include "YaraRuleSelectionDialog.h"
|
||||
#include "EntropyDialog.h"
|
||||
#include "HexEditDialog.h"
|
||||
#include "LineEditDialog.h"
|
||||
|
||||
MemoryMapView::MemoryMapView(StdTable* parent) : StdTable(parent)
|
||||
{
|
||||
|
@ -102,6 +104,16 @@ void MemoryMapView::setupContextMenu()
|
|||
this->addAction(mMemoryExecuteSingleshootToggle);
|
||||
connect(mMemoryExecuteSingleshootToggle, SIGNAL(triggered()), this, SLOT(memoryExecuteSingleshootToggleSlot()));
|
||||
|
||||
//Allocate memory
|
||||
mMemoryAllocate = new QAction(tr("&Allocate memory"), this);
|
||||
connect(mMemoryAllocate, SIGNAL(triggered()), this, SLOT(memoryAllocateSlot()));
|
||||
this->addAction(mMemoryAllocate);
|
||||
|
||||
//Free memory
|
||||
mMemoryFree = new QAction(tr("&Free memory"), this);
|
||||
connect(mMemoryFree, SIGNAL(triggered()), this, SLOT(memoryFreeSlot()));
|
||||
this->addAction(mMemoryFree);
|
||||
|
||||
//Entropy
|
||||
mEntropy = new QAction(QIcon(":/icons/images/entropy.png"), tr("Entropy..."), this);
|
||||
connect(mEntropy, SIGNAL(triggered()), this, SLOT(entropy()));
|
||||
|
@ -141,6 +153,9 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
|
|||
wMenu.addAction(mFindPattern);
|
||||
wMenu.addAction(mSwitchView);
|
||||
wMenu.addSeparator();
|
||||
wMenu.addAction(mMemoryAllocate);
|
||||
wMenu.addAction(mMemoryFree);
|
||||
wMenu.addSeparator();
|
||||
wMenu.addAction(mPageMemoryRights);
|
||||
wMenu.addSeparator();
|
||||
wMenu.addMenu(mBreakpointMenu);
|
||||
|
@ -440,12 +455,63 @@ void MemoryMapView::entropy()
|
|||
delete[] data;
|
||||
}
|
||||
|
||||
void MemoryMapView::memoryAllocateSlot()
|
||||
{
|
||||
LineEditDialog mLineEdit(this);
|
||||
mLineEdit.setWindowTitle(tr("Enter the size of memory to allocate."));
|
||||
if(mLineEdit.exec() == QDialog::Accepted)
|
||||
{
|
||||
QByteArray textUtf8 = mLineEdit.editText.toUtf8();
|
||||
if(!DbgIsValidExpression(textUtf8.constData()))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Error"), tr("The expression \"%1\" is not valid.").arg(mLineEdit.editText));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
duint memsize = DbgValFromString(textUtf8.constData());
|
||||
if(memsize == 0) // 1GB
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Warning, tr("Warning"), tr("You're trying to allocate a zero-sized buffer just now."));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
if(memsize > 1024 * 1024 * 1024)
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Error"), tr("The size of buffer you're trying to allocate exceeds 1GB. Please check your expression to ensure nothing is wrong."));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
DbgCmdExecDirect(QString("alloc %1").arg(ToPtrString(memsize)).toUtf8().constData());
|
||||
duint addr = DbgValFromString("$result");
|
||||
if(addr != 0)
|
||||
{
|
||||
DbgCmdExec("Dump $result");
|
||||
emit showCpu();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Error"), tr("Memory allocation failed!"));
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryMapView::memoryFreeSlot()
|
||||
{
|
||||
DbgCmdExec(QString("free %1").arg(getCellContent(getInitialSelection(), 0)).toUtf8().constData());
|
||||
}
|
||||
|
||||
void MemoryMapView::findPatternSlot()
|
||||
{
|
||||
HexEditDialog hexEdit(this);
|
||||
hexEdit.showEntireBlock(true);
|
||||
hexEdit.mHexEdit->setOverwriteMode(false);
|
||||
hexEdit.setWindowTitle("Find Pattern...");
|
||||
hexEdit.setWindowTitle(tr("Find Pattern..."));
|
||||
if(hexEdit.exec() != QDialog::Accepted)
|
||||
return;
|
||||
duint addr = getCellContent(getInitialSelection(), 0).toULongLong(0, 16);
|
||||
|
@ -458,7 +524,7 @@ void MemoryMapView::findPatternSlot()
|
|||
|
||||
void MemoryMapView::dumpMemory()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, "Save Memory Region", QDir::currentPath(), tr("All files (*.*)"));
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Memory Region"), QDir::currentPath(), tr("All files (*.*)"));
|
||||
|
||||
if(fileName.length())
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@ public slots:
|
|||
void memoryExecuteRestoreSlot();
|
||||
void memoryRemoveSlot();
|
||||
void memoryExecuteSingleshootToggleSlot();
|
||||
void memoryAllocateSlot();
|
||||
void memoryFreeSlot();
|
||||
void contextMenuSlot(const QPoint & pos);
|
||||
void switchView();
|
||||
void pageMemoryRights();
|
||||
|
@ -61,6 +63,8 @@ private:
|
|||
QAction* mMemoryExecuteSingleshootToggle;
|
||||
QAction* mEntropy;
|
||||
QAction* mFindPattern;
|
||||
QAction* mMemoryAllocate;
|
||||
QAction* mMemoryFree;
|
||||
};
|
||||
|
||||
#endif // MEMORYMAPVIEW_H
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<context>
|
||||
<name>AbstractTableView</name>
|
||||
<message>
|
||||
<location filename="../Src/BasicView/AbstractTableView.cpp" line="445"/>
|
||||
<location filename="../Src/BasicView/AbstractTableView.cpp" line="510"/>
|
||||
<location filename="../Src/BasicView/AbstractTableView.cpp" line="446"/>
|
||||
<location filename="../Src/BasicView/AbstractTableView.cpp" line="511"/>
|
||||
<source>Edit columns</source>
|
||||
<translation>编辑表头</translation>
|
||||
</message>
|
||||
|
@ -4103,17 +4103,17 @@ run</translation>
|
|||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.ui" line="776"/>
|
||||
<source>Trace over until condition</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>条件性步过</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.ui" line="785"/>
|
||||
<source>Trace into until condition</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>条件性步进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.cpp" line="60"/>
|
||||
<source>x32dbg</source>
|
||||
<translation>x64dbg {32d?}</translation>
|
||||
<translation>x64dbg (32位)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.cpp" line="77"/>
|
||||
|
@ -4171,12 +4171,12 @@ run</translation>
|
|||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.cpp" line="601"/>
|
||||
<source>Enter trace into finishing condition.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>请输入步进结束的条件。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.cpp" line="611"/>
|
||||
<source>Enter trace over finishing condition.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>请输入步过结束的条件。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MainWindow.cpp" line="634"/>
|
||||
|
@ -4239,139 +4239,196 @@ Make sure to fill in as much information as possible.</source>
|
|||
<context>
|
||||
<name>MemoryMapView</name>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="17"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="19"/>
|
||||
<source>Address</source>
|
||||
<translation>地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="18"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="20"/>
|
||||
<source>Size</source>
|
||||
<translation>大小</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="19"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="21"/>
|
||||
<source>Info</source>
|
||||
<translation>页面信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="19"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="21"/>
|
||||
<source>Page Information</source>
|
||||
<translation>页面信息</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="20"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="22"/>
|
||||
<source>Type</source>
|
||||
<translation>类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="20"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="22"/>
|
||||
<source>Allocation Type</source>
|
||||
<translation>分配类型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="21"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="23"/>
|
||||
<source>Protection</source>
|
||||
<translation>页面保护</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="21"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="23"/>
|
||||
<source>Current Protection</source>
|
||||
<translation>当前保护</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="22"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="24"/>
|
||||
<source>Initial</source>
|
||||
<translation>初始保护</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="22"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="24"/>
|
||||
<source>Allocation Protection</source>
|
||||
<translation>初始保护</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="36"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="38"/>
|
||||
<source>&Follow in Dump</source>
|
||||
<translation>在内存窗口中转到(&F)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="40"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="42"/>
|
||||
<source>Follow in &Disassembler</source>
|
||||
<translation>在反汇编中转到(&D)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="52"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="54"/>
|
||||
<source>Set Page Memory Rights</source>
|
||||
<translation>设置内存保护权限</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="56"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="58"/>
|
||||
<source>&Switch View</source>
|
||||
<translation>切换视图(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="60"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="62"/>
|
||||
<source>Memory &Breakpoint</source>
|
||||
<translation>内存断点(&B)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="63"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="65"/>
|
||||
<source>Access</source>
|
||||
<translation>读取</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="64"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="74"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="84"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="66"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="76"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="86"/>
|
||||
<source>&Singleshoot</source>
|
||||
<translation>一次性(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="67"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="77"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="88"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="69"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="79"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="90"/>
|
||||
<source>&Restore</source>
|
||||
<translation>重复设置(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="73"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="75"/>
|
||||
<source>Write</source>
|
||||
<translation>写入</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="83"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="85"/>
|
||||
<source>Execute</source>
|
||||
<translation>执行</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="94"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="96"/>
|
||||
<source>&Remove</source>
|
||||
<translation>删除(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="106"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="108"/>
|
||||
<source>&Allocate memory</source>
|
||||
<translation>分配内存(&A)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="113"/>
|
||||
<source>&Free memory</source>
|
||||
<translation>释放内存(&F)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="118"/>
|
||||
<source>Entropy...</source>
|
||||
<translation>熵...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="110"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="122"/>
|
||||
<source>&Find Pattern...</source>
|
||||
<translation>搜索匹配特征(&F)...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="116"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="128"/>
|
||||
<source>&Dump Memory to File</source>
|
||||
<translation>将内存转存到文件(&D)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="147"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="162"/>
|
||||
<source>&Copy</source>
|
||||
<translation>复制(&C)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="461"/>
|
||||
<source>Enter the size of memory to allocate.</source>
|
||||
<translation>请输入需要分配的内存大小。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="467"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="480"/>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="493"/>
|
||||
<source>Error</source>
|
||||
<translation>发生错误</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="467"/>
|
||||
<source>The expression "%1" is not valid.</source>
|
||||
<translation>您刚才输入的表达式"%1"是无效的。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="474"/>
|
||||
<source>Warning</source>
|
||||
<translation>温馨提示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="474"/>
|
||||
<source>You're trying to allocate a zero-sized buffer just now.</source>
|
||||
<translation>您刚刚试图分配一个零字节大小的缓冲区。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="480"/>
|
||||
<source>The size of buffer you're trying to allocate exceeds 1GB. Please check your expression to ensure nothing is wrong.</source>
|
||||
<translation>你想要分配的内存大小已经超过了1GB。请检查表达式以确保输入正确。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="493"/>
|
||||
<source>Memory allocation failed!</source>
|
||||
<translation>内存分配失败了!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="510"/>
|
||||
<source>Find Pattern...</source>
|
||||
<translation>搜索匹配特征...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="523"/>
|
||||
<source>All files (*.*)</source>
|
||||
<translation>所有文件 (*.*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../Src/Gui/MemoryMapView.cpp" line="523"/>
|
||||
<source>Save Memory Region</source>
|
||||
<translation>保存内存区域</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NotesManager</name>
|
||||
|
|
Loading…
Reference in New Issue