[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / generaledit / trainer.cpp
blob721e2d60ae304a8a2586e5140b0d434d4b8efbbe
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include "trainer.h"
22 #include "ui_trainer.h"
24 TrainerPanel::TrainerPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
25 GeneralPanel(parent, generalSettings, firmware),
26 ui(new Ui::Trainer)
28 ui->setupUi(this);
31 ui->trnMode_1->setCurrentIndex(generalSettings.trainer.mix[0].mode);
32 ui->trnChn_1->setCurrentIndex(generalSettings.trainer.mix[0].src);
33 ui->trnWeight_1->setValue(generalSettings.trainer.mix[0].weight);
34 ui->trnMode_2->setCurrentIndex(generalSettings.trainer.mix[1].mode);
35 ui->trnChn_2->setCurrentIndex(generalSettings.trainer.mix[1].src);
36 ui->trnWeight_2->setValue(generalSettings.trainer.mix[1].weight);
37 ui->trnMode_3->setCurrentIndex(generalSettings.trainer.mix[2].mode);
38 ui->trnChn_3->setCurrentIndex(generalSettings.trainer.mix[2].src);
39 ui->trnWeight_3->setValue(generalSettings.trainer.mix[2].weight);
40 ui->trnMode_4->setCurrentIndex(generalSettings.trainer.mix[3].mode);
41 ui->trnChn_4->setCurrentIndex(generalSettings.trainer.mix[3].src);
42 ui->trnWeight_4->setValue(generalSettings.trainer.mix[3].weight);
46 TrainerPanel::~TrainerPanel()
48 delete ui;
51 void TrainerPanel::on_trnMode_1_currentIndexChanged(int index)
53 generalSettings.trainer.mix[0].mode = index;
54 emit modified();
57 void TrainerPanel::on_trnChn_1_currentIndexChanged(int index)
59 generalSettings.trainer.mix[0].src = index;
60 emit modified();
63 void TrainerPanel::on_trnWeight_1_editingFinished()
65 generalSettings.trainer.mix[0].weight = ui->trnWeight_1->value();
66 emit modified();
69 void TrainerPanel::on_trnMode_2_currentIndexChanged(int index)
71 generalSettings.trainer.mix[1].mode = index;
72 emit modified();
75 void TrainerPanel::on_trnChn_2_currentIndexChanged(int index)
77 generalSettings.trainer.mix[1].src = index;
78 emit modified();
81 void TrainerPanel::on_trnWeight_2_editingFinished()
83 generalSettings.trainer.mix[1].weight = ui->trnWeight_2->value();
84 emit modified();
87 void TrainerPanel::on_trnMode_3_currentIndexChanged(int index)
89 generalSettings.trainer.mix[2].mode = index;
90 emit modified();
93 void TrainerPanel::on_trnChn_3_currentIndexChanged(int index)
95 generalSettings.trainer.mix[2].src = index;
96 emit modified();
99 void TrainerPanel::on_trnWeight_3_editingFinished()
101 generalSettings.trainer.mix[2].weight = ui->trnWeight_3->value();
102 emit modified();
105 void TrainerPanel::on_trnMode_4_currentIndexChanged(int index)
107 generalSettings.trainer.mix[3].mode = index;
108 emit modified();
111 void TrainerPanel::on_trnChn_4_currentIndexChanged(int index)
113 generalSettings.trainer.mix[3].src = index;
114 emit modified();
117 void TrainerPanel::on_trnWeight_4_editingFinished()
119 generalSettings.trainer.mix[3].weight = ui->trnWeight_4->value();
120 emit modified();