From 2ad272c44a3b2e4b24632007c51c6e892caf6a29 Mon Sep 17 00:00:00 2001 From: Pulak Malhotra <56169176+PulakIIIT@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:40:35 +0530 Subject: [PATCH] Removed `format` in table view --- rizin | 2 +- src/dialogs/LinkTypeDialog.cpp | 2 +- src/widgets/TypesWidget.cpp | 18 ++++++++---------- src/widgets/TypesWidget.h | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/rizin b/rizin index 254c5119..d7d2c053 160000 --- a/rizin +++ b/rizin @@ -1 +1 @@ -Subproject commit 254c5119e3563d05d02665cabbcba003c921cee8 +Subproject commit d7d2c053ea31af69704f6a5b1721f1407a42f2e4 diff --git a/src/dialogs/LinkTypeDialog.cpp b/src/dialogs/LinkTypeDialog.cpp index 837087fc..834fea2f 100644 --- a/src/dialogs/LinkTypeDialog.cpp +++ b/src/dialogs/LinkTypeDialog.cpp @@ -59,7 +59,7 @@ void LinkTypeDialog::done(int r) Core()->cmdRaw("tl- " + address); } else { // 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); diff --git a/src/widgets/TypesWidget.cpp b/src/widgets/TypesWidget.cpp index 1687f205..dd727606 100644 --- a/src/widgets/TypesWidget.cpp +++ b/src/widgets/TypesWidget.cpp @@ -39,8 +39,6 @@ QVariant TypesModel::data(const QModelIndex &index, int role) const return exp.type; case SIZE: return exp.size ? exp.size : QVariant(); - case FORMAT: - return exp.format; case CATEGORY: return exp.category; default: @@ -62,8 +60,6 @@ QVariant TypesModel::headerData(int section, Qt::Orientation, int role) const return tr("Type / Name"); case SIZE: return tr("Size"); - case FORMAT: - return tr("Format"); case CATEGORY: return tr("Category"); default: @@ -122,8 +118,6 @@ bool TypesSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn return left_exp.type < right_exp.type; case TypesModel::SIZE: return left_exp.size < right_exp.size; - case TypesModel::FORMAT: - return left_exp.format < right_exp.format; case TypesModel::CATEGORY: return left_exp.category < right_exp.category; default: @@ -183,10 +177,11 @@ TypesWidget::TypesWidget(MainWindow *main) }); 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(actionEditType, &QAction::triggered, [this]() { viewType(false); }); + // connect(actionEditType, &QAction::triggered, [this]() { viewType(false); }); connect(ui->typesTreeView, &QTreeView::doubleClicked, this, &TypesWidget::typeItemDoubleClicked); } @@ -217,6 +212,9 @@ void TypesWidget::refreshCategoryCombo(const QStringList &categories) combo->addItem(tr("(All)")); for (const QString &category : categories) { + if (category.isEmpty()) { + continue; + } combo->addItem(category, category); } @@ -240,7 +238,7 @@ void TypesWidget::showTypesContextMenu(const QPoint &pt) if (t.category != "Primitive") { // Add "Link To Address" option menu.addAction(actionViewType); - menu.addAction(actionEditType); + // menu.addAction(actionEditType); if (t.category == "Struct") { menu.addAction(ui->actionLink_Type_To_Address); } @@ -276,7 +274,7 @@ void TypesWidget::on_actionExport_Types_triggered() } QTextStream fileOut(&file); for (const auto &type : types) { - if (type.category == "Primitive"){ + if (type.category == "Primitive") { continue; } fileOut << Core()->getTypeAsC(type.type, type.category) << "\n"; diff --git a/src/widgets/TypesWidget.h b/src/widgets/TypesWidget.h index ddddeb09..f942e432 100644 --- a/src/widgets/TypesWidget.h +++ b/src/widgets/TypesWidget.h @@ -31,7 +31,7 @@ private: QList *types; public: - enum Columns { TYPE = 0, SIZE, FORMAT, CATEGORY, COUNT }; + enum Columns { TYPE = 0, SIZE, CATEGORY, COUNT }; static const int TypeDescriptionRole = Qt::UserRole; TypesModel(QList *types, QObject *parent = nullptr);