mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Minor Header Optimizations (#1429)
1. remove unnecessary includes. compile optimization 2. add more const for getter functions
This commit is contained in:
parent
5477054d5e
commit
ae35ac9d08
@ -25,10 +25,9 @@ void EditInstructionDialog::on_buttonBox_rejected()
|
||||
close();
|
||||
}
|
||||
|
||||
QString EditInstructionDialog::getInstruction()
|
||||
QString EditInstructionDialog::getInstruction() const
|
||||
{
|
||||
QString ret = ui->lineEdit->text();
|
||||
return ret;
|
||||
return ui->lineEdit->text();
|
||||
}
|
||||
|
||||
void EditInstructionDialog::setInstruction(const QString &instruction)
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define EDITINSTRUCTIONDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
@ -21,7 +20,7 @@ public:
|
||||
explicit EditInstructionDialog(InstructionEditMode isEditingBytes, QWidget *parent = nullptr);
|
||||
~EditInstructionDialog();
|
||||
|
||||
QString getInstruction();
|
||||
QString getInstruction() const;
|
||||
void setInstruction(const QString &instruction);
|
||||
|
||||
private slots:
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "EditMethodDialog.h"
|
||||
#include "ui_EditMethodDialog.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
EditMethodDialog::EditMethodDialog(bool classFixed, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::EditMethodDialog)
|
||||
@ -103,7 +105,7 @@ void EditMethodDialog::setMethod(const AnalMethodDescription &desc)
|
||||
validateInput();
|
||||
}
|
||||
|
||||
QString EditMethodDialog::getClass()
|
||||
QString EditMethodDialog::getClass() const
|
||||
{
|
||||
if (classComboBox) {
|
||||
int index = classComboBox->currentIndex();
|
||||
@ -116,7 +118,7 @@ QString EditMethodDialog::getClass()
|
||||
}
|
||||
}
|
||||
|
||||
AnalMethodDescription EditMethodDialog::getMethod()
|
||||
AnalMethodDescription EditMethodDialog::getMethod() const
|
||||
{
|
||||
AnalMethodDescription ret;
|
||||
ret.name = ui->nameEdit->text();
|
||||
@ -170,4 +172,4 @@ void EditMethodDialog::editMethod(const QString &className, const QString &meth,
|
||||
Core()->renameAnalMethod(className, meth, desc.name);
|
||||
}
|
||||
Core()->setAnalMethod(className, desc);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define EDITMETHODDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QComboBox>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "core/Cutter.h"
|
||||
@ -12,6 +10,7 @@ namespace Ui {
|
||||
class EditMethodDialog;
|
||||
}
|
||||
|
||||
class QComboBox;
|
||||
class EditMethodDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -26,8 +25,8 @@ public:
|
||||
void setClass(const QString &className);
|
||||
void setMethod(const AnalMethodDescription &desc);
|
||||
|
||||
QString getClass();
|
||||
AnalMethodDescription getMethod();
|
||||
QString getClass() const;
|
||||
AnalMethodDescription getMethod() const;
|
||||
|
||||
/**
|
||||
* @brief Helper function to display the dialog
|
||||
|
@ -1,11 +1,14 @@
|
||||
#include "FlagDialog.h"
|
||||
#include "ui_FlagDialog.h"
|
||||
|
||||
#include <QIntValidator>
|
||||
#include "core/Cutter.h"
|
||||
|
||||
|
||||
FlagDialog::FlagDialog(RVA offset, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FlagDialog),
|
||||
offset(offset),
|
||||
core(Core())
|
||||
offset(offset)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
@ -21,7 +24,7 @@ void FlagDialog::on_buttonBox_accepted()
|
||||
{
|
||||
QString name = ui->nameEdit->text();
|
||||
RVA size = ui->sizeEdit->text().toULongLong();
|
||||
core->addFlag(offset, name, size);
|
||||
Core()->addFlag(offset, name, size);
|
||||
}
|
||||
|
||||
void FlagDialog::on_buttonBox_rejected()
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define FLAGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QIntValidator>
|
||||
#include <memory>
|
||||
#include "core/Cutter.h"
|
||||
#include "core/CutterCommon.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class FlagDialog;
|
||||
@ -25,7 +25,6 @@ private slots:
|
||||
private:
|
||||
std::unique_ptr<Ui::FlagDialog> ui;
|
||||
RVA offset;
|
||||
CutterCore *core;
|
||||
};
|
||||
|
||||
#endif // FLAGDIALOG_H
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "HexdumpRangeDialog.h"
|
||||
#include "ui_HexdumpRangeDialog.h"
|
||||
|
||||
#include <QRegExpValidator>
|
||||
#include "core/Cutter.h"
|
||||
|
||||
HexdumpRangeDialog::HexdumpRangeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::HexdumpRangeDialog)
|
||||
|
@ -1,10 +1,9 @@
|
||||
#ifndef HEXDUMPRANGEDIALOG_H
|
||||
#define HEXDUMPRANGEDIALOG_H
|
||||
|
||||
#include "core/Cutter.h"
|
||||
|
||||
#include "core/CutterCommon.h"
|
||||
#include <QDialog>
|
||||
#include <QRegExpValidator>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class HexdumpRangeDialog;
|
||||
|
@ -12,8 +12,12 @@
|
||||
#include <QFileDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "core/Cutter.h"
|
||||
#include "common/AnalTask.h"
|
||||
|
||||
|
||||
InitialOptionsDialog::InitialOptionsDialog(MainWindow *main):
|
||||
QDialog(0), // parent must not be main
|
||||
QDialog(nullptr), // parent must not be main
|
||||
ui(new Ui::InitialOptionsDialog),
|
||||
main(main),
|
||||
core(Core())
|
||||
@ -122,13 +126,13 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
||||
// TODO: all other options should also be applied to the ui
|
||||
}
|
||||
|
||||
QString InitialOptionsDialog::getSelectedArch()
|
||||
QString InitialOptionsDialog::getSelectedArch() const
|
||||
{
|
||||
QVariant archValue = ui->archComboBox->currentData();
|
||||
return archValue.isValid() ? archValue.toString() : nullptr;
|
||||
}
|
||||
|
||||
QString InitialOptionsDialog::getSelectedCPU()
|
||||
QString InitialOptionsDialog::getSelectedCPU() const
|
||||
{
|
||||
QString cpu = ui->cpuComboBox->currentText();
|
||||
if (cpu.isNull() || cpu.isEmpty())
|
||||
@ -136,7 +140,7 @@ QString InitialOptionsDialog::getSelectedCPU()
|
||||
return cpu;
|
||||
}
|
||||
|
||||
int InitialOptionsDialog::getSelectedBits()
|
||||
int InitialOptionsDialog::getSelectedBits() const
|
||||
{
|
||||
QString sel_bits = ui->bitsComboBox->currentText();
|
||||
if (sel_bits != "Auto") {
|
||||
@ -146,7 +150,7 @@ int InitialOptionsDialog::getSelectedBits()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int InitialOptionsDialog::getSelectedBBSize()
|
||||
int InitialOptionsDialog::getSelectedBBSize() const
|
||||
{
|
||||
QString sel_bbsize = ui->entry_analbb->text();
|
||||
bool ok;
|
||||
@ -156,7 +160,7 @@ int InitialOptionsDialog::getSelectedBBSize()
|
||||
return 1024;
|
||||
}
|
||||
|
||||
InitialOptions::Endianness InitialOptionsDialog::getSelectedEndianness()
|
||||
InitialOptions::Endianness InitialOptionsDialog::getSelectedEndianness() const
|
||||
{
|
||||
switch (ui->endiannessComboBox->currentIndex()) {
|
||||
case 1:
|
||||
@ -168,13 +172,13 @@ InitialOptions::Endianness InitialOptionsDialog::getSelectedEndianness()
|
||||
}
|
||||
}
|
||||
|
||||
QString InitialOptionsDialog::getSelectedOS()
|
||||
QString InitialOptionsDialog::getSelectedOS() const
|
||||
{
|
||||
QVariant os = ui->kernelComboBox->currentData();
|
||||
return os.isValid() ? os.toString() : nullptr;
|
||||
}
|
||||
|
||||
QList<QString> InitialOptionsDialog::getSelectedAdvancedAnalCmds()
|
||||
QList<QString> InitialOptionsDialog::getSelectedAdvancedAnalCmds() const
|
||||
{
|
||||
QList<QString> advanced = QList<QString>();
|
||||
if (ui->analSlider->value() == 3) {
|
||||
|
@ -2,20 +2,15 @@
|
||||
#define OPTIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
#include <QElapsedTimer>
|
||||
#include <memory>
|
||||
#include "core/Cutter.h"
|
||||
#include "common/AnalTask.h"
|
||||
#include "common/InitialOptions.h"
|
||||
|
||||
namespace Ui {
|
||||
class InitialOptionsDialog;
|
||||
}
|
||||
|
||||
class CutterCore;
|
||||
class MainWindow;
|
||||
|
||||
class InitialOptionsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -24,8 +19,6 @@ public:
|
||||
explicit InitialOptionsDialog(MainWindow *main);
|
||||
~InitialOptionsDialog();
|
||||
|
||||
QStringList asm_plugins;
|
||||
|
||||
void setupAndStartAnalysis(/*int level, QList<QString> advanced*/);
|
||||
|
||||
private slots:
|
||||
@ -52,16 +45,18 @@ private:
|
||||
QString analysisDescription(int level);
|
||||
QString shellcode;
|
||||
int analLevel;
|
||||
QStringList asm_plugins;
|
||||
|
||||
|
||||
void updateCPUComboBox();
|
||||
|
||||
QString getSelectedArch();
|
||||
QString getSelectedCPU();
|
||||
int getSelectedBits();
|
||||
int getSelectedBBSize();
|
||||
InitialOptions::Endianness getSelectedEndianness();
|
||||
QString getSelectedOS();
|
||||
QList<QString> getSelectedAdvancedAnalCmds();
|
||||
QString getSelectedArch() const;
|
||||
QString getSelectedCPU() const;
|
||||
int getSelectedBits() const;
|
||||
int getSelectedBBSize() const;
|
||||
InitialOptions::Endianness getSelectedEndianness() const;
|
||||
QString getSelectedOS() const;
|
||||
QList<QString> getSelectedAdvancedAnalCmds() const;
|
||||
|
||||
public:
|
||||
void loadOptions(const InitialOptions &options);
|
||||
|
Loading…
Reference in New Issue
Block a user