summaryrefslogtreecommitdiff
path: root/view/sharedcache/ui/dsctriage.h
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2025-04-14 11:15:01 -0400
committerAlexander Taylor <alex@vector35.com>2025-04-14 14:53:51 -0400
commit507935f828188047ee009d2216a2c2d92c8b83fd (patch)
tree4247355ef5788809c8e47fc11e345a623f053196 /view/sharedcache/ui/dsctriage.h
parent37e20cc30d57fff6b78bf6be9be2230a8ff973cc (diff)
Fixes for multiple issues in DSC/KC Triage views.
1. Crash on kernel cache image load 2. Duplicate Load Image buttons in kernel cache view 3. Improper selection behavior in both views 4. Address column should no longer resize to be smaller than contents 5. Symbol tables should now be properly sortable
Diffstat (limited to 'view/sharedcache/ui/dsctriage.h')
-rw-r--r--view/sharedcache/ui/dsctriage.h73
1 files changed, 44 insertions, 29 deletions
diff --git a/view/sharedcache/ui/dsctriage.h b/view/sharedcache/ui/dsctriage.h
index a16457e3..e847625e 100644
--- a/view/sharedcache/ui/dsctriage.h
+++ b/view/sharedcache/ui/dsctriage.h
@@ -1,24 +1,29 @@
-#include <binaryninjaapi.h>
+#include <QHeaderView>
#include <QItemDelegate>
+#include <QPainter>
+#include <QSortFilterProxyModel>
+#include <QStandardItemModel>
#include <QStyledItemDelegate>
-
-#include "uitypes.h"
-#include "viewframe.h"
-#include "animation.h"
-#include "uicontext.h"
-
+#include <QTableView>
+#include <binaryninjaapi.h>
+#include <progresstask.h>
+#include <sharedcacheapi.h>
#include "filter.h"
#include "symboltable.h"
-
#include "ui/fontsettings.h"
+#include "uicontext.h"
+#include "uitypes.h"
+#include "viewframe.h"
#ifndef BINARYNINJA_DSCTRIAGE_H
#define BINARYNINJA_DSCTRIAGE_H
+using namespace BinaryNinja;
+using namespace SharedCacheAPI;
+
class AddressColorDelegate : public QStyledItemDelegate
{
-
public:
explicit AddressColorDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {}
@@ -27,6 +32,7 @@ public:
QStyleOptionViewItem opt = option;
initStyleOption(&opt, index);
+ opt.font = getMonospaceFont(qobject_cast<QWidget*>(parent()));
opt.palette.setColor(QPalette::Text, getThemeColor(BNThemeColor::AddressColor));
opt.displayAlignment = Qt::AlignCenter | Qt::AlignVCenter;
@@ -130,7 +136,10 @@ public:
void scrollToFirstItem() override {
if (model()->rowCount() > 0) {
- scrollTo(model()->index(0, 0));
+ QModelIndex top = indexAt(rect().topLeft());
+ if (top.isValid()) {
+ scrollTo(top);
+ }
}
}
@@ -143,34 +152,39 @@ public:
void selectFirstItem() override {
if (model()->rowCount() > 0) {
- QModelIndex firstIndex = model()->index(0, 0);
- selectionModel()->select(firstIndex, QItemSelectionModel::ClearAndSelect);
+ QModelIndex top = indexAt(rect().topLeft());
+ if (top.isValid()) {
+ selectionModel()->select(top, QItemSelectionModel::ClearAndSelect);
+ setCurrentIndex(top);
+ }
}
}
void activateFirstItem() override {
if (model()->rowCount() > 0) {
- QModelIndex firstIndex = model()->index(0, 0);
- setCurrentIndex(firstIndex);
- emit activated(firstIndex);
- }
- }
-
- bool eventFilter(QObject* obj, QEvent* event) override {
- if (event->type() == QEvent::KeyPress) {
- auto* keyEvent = dynamic_cast<QKeyEvent*>(event);
- if (keyEvent->key() == Qt::Key_Escape) {
- clearSelection();
- return true;
- }
- if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
- emit activated(currentIndex());
- return true;
+ QModelIndex topLeft = indexAt(rect().topLeft());
+ if (topLeft.isValid()) {
+ setCurrentIndex(topLeft);
+ emit activated(topLeft);
}
}
- return QTableView::eventFilter(obj, event);
}
+// bool eventFilter(QObject* obj, QEvent* event) override {
+// if (event->type() == QEvent::KeyPress) {
+// auto* keyEvent = dynamic_cast<QKeyEvent*>(event);
+// if (keyEvent->key() == Qt::Key_Escape) {
+// clearSelection();
+// return true;
+// }
+// if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) {
+// emit activated(currentIndex());
+// return true;
+// }
+// }
+// return QTableView::eventFilter(obj, event);
+// }
+
signals:
void filterTextChanged(const QString& text);
};
@@ -184,6 +198,7 @@ class DSCTriageView : public QWidget, public View, public UIContextNotification
SplitTabWidget* m_triageTabs;
DockableTabCollection* m_triageCollection;
+ FilterableTableView* m_imageTable;
QStandardItemModel* m_imageModel;
SymbolTableView* m_symbolTable;