qt: Various updates to the settings menu to improve consistency

- All buttons which open a modal interface now disable themselves until their interface is closed
- Renamed button_linked_console to button_unlink_console to better reflect what it actually does
- Changed the warning icon of the Regenerate Console ID button to be the same as the Regenerate MAC Address button

# Conflicts:
#	src/citra_qt/configuration/configure_system.cpp
#	src/citra_qt/configuration/configure_system.ui
This commit is contained in:
OpenSauce04 2025-04-03 14:33:45 +01:00 committed by AzaharPlus
parent 452c553143
commit 0843a628ce
4 changed files with 30 additions and 4 deletions

View File

@ -60,12 +60,14 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
}); });
connect(ui->change_screenshot_dir, &QToolButton::clicked, this, [this] { connect(ui->change_screenshot_dir, &QToolButton::clicked, this, [this] {
ui->change_screenshot_dir->setEnabled(false);
const QString dir_path = QFileDialog::getExistingDirectory( const QString dir_path = QFileDialog::getExistingDirectory(
this, tr("Select Screenshot Directory"), ui->screenshot_dir_path->text(), this, tr("Select Screenshot Directory"), ui->screenshot_dir_path->text(),
QFileDialog::ShowDirsOnly); QFileDialog::ShowDirsOnly);
if (!dir_path.isEmpty()) { if (!dir_path.isEmpty()) {
ui->screenshot_dir_path->setText(dir_path); ui->screenshot_dir_path->setText(dir_path);
} }
ui->change_screenshot_dir->setEnabled(true);
}); });
} }
@ -135,12 +137,14 @@ void ConfigureGeneral::SetConfiguration() {
} }
void ConfigureGeneral::ResetDefaults() { void ConfigureGeneral::ResetDefaults() {
ui->button_reset_defaults->setEnabled(false);
QMessageBox::StandardButton answer = QMessageBox::question( QMessageBox::StandardButton answer = QMessageBox::question(
this, tr("Azahar"), this, tr("Azahar"),
tr("Are you sure you want to <b>reset your settings</b> and close Azahar?"), tr("Are you sure you want to <b>reset your settings</b> and close Azahar?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (answer == QMessageBox::No) { if (answer == QMessageBox::No) {
ui->button_reset_defaults->setEnabled(true);
return; return;
} }

View File

@ -1,4 +1,4 @@
// Copyright Citra Emulator Project / Lime3DS Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -377,8 +377,10 @@ ConfigureInput::ConfigureInput(Core::System& _system, QWidget* parent)
}); });
connect(ui->buttonMotionTouch, &QPushButton::clicked, this, [this] { connect(ui->buttonMotionTouch, &QPushButton::clicked, this, [this] {
ui->buttonMotionTouch->setEnabled(false);
QDialog* motion_touch_dialog = new ConfigureMotionTouch(this); QDialog* motion_touch_dialog = new ConfigureMotionTouch(this);
return motion_touch_dialog->exec(); motion_touch_dialog->exec();
ui->buttonMotionTouch->setEnabled(true);
}); });
ui->buttonDelete->setEnabled(ui->profile->count() > 1); ui->buttonDelete->setEnabled(ui->profile->count() > 1);
@ -580,9 +582,11 @@ void ConfigureInput::MapFromButton(const Common::ParamPackage& params) {
} }
void ConfigureInput::AutoMap() { void ConfigureInput::AutoMap() {
ui->buttonAutoMap->setEnabled(false);
if (QMessageBox::information(this, tr("Information"), if (QMessageBox::information(this, tr("Information"),
tr("After pressing OK, press any button on your joystick"), tr("After pressing OK, press any button on your joystick"),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) {
ui->buttonAutoMap->setEnabled(true);
return; return;
} }
input_setter = [this](const Common::ParamPackage& params) { input_setter = [this](const Common::ParamPackage& params) {
@ -597,6 +601,7 @@ void ConfigureInput::AutoMap() {
} }
timeout_timer->start(5000); // Cancel after 5 seconds timeout_timer->start(5000); // Cancel after 5 seconds
poll_timer->start(200); // Check for new inputs every 200ms poll_timer->start(200); // Check for new inputs every 200ms
ui->buttonAutoMap->setEnabled(true);
} }
void ConfigureInput::HandleClick(QPushButton* button, void ConfigureInput::HandleClick(QPushButton* button,
@ -671,13 +676,16 @@ void ConfigureInput::RetranslateUI() {
} }
void ConfigureInput::NewProfile() { void ConfigureInput::NewProfile() {
ui->buttonNew->setEnabled(false);
const 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()) {
ui->buttonNew->setEnabled(true);
return; return;
} }
if (IsProfileNameDuplicate(name)) { if (IsProfileNameDuplicate(name)) {
WarnProposedProfileNameIsDuplicate(); WarnProposedProfileNameIsDuplicate();
ui->buttonNew->setEnabled(true);
return; return;
} }
@ -688,12 +696,15 @@ void ConfigureInput::NewProfile() {
ui->profile->setCurrentIndex(Settings::values.current_input_profile_index); ui->profile->setCurrentIndex(Settings::values.current_input_profile_index);
LoadConfiguration(); LoadConfiguration();
ui->buttonDelete->setEnabled(ui->profile->count() > 1); ui->buttonDelete->setEnabled(ui->profile->count() > 1);
ui->buttonNew->setEnabled(true);
} }
void ConfigureInput::DeleteProfile() { void ConfigureInput::DeleteProfile() {
ui->buttonDelete->setEnabled(false);
const auto 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) {
ui->buttonDelete->setEnabled(true);
return; return;
} }
const int index = ui->profile->currentIndex(); const int index = ui->profile->currentIndex();
@ -705,18 +716,22 @@ void ConfigureInput::DeleteProfile() {
} }
void ConfigureInput::RenameProfile() { void ConfigureInput::RenameProfile() {
ui->buttonRename->setEnabled(false);
const 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()) {
ui->buttonRename->setEnabled(true);
return; return;
} }
if (IsProfileNameDuplicate(new_name)) { if (IsProfileNameDuplicate(new_name)) {
WarnProposedProfileNameIsDuplicate(); WarnProposedProfileNameIsDuplicate();
ui->buttonRename->setEnabled(true);
return; return;
} }
ui->profile->setItemText(ui->profile->currentIndex(), new_name); ui->profile->setItemText(ui->profile->currentIndex(), new_name);
Settings::RenameCurrentProfile(new_name.toStdString()); Settings::RenameCurrentProfile(new_name.toStdString());
Settings::SaveProfile(ui->profile->currentIndex()); Settings::SaveProfile(ui->profile->currentIndex());
ui->buttonRename->setEnabled(true);
} }
bool ConfigureInput::IsProfileNameDuplicate(const QString& name) const { bool ConfigureInput::IsProfileNameDuplicate(const QString& name) const {

View File

@ -1,4 +1,4 @@
// Copyright Citra Emulator Project / Lime3DS Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -98,8 +98,10 @@ ConfigureLayout::ConfigureLayout(QWidget* parent)
#endif #endif
connect(ui->bg_button, &QPushButton::clicked, this, [this] { connect(ui->bg_button, &QPushButton::clicked, this, [this] {
ui->bg_button->setEnabled(false);
const QColor new_bg_color = QColorDialog::getColor(bg_color); const QColor new_bg_color = QColorDialog::getColor(bg_color);
if (!new_bg_color.isValid()) { if (!new_bg_color.isValid()) {
ui->bg_button->setEnabled(true);
return; return;
} }
bg_color = new_bg_color; bg_color = new_bg_color;
@ -107,6 +109,7 @@ ConfigureLayout::ConfigureLayout(QWidget* parent)
pixmap.fill(bg_color); pixmap.fill(bg_color);
const QIcon color_icon(pixmap); const QIcon color_icon(pixmap);
ui->bg_button->setIcon(color_icon); ui->bg_button->setIcon(color_icon);
ui->bg_button->setEnabled(true);
}); });
} }

