citra-emu
/
citra
Archived
1
0
Fork 0

address some comments

This commit is contained in:
Valentin Vanelslande 2018-12-29 08:27:06 -05:00
parent 5a4c7c32d8
commit 5a14af5f38
5 changed files with 30 additions and 27 deletions

View File

@ -113,7 +113,7 @@ void Config::ReadValues() {
Settings::LoadProfile(Settings::values.current_input_profile_index); Settings::LoadProfile(Settings::values.current_input_profile_index);
qt_config->endArray(); qt_config->endGroup();
qt_config->beginGroup("Core"); qt_config->beginGroup("Core");
Settings::values.use_cpu_jit = ReadSetting("use_cpu_jit", true).toBool(); Settings::values.use_cpu_jit = ReadSetting("use_cpu_jit", true).toBool();

View File

@ -42,7 +42,7 @@ void ConfigureDialog::applyConfiguration() {
ui->generalTab->applyConfiguration(); ui->generalTab->applyConfiguration();
ui->systemTab->applyConfiguration(); ui->systemTab->applyConfiguration();
ui->inputTab->applyConfiguration(); ui->inputTab->applyConfiguration();
ui->inputTab->applyProfile(); ui->inputTab->ApplyProfile();
ui->graphicsTab->applyConfiguration(); ui->graphicsTab->applyConfiguration();
ui->audioTab->applyConfiguration(); ui->audioTab->applyConfiguration();
ui->cameraTab->applyConfiguration(); ui->cameraTab->applyConfiguration();

View File

@ -224,11 +224,14 @@ ConfigureInput::ConfigureInput(QWidget* parent)
QDialog* motion_touch_dialog = new ConfigureMotionTouch(this); QDialog* motion_touch_dialog = new ConfigureMotionTouch(this);
return motion_touch_dialog->exec(); return motion_touch_dialog->exec();
}); });
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); }); connect(ui->buttonClearAll, &QPushButton::released, [this] { ClearAll(); });
connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); }); connect(ui->buttonRestoreDefaults, &QPushButton::released, [this]() { restoreDefaults(); });
connect(ui->buttonNew, &QPushButton::released, [this] { newProfile(); }); connect(ui->buttonNew, &QPushButton::released, [this] { NewProfile(); });
connect(ui->buttonDelete, &QPushButton::released, [this] { deleteProfile(); }); connect(ui->buttonDelete, &QPushButton::released, [this] { DeleteProfile(); });
connect(ui->buttonRename, &QPushButton::released, [this] { renameProfile(); }); connect(ui->buttonRename, &QPushButton::released, [this] { RenameProfile(); });
connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->profile, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int i) { [this](int i) {
@ -269,7 +272,7 @@ void ConfigureInput::applyConfiguration() {
[](const Common::ParamPackage& param) { return param.Serialize(); }); [](const Common::ParamPackage& param) { return param.Serialize(); });
} }
void ConfigureInput::applyProfile() { void ConfigureInput::ApplyProfile() {
Settings::values.current_input_profile_index = ui->profile->currentIndex(); Settings::values.current_input_profile_index = ui->profile->currentIndex();
} }
@ -390,7 +393,7 @@ void ConfigureInput::retranslateUi() {
ui->retranslateUi(this); ui->retranslateUi(this);
} }
void ConfigureInput::newProfile() { void ConfigureInput::NewProfile() {
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()) {
@ -402,13 +405,10 @@ void ConfigureInput::newProfile() {
ui->profile->addItem(name); ui->profile->addItem(name);
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);
} }
void ConfigureInput::deleteProfile() { void ConfigureInput::DeleteProfile() {
if (ui->profile->count() == 1) {
QMessageBox::critical(this, tr("Citra"), tr("You need to have 1 profile at least"));
return;
}
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) {
@ -419,9 +419,10 @@ void ConfigureInput::deleteProfile() {
ui->profile->setCurrentIndex(0); ui->profile->setCurrentIndex(0);
Settings::DeleteProfile(index); Settings::DeleteProfile(index);
loadConfiguration(); loadConfiguration();
ui->buttonDelete->setEnabled(ui->profile->count() > 1);
} }
void ConfigureInput::renameProfile() { void ConfigureInput::RenameProfile() {
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()) {
return; return;

View File

@ -40,7 +40,7 @@ public:
void loadConfiguration(); void loadConfiguration();
// Save the current input profile index // Save the current input profile index
void applyProfile(); void ApplyProfile();
private: private:
std::unique_ptr<Ui::ConfigureInput> ui; std::unique_ptr<Ui::ConfigureInput> ui;
@ -96,7 +96,7 @@ private:
void keyPressEvent(QKeyEvent* event) override; void keyPressEvent(QKeyEvent* event) override;
/// input profiles /// input profiles
void newProfile(); void NewProfile();
void deleteProfile(); void DeleteProfile();
void renameProfile(); void RenameProfile();
}; };

View File

@ -101,29 +101,31 @@ void LogSettings() {
} }
void LoadProfile(int index) { void LoadProfile(int index) {
values.current_input_profile = values.input_profiles[index]; Settings::values.current_input_profile = Settings::values.input_profiles[index];
values.current_input_profile_index = index; Settings::values.current_input_profile_index = index;
} }
void SaveProfile(int index) { void SaveProfile(int index) {
values.input_profiles[index] = values.current_input_profile; Settings::values.input_profiles[index] = Settings::values.current_input_profile;
} }
void CreateProfile(std::string name) { void CreateProfile(std::string name) {
InputProfile profile = values.current_input_profile; Settings::InputProfile profile = values.current_input_profile;
profile.name = std::move(name); profile.name = std::move(name);
values.input_profiles.push_back(std::move(profile)); Settings::values.input_profiles.push_back(std::move(profile));
values.current_input_profile_index = static_cast<int>(values.input_profiles.size()) - 1; Settings::values.current_input_profile_index =
LoadProfile(values.current_input_profile_index); static_cast<int>(Settings::values.input_profiles.size()) - 1;
Settings::LoadProfile(Settings::values.current_input_profile_index);
} }
void DeleteProfile(int index) { void DeleteProfile(int index) {
values.input_profiles.erase(values.input_profiles.begin() + index); Settings::values.input_profiles.erase(Settings::values.input_profiles.begin() + index);
LoadProfile(0); Settings::LoadProfile(0);
} }
void RenameCurrentProfile(std::string new_name) { void RenameCurrentProfile(std::string new_name) {
values.input_profiles[values.current_input_profile_index].name = std::move(new_name); Settings::values.input_profiles[Settings::values.current_input_profile_index].name =
std::move(new_name);
} }
} // namespace Settings } // namespace Settings