| 574 | } |
| 575 | |
| 576 | void ControllerSettingsWindow::switchProfile(const QString& name) |
| 577 | { |
| 578 | QSignalBlocker sb(m_ui.currentProfile); |
| 579 | |
| 580 | if (!name.isEmpty()) |
| 581 | { |
| 582 | std::string path(VMManager::GetInputProfilePath(name.toStdString())); |
| 583 | if (!FileSystem::FileExists(path.c_str())) |
| 584 | { |
| 585 | QMessageBox::critical(this, tr("Error"), tr("The input profile named '%1' cannot be found.").arg(name)); |
| 586 | return; |
| 587 | } |
| 588 | |
| 589 | std::unique_ptr<INISettingsInterface> sif(std::make_unique<INISettingsInterface>(std::move(path))); |
| 590 | sif->Load(); |
| 591 | m_profile_interface = std::move(sif); |
| 592 | m_ui.currentProfile->setCurrentIndex(m_ui.currentProfile->findText(name)); |
| 593 | } |
| 594 | else |
| 595 | { |
| 596 | m_profile_interface.reset(); |
| 597 | m_ui.currentProfile->setCurrentIndex(0); |
| 598 | } |
| 599 | |
| 600 | m_profile_name = name; |
| 601 | createWidgets(); |
| 602 | } |
| 603 | |
| 604 | #include "moc_ControllerSettingsWindow.cpp" |