Removed format in table view

This commit is contained in:
Pulak Malhotra 2021-08-10 16:40:35 +05:30
parent 7e9eede5dc
commit 2ad272c44a
4 changed files with 11 additions and 13 deletions

2
rizin

@ -1 +1 @@
Subproject commit 254c5119e3563d05d02665cabbcba003c921cee8 Subproject commit d7d2c053ea31af69704f6a5b1721f1407a42f2e4

View File

@ -59,7 +59,7 @@ void LinkTypeDialog::done(int r)
Core()->cmdRaw("tl- " + address); Core()->cmdRaw("tl- " + address);
} else { } else {
// Create link // Create link
Core()->cmdRaw(QString("tl %1 = %2").arg(type).arg(address)); Core()->cmdRaw(QString("tl %1 %2").arg(type).arg(address));
} }
QDialog::done(r); QDialog::done(r);

View File

@ -39,8 +39,6 @@ QVariant TypesModel::data(const QModelIndex &index, int role) const
return exp.type; return exp.type;
case SIZE: case SIZE:
return exp.size ? exp.size : QVariant(); return exp.size ? exp.size : QVariant();
case FORMAT:
return exp.format;
case CATEGORY: case CATEGORY:
return exp.category; return exp.category;
default: default:
@ -62,8 +60,6 @@ QVariant TypesModel::headerData(int section, Qt::Orientation, int role) const
return tr("Type / Name"); return tr("Type / Name");
case SIZE: case SIZE:
return tr("Size"); return tr("Size");
case FORMAT:
return tr("Format");
case CATEGORY: case CATEGORY:
return tr("Category"); return tr("Category");
default: default:
@ -122,8 +118,6 @@ bool TypesSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
return left_exp.type < right_exp.type; return left_exp.type < right_exp.type;
case TypesModel::SIZE: case TypesModel::SIZE:
return left_exp.size < right_exp.size; return left_exp.size < right_exp.size;
case TypesModel::FORMAT:
return left_exp.format < right_exp.format;
case TypesModel::CATEGORY: case TypesModel::CATEGORY:
return left_exp.category < right_exp.category; return left_exp.category < right_exp.category;
default: default:
@ -183,10 +177,11 @@ TypesWidget::TypesWidget(MainWindow *main)
}); });
actionViewType = new QAction(tr("View Type"), this); actionViewType = new QAction(tr("View Type"), this);
actionEditType = new QAction(tr("Edit Type"), this); // disable option to edit types till there is an RZ API for it
// actionEditType = new QAction(tr("Edit Type"), this);
connect(actionViewType, &QAction::triggered, [this]() { viewType(true); }); connect(actionViewType, &QAction::triggered, [this]() { viewType(true); });
connect(actionEditType, &QAction::triggered, [this]() { viewType(false); }); // connect(actionEditType, &QAction::triggered, [this]() { viewType(false); });
connect(ui->typesTreeView, &QTreeView::doubleClicked, this, connect(ui->typesTreeView, &QTreeView::doubleClicked, this,
&TypesWidget::typeItemDoubleClicked); &TypesWidget::typeItemDoubleClicked);
} }
@ -217,6 +212,9 @@ void TypesWidget::refreshCategoryCombo(const QStringList &categories)
combo->addItem(tr("(All)")); combo->addItem(tr("(All)"));
for (const QString &category : categories) { for (const QString &category : categories) {
if (category.isEmpty()) {
continue;
}
combo->addItem(category, category); combo->addItem(category, category);
} }
@ -240,7 +238,7 @@ void TypesWidget::showTypesContextMenu(const QPoint &pt)
if (t.category != "Primitive") { if (t.category != "Primitive") {
// Add "Link To Address" option // Add "Link To Address" option
menu.addAction(actionViewType); menu.addAction(actionViewType);
menu.addAction(actionEditType); // menu.addAction(actionEditType);
if (t.category == "Struct") { if (t.category == "Struct") {
menu.addAction(ui->actionLink_Type_To_Address); menu.addAction(ui->actionLink_Type_To_Address);
} }
@ -276,7 +274,7 @@ void TypesWidget::on_actionExport_Types_triggered()
} }
QTextStream fileOut(&file); QTextStream fileOut(&file);
for (const auto &type : types) { for (const auto &type : types) {
if (type.category == "Primitive"){ if (type.category == "Primitive") {
continue; continue;
} }
fileOut << Core()->getTypeAsC(type.type, type.category) << "\n"; fileOut << Core()->getTypeAsC(type.type, type.category) << "\n";

View File

@ -31,7 +31,7 @@ private:
QList<TypeDescription> *types; QList<TypeDescription> *types;
public: public:
enum Columns { TYPE = 0, SIZE, FORMAT, CATEGORY, COUNT }; enum Columns { TYPE = 0, SIZE, CATEGORY, COUNT };
static const int TypeDescriptionRole = Qt::UserRole; static const int TypeDescriptionRole = Qt::UserRole;
TypesModel(QList<TypeDescription> *types, QObject *parent = nullptr); TypesModel(QList<TypeDescription> *types, QObject *parent = nullptr);