mode: move responsabilities from mode to modehandler

- Pass the following responsabilities from mode to mode handler:
   - active / deactive target mode
   - get active mode
   - create new modes

- Move back setting averaging mode when settings are
updated using getModes() method instead of handling
logic in mode handler.
This commit is contained in:
Kiara Navarro 2022-07-10 19:55:10 -05:00
parent f56e32488e
commit 2fbe6e84be
No known key found for this signature in database
GPG key ID: CBA9F2172CE33FBA
17 changed files with 142 additions and 126 deletions

View file

@ -1,4 +1,5 @@
#include "generator.h"
#include "modehandler.h"
#include <QSettings>
@ -55,7 +56,7 @@ void Generator::fromJSON(nlohmann::json j)
void Generator::updateDevice()
{
if(!window->getDevice() || Mode::getActiveMode() != this) {
if(!window->getDevice() || window->getModeHandler()->getActiveMode() != this) {
// can't update if not connected
return;
}