A bit more clang-format

This commit is contained in:
Jasmine Iwanek
2022-11-19 08:49:04 -05:00
parent b04dd8cc8b
commit 3fe4f75108
223 changed files with 8047 additions and 7456 deletions

View File

@@ -22,24 +22,23 @@ extern "C" {
#include <86box/gameport.h>
}
#include <QLabel>
#include <QComboBox>
#include <QDialogButtonBox>
#include "qt_models_common.hpp"
JoystickConfiguration::JoystickConfiguration(int type, int joystick_nr, QWidget *parent) :
QDialog(parent),
ui(new Ui::JoystickConfiguration),
type(type),
joystick_nr(joystick_nr)
JoystickConfiguration::JoystickConfiguration(int type, int joystick_nr, QWidget *parent)
: QDialog(parent)
, ui(new Ui::JoystickConfiguration)
, type(type)
, joystick_nr(joystick_nr)
{
ui->setupUi(this);
auto model = ui->comboBoxDevice->model();
Models::AddEntry(model, "None", 0);
for (int c = 0; c < joysticks_present; c++) {
Models::AddEntry(model, plat_joystick_state[c].name, c+1);
Models::AddEntry(model, plat_joystick_state[c].name, c + 1);
}
ui->comboBoxDevice->setCurrentIndex(joystick_state[joystick_nr].plat_joystick_nr);
@@ -51,35 +50,45 @@ JoystickConfiguration::~JoystickConfiguration()
delete ui;
}
int JoystickConfiguration::selectedDevice() {
int
JoystickConfiguration::selectedDevice()
{
return ui->comboBoxDevice->currentIndex();
}
int JoystickConfiguration::selectedAxis(int axis) {
auto* cbox = findChild<QComboBox*>(QString("cboxAxis%1").arg(QString::number(axis)));
int
JoystickConfiguration::selectedAxis(int axis)
{
auto *cbox = findChild<QComboBox *>(QString("cboxAxis%1").arg(QString::number(axis)));
if (cbox == nullptr) {
return 0;
}
return cbox->currentIndex();
}
int JoystickConfiguration::selectedButton(int button) {
auto* cbox = findChild<QComboBox*>(QString("cboxButton%1").arg(QString::number(button)));
int
JoystickConfiguration::selectedButton(int button)
{
auto *cbox = findChild<QComboBox *>(QString("cboxButton%1").arg(QString::number(button)));
if (cbox == nullptr) {
return 0;
}
return cbox->currentIndex();
}
int JoystickConfiguration::selectedPov(int pov) {
auto* cbox = findChild<QComboBox*>(QString("cboxPov%1").arg(QString::number(pov)));
int
JoystickConfiguration::selectedPov(int pov)
{
auto *cbox = findChild<QComboBox *>(QString("cboxPov%1").arg(QString::number(pov)));
if (cbox == nullptr) {
return 0;
}
return cbox->currentIndex();
}
void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
void
JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index)
{
for (auto w : widgets) {
ui->ct->removeWidget(w);
w->deleteLater();
@@ -91,11 +100,11 @@ void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
}
int joystick = index - 1;
int row = 0;
int row = 0;
for (int c = 0; c < joystick_get_axis_count(type); c++) {
/*Combo box*/
auto label = new QLabel(joystick_get_axis_name(type, c), this);
auto cbox = new QComboBox(this);
auto cbox = new QComboBox(this);
cbox->setObjectName(QString("cboxAxis%1").arg(QString::number(c)));
auto model = cbox->model();
@@ -135,7 +144,7 @@ void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
for (int c = 0; c < joystick_get_button_count(type); c++) {
auto label = new QLabel(joystick_get_button_name(type, c), this);
auto cbox = new QComboBox(this);
auto cbox = new QComboBox(this);
cbox->setObjectName(QString("cboxButton%1").arg(QString::number(c)));
auto model = cbox->model();
@@ -155,11 +164,11 @@ void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
}
for (int c = 0; c < joystick_get_pov_count(type) * 2; c++) {
QLabel* label;
QLabel *label;
if (c & 1) {
label = new QLabel(QString("%1 (Y axis)").arg(joystick_get_pov_name(type, c/2)), this);
label = new QLabel(QString("%1 (Y axis)").arg(joystick_get_pov_name(type, c / 2)), this);
} else {
label = new QLabel(QString("%1 (X axis)").arg(joystick_get_pov_name(type, c/2)), this);
label = new QLabel(QString("%1 (X axis)").arg(joystick_get_pov_name(type, c / 2)), this);
}
auto cbox = new QComboBox(this);
cbox->setObjectName(QString("cboxPov%1").arg(QString::number(c)));
@@ -179,17 +188,17 @@ void JoystickConfiguration::on_comboBoxDevice_currentIndexChanged(int index) {
if (mapping & POV_X)
cbox->setCurrentIndex((mapping & 3) * 2);
else if (mapping & POV_Y)
cbox->setCurrentIndex((mapping & 3)*2 + 1);
cbox->setCurrentIndex((mapping & 3) * 2 + 1);
else
cbox->setCurrentIndex(mapping + nr_povs * 2);
mapping = joystick_state[joystick_nr].pov_mapping[c][1];
if (mapping & POV_X)
cbox->setCurrentIndex((mapping & 3)*2);
cbox->setCurrentIndex((mapping & 3) * 2);
else if (mapping & POV_Y)
cbox->setCurrentIndex((mapping & 3)*2 + 1);
cbox->setCurrentIndex((mapping & 3) * 2 + 1);
else
cbox->setCurrentIndex(mapping + nr_povs*2);
cbox->setCurrentIndex(mapping + nr_povs * 2);
ui->ct->addWidget(label, row, 0);
ui->ct->addWidget(cbox, row, 1);