mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Added /v search ability and usage hints in the box (#435)
This commit is contained in:
parent
d263778ad2
commit
7181c81a2b
@ -145,6 +145,9 @@ SearchWidget::SearchWidget(MainWindow *main, QAction *action) :
|
||||
refreshSearch();
|
||||
});
|
||||
|
||||
connect(ui->searchspaceCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[=](int index){ updatePlaceholderText(index);});
|
||||
|
||||
}
|
||||
|
||||
SearchWidget::~SearchWidget() {}
|
||||
@ -172,6 +175,7 @@ void SearchWidget::refreshSearchspaces()
|
||||
ui->searchspaceCombo->addItem(tr("string"), QVariant("/j"));
|
||||
ui->searchspaceCombo->addItem(tr("hex string"), QVariant("/xj"));
|
||||
ui->searchspaceCombo->addItem(tr("ROP gadgets"), QVariant("/Rj"));
|
||||
ui->searchspaceCombo->addItem(tr("32bit value"), QVariant("/vj"));
|
||||
|
||||
if (cur_idx > 0)
|
||||
ui->searchspaceCombo->setCurrentIndex(cur_idx);
|
||||
@ -196,3 +200,23 @@ void SearchWidget::setScrollMode()
|
||||
{
|
||||
qhelpers::setVerticalScrollMode(ui->searchTreeView);
|
||||
}
|
||||
|
||||
void SearchWidget::updatePlaceholderText(int index)
|
||||
{
|
||||
switch(index){
|
||||
case 1: // string
|
||||
ui->filterLineEdit->setPlaceholderText("foobar");
|
||||
break;
|
||||
case 2: // hex string
|
||||
ui->filterLineEdit->setPlaceholderText("deadbeef");
|
||||
break;
|
||||
case 3: // ROP gadgets
|
||||
ui->filterLineEdit->setPlaceholderText("pop,,pop");
|
||||
break;
|
||||
case 4: // 32bit value
|
||||
ui->filterLineEdit->setPlaceholderText("0xdeadbeef");
|
||||
break;
|
||||
default:
|
||||
ui->filterLineEdit->setPlaceholderText("jmp rax");
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ private:
|
||||
|
||||
void refreshSearch();
|
||||
void setScrollMode();
|
||||
void updatePlaceholderText(int index);
|
||||
};
|
||||
|
||||
#endif // SEARCHWIDGET_H
|
||||
|
@ -75,9 +75,6 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>jmp rax</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user