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

@@ -31,9 +31,9 @@ extern "C" {
#include "qt_deviceconfig.hpp"
#include "qt_joystickconfiguration.hpp"
SettingsInput::SettingsInput(QWidget *parent) :
QWidget(parent),
ui(new Ui::SettingsInput)
SettingsInput::SettingsInput(QWidget *parent)
: QWidget(parent)
, ui(new Ui::SettingsInput)
{
ui->setupUi(this);
@@ -45,21 +45,25 @@ SettingsInput::~SettingsInput()
delete ui;
}
void SettingsInput::save() {
mouse_type = ui->comboBoxMouse->currentData().toInt();
void
SettingsInput::save()
{
mouse_type = ui->comboBoxMouse->currentData().toInt();
joystick_type = ui->comboBoxJoystick->currentData().toInt();
}
void SettingsInput::onCurrentMachineChanged(int machineId) {
void
SettingsInput::onCurrentMachineChanged(int machineId)
{
// win_settings_video_proc, WM_INITDIALOG
this->machineId = machineId;
auto* mouseModel = ui->comboBoxMouse->model();
auto removeRows = mouseModel->rowCount();
auto *mouseModel = ui->comboBoxMouse->model();
auto removeRows = mouseModel->rowCount();
int selectedRow = 0;
for (int i = 0; i < mouse_get_ndev(); ++i) {
const auto* dev = mouse_get_device(i);
const auto *dev = mouse_get_device(i);
if ((i == MOUSE_TYPE_INTERNAL) && (machine_has_flags(machineId, MACHINE_MOUSE) == 0)) {
continue;
}
@@ -69,7 +73,7 @@ void SettingsInput::onCurrentMachineChanged(int machineId) {
}
QString name = DeviceConfig::DeviceName(dev, mouse_get_internal_name(i), 0);
int row = mouseModel->rowCount();
int row = mouseModel->rowCount();
mouseModel->insertRow(row);
auto idx = mouseModel->index(row, 0);
@@ -83,12 +87,11 @@ void SettingsInput::onCurrentMachineChanged(int machineId) {
mouseModel->removeRows(0, removeRows);
ui->comboBoxMouse->setCurrentIndex(selectedRow);
int i = 0;
char* joyName = joystick_get_name(i);
auto* joystickModel = ui->comboBoxJoystick->model();
removeRows = joystickModel->rowCount();
selectedRow = 0;
int i = 0;
char *joyName = joystick_get_name(i);
auto *joystickModel = ui->comboBoxJoystick->model();
removeRows = joystickModel->rowCount();
selectedRow = 0;
while (joyName) {
int row = Models::AddEntry(joystickModel, tr(joyName).toUtf8().data(), i);
if (i == joystick_type) {
@@ -102,16 +105,19 @@ void SettingsInput::onCurrentMachineChanged(int machineId) {
ui->comboBoxJoystick->setCurrentIndex(selectedRow);
}
void SettingsInput::on_comboBoxMouse_currentIndexChanged(int index) {
void
SettingsInput::on_comboBoxMouse_currentIndexChanged(int index)
{
int mouseId = ui->comboBoxMouse->currentData().toInt();
ui->pushButtonConfigureMouse->setEnabled(mouse_has_config(mouseId) > 0);
}
void SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index) {
void
SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index)
{
int joystickId = ui->comboBoxJoystick->currentData().toInt();
for (int i = 0; i < 4; ++i) {
auto* btn = findChild<QPushButton*>(QString("pushButtonJoystick%1").arg(i+1));
auto *btn = findChild<QPushButton *>(QString("pushButtonJoystick%1").arg(i + 1));
if (btn == nullptr) {
continue;
}
@@ -119,15 +125,19 @@ void SettingsInput::on_comboBoxJoystick_currentIndexChanged(int index) {
}
}
void SettingsInput::on_pushButtonConfigureMouse_clicked() {
void
SettingsInput::on_pushButtonConfigureMouse_clicked()
{
int mouseId = ui->comboBoxMouse->currentData().toInt();
DeviceConfig::ConfigureDevice(mouse_get_device(mouseId), 0, qobject_cast<Settings*>(Settings::settings));
DeviceConfig::ConfigureDevice(mouse_get_device(mouseId), 0, qobject_cast<Settings *>(Settings::settings));
}
static int get_axis(JoystickConfiguration& jc, int axis, int joystick_nr) {
static int
get_axis(JoystickConfiguration &jc, int axis, int joystick_nr)
{
int axis_sel = jc.selectedAxis(axis);
int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_axes;
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_povs;
int nr_axes = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_axes;
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_povs;
if (axis_sel < nr_axes) {
return axis_sel;
@@ -145,12 +155,13 @@ static int get_axis(JoystickConfiguration& jc, int axis, int joystick_nr) {
return SLIDER | (axis_sel >> 1);
}
static int get_pov(JoystickConfiguration& jc, int pov, int joystick_nr) {
static int
get_pov(JoystickConfiguration &jc, int pov, int joystick_nr)
{
int pov_sel = jc.selectedPov(pov);
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr-1].nr_povs*2;
int nr_povs = plat_joystick_state[joystick_state[joystick_nr].plat_joystick_nr - 1].nr_povs * 2;
if (pov_sel < nr_povs)
{
if (pov_sel < nr_povs) {
if (pov_sel & 1)
return POV_Y | (pov_sel >> 1);
else
@@ -160,13 +171,15 @@ static int get_pov(JoystickConfiguration& jc, int pov, int joystick_nr) {
return pov_sel - nr_povs;
}
static void updateJoystickConfig(int type, int joystick_nr, QWidget* parent) {
static void
updateJoystickConfig(int type, int joystick_nr, QWidget *parent)
{
JoystickConfiguration jc(type, joystick_nr, parent);
switch (jc.exec()) {
case QDialog::Rejected:
return;
case QDialog::Accepted:
break;
case QDialog::Rejected:
return;
case QDialog::Accepted:
break;
}
joystick_state[joystick_nr].plat_joystick_nr = jc.selectedDevice();
@@ -184,18 +197,26 @@ static void updateJoystickConfig(int type, int joystick_nr, QWidget* parent) {
}
}
void SettingsInput::on_pushButtonJoystick1_clicked() {
void
SettingsInput::on_pushButtonJoystick1_clicked()
{
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 0, this);
}
void SettingsInput::on_pushButtonJoystick2_clicked() {
void
SettingsInput::on_pushButtonJoystick2_clicked()
{
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 1, this);
}
void SettingsInput::on_pushButtonJoystick3_clicked() {
void
SettingsInput::on_pushButtonJoystick3_clicked()
{
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 2, this);
}
void SettingsInput::on_pushButtonJoystick4_clicked() {
void
SettingsInput::on_pushButtonJoystick4_clicked()
{
updateJoystickConfig(ui->comboBoxJoystick->currentData().toInt(), 3, this);
}