LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / config / mixercurve.h
blobfaa581fcc64441258ca3d990c2cfe676f23e4686
1 /**
2 ******************************************************************************
4 * @file mixercurve.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup ConfigPlugin Config Plugin
9 * @{
10 * @brief A MixerCurve Gadget used to update settings in the firmware
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef MIXERCURVE_H
28 #define MIXERCURVE_H
30 #include <QFrame>
31 #include <QWidget>
32 #include <QList>
33 #include <QTableWidget>
35 #include "ui_mixercurve.h"
36 #include "mixercurvewidget.h"
37 #include "dblspindelegate.h"
38 #include "uavobjectwidgetutils_global.h"
39 #include "uavobjectwidgetutils/popupwidget.h"
42 namespace Ui {
43 class MixerCurve;
46 class MixerCurve : public QFrame {
47 Q_OBJECT
49 public:
50 explicit MixerCurve(QWidget *parent = 0);
51 ~MixerCurve();
54 /* Enumeration options for ThrottleCurves */
55 typedef enum { MIXERCURVE_THROTTLE = 0, MIXERCURVE_PITCH = 1 } MixerCurveType;
57 void setMixerType(MixerCurveType curveType);
58 void initCurve(const QList<double> *points);
59 QList<double> getCurve();
60 void initLinearCurve(int numPoints, double maxValue = 1, double minValue = 0);
61 void setCurve(const QList<double> *points);
62 void setMin(double value);
63 double getMin();
64 void setMax(double value);
65 double getMax();
66 double getCurveMin();
67 double getCurveMax();
68 double getCurveStep();
69 double setRange(double min, double max);
71 void setXAxisLabel(QString label);
72 void setYAxisLabel(QString label);
74 MixerCurveWidget *getCurveWidget()
76 return m_curve;
79 signals:
81 protected:
82 void showEvent(QShowEvent *event);
83 void resizeEvent(QResizeEvent *event);
85 public slots:
86 void ResetCurve();
87 void PopupCurve();
88 void GenerateCurve();
89 void UpdateSettingsTable();
91 private slots:
92 void SettingsTableChanged();
93 void CurveTypeChanged();
94 void CurveMinChanged(double value);
95 void CurveMaxChanged(double value);
96 void UpdateCurveUI();
98 private:
99 Ui::MixerCurve *m_mixerUI;
100 MixerCurveWidget *m_curve;
101 QTableWidget *m_settings;
102 MixerCurveType m_curveType;
103 DoubleSpinDelegate *m_spinDelegate;
106 #endif // MIXERCURVE_H