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