Skip to content

Commit

Permalink
AStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Jun 3, 2017
1 parent 2b90122 commit 2e4c088
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 134 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ int main(int argc, char *argv[])
cmd_parser.addPositionalArgument("filename", QObject::tr("Filename to open."));

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("level"));
QObject::tr("Automatically start analysis. Needs filename to be specified. May be a value between 0 and 4."),
QObject::tr("level"));
cmd_parser.addOption(anal_option);

cmd_parser.process(a);
Expand Down
12 changes: 6 additions & 6 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void MainWindow::openFile(const QString &fn, int anal_level)
{
QString project_name = qhelpers::uniqueProjectName(fn);

if(core->getProjectNames().contains(project_name))
if (core->getProjectNames().contains(project_name))
openProject(project_name);
else
openNewFile(fn, anal_level);
Expand All @@ -298,7 +298,7 @@ void MainWindow::openNewFile(const QString &fn, int anal_level)
o->setAttribute(Qt::WA_DeleteOnClose);
o->show();

if(anal_level >= 0)
if (anal_level >= 0)
o->setupAndStartAnalysis(anal_level);
}

Expand Down Expand Up @@ -344,7 +344,7 @@ void MainWindow::finalizeOpen()
addOutput(" > Adding binary information to notepad");

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
Expand Down Expand Up @@ -1040,9 +1040,9 @@ void MainWindow::on_actionTabs_on_Top_triggered()
void MainWindow::on_actionReset_settings_triggered()
{
QMessageBox::StandardButton ret =
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
"Do you really want to clear all settings?",
QMessageBox::Ok | QMessageBox::Cancel);
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
"Do you really want to clear all settings?",
QMessageBox::Ok | QMessageBox::Cancel);
if (ret == QMessageBox::Ok)
{
// Save options in settings
Expand Down
2 changes: 1 addition & 1 deletion src/qrcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ QStringList QRCore::getProjectNames()
QStringList ret;

QJsonArray jsonArray = cmdj("Plj").array();
for(QJsonValue value : jsonArray)
for (QJsonValue value : jsonArray)
ret.append(value.toString());

return ret;
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/consolewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void ConsoleWidget::historyNext()
{
if (lastHistoryPosition >= history.size())
{
lastHistoryPosition = history.size() -1 ;
lastHistoryPosition = history.size() - 1 ;
}

--lastHistoryPosition;
Expand All @@ -257,7 +257,7 @@ void ConsoleWidget::historyPrev()
{
if (!history.isEmpty())
{
if (lastHistoryPosition >= history.size() -1)
if (lastHistoryPosition >= history.size() - 1)
{
lastHistoryPosition = history.size() - 2;
}
Expand Down
104 changes: 52 additions & 52 deletions src/widgets/exportswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


ExportsModel::ExportsModel(QList<ExportDescription> *exports, QObject *parent)
: QAbstractListModel(parent),
exports(exports)
: QAbstractListModel(parent),
exports(exports)
{
}

Expand All @@ -24,54 +24,54 @@ int ExportsModel::columnCount(const QModelIndex &) const

QVariant ExportsModel::data(const QModelIndex &index, int role) const
{
if(index.row() >= exports->count())
if (index.row() >= exports->count())
return QVariant();

const ExportDescription &exp = exports->at(index.row());

switch(role)
switch (role)
{
case Qt::DisplayRole:
switch(index.column())
{
case OFFSET:
return RAddressString(exp.vaddr);
case SIZE:
return RSizeString(exp.size);
case TYPE:
return exp.type;
case NAME:
return exp.name;
default:
return QVariant();
}
case ExportDescriptionRole:
return QVariant::fromValue(exp);
case Qt::DisplayRole:
switch (index.column())
{
case OFFSET:
return RAddressString(exp.vaddr);
case SIZE:
return RSizeString(exp.size);
case TYPE:
return exp.type;
case NAME:
return exp.name;
default:
return QVariant();
}
case ExportDescriptionRole:
return QVariant::fromValue(exp);
default:
return QVariant();
}
}

QVariant ExportsModel::headerData(int section, Qt::Orientation, int role) const
{
switch(role)
switch (role)
{
case Qt::DisplayRole:
switch(section)
{
case OFFSET:
return tr("Address");
case SIZE:
return tr("Size");
case TYPE:
return tr("Type");
case NAME:
return tr("Name");
default:
return QVariant();
}
case Qt::DisplayRole:
switch (section)
{
case OFFSET:
return tr("Address");
case SIZE:
return tr("Size");
case TYPE:
return tr("Type");
case NAME:
return tr("Name");
default:
return QVariant();
}
default:
return QVariant();
}
}

Expand All @@ -90,7 +90,7 @@ void ExportsModel::endReloadExports()


ExportsSortFilterProxyModel::ExportsSortFilterProxyModel(ExportsModel *source_model, QObject *parent)
: QSortFilterProxyModel(parent)
: QSortFilterProxyModel(parent)
{
setSourceModel(source_model);
}
Expand All @@ -107,23 +107,23 @@ bool ExportsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModel
ExportDescription left_exp = left.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
ExportDescription right_exp = right.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();

switch(left.column())
switch (left.column())
{
case ExportsModel::SIZE:
if(left_exp.size != right_exp.size)
return left_exp.size < right_exp.size;
// fallthrough
case ExportsModel::OFFSET:
if(left_exp.vaddr != right_exp.vaddr)
return left_exp.vaddr < right_exp.vaddr;
// fallthrough
case ExportsModel::NAME:
return left_exp.name < right_exp.name;
case ExportsModel::TYPE:
if(left_exp.type != right_exp.type)
return left_exp.type < right_exp.type;
default:
break;
case ExportsModel::SIZE:
if (left_exp.size != right_exp.size)
return left_exp.size < right_exp.size;
// fallthrough
case ExportsModel::OFFSET:
if (left_exp.vaddr != right_exp.vaddr)
return left_exp.vaddr < right_exp.vaddr;
// fallthrough
case ExportsModel::NAME:
return left_exp.name < right_exp.name;
case ExportsModel::TYPE:
if (left_exp.type != right_exp.type)
return left_exp.type < right_exp.type;
default:
break;
}

// fallback
Expand Down
86 changes: 43 additions & 43 deletions src/widgets/flagswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,50 @@ int FlagsModel::columnCount(const QModelIndex &) const

QVariant FlagsModel::data(const QModelIndex &index, int role) const
{
if(index.row() >= flags->count())
if (index.row() >= flags->count())
return QVariant();

const FlagDescription &flag = flags->at(index.row());

switch(role)
switch (role)
{
case Qt::DisplayRole:
switch(index.column())
{
case SIZE:
return RSizeString(flag.size);
case OFFSET:
return RAddressString(flag.offset);
case NAME:
return flag.name;
default:
return QVariant();
}
case FlagDescriptionRole:
return QVariant::fromValue(flag);
case Qt::DisplayRole:
switch (index.column())
{
case SIZE:
return RSizeString(flag.size);
case OFFSET:
return RAddressString(flag.offset);
case NAME:
return flag.name;
default:
return QVariant();
}
case FlagDescriptionRole:
return QVariant::fromValue(flag);
default:
return QVariant();
}
}

QVariant FlagsModel::headerData(int section, Qt::Orientation, int role) const
{
switch(role)
switch (role)
{
case Qt::DisplayRole:
switch(section)
{
case SIZE:
return tr("Size");
case OFFSET:
return tr("Offset");
case NAME:
return tr("Name");
default:
return QVariant();
}
case Qt::DisplayRole:
switch (section)
{
case SIZE:
return tr("Size");
case OFFSET:
return tr("Offset");
case NAME:
return tr("Name");
default:
return QVariant();
}
default:
return QVariant();
}
}

Expand Down Expand Up @@ -107,20 +107,20 @@ bool FlagsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIn
FlagDescription left_flag = left.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
FlagDescription right_flag = right.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();

switch(left.column())
switch (left.column())
{
case FlagsModel::SIZE:
if(left_flag.size != right_flag.size)
return left_flag.size < right_flag.size;
// fallthrough
case FlagsModel::OFFSET:
if(left_flag.offset != right_flag.offset)
return left_flag.offset < right_flag.offset;
// fallthrough
case FlagsModel::NAME:
return left_flag.name < right_flag.name;
default:
break;
case FlagsModel::SIZE:
if (left_flag.size != right_flag.size)
return left_flag.size < right_flag.size;
// fallthrough
case FlagsModel::OFFSET:
if (left_flag.offset != right_flag.offset)
return left_flag.offset < right_flag.offset;
// fallthrough
case FlagsModel::NAME:
return left_flag.name < right_flag.name;
default:
break;
}

// fallback
Expand Down Expand Up @@ -197,7 +197,7 @@ void FlagsWidget::refreshFlags()
QString flagspace;

QVariant flagspace_data = ui->flagspaceCombo->currentData();
if(flagspace_data.isValid())
if (flagspace_data.isValid())
flagspace = flagspace_data.value<FlagspaceDescription>().name;


Expand Down
13 changes: 9 additions & 4 deletions src/widgets/functionswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,18 +617,23 @@ void FunctionsWidget::setScrollMode()
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
}

void FunctionsWidget::show_filter() {
void FunctionsWidget::show_filter()
{
ui->filterLineEdit->setVisible(true);
ui->closeFilterButton->setVisible(true);
ui->filterLineEdit->setFocus();
}

void FunctionsWidget::clear_filter() {
if (ui->filterLineEdit->text() == "") {
void FunctionsWidget::clear_filter()
{
if (ui->filterLineEdit->text() == "")
{
ui->filterLineEdit->setVisible(false);
ui->closeFilterButton->setVisible(false);
ui->functionsTreeView->setFocus();
} else {
}
else
{
ui->filterLineEdit->setText("");
}
}
Expand Down
Loading

0 comments on commit 2e4c088

Please sign in to comment.