mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +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)
|
analThread(this)
|
||||||
{
|
{
|
||||||
this->core = new QRCore();
|
this->core = new QRCore();
|
||||||
this->anal_level = 0;
|
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
ui->progressBar->setVisible(0);
|
ui->progressBar->setVisible(0);
|
||||||
ui->statusLabel->setVisible(0);
|
ui->statusLabel->setVisible(0);
|
||||||
|
|
||||||
|
ui->analSlider->setValue(defaultAnalLevel);
|
||||||
|
|
||||||
// Fill the plugins combo
|
// Fill the plugins combo
|
||||||
QStringList plugins;
|
QStringList plugins;
|
||||||
for (auto i : this->core->getList("asm", "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
|
// options dialog should show the list of archs inside the given fatbin
|
||||||
int binidx = 0; // index of subbin
|
int binidx = 0; // index of subbin
|
||||||
|
|
||||||
anal_level = ui->analCheckBox->isChecked();
|
|
||||||
this->w->add_output(" > Loading file: " + this->filename);
|
this->w->add_output(" > Loading file: " + this->filename);
|
||||||
this->w->core->loadFile(this->filename, loadaddr, mapaddr, rw, va, bits, binidx, load_bininfo);
|
this->w->core->loadFile(this->filename, loadaddr, mapaddr, rw, va, bits, binidx, load_bininfo);
|
||||||
//ui->progressBar->setValue(40);
|
//ui->progressBar->setValue(40);
|
||||||
@ -205,13 +205,7 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
// Threads stuff
|
// Threads stuff
|
||||||
// connect signal/slot
|
// connect signal/slot
|
||||||
|
|
||||||
int level = 0;
|
analThread.start(core, ui->analSlider->value());
|
||||||
if (anal_level)
|
|
||||||
{
|
|
||||||
level = ui->analSlider->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
analThread.start(core, level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::anal_finished()
|
void OptionsDialog::anal_finished()
|
||||||
@ -277,9 +271,29 @@ void OptionsDialog::on_cancelButton_clicked()
|
|||||||
n->show();
|
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)
|
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)
|
if (value == 0)
|
||||||
{
|
{
|
||||||
ui->analCheckBox->setChecked(false);
|
ui->analCheckBox->setChecked(false);
|
||||||
@ -301,6 +315,12 @@ void OptionsDialog::on_AdvOptButton_clicked()
|
|||||||
{
|
{
|
||||||
ui->hideFrame->setVisible(false);
|
ui->hideFrame->setVisible(false);
|
||||||
ui->AdvOptButton->setArrowType(Qt::RightArrow);
|
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_AdvOptButton_clicked();
|
||||||
|
|
||||||
|
void on_analCheckBox_clicked(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int anal_level;
|
int defaultAnalLevel = 3;
|
||||||
QString filename;
|
QString filename;
|
||||||
QString shortfn;
|
QString shortfn;
|
||||||
Ui::OptionsDialog *ui;
|
Ui::OptionsDialog *ui;
|
||||||
@ -48,6 +50,7 @@ private:
|
|||||||
|
|
||||||
void setFilename(QString fn, QString shortfn);
|
void setFilename(QString fn, QString shortfn);
|
||||||
void setFilename(QString fn);
|
void setFilename(QString fn);
|
||||||
|
QString analysisDescription(int level);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OPTIONSDIALOG_H
|
#endif // OPTIONSDIALOG_H
|
||||||
|
@ -188,7 +188,7 @@
|
|||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="analDescription">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -214,7 +214,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="analCheckBox">
|
<widget class="QCheckBox" name="analCheckBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@ -223,7 +223,7 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Analyze program</string>
|
<string>Enabled</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -231,69 +231,38 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QSlider" name="analSlider">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="minimum">
|
||||||
<string>Analysis level:</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="maximum">
|
||||||
</item>
|
<number>4</number>
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="analLevel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="pageStep">
|
||||||
<font>
|
<number>1</number>
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="value">
|
||||||
<string>3</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="frame">
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly">
|
<property name="tickPosition">
|
||||||
<bool>true</bool>
|
<enum>QSlider::TicksBelow</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user