Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / config / mixercurve.h
blob3c578a92c170605b1b8f69d0c7e149f20f847071
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 "mixercurvewidget.h"
31 #include "dblspindelegate.h"
32 #include "uavobjectwidgetutils_global.h"
33 #include "uavobjectwidgetutils/popupwidget.h"
35 #include <QFrame>
36 #include <QList>
38 namespace Ui {
39 class MixerCurve;
42 class QWidget;
43 class QTableWidget;
45 class MixerCurve : public QFrame {
46 Q_OBJECT
48 public:
49 explicit MixerCurve(QWidget *parent = 0);
50 ~MixerCurve();
53 /* Enumeration options for ThrottleCurves */
54 typedef enum { MIXERCURVE_THROTTLE = 0, MIXERCURVE_PITCH = 1 } MixerCurveType;
56 void setMixerType(MixerCurveType curveType);
57 void initCurve(const QList<double> *points);
58 QList<double> getCurve();
59 void initLinearCurve(int numPoints, double maxValue = 1, double minValue = 0);
60 void setCurve(const QList<double> *points);
61 void setMin(double value);
62 double getMin();
63 void setMax(double value);
64 double getMax();
65 double getCurveMin();
66 double getCurveMax();
67 double getCurveStep();
68 double setRange(double min, double max);
70 void setXAxisLabel(QString label);
71 void setYAxisLabel(QString label);
73 MixerCurveWidget *getCurveWidget()
75 return m_curve;
78 signals:
80 protected:
81 void showEvent(QShowEvent *event);
82 void resizeEvent(QResizeEvent *event);
84 public slots:
85 void ResetCurve();
86 void PopupCurve();
87 void GenerateCurve();
88 void UpdateSettingsTable();
90 private slots:
91 void SettingsTableChanged();
92 void CurveTypeChanged();
93 void CurveMinChanged(double value);
94 void CurveMaxChanged(double value);
95 void UpdateCurveUI();
97 private:
98 Ui::MixerCurve *m_mixerUI;
99 MixerCurveWidget *m_curve;
100 QTableWidget *m_settings;
101 MixerCurveType m_curveType;
102 DoubleSpinDelegate *m_spinDelegate;
105 #endif // MIXERCURVE_H