Apply suggestions from code review

Co-Authored-By: valentinvanelslande <valentinvanelslandeacnl@gmail.com>
This commit is contained in:
Mat M 2018-12-28 21:00:09 -05:00 committed by GitHub
parent 7c95032e3a
commit 90965525ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 10 deletions

View file

@ -100,7 +100,9 @@ ConfigureInput::ConfigureInput(QWidget* parent)
ui->setupUi(this);
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));
}
@ -389,7 +391,7 @@ void ConfigureInput::retranslateUi() {
}
void ConfigureInput::newProfile() {
QString name =
const QString name =
QInputDialog::getText(this, tr("New Profile"), tr("Enter the name for the new profile."));
if (name.isEmpty()) {
return;
@ -407,12 +409,12 @@ void ConfigureInput::deleteProfile() {
QMessageBox::critical(this, tr("Citra"), tr("You need to have 1 profile at least"));
return;
}
QMessageBox::StandardButton answer = QMessageBox::question(
const auto answer = QMessageBox::question(
this, tr("Delete Profile"), tr("Delete profile %1?").arg(ui->profile->currentText()));
if (answer != QMessageBox::Yes) {
return;
}
int index = ui->profile->currentIndex();
const int index = ui->profile->currentIndex();
ui->profile->removeItem(index);
ui->profile->setCurrentIndex(0);
Settings::DeleteProfile(index);
@ -420,7 +422,7 @@ void ConfigureInput::deleteProfile() {
}
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()) {
return;
}