mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 04:16:12 +00:00
AStyle
This commit is contained in:
parent
2b90122e92
commit
2e4c088eab
@ -30,8 +30,8 @@ int main(int argc, char *argv[])
|
|||||||
cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open."));
|
cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open."));
|
||||||
|
|
||||||
QCommandLineOption anal_option({"A", "anal"},
|
QCommandLineOption anal_option({"A", "anal"},
|
||||||
QObject::tr("Automatically start analysis. Needs filename to be specified. May be a value between 0 and 4."),
|
QObject::tr("Automatically start analysis. Needs filename to be specified. May be a value between 0 and 4."),
|
||||||
QObject::tr("level"));
|
QObject::tr("level"));
|
||||||
cmd_parser.addOption(anal_option);
|
cmd_parser.addOption(anal_option);
|
||||||
|
|
||||||
cmd_parser.process(a);
|
cmd_parser.process(a);
|
||||||
|
@ -284,7 +284,7 @@ void MainWindow::openFile(const QString &fn, int anal_level)
|
|||||||
{
|
{
|
||||||
QString project_name = qhelpers::uniqueProjectName(fn);
|
QString project_name = qhelpers::uniqueProjectName(fn);
|
||||||
|
|
||||||
if(core->getProjectNames().contains(project_name))
|
if (core->getProjectNames().contains(project_name))
|
||||||
openProject(project_name);
|
openProject(project_name);
|
||||||
else
|
else
|
||||||
openNewFile(fn, anal_level);
|
openNewFile(fn, anal_level);
|
||||||
@ -298,7 +298,7 @@ void MainWindow::openNewFile(const QString &fn, int anal_level)
|
|||||||
o->setAttribute(Qt::WA_DeleteOnClose);
|
o->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
o->show();
|
o->show();
|
||||||
|
|
||||||
if(anal_level >= 0)
|
if (anal_level >= 0)
|
||||||
o->setupAndStartAnalysis(anal_level);
|
o->setupAndStartAnalysis(anal_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ void MainWindow::finalizeOpen()
|
|||||||
addOutput(" > Adding binary information to notepad");
|
addOutput(" > Adding binary information to notepad");
|
||||||
|
|
||||||
notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
|
notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
|
||||||
"\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
|
"\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get binary beginning/end addresses
|
//Get binary beginning/end addresses
|
||||||
@ -1040,9 +1040,9 @@ void MainWindow::on_actionTabs_on_Top_triggered()
|
|||||||
void MainWindow::on_actionReset_settings_triggered()
|
void MainWindow::on_actionReset_settings_triggered()
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton ret =
|
QMessageBox::StandardButton ret =
|
||||||
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
|
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
|
||||||
"Do you really want to clear all settings?",
|
"Do you really want to clear all settings?",
|
||||||
QMessageBox::Ok | QMessageBox::Cancel);
|
QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
if (ret == QMessageBox::Ok)
|
if (ret == QMessageBox::Ok)
|
||||||
{
|
{
|
||||||
// Save options in settings
|
// Save options in settings
|
||||||
|
@ -855,7 +855,7 @@ QStringList QRCore::getProjectNames()
|
|||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
|
||||||
QJsonArray jsonArray = cmdj("Plj").array();
|
QJsonArray jsonArray = cmdj("Plj").array();
|
||||||
for(QJsonValue value : jsonArray)
|
for (QJsonValue value : jsonArray)
|
||||||
ret.append(value.toString());
|
ret.append(value.toString());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -234,7 +234,7 @@ void ConsoleWidget::historyNext()
|
|||||||
{
|
{
|
||||||
if (lastHistoryPosition >= history.size())
|
if (lastHistoryPosition >= history.size())
|
||||||
{
|
{
|
||||||
lastHistoryPosition = history.size() -1 ;
|
lastHistoryPosition = history.size() - 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
--lastHistoryPosition;
|
--lastHistoryPosition;
|
||||||
@ -257,7 +257,7 @@ void ConsoleWidget::historyPrev()
|
|||||||
{
|
{
|
||||||
if (!history.isEmpty())
|
if (!history.isEmpty())
|
||||||
{
|
{
|
||||||
if (lastHistoryPosition >= history.size() -1)
|
if (lastHistoryPosition >= history.size() - 1)
|
||||||
{
|
{
|
||||||
lastHistoryPosition = history.size() - 2;
|
lastHistoryPosition = history.size() - 2;
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
|
|
||||||
ExportsModel::ExportsModel(QList<ExportDescription> *exports, QObject *parent)
|
ExportsModel::ExportsModel(QList<ExportDescription> *exports, QObject *parent)
|
||||||
: QAbstractListModel(parent),
|
: QAbstractListModel(parent),
|
||||||
exports(exports)
|
exports(exports)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,54 +24,54 @@ int ExportsModel::columnCount(const QModelIndex &) const
|
|||||||
|
|
||||||
QVariant ExportsModel::data(const QModelIndex &index, int role) const
|
QVariant ExportsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if(index.row() >= exports->count())
|
if (index.row() >= exports->count())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
const ExportDescription &exp = exports->at(index.row());
|
const ExportDescription &exp = exports->at(index.row());
|
||||||
|
|
||||||
switch(role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch(index.column())
|
switch (index.column())
|
||||||
{
|
{
|
||||||
case OFFSET:
|
case OFFSET:
|
||||||
return RAddressString(exp.vaddr);
|
return RAddressString(exp.vaddr);
|
||||||
case SIZE:
|
case SIZE:
|
||||||
return RSizeString(exp.size);
|
return RSizeString(exp.size);
|
||||||
case TYPE:
|
case TYPE:
|
||||||
return exp.type;
|
return exp.type;
|
||||||
case NAME:
|
case NAME:
|
||||||
return exp.name;
|
return exp.name;
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
case ExportDescriptionRole:
|
|
||||||
return QVariant::fromValue(exp);
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
case ExportDescriptionRole:
|
||||||
|
return QVariant::fromValue(exp);
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ExportsModel::headerData(int section, Qt::Orientation, int role) const
|
QVariant ExportsModel::headerData(int section, Qt::Orientation, int role) const
|
||||||
{
|
{
|
||||||
switch(role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch(section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case OFFSET:
|
case OFFSET:
|
||||||
return tr("Address");
|
return tr("Address");
|
||||||
case SIZE:
|
case SIZE:
|
||||||
return tr("Size");
|
return tr("Size");
|
||||||
case TYPE:
|
case TYPE:
|
||||||
return tr("Type");
|
return tr("Type");
|
||||||
case NAME:
|
case NAME:
|
||||||
return tr("Name");
|
return tr("Name");
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ void ExportsModel::endReloadExports()
|
|||||||
|
|
||||||
|
|
||||||
ExportsSortFilterProxyModel::ExportsSortFilterProxyModel(ExportsModel *source_model, QObject *parent)
|
ExportsSortFilterProxyModel::ExportsSortFilterProxyModel(ExportsModel *source_model, QObject *parent)
|
||||||
: QSortFilterProxyModel(parent)
|
: QSortFilterProxyModel(parent)
|
||||||
{
|
{
|
||||||
setSourceModel(source_model);
|
setSourceModel(source_model);
|
||||||
}
|
}
|
||||||
@ -107,23 +107,23 @@ bool ExportsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
|
|||||||
ExportDescription left_exp = left.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
ExportDescription left_exp = left.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||||
ExportDescription right_exp = right.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
ExportDescription right_exp = right.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||||
|
|
||||||
switch(left.column())
|
switch (left.column())
|
||||||
{
|
{
|
||||||
case ExportsModel::SIZE:
|
case ExportsModel::SIZE:
|
||||||
if(left_exp.size != right_exp.size)
|
if (left_exp.size != right_exp.size)
|
||||||
return left_exp.size < right_exp.size;
|
return left_exp.size < right_exp.size;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case ExportsModel::OFFSET:
|
case ExportsModel::OFFSET:
|
||||||
if(left_exp.vaddr != right_exp.vaddr)
|
if (left_exp.vaddr != right_exp.vaddr)
|
||||||
return left_exp.vaddr < right_exp.vaddr;
|
return left_exp.vaddr < right_exp.vaddr;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case ExportsModel::NAME:
|
case ExportsModel::NAME:
|
||||||
return left_exp.name < right_exp.name;
|
return left_exp.name < right_exp.name;
|
||||||
case ExportsModel::TYPE:
|
case ExportsModel::TYPE:
|
||||||
if(left_exp.type != right_exp.type)
|
if (left_exp.type != right_exp.type)
|
||||||
return left_exp.type < right_exp.type;
|
return left_exp.type < right_exp.type;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback
|
// fallback
|
||||||
|
@ -28,50 +28,50 @@ int FlagsModel::columnCount(const QModelIndex &) const
|
|||||||
|
|
||||||
QVariant FlagsModel::data(const QModelIndex &index, int role) const
|
QVariant FlagsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if(index.row() >= flags->count())
|
if (index.row() >= flags->count())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
const FlagDescription &flag = flags->at(index.row());
|
const FlagDescription &flag = flags->at(index.row());
|
||||||
|
|
||||||
switch(role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch(index.column())
|
switch (index.column())
|
||||||
{
|
{
|
||||||
case SIZE:
|
case SIZE:
|
||||||
return RSizeString(flag.size);
|
return RSizeString(flag.size);
|
||||||
case OFFSET:
|
case OFFSET:
|
||||||
return RAddressString(flag.offset);
|
return RAddressString(flag.offset);
|
||||||
case NAME:
|
case NAME:
|
||||||
return flag.name;
|
return flag.name;
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
case FlagDescriptionRole:
|
|
||||||
return QVariant::fromValue(flag);
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
case FlagDescriptionRole:
|
||||||
|
return QVariant::fromValue(flag);
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant FlagsModel::headerData(int section, Qt::Orientation, int role) const
|
QVariant FlagsModel::headerData(int section, Qt::Orientation, int role) const
|
||||||
{
|
{
|
||||||
switch(role)
|
switch (role)
|
||||||
{
|
{
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
switch(section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case SIZE:
|
case SIZE:
|
||||||
return tr("Size");
|
return tr("Size");
|
||||||
case OFFSET:
|
case OFFSET:
|
||||||
return tr("Offset");
|
return tr("Offset");
|
||||||
case NAME:
|
case NAME:
|
||||||
return tr("Name");
|
return tr("Name");
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,20 +107,20 @@ bool FlagsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
|
|||||||
FlagDescription left_flag = left.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
FlagDescription left_flag = left.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
||||||
FlagDescription right_flag = right.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
FlagDescription right_flag = right.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
||||||
|
|
||||||
switch(left.column())
|
switch (left.column())
|
||||||
{
|
{
|
||||||
case FlagsModel::SIZE:
|
case FlagsModel::SIZE:
|
||||||
if(left_flag.size != right_flag.size)
|
if (left_flag.size != right_flag.size)
|
||||||
return left_flag.size < right_flag.size;
|
return left_flag.size < right_flag.size;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case FlagsModel::OFFSET:
|
case FlagsModel::OFFSET:
|
||||||
if(left_flag.offset != right_flag.offset)
|
if (left_flag.offset != right_flag.offset)
|
||||||
return left_flag.offset < right_flag.offset;
|
return left_flag.offset < right_flag.offset;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case FlagsModel::NAME:
|
case FlagsModel::NAME:
|
||||||
return left_flag.name < right_flag.name;
|
return left_flag.name < right_flag.name;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback
|
// fallback
|
||||||
@ -197,7 +197,7 @@ void FlagsWidget::refreshFlags()
|
|||||||
QString flagspace;
|
QString flagspace;
|
||||||
|
|
||||||
QVariant flagspace_data = ui->flagspaceCombo->currentData();
|
QVariant flagspace_data = ui->flagspaceCombo->currentData();
|
||||||
if(flagspace_data.isValid())
|
if (flagspace_data.isValid())
|
||||||
flagspace = flagspace_data.value<FlagspaceDescription>().name;
|
flagspace = flagspace_data.value<FlagspaceDescription>().name;
|
||||||
|
|
||||||
|
|
||||||
|
@ -617,18 +617,23 @@ void FunctionsWidget::setScrollMode()
|
|||||||
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
|
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::show_filter() {
|
void FunctionsWidget::show_filter()
|
||||||
|
{
|
||||||
ui->filterLineEdit->setVisible(true);
|
ui->filterLineEdit->setVisible(true);
|
||||||
ui->closeFilterButton->setVisible(true);
|
ui->closeFilterButton->setVisible(true);
|
||||||
ui->filterLineEdit->setFocus();
|
ui->filterLineEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::clear_filter() {
|
void FunctionsWidget::clear_filter()
|
||||||
if (ui->filterLineEdit->text() == "") {
|
{
|
||||||
|
if (ui->filterLineEdit->text() == "")
|
||||||
|
{
|
||||||
ui->filterLineEdit->setVisible(false);
|
ui->filterLineEdit->setVisible(false);
|
||||||
ui->closeFilterButton->setVisible(false);
|
ui->closeFilterButton->setVisible(false);
|
||||||
ui->functionsTreeView->setFocus();
|
ui->functionsTreeView->setFocus();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->filterLineEdit->setText("");
|
ui->filterLineEdit->setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -754,7 +754,7 @@ void MemoryWidget::hexScrolled()
|
|||||||
|
|
||||||
// To prevent recursive calls to hexScrolled (this function) blocks the
|
// To prevent recursive calls to hexScrolled (this function) blocks the
|
||||||
// scroll bar signals
|
// scroll bar signals
|
||||||
auto appendTextWithoutSignals = [](QTextEdit *edit, const QString &text)
|
auto appendTextWithoutSignals = [](QTextEdit * edit, const QString & text)
|
||||||
{
|
{
|
||||||
edit->verticalScrollBar()->blockSignals(true);
|
edit->verticalScrollBar()->blockSignals(true);
|
||||||
edit->append(text);
|
edit->append(text);
|
||||||
@ -1573,7 +1573,9 @@ void MemoryWidget::create_graph(QString off)
|
|||||||
if (settings.value("dark").toBool())
|
if (settings.value("dark").toBool())
|
||||||
{
|
{
|
||||||
ui->graphWebView->page()->runJavaScript(QString("init_panel('dark');"));
|
ui->graphWebView->page()->runJavaScript(QString("init_panel('dark');"));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->graphWebView->page()->runJavaScript(QString("init_panel('light');"));
|
ui->graphWebView->page()->runJavaScript(QString("init_panel('light');"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1622,7 +1624,8 @@ void MemoryWidget::on_disasTextEdit_2_cursorPositionChanged()
|
|||||||
tc.select(QTextCursor::LineUnderCursor);
|
tc.select(QTextCursor::LineUnderCursor);
|
||||||
QString lastline = tc.selectedText().trimmed();
|
QString lastline = tc.selectedText().trimmed();
|
||||||
QList<QString> words = lastline.split(" ", QString::SkipEmptyParts);
|
QList<QString> words = lastline.split(" ", QString::SkipEmptyParts);
|
||||||
if (words.length() == 0) {
|
if (words.length() == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString ele = words[0];
|
QString ele = words[0];
|
||||||
|
@ -10,23 +10,26 @@
|
|||||||
Omnibar::Omnibar(MainWindow *main, QWidget *parent) :
|
Omnibar::Omnibar(MainWindow *main, QWidget *parent) :
|
||||||
QLineEdit(parent),
|
QLineEdit(parent),
|
||||||
main(main),
|
main(main),
|
||||||
commands({": Comments toggle",
|
commands(
|
||||||
": Dashboard toggle",
|
{
|
||||||
": Exports toggle",
|
": Comments toggle",
|
||||||
": Flags toggle",
|
": Dashboard toggle",
|
||||||
": Functions toggle",
|
": Exports toggle",
|
||||||
": Imports toggle",
|
": Flags toggle",
|
||||||
": Lock/Unlock interface",
|
": Functions toggle",
|
||||||
": Notepad toggle",
|
": Imports toggle",
|
||||||
": Refresh contents",
|
": Lock/Unlock interface",
|
||||||
": Relocs toggle",
|
": Notepad toggle",
|
||||||
": Run Script",
|
": Refresh contents",
|
||||||
": Sections toggle",
|
": Relocs toggle",
|
||||||
": Strings toggle",
|
": Run Script",
|
||||||
": Symbols toggle",
|
": Sections toggle",
|
||||||
": Tabs up/down",
|
": Strings toggle",
|
||||||
": Theme switch",
|
": Symbols toggle",
|
||||||
": Web server start/stop"})
|
": Tabs up/down",
|
||||||
|
": Theme switch",
|
||||||
|
": Web server start/stop"
|
||||||
|
})
|
||||||
{
|
{
|
||||||
// QLineEdit basic features
|
// QLineEdit basic features
|
||||||
this->setMinimumHeight(16);
|
this->setMinimumHeight(16);
|
||||||
|
@ -26,7 +26,7 @@ void SectionsWidget::setup()
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
for (auto section : main->core->getAllSections())
|
for (auto section : main->core->getAllSections())
|
||||||
{
|
{
|
||||||
if(!section.name.contains("."))
|
if (!section.name.contains("."))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fillSections(row++, section);
|
fillSections(row++, section);
|
||||||
|
@ -49,9 +49,9 @@ void SymbolsWidget::fillSymbols()
|
|||||||
for (auto symbol : this->main->core->getAllSymbols())
|
for (auto symbol : this->main->core->getAllSymbols())
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = qhelpers::appendRow(ui->symbolsTreeWidget,
|
QTreeWidgetItem *item = qhelpers::appendRow(ui->symbolsTreeWidget,
|
||||||
RAddressString(symbol.vaddr),
|
RAddressString(symbol.vaddr),
|
||||||
QString("%1 %2").arg(symbol.bind, symbol.type).trimmed(),
|
QString("%1 %2").arg(symbol.bind, symbol.type).trimmed(),
|
||||||
symbol.name);
|
symbol.name);
|
||||||
|
|
||||||
item->setData(0, Qt::UserRole, QVariant::fromValue(symbol));
|
item->setData(0, Qt::UserRole, QVariant::fromValue(symbol));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user