Renamed CheckIfOperationChanged to OnDockedModeChanged

This commit is contained in:
David Marcec 2018-11-08 12:12:00 +11:00
parent fd1ef25257
commit 40db288a2a
2 changed files with 20 additions and 18 deletions

View File

@ -41,25 +41,27 @@ void ConfigureGeneral::PopulateHotkeyList(const HotkeyRegistry& registry) {
ui->widget->Populate(registry); ui->widget->Populate(registry);
} }
void ConfigureGeneral::CheckIfOperationChanged(bool last_state, bool new_state) { void ConfigureGeneral::OnDockedModeChanged(bool last_state, bool new_state) {
if (last_state != new_state) { if (last_state == new_state) {
Core::System& system{Core::System::GetInstance()}; return;
Service::SM::ServiceManager& sm = system.ServiceManager(); }
// Message queue is shared between these services, we just need to signal an operation Core::System& system{Core::System::GetInstance()};
// change to one and it will handle both automatically Service::SM::ServiceManager& sm = system.ServiceManager();
auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
bool has_signalled = false;
if (applet_oe != nullptr) { // Message queue is shared between these services, we just need to signal an operation
applet_oe->GetMessageQueue()->OperationModeChanged(); // change to one and it will handle both automatically
has_signalled = true; auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
} auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
bool has_signalled = false;
if (applet_ae != nullptr && !has_signalled) { if (applet_oe != nullptr) {
applet_ae->GetMessageQueue()->OperationModeChanged(); applet_oe->GetMessageQueue()->OperationModeChanged();
} has_signalled = true;
}
if (applet_ae != nullptr && !has_signalled) {
applet_ae->GetMessageQueue()->OperationModeChanged();
} }
} }
@ -72,7 +74,7 @@ void ConfigureGeneral::applyConfiguration() {
Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked(); Settings::values.use_cpu_jit = ui->use_cpu_jit->isChecked();
const bool pre_docked_mode = Settings::values.use_docked_mode; const bool pre_docked_mode = Settings::values.use_docked_mode;
Settings::values.use_docked_mode = ui->use_docked_mode->isChecked(); Settings::values.use_docked_mode = ui->use_docked_mode->isChecked();
CheckIfOperationChanged(pre_docked_mode, Settings::values.use_docked_mode); OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode);
Settings::values.enable_nfc = ui->enable_nfc->isChecked(); Settings::values.enable_nfc = ui->enable_nfc->isChecked();
} }

View File

@ -25,7 +25,7 @@ public:
private: private:
void setConfiguration(); void setConfiguration();
void CheckIfOperationChanged(bool last_state, bool new_state); void OnDockedModeChanged(bool last_state, bool new_state);
std::unique_ptr<Ui::ConfigureGeneral> ui; std::unique_ptr<Ui::ConfigureGeneral> ui;
}; };