mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Code cleanup
This commit is contained in:
parent
f071c952a3
commit
48c071640e
@ -5,7 +5,6 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "common/path_util.h"
|
#include "common/path_util.h"
|
||||||
#include "control_settings.h"
|
#include "control_settings.h"
|
||||||
#include "input/input_handler.h"
|
|
||||||
#include "kbm_config_dialog.h"
|
#include "kbm_config_dialog.h"
|
||||||
#include "ui_control_settings.h"
|
#include "ui_control_settings.h"
|
||||||
|
|
||||||
@ -60,11 +59,8 @@ ControlSettings::ControlSettings(std::shared_ptr<GameInfoClass> game_info_get, Q
|
|||||||
void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
||||||
QList<QComboBox*> list;
|
QList<QComboBox*> list;
|
||||||
list << ui->RStickUpBox << ui->RStickRightBox << ui->LStickUpBox << ui->LStickRightBox;
|
list << ui->RStickUpBox << ui->RStickRightBox << ui->LStickUpBox << ui->LStickRightBox;
|
||||||
int count_axis_left_x = 0;
|
int count_axis_left_x = 0, count_axis_left_y = 0, count_axis_right_x = 0,
|
||||||
int count_axis_left_y = 0;
|
count_axis_right_y = 0;
|
||||||
int count_axis_right_x = 0;
|
|
||||||
int count_axis_right_y = 0;
|
|
||||||
|
|
||||||
for (const auto& i : list) {
|
for (const auto& i : list) {
|
||||||
if (i->currentText() == "axis_left_x") {
|
if (i->currentText() == "axis_left_x") {
|
||||||
count_axis_left_x = count_axis_left_x + 1;
|
count_axis_left_x = count_axis_left_x + 1;
|
||||||
@ -96,8 +92,7 @@ void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
|||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
std::string line;
|
std::string line;
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
std::string output_string = "";
|
std::string output_string = "", input_string = "";
|
||||||
std::string input_string = "";
|
|
||||||
std::fstream file(config_file);
|
std::fstream file(config_file);
|
||||||
|
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
@ -228,8 +223,7 @@ void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
|||||||
lines.push_back("analog_deadzone = rightjoystick, " + deadzonevalue);
|
lines.push_back("analog_deadzone = rightjoystick, " + deadzonevalue);
|
||||||
|
|
||||||
std::vector<std::string> save;
|
std::vector<std::string> save;
|
||||||
bool CurrentLineEmpty = false;
|
bool CurrentLineEmpty = false, LastLineEmpty = false;
|
||||||
bool LastLineEmpty = false;
|
|
||||||
for (auto const& line : lines) {
|
for (auto const& line : lines) {
|
||||||
if (CurrentLineEmpty) {
|
if (CurrentLineEmpty) {
|
||||||
LastLineEmpty = true;
|
LastLineEmpty = true;
|
||||||
@ -258,9 +252,8 @@ void ControlSettings::SaveControllerConfig(bool CloseOnSave) {
|
|||||||
Config::SetUseUnifiedInputConfig(!ui->PerGameCheckBox->isChecked());
|
Config::SetUseUnifiedInputConfig(!ui->PerGameCheckBox->isChecked());
|
||||||
Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml");
|
Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "config.toml");
|
||||||
|
|
||||||
if (CloseOnSave) {
|
if (CloseOnSave)
|
||||||
QWidget::close();
|
QWidget::close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlSettings::SetDefault() {
|
void ControlSettings::SetDefault() {
|
||||||
@ -340,26 +333,11 @@ void ControlSettings::SetUIValuestoMappings() {
|
|||||||
const auto config_file = Config::GetFoolproofKbmConfigFile(config_id);
|
const auto config_file = Config::GetFoolproofKbmConfigFile(config_id);
|
||||||
std::ifstream file(config_file);
|
std::ifstream file(config_file);
|
||||||
|
|
||||||
bool CrossExists = false;
|
bool CrossExists = false, CircleExists = false, SquareExists = false, TriangleExists = false,
|
||||||
bool CircleExists = false;
|
L1Exists = false, L2Exists = false, L3Exists = false, R1Exists = false, R2Exists = false,
|
||||||
bool SquareExists = false;
|
R3Exists = false, DPadUpExists = false, DPadDownExists = false, DPadLeftExists = false,
|
||||||
bool TriangleExists = false;
|
DPadRightExists = false, StartExists = false, BackExists = false, LStickXExists = false,
|
||||||
bool L1Exists = false;
|
LStickYExists = false, RStickXExists = false, RStickYExists = false;
|
||||||
bool L2Exists = false;
|
|
||||||
bool L3Exists = false;
|
|
||||||
bool R1Exists = false;
|
|
||||||
bool R2Exists = false;
|
|
||||||
bool R3Exists = false;
|
|
||||||
bool DPadUpExists = false;
|
|
||||||
bool DPadDownExists = false;
|
|
||||||
bool DPadLeftExists = false;
|
|
||||||
bool DPadRightExists = false;
|
|
||||||
bool StartExists = false;
|
|
||||||
bool BackExists = false;
|
|
||||||
bool LStickXExists = false;
|
|
||||||
bool LStickYExists = false;
|
|
||||||
bool RStickXExists = false;
|
|
||||||
bool RStickYExists = false;
|
|
||||||
int lineCount = 0;
|
int lineCount = 0;
|
||||||
std::string line = "";
|
std::string line = "";
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user