mirror of
https://github.com/x64dbg/x64dbg.git
synced 2024-11-23 21:10:14 +00:00
Add support for getCellUserdata in StdSearchListView
This commit is contained in:
parent
911329e8e6
commit
ee13290541
@ -42,6 +42,7 @@ public:
|
||||
void deleteAllColumns() override;
|
||||
|
||||
virtual QString getCellContent(duint row, duint column) = 0;
|
||||
virtual duint getCellUserdata(duint row, duint column) = 0;
|
||||
virtual bool isValidIndex(duint row, duint column) = 0;
|
||||
virtual void sortRows(duint column, bool ascending) = 0;
|
||||
|
||||
|
@ -182,7 +182,7 @@ void ReferenceView::addColumnAtRef(int width, QString title)
|
||||
StdSearchListView::addColumnAt(width, title, true);
|
||||
}
|
||||
|
||||
void ReferenceView::setRowCount(dsint count)
|
||||
void ReferenceView::setRowCount(duint count)
|
||||
{
|
||||
if(!stdList()->getRowCount() && count) //from zero to N rows
|
||||
searchSelectionChanged(0);
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
public slots:
|
||||
void addColumnAtRef(int width, QString title);
|
||||
|
||||
void setRowCount(dsint count) override;
|
||||
void setRowCount(duint count) override;
|
||||
|
||||
void setSingleSelection(int index, bool scroll);
|
||||
void addCommand(QString title, QString command);
|
||||
|
@ -57,16 +57,22 @@ void StdSearchListView::loadColumnFromConfig(const QString & viewName)
|
||||
stdSearchList()->loadColumnFromConfig(viewName);
|
||||
}
|
||||
|
||||
void StdSearchListView::setRowCount(dsint count)
|
||||
void StdSearchListView::setRowCount(duint count)
|
||||
{
|
||||
//clearFilter();
|
||||
stdList()->setRowCount(count);
|
||||
}
|
||||
|
||||
void StdSearchListView::setCellContent(int r, int c, QString s)
|
||||
void StdSearchListView::setCellContent(duint row, duint column, QString s)
|
||||
{
|
||||
//clearFilter();
|
||||
stdList()->setCellContent(r, c, s);
|
||||
stdList()->setCellContent(row, column, s);
|
||||
}
|
||||
|
||||
void StdSearchListView::setCellUserdata(duint row, duint column, duint userdata)
|
||||
{
|
||||
//clearFilter();
|
||||
stdList()->setCellUserdata(row, column, userdata);
|
||||
}
|
||||
|
||||
void StdSearchListView::reloadData()
|
||||
|
@ -18,12 +18,13 @@ public:
|
||||
void enableMultiSelection(bool enabled);
|
||||
void setAddressColumn(int col, bool cipBase = false);
|
||||
void loadColumnFromConfig(const QString & viewName);
|
||||
virtual void setRowCount(duint count);
|
||||
void setCellContent(duint row, duint column, QString s);
|
||||
void setCellUserdata(duint row, duint column, duint userdata);
|
||||
void setSearchStartCol(duint column);
|
||||
|
||||
public slots:
|
||||
virtual void setRowCount(dsint count);
|
||||
void setCellContent(int r, int c, QString s);
|
||||
void reloadData();
|
||||
void setSearchStartCol(duint col);
|
||||
|
||||
private:
|
||||
StdTableSearchList* mSearchListData;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
void setCellContent(duint r, duint c, QString s, duint userdata);
|
||||
QString getCellContent(duint r, duint c) override;
|
||||
void setCellUserdata(duint r, duint c, duint userdata);
|
||||
duint getCellUserdata(duint r, duint c);
|
||||
duint getCellUserdata(duint r, duint c) override;
|
||||
bool isValidIndex(duint r, duint c) override;
|
||||
void sortRows(duint column, bool ascending) override;
|
||||
|
||||
|
@ -41,12 +41,12 @@ SourceView::~SourceView()
|
||||
clear();
|
||||
}
|
||||
|
||||
QString SourceView::getCellContent(duint r, duint c)
|
||||
QString SourceView::getCellContent(duint row, duint column)
|
||||
{
|
||||
if(!isValidIndex(r, c))
|
||||
if(!isValidIndex(row, column))
|
||||
return QString();
|
||||
LineData & line = mLines.at(r - mPrepareTableOffset);
|
||||
switch(c)
|
||||
LineData & line = mLines.at(row - mPrepareTableOffset);
|
||||
switch(column)
|
||||
{
|
||||
case ColAddr:
|
||||
return line.addr ? ToPtrString(line.addr) : QString();
|
||||
@ -59,13 +59,29 @@ QString SourceView::getCellContent(duint r, duint c)
|
||||
return "INVALID";
|
||||
}
|
||||
|
||||
bool SourceView::isValidIndex(duint r, duint c)
|
||||
duint SourceView::getCellUserdata(duint row, duint column)
|
||||
{
|
||||
if(!isValidIndex(row, column))
|
||||
return 0;
|
||||
LineData & line = mLines.at(row - mPrepareTableOffset);
|
||||
switch(column)
|
||||
{
|
||||
case ColAddr:
|
||||
return line.addr;
|
||||
case ColLine:
|
||||
return line.index + 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool SourceView::isValidIndex(duint row, duint column)
|
||||
{
|
||||
if(!mFileLines)
|
||||
return false;
|
||||
if(c < ColAddr || c > ColCode)
|
||||
if(column < ColAddr || column > ColCode)
|
||||
return false;
|
||||
return r >= 0 && size_t(r) < mFileLines->size();
|
||||
return row >= 0 && size_t(row) < mFileLines->size();
|
||||
}
|
||||
|
||||
void SourceView::sortRows(duint column, bool ascending)
|
||||
|
@ -13,8 +13,9 @@ public:
|
||||
SourceView(QString path, duint addr, QWidget* parent = nullptr);
|
||||
~SourceView();
|
||||
|
||||
QString getCellContent(duint r, duint c) override;
|
||||
bool isValidIndex(duint r, duint c) override;
|
||||
QString getCellContent(duint row, duint column) override;
|
||||
duint getCellUserdata(duint row, duint column) override;
|
||||
bool isValidIndex(duint row, duint column) override;
|
||||
void sortRows(duint column, bool ascending) override;
|
||||
void prepareData() override;
|
||||
|
||||
|
@ -56,20 +56,40 @@ ZehSymbolTable::ZehSymbolTable(QWidget* parent)
|
||||
Initialize();
|
||||
}
|
||||
|
||||
QString ZehSymbolTable::getCellContent(duint r, duint c)
|
||||
QString ZehSymbolTable::getCellContent(duint row, duint column)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
if(!isValidIndex(r, c))
|
||||
if(!isValidIndex(row, column))
|
||||
return QString();
|
||||
SymbolInfoWrapper info;
|
||||
DbgGetSymbolInfo(&mData.at(r), info.put());
|
||||
return symbolInfoString(info.get(), c);
|
||||
DbgGetSymbolInfo(&mData.at(row), info.put());
|
||||
return symbolInfoString(info.get(), column);
|
||||
}
|
||||
|
||||
bool ZehSymbolTable::isValidIndex(duint r, duint c)
|
||||
duint ZehSymbolTable::getCellUserdata(duint row, duint column)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
return r >= 0 && r < (int)mData.size() && c >= 0 && c <= ColUndecorated;
|
||||
if(!isValidIndex(row, column))
|
||||
return 0;
|
||||
SymbolInfoWrapper info;
|
||||
DbgGetSymbolInfo(&mData.at(row), info.put());
|
||||
switch(column)
|
||||
{
|
||||
case ColAddr:
|
||||
return info->addr;
|
||||
case ColOrdinal:
|
||||
return info->ordinal;
|
||||
case ColType:
|
||||
return info->type;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ZehSymbolTable::isValidIndex(duint row, duint column)
|
||||
{
|
||||
QMutexLocker lock(&mMutex);
|
||||
return row >= 0 && row < (int)mData.size() && column >= 0 && column <= ColUndecorated;
|
||||
}
|
||||
|
||||
void ZehSymbolTable::sortRows(duint column, bool ascending)
|
||||
|
@ -9,8 +9,9 @@ class ZehSymbolTable : public AbstractStdTable
|
||||
public:
|
||||
ZehSymbolTable(QWidget* parent = nullptr);
|
||||
|
||||
QString getCellContent(duint r, duint c) override;
|
||||
bool isValidIndex(duint r, duint c) override;
|
||||
QString getCellContent(duint row, duint column) override;
|
||||
duint getCellUserdata(duint row, duint column) override;
|
||||
bool isValidIndex(duint row, duint column) override;
|
||||
void sortRows(duint column, bool ascending) override;
|
||||
|
||||
friend class SymbolView;
|
||||
|
Loading…
Reference in New Issue
Block a user