2018-05-28 14:19:04 +00:00
|
|
|
|
|
|
|
#include "utils/AsyncTask.h"
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
#include "InitialOptionsDialog.h"
|
|
|
|
#include "ui_InitialOptionsDialog.h"
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "MainWindow.h"
|
2017-10-02 09:41:28 +00:00
|
|
|
#include "dialogs/NewFileDialog.h"
|
2018-05-26 18:49:57 +00:00
|
|
|
#include "dialogs/AsyncTaskDialog.h"
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "utils/Helpers.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
#include <QSettings>
|
2017-07-11 16:41:58 +00:00
|
|
|
#include <QFileInfo>
|
2017-09-27 20:23:18 +00:00
|
|
|
#include <QFileDialog>
|
2017-04-18 10:03:47 +00:00
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
InitialOptionsDialog::InitialOptionsDialog(MainWindow *main):
|
2018-08-15 17:32:33 +00:00
|
|
|
QDialog(0), // parent must not be main
|
2018-08-18 10:51:11 +00:00
|
|
|
ui(new Ui::InitialOptionsDialog),
|
2017-10-09 18:08:35 +00:00
|
|
|
main(main),
|
2018-04-12 06:33:30 +00:00
|
|
|
core(Core()),
|
2018-08-15 17:32:33 +00:00
|
|
|
defaultAnalLevel(1)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-03-31 00:51:14 +00:00
|
|
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
2018-02-12 12:22:53 +00:00
|
|
|
ui->logoSvgWidget->load(Config()->getLogoFile());
|
2017-04-10 12:22:18 +00:00
|
|
|
ui->analSlider->setValue(defaultAnalLevel);
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
// Fill the plugins combo
|
2017-10-09 18:08:35 +00:00
|
|
|
asm_plugins = core->getAsmPluginNames();
|
2017-05-03 09:09:57 +00:00
|
|
|
for (auto plugin : asm_plugins)
|
2017-09-27 20:23:18 +00:00
|
|
|
ui->archComboBox->addItem(plugin, plugin);
|
2017-10-09 18:08:35 +00:00
|
|
|
ui->archComboBox->setToolTip(core->cmd("e? asm.arch").trimmed());
|
2017-09-27 20:23:18 +00:00
|
|
|
|
|
|
|
// cpu combo box
|
|
|
|
ui->cpuComboBox->lineEdit()->setPlaceholderText(tr("Auto"));
|
2017-10-09 18:08:35 +00:00
|
|
|
ui->cpuComboBox->setToolTip(core->cmd("e? asm.cpu").trimmed());
|
2017-09-27 20:23:18 +00:00
|
|
|
updateCPUComboBox();
|
|
|
|
|
|
|
|
// os combo box
|
2017-10-09 18:08:35 +00:00
|
|
|
for (const auto &plugin : core->cmdList("e asm.os=?"))
|
2017-09-27 20:23:18 +00:00
|
|
|
ui->kernelComboBox->addItem(plugin, plugin);
|
2017-10-09 18:08:35 +00:00
|
|
|
ui->kernelComboBox->setToolTip(core->cmd("e? asm.os").trimmed());
|
2017-09-27 20:23:18 +00:00
|
|
|
|
2017-10-09 18:08:35 +00:00
|
|
|
ui->bitsComboBox->setToolTip(core->cmd("e? asm.bits").trimmed());
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-03-07 12:02:39 +00:00
|
|
|
ui->entry_analbb->setToolTip(core->cmd("e? anal.bb.maxsize").trimmed());
|
2018-03-21 20:32:32 +00:00
|
|
|
|
2017-10-09 18:08:35 +00:00
|
|
|
for (auto plugin : core->getRBinPluginDescriptions("bin"))
|
2017-09-29 11:32:53 +00:00
|
|
|
ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin));
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
ui->hideFrame->setVisible(false);
|
2017-07-24 11:05:28 +00:00
|
|
|
ui->analoptionsFrame->setVisible(false);
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-09-27 20:23:18 +00:00
|
|
|
updatePDBLayout();
|
|
|
|
|
|
|
|
connect(ui->pdbCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updatePDBLayout()));
|
|
|
|
|
2018-04-30 06:39:48 +00:00
|
|
|
updateScriptLayout();
|
2018-07-17 19:00:35 +00:00
|
|
|
|
2018-04-30 06:39:48 +00:00
|
|
|
connect(ui->scriptCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateScriptLayout()));
|
|
|
|
|
2017-12-06 12:32:35 +00:00
|
|
|
connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
2017-04-09 19:55:06 +00:00
|
|
|
|
2017-05-13 18:09:36 +00:00
|
|
|
ui->programLineEdit->setText(main->getFilename());
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
InitialOptionsDialog::~InitialOptionsDialog() {}
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::updateCPUComboBox()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QString currentText = ui->cpuComboBox->lineEdit()->text();
|
|
|
|
ui->cpuComboBox->clear();
|
|
|
|
|
|
|
|
QString cmd = "e asm.cpu=?";
|
|
|
|
|
|
|
|
QString arch = getSelectedArch();
|
|
|
|
if (!arch.isNull())
|
|
|
|
cmd += " @a:" + arch;
|
|
|
|
|
|
|
|
ui->cpuComboBox->addItem("");
|
2017-10-09 18:08:35 +00:00
|
|
|
ui->cpuComboBox->addItems(core->cmdList(cmd));
|
2017-09-27 20:23:18 +00:00
|
|
|
|
|
|
|
ui->cpuComboBox->lineEdit()->setText(currentText);
|
|
|
|
}
|
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
2018-07-24 16:49:52 +00:00
|
|
|
{
|
2018-08-18 16:04:45 +00:00
|
|
|
if (options.analCmd.isEmpty()) {
|
2018-07-24 16:49:52 +00:00
|
|
|
ui->analSlider->setValue(0);
|
2018-08-18 16:04:45 +00:00
|
|
|
} else if (options.analCmd == QList<QString>({ "aaa" })) {
|
|
|
|
ui->analSlider->setValue(1);
|
|
|
|
} else if (options.analCmd == QList<QString>({ "aaaa" })){
|
|
|
|
// TODO: These checks must always be in sync with getSelectedAdvancedAnalCmds(), which is dangerous
|
|
|
|
ui->aa_symbols->setChecked(options.analCmd.contains("aa"));
|
|
|
|
ui->aar_references->setChecked(options.analCmd.contains("aar"));
|
|
|
|
ui->aac_calls->setChecked(options.analCmd.contains("aac"));
|
|
|
|
ui->aab_basicblocks->setChecked(options.analCmd.contains("aab"));
|
|
|
|
ui->aan_rename->setChecked(options.analCmd.contains("aan"));
|
|
|
|
ui->aae_emulate->setChecked(options.analCmd.contains("aae"));
|
|
|
|
ui->aat_consecutive->setChecked(options.analCmd.contains("aat"));
|
|
|
|
ui->afta_typeargument->setChecked(options.analCmd.contains("afta"));
|
|
|
|
ui->aaT_aftertrap->setChecked(options.analCmd.contains("aaT"));
|
|
|
|
ui->aap_preludes->setChecked(options.analCmd.contains("aap"));
|
|
|
|
ui->jmptbl->setChecked(options.analCmd.contains("e! anal.jmptbl"));
|
|
|
|
ui->pushret->setChecked(options.analCmd.contains("e! anal.pushret"));
|
|
|
|
ui->hasnext->setChecked(options.analCmd.contains("e! anal.hasnext"));
|
2018-07-24 16:49:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
if (!options.script.isEmpty()) {
|
|
|
|
ui->scriptCheckBox->setChecked(true);
|
|
|
|
ui->scriptLineEdit->setText(options.script);
|
2018-08-18 16:09:49 +00:00
|
|
|
ui->analSlider->setValue(0);
|
|
|
|
} else {
|
|
|
|
ui->scriptCheckBox->setChecked(false);
|
|
|
|
ui->scriptLineEdit->setText("");
|
2018-08-18 16:04:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
shellcode = options.shellcode;
|
|
|
|
|
|
|
|
// TODO: all other options should also be applied to the ui
|
2018-08-10 17:12:00 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
QString InitialOptionsDialog::getSelectedArch()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QVariant archValue = ui->archComboBox->currentData();
|
|
|
|
return archValue.isValid() ? archValue.toString() : nullptr;
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
QString InitialOptionsDialog::getSelectedCPU()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QString cpu = ui->cpuComboBox->currentText();
|
|
|
|
if (cpu.isNull() || cpu.isEmpty())
|
|
|
|
return nullptr;
|
|
|
|
return cpu;
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
int InitialOptionsDialog::getSelectedBits()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QString sel_bits = ui->bitsComboBox->currentText();
|
2018-03-21 20:32:32 +00:00
|
|
|
if (sel_bits != "Auto") {
|
2017-09-27 20:23:18 +00:00
|
|
|
return sel_bits.toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
int InitialOptionsDialog::getSelectedBBSize()
|
2018-03-07 12:02:39 +00:00
|
|
|
{
|
|
|
|
QString sel_bbsize = ui->entry_analbb->text();
|
|
|
|
bool ok;
|
|
|
|
int bbsize = sel_bbsize.toInt(&ok);
|
|
|
|
if (ok)
|
|
|
|
return bbsize;
|
|
|
|
return 1024;
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
InitialOptions::Endianness InitialOptionsDialog::getSelectedEndianness()
|
2018-01-20 10:35:31 +00:00
|
|
|
{
|
2018-03-21 20:32:32 +00:00
|
|
|
switch (ui->endiannessComboBox->currentIndex()) {
|
2018-01-20 10:35:31 +00:00
|
|
|
case 1:
|
2018-05-27 16:03:29 +00:00
|
|
|
return InitialOptions::Endianness::Little;
|
2018-01-20 10:35:31 +00:00
|
|
|
case 2:
|
2018-05-27 16:03:29 +00:00
|
|
|
return InitialOptions::Endianness::Big;
|
2018-01-20 10:35:31 +00:00
|
|
|
default:
|
2018-05-27 16:03:29 +00:00
|
|
|
return InitialOptions::Endianness::Auto;
|
2018-01-20 10:35:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
QString InitialOptionsDialog::getSelectedOS()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QVariant os = ui->kernelComboBox->currentData();
|
|
|
|
return os.isValid() ? os.toString() : nullptr;
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
QList<QString> InitialOptionsDialog::getSelectedAdvancedAnalCmds()
|
2018-05-27 19:38:19 +00:00
|
|
|
{
|
|
|
|
QList<QString> advanced = QList<QString>();
|
|
|
|
if (ui->analSlider->value() == 3) {
|
|
|
|
if (ui->aa_symbols->isChecked()) {
|
|
|
|
advanced << "aa";
|
|
|
|
}
|
|
|
|
if (ui->aar_references->isChecked()) {
|
|
|
|
advanced << "aar";
|
|
|
|
}
|
|
|
|
if (ui->aac_calls->isChecked()) {
|
|
|
|
advanced << "aac";
|
|
|
|
}
|
|
|
|
if (ui->aab_basicblocks->isChecked()) {
|
|
|
|
advanced << "aab";
|
|
|
|
}
|
|
|
|
if (ui->aan_rename->isChecked()) {
|
|
|
|
advanced << "aan";
|
|
|
|
}
|
|
|
|
if (ui->aae_emulate->isChecked()) {
|
|
|
|
advanced << "aae";
|
|
|
|
}
|
|
|
|
if (ui->aat_consecutive->isChecked()) {
|
|
|
|
advanced << "aat";
|
|
|
|
}
|
|
|
|
if (ui->afta_typeargument->isChecked()) {
|
|
|
|
advanced << "afta";
|
|
|
|
}
|
|
|
|
if (ui->aaT_aftertrap->isChecked()) {
|
|
|
|
advanced << "aaT";
|
|
|
|
}
|
|
|
|
if (ui->aap_preludes->isChecked()) {
|
|
|
|
advanced << "aap";
|
|
|
|
}
|
|
|
|
if (ui->jmptbl->isChecked()) {
|
|
|
|
advanced << "e! anal.jmptbl";
|
|
|
|
}
|
|
|
|
if (ui->pushret->isChecked()) {
|
|
|
|
advanced << "e! anal.pushret";
|
|
|
|
}
|
|
|
|
if (ui->hasnext->isChecked()) {
|
|
|
|
advanced << "e! anal.hasnext";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return advanced;
|
|
|
|
}
|
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> advanced*/)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
2017-05-13 18:09:36 +00:00
|
|
|
main->initUI();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2018-05-27 16:03:29 +00:00
|
|
|
InitialOptions options;
|
2018-05-26 18:49:57 +00:00
|
|
|
|
2018-05-27 16:03:29 +00:00
|
|
|
options.filename = main->getFilename();
|
2018-08-10 17:12:00 +00:00
|
|
|
options.shellcode = this->shellcode;
|
2018-05-27 16:03:29 +00:00
|
|
|
|
|
|
|
// Where the bin header is located in the file (-B)
|
|
|
|
if (ui->entry_loadOffset->text().length() > 0) {
|
|
|
|
options.binLoadAddr = Core()->math(ui->entry_loadOffset->text());
|
|
|
|
}
|
|
|
|
|
|
|
|
options.mapAddr = Core()->math(ui->entry_mapOffset->text()); // Where to map the file once loaded (-m)
|
|
|
|
options.arch = getSelectedArch();
|
|
|
|
options.cpu = getSelectedCPU();
|
|
|
|
options.bits = getSelectedBits();
|
|
|
|
options.os = getSelectedOS();
|
|
|
|
options.writeEnabled = ui->writeCheckBox->isChecked();
|
|
|
|
options.loadBinInfo = !ui->binCheckBox->isChecked();
|
|
|
|
QVariant forceBinPluginData = ui->formatComboBox->currentData();
|
|
|
|
if (!forceBinPluginData.isNull()) {
|
|
|
|
RBinPluginDescription pluginDesc = forceBinPluginData.value<RBinPluginDescription>();
|
|
|
|
options.forceBinPlugin = pluginDesc.name;
|
|
|
|
}
|
|
|
|
options.demangle = ui->demangleCheckBox->isChecked();
|
|
|
|
if (ui->pdbCheckBox->isChecked()) {
|
|
|
|
options.pdbFile = ui->pdbLineEdit->text();
|
|
|
|
}
|
|
|
|
if (ui->scriptCheckBox->isChecked()) {
|
|
|
|
options.script = ui->scriptLineEdit->text();
|
|
|
|
}
|
|
|
|
options.endian = getSelectedEndianness();
|
|
|
|
options.bbsize = getSelectedBBSize();
|
|
|
|
|
2018-08-18 16:04:45 +00:00
|
|
|
int level = ui->analSlider->value();
|
2018-05-27 19:38:19 +00:00
|
|
|
switch(level) {
|
|
|
|
case 1:
|
|
|
|
options.analCmd = { "aaa" };
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
options.analCmd = { "aaaa" };
|
|
|
|
break;
|
|
|
|
case 3:
|
2018-08-18 16:04:45 +00:00
|
|
|
options.analCmd = getSelectedAdvancedAnalCmds();
|
2018-05-27 19:38:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
options.analCmd = {};
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-28 14:19:04 +00:00
|
|
|
AnalTask *analTask = new AnalTask();
|
2018-05-27 16:03:29 +00:00
|
|
|
analTask->setOptions(options);
|
|
|
|
|
2018-07-07 10:39:28 +00:00
|
|
|
MainWindow *main = this->main;
|
2018-05-27 16:03:29 +00:00
|
|
|
connect(analTask, &AnalTask::openFileFailed, main, &MainWindow::openNewFileFailed);
|
2018-07-07 10:39:28 +00:00
|
|
|
connect(analTask, &AsyncTask::finished, main, [analTask, main]() {
|
|
|
|
if (analTask->getOpenFileFailed()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
main->finalizeOpen();
|
|
|
|
});
|
2018-05-27 16:03:29 +00:00
|
|
|
|
2018-05-28 14:19:04 +00:00
|
|
|
AsyncTask::Ptr analTaskPtr(analTask);
|
|
|
|
|
|
|
|
AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr);
|
2018-06-26 20:11:26 +00:00
|
|
|
taskDialog->setInterruptOnClose(true);
|
2018-05-27 16:03:29 +00:00
|
|
|
taskDialog->setAttribute(Qt::WA_DeleteOnClose);
|
2018-05-26 18:49:57 +00:00
|
|
|
taskDialog->show();
|
2018-05-27 16:03:29 +00:00
|
|
|
|
2018-07-07 10:32:51 +00:00
|
|
|
Core()->getAsyncTaskManager()->start(analTaskPtr);
|
|
|
|
|
2018-05-27 16:03:29 +00:00
|
|
|
done(0);
|
2017-09-28 22:04:57 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_okButton_clicked()
|
2017-04-28 13:09:40 +00:00
|
|
|
{
|
2018-08-01 19:31:57 +00:00
|
|
|
ui->okButton->setEnabled(false);
|
2018-08-18 16:04:45 +00:00
|
|
|
setupAndStartAnalysis();
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::closeEvent(QCloseEvent *event)
|
2018-03-09 12:57:57 +00:00
|
|
|
{
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
QString InitialOptionsDialog::analysisDescription(int level)
|
2017-04-10 12:22:18 +00:00
|
|
|
{
|
|
|
|
//TODO: replace this with meaningful descriptions
|
2018-03-21 20:32:32 +00:00
|
|
|
switch (level) {
|
2017-04-10 12:22:18 +00:00
|
|
|
case 0:
|
2017-07-24 11:05:28 +00:00
|
|
|
return tr("No analysis");
|
2017-04-10 12:22:18 +00:00
|
|
|
case 1:
|
2017-07-24 11:05:28 +00:00
|
|
|
return tr("Auto-Analysis (aaa)");
|
2017-04-10 12:22:18 +00:00
|
|
|
case 2:
|
2017-07-24 11:05:28 +00:00
|
|
|
return tr("Auto-Analysis Experimental (aaaa)");
|
2017-04-10 12:22:18 +00:00
|
|
|
case 3:
|
2017-07-24 11:05:28 +00:00
|
|
|
return tr("Advanced");
|
2017-04-10 12:22:18 +00:00
|
|
|
default:
|
|
|
|
return tr("Unknown");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_analSlider_valueChanged(int value)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
2017-04-12 15:02:35 +00:00
|
|
|
ui->analDescription->setText(tr("Level") + QString(": %1").arg(analysisDescription(value)));
|
2018-03-21 20:32:32 +00:00
|
|
|
if (value == 0) {
|
2017-03-29 10:18:37 +00:00
|
|
|
ui->analCheckBox->setChecked(false);
|
2017-09-09 09:36:15 +00:00
|
|
|
ui->analCheckBox->setText(tr("Analysis: Disabled"));
|
2018-03-21 20:32:32 +00:00
|
|
|
} else {
|
2017-03-29 10:18:37 +00:00
|
|
|
ui->analCheckBox->setChecked(true);
|
2017-09-09 09:36:15 +00:00
|
|
|
ui->analCheckBox->setText(tr("Analysis: Enabled"));
|
2018-03-21 20:32:32 +00:00
|
|
|
if (value == 3) {
|
2017-07-24 11:05:28 +00:00
|
|
|
ui->analoptionsFrame->setVisible(true);
|
2018-03-21 20:32:32 +00:00
|
|
|
} else {
|
2017-07-24 11:05:28 +00:00
|
|
|
ui->analoptionsFrame->setVisible(false);
|
|
|
|
}
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_AdvOptButton_clicked()
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
2018-03-21 20:32:32 +00:00
|
|
|
if (ui->AdvOptButton->isChecked()) {
|
2017-03-29 10:18:37 +00:00
|
|
|
ui->hideFrame->setVisible(true);
|
|
|
|
ui->AdvOptButton->setArrowType(Qt::DownArrow);
|
2018-03-21 20:32:32 +00:00
|
|
|
} else {
|
2017-03-29 10:18:37 +00:00
|
|
|
ui->hideFrame->setVisible(false);
|
|
|
|
ui->AdvOptButton->setArrowType(Qt::RightArrow);
|
|
|
|
}
|
|
|
|
}
|
2017-04-10 12:22:18 +00:00
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_analCheckBox_clicked(bool checked)
|
2017-04-10 12:22:18 +00:00
|
|
|
{
|
2017-04-13 15:51:58 +00:00
|
|
|
if (!checked)
|
2017-04-10 12:22:18 +00:00
|
|
|
defaultAnalLevel = ui->analSlider->value();
|
|
|
|
ui->analSlider->setValue(checked ? defaultAnalLevel : 0);
|
|
|
|
}
|
2017-09-27 20:23:18 +00:00
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_archComboBox_currentIndexChanged(int)
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
updateCPUComboBox();
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::updatePDBLayout()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
ui->pdbWidget->setEnabled(ui->pdbCheckBox->isChecked());
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_pdbSelectButton_clicked()
|
2017-09-27 20:23:18 +00:00
|
|
|
{
|
|
|
|
QFileDialog dialog(this);
|
|
|
|
dialog.setWindowTitle(tr("Select PDB file"));
|
|
|
|
dialog.setNameFilters({ tr("PDB file (*.pdb)"), tr("All files (*)") });
|
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
if (!dialog.exec()) {
|
2017-09-27 20:23:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fileName = dialog.selectedFiles().first();
|
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
if (!fileName.isEmpty()) {
|
2017-09-27 20:23:18 +00:00
|
|
|
ui->pdbLineEdit->setText(fileName);
|
|
|
|
}
|
|
|
|
}
|
2017-12-06 12:32:35 +00:00
|
|
|
|
2018-04-30 06:39:48 +00:00
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::updateScriptLayout()
|
2018-04-30 06:39:48 +00:00
|
|
|
{
|
|
|
|
ui->scriptWidget->setEnabled(ui->scriptCheckBox->isChecked());
|
|
|
|
}
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::on_scriptSelectButton_clicked()
|
2018-04-30 06:39:48 +00:00
|
|
|
{
|
|
|
|
QFileDialog dialog(this);
|
|
|
|
dialog.setWindowTitle(tr("Select radare2 script file"));
|
|
|
|
dialog.setNameFilters({ tr("Script file (*.r2)"), tr("All files (*)") });
|
|
|
|
|
|
|
|
if (!dialog.exec()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fileName = dialog.selectedFiles().first();
|
|
|
|
|
|
|
|
if (!fileName.isEmpty()) {
|
|
|
|
ui->scriptLineEdit->setText(fileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-18 10:51:11 +00:00
|
|
|
void InitialOptionsDialog::reject()
|
2017-12-06 12:32:35 +00:00
|
|
|
{
|
|
|
|
done(0);
|
|
|
|
NewFileDialog *n = new NewFileDialog(nullptr);
|
|
|
|
n->show();
|
|
|
|
}
|