Added /v search ability and usage hints in the box (#435)

This commit is contained in:
fcasal 2018-04-11 10:55:37 +01:00 committed by xarkes
parent d263778ad2
commit 7181c81a2b
3 changed files with 25 additions and 3 deletions

View File

@ -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");
}
}

View File

@ -79,6 +79,7 @@ private:
void refreshSearch();
void setScrollMode();
void updatePlaceholderText(int index);
};
#endif // SEARCHWIDGET_H

View File

@ -75,9 +75,6 @@
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>jmp rax</string>
</property>
</widget>
</item>
<item>