AStyle format

This commit is contained in:
ballessay 2017-04-13 17:51:58 +02:00 committed by C. Balles
parent ad0de05654
commit 312cc9b912
10 changed files with 55 additions and 38 deletions

View File

@ -59,7 +59,7 @@ namespace qhelpers
} }
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2, void appendRow(QTreeWidget *tw, const QString &str, const QString &str2,
const QString &str3, const QString &str4, const QString &str5) const QString &str3, const QString &str4, const QString &str5)
{ {
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
// Fill dummy hidden column // Fill dummy hidden column

View File

@ -20,7 +20,7 @@ namespace qhelpers
void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(), void appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString()); const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
void setVerticalScrollMode(QTreeWidget* tw); void setVerticalScrollMode(QTreeWidget *tw);
} }
#endif // HELPERS_H #endif // HELPERS_H

View File

@ -723,7 +723,8 @@ void MainWindow::seek(const QString &offset, const QString &name)
{ {
if (offset.length() == 0) if (offset.length() == 0)
return; return;
if (name != NULL) { if (name != NULL)
{
this->memoryDock->setWindowTitle(name); this->memoryDock->setWindowTitle(name);
this->current_address = name; this->current_address = name;
} }
@ -846,15 +847,16 @@ void MainWindow::hideAllDocks()
void MainWindow::showDefaultDocks() void MainWindow::showDefaultDocks()
{ {
const QList<DockWidget*> defaultDocks = { sectionsDock, const QList<DockWidget *> defaultDocks = { sectionsDock,
functionsDock, functionsDock,
memoryDock, memoryDock,
commentsDock, commentsDock,
stringsDock, stringsDock,
importsDock, importsDock,
symbolsDock, symbolsDock,
notepadDock, notepadDock,
dashboardDock}; dashboardDock
};
for (auto w : dockWidgets) for (auto w : dockWidgets)
{ {
@ -909,7 +911,7 @@ void MainWindow::add_debug_output(QString msg)
void MainWindow::on_actionNew_triggered() void MainWindow::on_actionNew_triggered()
{ {
if(close()) if (close())
on_actionLoad_triggered(); on_actionLoad_triggered();
} }
@ -931,7 +933,7 @@ void MainWindow::on_actionRun_Script_triggered()
QString fileName; QString fileName;
fileName = dialog.getOpenFileName(this, "Select radare2 script"); fileName = dialog.getOpenFileName(this, "Select radare2 script");
if(!fileName.length()) //cancel was pressed if (!fileName.length()) //cancel was pressed
return; return;
qDebug() << "Meow: " + fileName; qDebug() << "Meow: " + fileName;
@ -1035,7 +1037,8 @@ void MainWindow::refreshVisibleDockWidgets()
{ {
// There seems to be no convenience function to check if a QDockWidget // There seems to be no convenience function to check if a QDockWidget
// is really visible or hidden in a tabbed dock. So: // is really visible or hidden in a tabbed dock. So:
auto isDockVisible = [](const QDockWidget * const pWidget) { auto isDockVisible = [](const QDockWidget * const pWidget)
{
return pWidget != nullptr && !pWidget->visibleRegion().isEmpty(); return pWidget != nullptr && !pWidget->visibleRegion().isEmpty();
}; };

View File

@ -271,7 +271,7 @@ void OptionsDialog::on_cancelButton_clicked()
QString OptionsDialog::analysisDescription(int level) QString OptionsDialog::analysisDescription(int level)
{ {
//TODO: replace this with meaningful descriptions //TODO: replace this with meaningful descriptions
switch(level) switch (level)
{ {
case 0: case 0:
return tr("-"); return tr("-");
@ -319,7 +319,7 @@ void OptionsDialog::on_AdvOptButton_clicked()
void OptionsDialog::on_analCheckBox_clicked(bool checked) void OptionsDialog::on_analCheckBox_clicked(bool checked)
{ {
if(!checked) if (!checked)
defaultAnalLevel = ui->analSlider->value(); defaultAnalLevel = ui->analSlider->value();
ui->analSlider->setValue(checked ? defaultAnalLevel : 0); ui->analSlider->setValue(checked ? defaultAnalLevel : 0);
} }

View File

@ -469,18 +469,18 @@ QList<QString> QRCore::getList(const QString &type, const QString &subtype)
{ {
QJsonArray importsArray = cmdj("iij").array(); QJsonArray importsArray = cmdj("iij").array();
foreach(QJsonValue value, importsArray) foreach (QJsonValue value, importsArray)
{ {
QJsonObject importObject = value.toObject(); QJsonObject importObject = value.toObject();
unsigned long plt = (unsigned long)importObject["plt"].toVariant().toULongLong(); unsigned long plt = (unsigned long)importObject["plt"].toVariant().toULongLong();
int ordinal = importObject["ordinal"].toInt(); int ordinal = importObject["ordinal"].toInt();
QString final = QString("%1,%2,%3,%4,%5,").arg( QString final = QString("%1,%2,%3,%4,%5,").arg(
QString::asprintf("%#o", ordinal), QString::asprintf("%#o", ordinal),
QString::asprintf("%#010lx", plt), QString::asprintf("%#010lx", plt),
importObject["bind"].toString(), importObject["bind"].toString(),
importObject["type"].toString(), importObject["type"].toString(),
importObject["name"].toString()); importObject["name"].toString());
ret << final; ret << final;

View File

@ -106,7 +106,7 @@ void CommentsWidget::on_actionVertical_triggered()
void CommentsWidget::resizeEvent(QResizeEvent *event) void CommentsWidget::resizeEvent(QResizeEvent *event)
{ {
if(main->responsive && isVisible()) if (main->responsive && isVisible())
{ {
if (event->size().width() >= event->size().height()) if (event->size().width() >= event->size().height())
{ {

View File

@ -409,7 +409,7 @@ void FunctionsWidget::on_nestedFunctionsTree_itemDoubleClicked(QTreeWidgetItem *
void FunctionsWidget::resizeEvent(QResizeEvent *event) void FunctionsWidget::resizeEvent(QResizeEvent *event)
{ {
if(main->responsive && isVisible()) if (main->responsive && isVisible())
{ {
if (event->size().width() >= event->size().height()) if (event->size().width() >= event->size().height())
{ {

View File

@ -533,9 +533,12 @@ void MemoryWidget::refreshDisasm(const QString &offset)
if (ele.contains("0x")) if (ele.contains("0x"))
{ {
QString fcn = this->main->core->cmdFunctionAt(ele); QString fcn = this->main->core->cmdFunctionAt(ele);
if (fcn != "") { if (fcn != "")
{
this->main->core->cmd("s " + fcn); this->main->core->cmd("s " + fcn);
} else { }
else
{
this->main->core->cmd("s " + ele); this->main->core->cmd("s " + ele);
} }
} }
@ -1753,7 +1756,7 @@ void MemoryWidget::on_previewToolButton_2_clicked()
void MemoryWidget::resizeEvent(QResizeEvent *event) void MemoryWidget::resizeEvent(QResizeEvent *event)
{ {
if(main->responsive && isVisible()) if (main->responsive && isVisible())
{ {
if (event->size().width() <= 1150) if (event->size().width() <= 1150)
{ {
@ -1834,7 +1837,8 @@ void MemoryWidget::on_actionXRefs_triggered()
{ {
// Get function for clicked offset // Get function for clicked offset
RAnalFunction *fcn = this->main->core->functionAt(ele.toLongLong(0, 16)); RAnalFunction *fcn = this->main->core->functionAt(ele.toLongLong(0, 16));
if (!fcn) { if (!fcn)
{
return; return;
} }
XrefsDialog *x = new XrefsDialog(this->main, this); XrefsDialog *x = new XrefsDialog(this->main, this);
@ -1980,27 +1984,36 @@ void MemoryWidget::on_memTabWidget_currentChanged(int /*index*/)
this->updateViews(); this->updateViews();
} }
void MemoryWidget::updateViews() { void MemoryWidget::updateViews()
{
// Update only the selected view to improve performance // Update only the selected view to improve performance
int index = ui->memTabWidget->tabBar()->currentIndex(); int index = ui->memTabWidget->tabBar()->currentIndex();
if (index == 0) { if (index == 0)
{
// Disasm // Disasm
if (this->last_disasm_fcn != this->main->current_address) { if (this->last_disasm_fcn != this->main->current_address)
{
//this->main->add_debug_output("Doing disasm"); //this->main->add_debug_output("Doing disasm");
this->refreshDisasm(this->main->current_address); this->refreshDisasm(this->main->current_address);
this->last_disasm_fcn = this->main->current_address; this->last_disasm_fcn = this->main->current_address;
} }
} else if (index == 1) { }
else if (index == 1)
{
// Hex // Hex
if (this->last_hexdump_fcn != this->main->current_address) { if (this->last_hexdump_fcn != this->main->current_address)
{
//this->main->add_debug_output("Doing hex"); //this->main->add_debug_output("Doing hex");
this->refreshHexdump(this->main->current_address); this->refreshHexdump(this->main->current_address);
this->last_hexdump_fcn = this->main->current_address; this->last_hexdump_fcn = this->main->current_address;
} }
} else if (index == 2) { }
else if (index == 2)
{
// Graph // Graph
if (this->last_graph_fcn != this->main->current_address) { if (this->last_graph_fcn != this->main->current_address)
{
//this->main->add_debug_output("Doing graph"); //this->main->add_debug_output("Doing graph");
this->create_graph(this->main->current_address); this->create_graph(this->main->current_address);
this->last_graph_fcn = this->main->current_address; this->last_graph_fcn = this->main->current_address;

View File

@ -66,7 +66,7 @@ void SectionsDock::showSectionsContextMenu(const QPoint &pt)
void SectionsDock::resizeEvent(QResizeEvent *event) void SectionsDock::resizeEvent(QResizeEvent *event)
{ {
if(main->responsive && isVisible()) if (main->responsive && isVisible())
{ {
if (event->size().width() >= event->size().height()) if (event->size().width() >= event->size().height())
{ {

View File

@ -95,7 +95,8 @@ void SectionsWidget::fillSections(int row, const QString &str, const QString &st
QColor("#E74C3C"), //ALIZARIN QColor("#E74C3C"), //ALIZARIN
QColor("#ECF0F1"), //CLOUDS QColor("#ECF0F1"), //CLOUDS
QColor("#BDC3C7"), //SILVER QColor("#BDC3C7"), //SILVER
QColor("#95A5A6")}; //COBCRETE QColor("#95A5A6") //COBCRETE
};
QTreeWidgetItem *tempItem = new QTreeWidgetItem(); QTreeWidgetItem *tempItem = new QTreeWidgetItem();
tempItem->setText(0, str); tempItem->setText(0, str);