mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-14 08:48:36 +00:00
beautified analysis dialog (https://i.imgur.com/HN2S5in.gif)
This commit is contained in:
parent
e18899b9c8
commit
3b147a00bb
@ -12,13 +12,14 @@ OptionsDialog::OptionsDialog(QString filename, QWidget *parent):
|
||||
analThread(this)
|
||||
{
|
||||
this->core = new QRCore();
|
||||
this->anal_level = 0;
|
||||
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
ui->progressBar->setVisible(0);
|
||||
ui->statusLabel->setVisible(0);
|
||||
|
||||
ui->analSlider->setValue(defaultAnalLevel);
|
||||
|
||||
// Fill the plugins combo
|
||||
QStringList plugins;
|
||||
for (auto i : this->core->getList("asm", "plugins"))
|
||||
@ -196,7 +197,6 @@ void OptionsDialog::on_okButton_clicked()
|
||||
// options dialog should show the list of archs inside the given fatbin
|
||||
int binidx = 0; // index of subbin
|
||||
|
||||
anal_level = ui->analCheckBox->isChecked();
|
||||
this->w->add_output(" > Loading file: " + this->filename);
|
||||
this->w->core->loadFile(this->filename, loadaddr, mapaddr, rw, va, bits, binidx, load_bininfo);
|
||||
//ui->progressBar->setValue(40);
|
||||
@ -205,13 +205,7 @@ void OptionsDialog::on_okButton_clicked()
|
||||
// Threads stuff
|
||||
// connect signal/slot
|
||||
|
||||
int level = 0;
|
||||
if (anal_level)
|
||||
{
|
||||
level = ui->analSlider->value();
|
||||
}
|
||||
|
||||
analThread.start(core, level);
|
||||
analThread.start(core, ui->analSlider->value());
|
||||
}
|
||||
|
||||
void OptionsDialog::anal_finished()
|
||||
@ -277,9 +271,29 @@ void OptionsDialog::on_cancelButton_clicked()
|
||||
n->show();
|
||||
}
|
||||
|
||||
QString OptionsDialog::analysisDescription(int level)
|
||||
{
|
||||
//TODO: replace this with meaningful descriptions
|
||||
switch(level)
|
||||
{
|
||||
case 0:
|
||||
return tr("Disabled");
|
||||
case 1:
|
||||
return tr("Finger");
|
||||
case 2:
|
||||
return tr("Buttplug");
|
||||
case 3:
|
||||
return tr("Dildo");
|
||||
case 4:
|
||||
return tr("Fisting");
|
||||
default:
|
||||
return tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::on_analSlider_valueChanged(int value)
|
||||
{
|
||||
ui->analLevel->setText(QString::number(value));
|
||||
ui->analDescription->setText(tr("Analysis") + QString(" (%1)").arg(analysisDescription(value)));
|
||||
if (value == 0)
|
||||
{
|
||||
ui->analCheckBox->setChecked(false);
|
||||
@ -301,6 +315,12 @@ void OptionsDialog::on_AdvOptButton_clicked()
|
||||
{
|
||||
ui->hideFrame->setVisible(false);
|
||||
ui->AdvOptButton->setArrowType(Qt::RightArrow);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OptionsDialog::on_analCheckBox_clicked(bool checked)
|
||||
{
|
||||
if(!checked)
|
||||
defaultAnalLevel = ui->analSlider->value();
|
||||
ui->analSlider->setValue(checked ? defaultAnalLevel : 0);
|
||||
}
|
||||
|
@ -38,8 +38,10 @@ private slots:
|
||||
|
||||
void on_AdvOptButton_clicked();
|
||||
|
||||
void on_analCheckBox_clicked(bool checked);
|
||||
|
||||
private:
|
||||
int anal_level;
|
||||
int defaultAnalLevel = 3;
|
||||
QString filename;
|
||||
QString shortfn;
|
||||
Ui::OptionsDialog *ui;
|
||||
@ -48,6 +50,7 @@ private:
|
||||
|
||||
void setFilename(QString fn, QString shortfn);
|
||||
void setFilename(QString fn);
|
||||
QString analysisDescription(int level);
|
||||
};
|
||||
|
||||
#endif // OPTIONSDIALOG_H
|
||||
|
@ -188,7 +188,7 @@
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="analDescription">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -214,7 +214,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="analCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -223,7 +223,7 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze program</string>
|
||||
<string>Enabled</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -231,69 +231,38 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QSlider" name="analSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analysis level:</string>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="analLevel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>3</string>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="analSlider">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user