Validate RSSI instance to allow user defined RSSI source (issue #5842) (#5846)
[opentx.git] / companion / src / simulation / radiooutputswidget.h
blob216a833936723c9bb535dd4d5bb0ea4845acd8b6
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 #ifndef RADIOOUTPUTSWIDGET_H
22 #define RADIOOUTPUTSWIDGET_H
24 #include "simulator.h"
25 #include "simulatorinterface.h"
27 #include <QTimer>
28 #include <QWidget>
30 namespace Ui {
31 class RadioOutputsWidget;
34 class Firmware;
35 //class SimulatorInterface;
37 class QFrame;
38 class QLabel;
39 class QSlider;
41 using namespace Simulator;
43 class RadioOutputsWidget : public QWidget
45 Q_OBJECT
47 public:
48 explicit RadioOutputsWidget(SimulatorInterface * simulator, Firmware * firmware, QWidget * parent = 0);
49 ~RadioOutputsWidget();
51 public slots:
52 void start();
53 //void stop();
54 void restart();
56 protected slots:
57 void saveState();
58 void restoreState();
59 void onChannelOutValueChange(quint8 index, qint32 value, qint32 limit);
60 void onChannelMixValueChange(quint8 index, qint32 value, qint32 limit);
61 void onVirtSwValueChange(quint8 index, qint32 value);
62 void onGVarValueChange(quint8 index, qint32 value);
63 void onPhaseChanged(qint32 phase, const QString &);
65 protected:
66 void changeEvent(QEvent *e);
67 void setupChannelsDisplay(bool mixes = false);
68 void setupLsDisplay();
69 void setupGVarsDisplay();
70 QWidget * createLogicalSwitch(QWidget * parent, int switchNo);
72 SimulatorInterface * m_simulator;
73 Firmware * m_firmware;
75 QHash<int, QPair<QLabel *, QSlider *> > m_channelsMap; // m_channelsMap[chanIndex] = {QLabel*, QSlider*}
76 QHash<int, QPair<QLabel *, QSlider *> > m_mixesMap; // m_mixesMap[chanIndex] = {QLabel*, QSlider*}
77 QHash<int, QLabel *> m_logicSwitchMap; // m_logicSwitchMap[lsIndex] = QLabel*
78 QHash<int, QHash<int, QLabel *> > m_globalVarsMap; // m_globalVarsMap[gvarIndex][fmodeIndex] = QLabel*
80 int m_radioProfileId;
81 int m_dataUpdateFreq;
83 const static quint16 m_savedViewStateVersion;
85 private:
86 Ui::RadioOutputsWidget * ui;
89 #endif // RADIOOUTPUTSWIDGET_H