mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-19 19:21:07 +00:00
Apply suggestions from code review
Co-Authored-By: valentinvanelslande <valentinvanelslandeacnl@gmail.com>
This commit is contained in:
parent
7c95032e3a
commit
90965525ac
@ -93,7 +93,7 @@ void Config::ReadValues() {
|
|||||||
Settings::values.profiles.emplace_back(std::move(profile));
|
Settings::values.profiles.emplace_back(std::move(profile));
|
||||||
};
|
};
|
||||||
|
|
||||||
int size = qt_config->beginReadArray("profiles");
|
const int num_input_profiles = qt_config->beginReadArray("profiles");
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
qt_config->setArrayIndex(i);
|
qt_config->setArrayIndex(i);
|
||||||
|
@ -100,7 +100,9 @@ ConfigureInput::ConfigureInput(QWidget* parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
|
|
||||||
for (int i = 0; i < Settings::values.profiles.size(); ++i) {
|
for (const auto& profile : Settings::values::profiles) {
|
||||||
|
ui->profile->addItem(QString::fromStdString(profile.name));
|
||||||
|
}
|
||||||
ui->profile->addItem(QString::fromStdString(Settings::values.profiles[i].name));
|
ui->profile->addItem(QString::fromStdString(Settings::values.profiles[i].name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +391,7 @@ void ConfigureInput::retranslateUi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::newProfile() {
|
void ConfigureInput::newProfile() {
|
||||||
QString name =
|
const QString name =
|
||||||
QInputDialog::getText(this, tr("New Profile"), tr("Enter the name for the new profile."));
|
QInputDialog::getText(this, tr("New Profile"), tr("Enter the name for the new profile."));
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@ -407,12 +409,12 @@ void ConfigureInput::deleteProfile() {
|
|||||||
QMessageBox::critical(this, tr("Citra"), tr("You need to have 1 profile at least"));
|
QMessageBox::critical(this, tr("Citra"), tr("You need to have 1 profile at least"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMessageBox::StandardButton answer = QMessageBox::question(
|
const auto answer = QMessageBox::question(
|
||||||
this, tr("Delete Profile"), tr("Delete profile %1?").arg(ui->profile->currentText()));
|
this, tr("Delete Profile"), tr("Delete profile %1?").arg(ui->profile->currentText()));
|
||||||
if (answer != QMessageBox::Yes) {
|
if (answer != QMessageBox::Yes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int index = ui->profile->currentIndex();
|
const int index = ui->profile->currentIndex();
|
||||||
ui->profile->removeItem(index);
|
ui->profile->removeItem(index);
|
||||||
ui->profile->setCurrentIndex(0);
|
ui->profile->setCurrentIndex(0);
|
||||||
Settings::DeleteProfile(index);
|
Settings::DeleteProfile(index);
|
||||||
@ -420,7 +422,7 @@ void ConfigureInput::deleteProfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::renameProfile() {
|
void ConfigureInput::renameProfile() {
|
||||||
QString new_name = QInputDialog::getText(this, tr("Rename Profile"), tr("New name:"));
|
const QString new_name = QInputDialog::getText(this, tr("Rename Profile"), tr("New name:"));
|
||||||
if (new_name.isEmpty()) {
|
if (new_name.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1327,7 +1327,7 @@ void GMainWindow::OnConfigure() {
|
|||||||
&GMainWindow::OnLanguageChanged);
|
&GMainWindow::OnLanguageChanged);
|
||||||
auto old_theme = UISettings::values.theme;
|
auto old_theme = UISettings::values.theme;
|
||||||
const int old_profile = Settings::values.profile;
|
const int old_profile = Settings::values.profile;
|
||||||
auto old_profiles = Settings::values.profiles;
|
const auto old_profiles = Settings::values.profiles;
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
||||||
auto result = configureDialog.exec();
|
auto result = configureDialog.exec();
|
||||||
if (result == QDialog::Accepted) {
|
if (result == QDialog::Accepted) {
|
||||||
|
@ -133,7 +133,7 @@ void CreateProfile(std::string name) {
|
|||||||
profile.udp_input_address = values.udp_input_address;
|
profile.udp_input_address = values.udp_input_address;
|
||||||
profile.udp_input_port = values.udp_input_port;
|
profile.udp_input_port = values.udp_input_port;
|
||||||
profile.udp_pad_index = values.udp_pad_index;
|
profile.udp_pad_index = values.udp_pad_index;
|
||||||
values.profiles.push_back(profile);
|
values.profiles.push_back(std::move(profile));
|
||||||
values.profile = static_cast<int>(values.profiles.size()) - 1;
|
values.profile = static_cast<int>(values.profiles.size()) - 1;
|
||||||
LoadProfile(values.profile);
|
LoadProfile(values.profile);
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ struct Values {
|
|||||||
u16 udp_input_port;
|
u16 udp_input_port;
|
||||||
u8 udp_pad_index;
|
u8 udp_pad_index;
|
||||||
|
|
||||||
int profile; ///< The current input profile index
|
int current_input_profile; ///< The current input profile index
|
||||||
std::vector<InputProfile> profiles; ///< The list of input profiles
|
std::vector<InputProfile> input_profiles; ///< The list of input profiles
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
bool use_cpu_jit;
|
bool use_cpu_jit;
|
||||||
|
Loading…
Reference in New Issue
Block a user