mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 00:35:05 +00:00
Add Permissions Column to SectionsWidget
This commit is contained in:
parent
e48392a1e0
commit
a3a8daae55
@ -1838,7 +1838,7 @@ QList<SectionDescription> CutterCore::getAllSections()
|
||||
section.vsize = sectionObject[RJsonKey::vsize].toVariant().toULongLong();
|
||||
section.paddr = sectionObject[RJsonKey::paddr].toVariant().toULongLong();
|
||||
section.size = sectionObject[RJsonKey::size].toVariant().toULongLong();
|
||||
section.flags = sectionObject[RJsonKey::flags].toString();
|
||||
section.perm = sectionObject[RJsonKey::perm].toString();
|
||||
section.entropy = sectionObject[RJsonKey::entropy].toString();
|
||||
|
||||
ret << section;
|
||||
|
@ -123,7 +123,7 @@ struct SectionDescription {
|
||||
RVA size;
|
||||
RVA vsize;
|
||||
QString name;
|
||||
QString flags;
|
||||
QString perm;
|
||||
QString entropy;
|
||||
};
|
||||
|
||||
|
@ -62,6 +62,8 @@ QVariant SectionsModel::data(const QModelIndex &index, int role) const
|
||||
return RAddressString(section.vaddr);
|
||||
case SectionsModel::EndAddressColumn:
|
||||
return RAddressString(section.vaddr + section.vsize);
|
||||
case SectionsModel::PermissionsColumn:
|
||||
return section.perm;
|
||||
case SectionsModel::EntropyColumn:
|
||||
return section.entropy;
|
||||
default:
|
||||
@ -91,6 +93,8 @@ QVariant SectionsModel::headerData(int section, Qt::Orientation, int role) const
|
||||
return tr("Address");
|
||||
case SectionsModel::EndAddressColumn:
|
||||
return tr("End Address");
|
||||
case SectionsModel::PermissionsColumn:
|
||||
return tr("Permissions");
|
||||
case SectionsModel::EntropyColumn:
|
||||
return tr("Entropy");
|
||||
default:
|
||||
@ -115,6 +119,7 @@ bool SectionsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri
|
||||
auto rightSection = right.data(SectionsModel::SectionDescriptionRole).value<SectionDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
default:
|
||||
case SectionsModel::NameColumn:
|
||||
return leftSection.name < rightSection.name;
|
||||
case SectionsModel::SizeColumn:
|
||||
@ -125,14 +130,11 @@ bool SectionsProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri
|
||||
return leftSection.vaddr < rightSection.vaddr;
|
||||
}
|
||||
return leftSection.vsize < rightSection.vsize;
|
||||
case SectionsModel::PermissionsColumn:
|
||||
return leftSection.perm < rightSection.perm;
|
||||
case SectionsModel::EntropyColumn:
|
||||
return leftSection.entropy < rightSection.entropy;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
SectionsWidget::SectionsWidget(MainWindow *main, QAction *action) :
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
QList<SectionDescription> *sections;
|
||||
|
||||
public:
|
||||
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, EntropyColumn, ColumnCount };
|
||||
enum Column { NameColumn = 0, SizeColumn, AddressColumn, EndAddressColumn, PermissionsColumn, EntropyColumn, ColumnCount };
|
||||
enum Role { SectionDescriptionRole = Qt::UserRole };
|
||||
|
||||
SectionsModel(QList<SectionDescription> *sections, QObject *parent = nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user