View File

@ -1,4 +1,4 @@
// Copyright 2021 Citra Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -21,6 +21,7 @@ ConfigureStorage::ConfigureStorage(bool is_powered_on_, QWidget* parent)
}); });
connect(ui->change_nand_dir, &QPushButton::clicked, this, [this]() { connect(ui->change_nand_dir, &QPushButton::clicked, this, [this]() {
ui->change_nand_dir->setEnabled(false);
const QString dir_path = QFileDialog::getExistingDirectory( const QString dir_path = QFileDialog::getExistingDirectory(
this, tr("Select NAND Directory"), this, tr("Select NAND Directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)), QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)),
@ -29,6 +30,7 @@ ConfigureStorage::ConfigureStorage(bool is_powered_on_, QWidget* parent)
FileUtil::UpdateUserPath(FileUtil::UserPath::NANDDir, dir_path.toStdString()); FileUtil::UpdateUserPath(FileUtil::UserPath::NANDDir, dir_path.toStdString());
SetConfiguration(); SetConfiguration();
} }
ui->change_nand_dir->setEnabled(true);
}); });
connect(ui->open_sdmc_dir, &QPushButton::clicked, []() { connect(ui->open_sdmc_dir, &QPushButton::clicked, []() {
@ -37,6 +39,7 @@ ConfigureStorage::ConfigureStorage(bool is_powered_on_, QWidget* parent)
}); });
connect(ui->change_sdmc_dir, &QPushButton::clicked, this, [this]() { connect(ui->change_sdmc_dir, &QPushButton::clicked, this, [this]() {
ui->change_sdmc_dir->setEnabled(false);
const QString dir_path = QFileDialog::getExistingDirectory( const QString dir_path = QFileDialog::getExistingDirectory(
this, tr("Select SDMC Directory"), this, tr("Select SDMC Directory"),
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)), QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)),
@ -45,6 +48,7 @@ ConfigureStorage::ConfigureStorage(bool is_powered_on_, QWidget* parent)
FileUtil::UpdateUserPath(FileUtil::UserPath::SDMCDir, dir_path.toStdString()); FileUtil::UpdateUserPath(FileUtil::UserPath::SDMCDir, dir_path.toStdString());
SetConfiguration(); SetConfiguration();
} }
ui->change_sdmc_dir->setEnabled(true);
}); });
connect(ui->toggle_virtual_sd, &QCheckBox::clicked, this, [this]() { connect(ui->toggle_virtual_sd, &QCheckBox::clicked, this, [this]() {