2010-08-20 23:18:20 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file configtaskwidget.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup ConfigPlugin Config Plugin
|
|
|
|
* @{
|
|
|
|
* @brief The Configuration Gadget used to update settings in the firmware (task widget)
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
#ifndef CONFIGTASKWIDGET_H
|
|
|
|
#define CONFIGTASKWIDGET_H
|
|
|
|
|
2010-09-07 21:31:19 +02:00
|
|
|
|
2010-08-20 23:18:20 +02:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
2011-01-22 18:38:22 +01:00
|
|
|
#include "uavobjectmanager.h"
|
|
|
|
#include "uavobject.h"
|
2011-06-02 16:08:19 +02:00
|
|
|
#include "uavobjectutilmanager.h"
|
2010-09-07 21:31:19 +02:00
|
|
|
#include <QQueue>
|
2010-08-20 23:18:20 +02:00
|
|
|
#include <QtGui/QWidget>
|
|
|
|
#include <QList>
|
2011-07-26 00:18:41 +02:00
|
|
|
#include <QLabel>
|
|
|
|
#include "smartsavebutton.h"
|
2011-07-26 21:35:38 +02:00
|
|
|
#include "mixercurvewidget.h"
|
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QDoubleSpinBox>
|
|
|
|
#include <QSpinBox>
|
2011-08-02 18:06:17 +02:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
|
2010-08-20 23:18:20 +02:00
|
|
|
class ConfigTaskWidget: public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2011-07-26 00:18:41 +02:00
|
|
|
struct objectToWidget
|
|
|
|
{
|
|
|
|
UAVObject * object;
|
|
|
|
UAVObjectField * field;
|
|
|
|
QWidget * widget;
|
2011-08-04 17:58:41 +02:00
|
|
|
int index;
|
|
|
|
int scale;
|
2011-07-26 00:18:41 +02:00
|
|
|
};
|
|
|
|
|
2010-08-20 23:18:20 +02:00
|
|
|
ConfigTaskWidget(QWidget *parent = 0);
|
|
|
|
~ConfigTaskWidget();
|
2010-09-07 21:31:19 +02:00
|
|
|
void saveObjectToSD(UAVObject *obj);
|
2010-08-26 16:23:40 +02:00
|
|
|
UAVObjectManager* getObjectManager();
|
2011-03-28 20:43:15 +02:00
|
|
|
static double listMean(QList<double> list);
|
2011-07-26 21:35:38 +02:00
|
|
|
void addUAVObject(QString objectName);
|
|
|
|
void addWidget(QWidget * widget);
|
2011-08-04 17:58:41 +02:00
|
|
|
void addUAVObjectToWidgetRelation(QString object,QString field,QWidget * widget,int index=0,int scale=1);
|
|
|
|
|
2011-07-26 00:18:41 +02:00
|
|
|
void setupButtons(QPushButton * update,QPushButton * save);
|
2011-07-26 21:35:38 +02:00
|
|
|
bool isDirty();
|
2011-08-02 18:06:17 +02:00
|
|
|
void setDirty(bool value);
|
2011-08-04 17:58:41 +02:00
|
|
|
void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index);
|
2011-09-23 14:48:27 +02:00
|
|
|
bool allObjectsUpdated();
|
2011-06-07 16:56:16 +02:00
|
|
|
public slots:
|
|
|
|
void onAutopilotDisconnect();
|
|
|
|
void onAutopilotConnect();
|
2011-09-23 14:48:27 +02:00
|
|
|
void invalidateObjects();
|
2011-06-07 16:56:16 +02:00
|
|
|
|
2011-03-29 03:29:56 +02:00
|
|
|
private slots:
|
2011-07-26 21:35:38 +02:00
|
|
|
virtual void refreshValues();
|
2011-07-26 00:18:41 +02:00
|
|
|
virtual void updateObjectsFromWidgets();
|
2011-09-23 14:48:27 +02:00
|
|
|
void objectUpdated(UAVObject*);
|
2010-09-07 21:31:19 +02:00
|
|
|
private:
|
2011-08-23 12:25:28 +02:00
|
|
|
bool isConnected;
|
2011-08-04 17:58:41 +02:00
|
|
|
QStringList objectsList;
|
2011-07-26 00:18:41 +02:00
|
|
|
QList <objectToWidget*> objOfInterest;
|
|
|
|
ExtensionSystem::PluginManager *pm;
|
|
|
|
UAVObjectManager *objManager;
|
|
|
|
smartSaveButton *smartsave;
|
2011-09-23 14:48:27 +02:00
|
|
|
QMap<UAVObject *,bool> objectUpdates;
|
2011-07-26 21:35:38 +02:00
|
|
|
bool dirty;
|
2011-07-26 00:18:41 +02:00
|
|
|
protected slots:
|
2011-07-26 21:35:38 +02:00
|
|
|
virtual void disableObjUpdates();
|
|
|
|
virtual void enableObjUpdates();
|
|
|
|
virtual void clearDirty();
|
2011-07-26 00:18:41 +02:00
|
|
|
virtual void widgetsContentsChanged();
|
|
|
|
virtual void populateWidgets();
|
|
|
|
virtual void refreshWidgetsValues();
|
|
|
|
protected:
|
|
|
|
virtual void enableControls(bool enable);
|
2010-09-07 21:31:19 +02:00
|
|
|
|
2010-08-20 23:18:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONFIGTASKWIDGET_H
|