mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
Fix companion script loading
This commit is contained in:
parent
390f30b124
commit
2987bd833f
@ -286,18 +286,19 @@ void MainWindow::openNewFile(const QString &fn, int analLevel, QList<QString> ad
|
||||
|
||||
/* Prompt to load filename.r2 script */
|
||||
QString script = QString("%1.r2").arg(this->filename);
|
||||
QString loadScript;
|
||||
if (r_file_exists(script.toStdString().data())) {
|
||||
QMessageBox mb;
|
||||
mb.setWindowTitle(tr("Script loading"));
|
||||
mb.setText(tr("Do you want to load the '%1' script?").arg(script));
|
||||
mb.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
if (mb.exec() == QMessageBox::Yes) {
|
||||
core->loadScript(script);
|
||||
loadScript = script;
|
||||
}
|
||||
}
|
||||
|
||||
/* Show analysis options dialog */
|
||||
displayAnalysisOptionsDialog(analLevel, advancedOptions);
|
||||
displayAnalysisOptionsDialog(analLevel, advancedOptions, loadScript);
|
||||
}
|
||||
|
||||
void MainWindow::openNewFileFailed()
|
||||
@ -327,10 +328,11 @@ void MainWindow::closeNewFileDialog()
|
||||
newFileDialog = nullptr;
|
||||
}
|
||||
|
||||
void MainWindow::displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions)
|
||||
void MainWindow::displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions, const QString &script)
|
||||
{
|
||||
OptionsDialog *o = new OptionsDialog(this);
|
||||
o->setAttribute(Qt::WA_DeleteOnClose);
|
||||
o->setInitialScript(script);
|
||||
o->show();
|
||||
|
||||
if (analLevel >= 0) {
|
||||
@ -823,7 +825,7 @@ void MainWindow::on_actionRefresh_Panels_triggered()
|
||||
|
||||
void MainWindow::on_actionAnalyze_triggered()
|
||||
{
|
||||
displayAnalysisOptionsDialog(-1, QList<QString>());
|
||||
displayAnalysisOptionsDialog(-1, QList<QString>(), nullptr);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionImportPDB_triggered()
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
QList<QString> advancedOptions = QList<QString>());
|
||||
void displayNewFileDialog();
|
||||
void closeNewFileDialog();
|
||||
void displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions);
|
||||
void displayAnalysisOptionsDialog(int analLevel, QList<QString> advancedOptions, const QString &script);
|
||||
void openProject(const QString &project_name);
|
||||
|
||||
void initUI();
|
||||
|
@ -82,6 +82,15 @@ void OptionsDialog::updateCPUComboBox()
|
||||
ui->cpuComboBox->lineEdit()->setText(currentText);
|
||||
}
|
||||
|
||||
void OptionsDialog::setInitialScript(const QString &script)
|
||||
{
|
||||
ui->scriptCheckBox->setChecked(!script.isEmpty());
|
||||
ui->scriptLineEdit->setText(script);
|
||||
if (!script.isEmpty()) {
|
||||
ui->analSlider->setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
QString OptionsDialog::getSelectedArch()
|
||||
{
|
||||
QVariant archValue = ui->archComboBox->currentData();
|
||||
|
@ -40,6 +40,8 @@ protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::OptionsDialog> ui;
|
||||
|
||||
MainWindow *main;
|
||||
CutterCore *core;
|
||||
int defaultAnalLevel;
|
||||
@ -49,7 +51,7 @@ private:
|
||||
void updateCPUComboBox();
|
||||
|
||||
public:
|
||||
std::unique_ptr<Ui::OptionsDialog> ui;
|
||||
void setInitialScript(const QString &script);
|
||||
|
||||
QString getSelectedArch();
|
||||
QString getSelectedCPU();
|
||||
|
Loading…
Reference in New Issue
Block a user