2012-02-05 21:07:19 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file smartsavebutton.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup UAVObjectWidgetUtils Plugin
|
|
|
|
* @{
|
|
|
|
* @brief Utility plugin for UAVObject to Widget relation management
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
2011-07-19 15:50:42 +02:00
|
|
|
#ifndef SMARTSAVEBUTTON_H
|
|
|
|
#define SMARTSAVEBUTTON_H
|
|
|
|
|
|
|
|
#include "uavtalk/telemetrymanager.h"
|
|
|
|
#include "extensionsystem/pluginmanager.h"
|
|
|
|
#include "uavobjectmanager.h"
|
|
|
|
#include "uavobject.h"
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QList>
|
|
|
|
#include <QEventLoop>
|
|
|
|
#include "uavobjectutilmanager.h"
|
|
|
|
#include <QObject>
|
2011-07-26 21:35:38 +02:00
|
|
|
#include <QDebug>
|
2011-07-19 15:50:42 +02:00
|
|
|
class smartSaveButton:public QObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
smartSaveButton(QPushButton * update,QPushButton * save);
|
2011-08-23 12:25:28 +02:00
|
|
|
void setObjects(QList<UAVDataObject *>);
|
|
|
|
void addObject(UAVDataObject *);
|
2011-07-19 15:50:42 +02:00
|
|
|
void clearObjects();
|
2012-02-02 17:22:40 +01:00
|
|
|
void removeObject(UAVDataObject *obj);
|
|
|
|
void removeAllObjects();
|
2011-07-19 15:50:42 +02:00
|
|
|
signals:
|
|
|
|
void preProcessOperations();
|
2011-07-26 21:35:38 +02:00
|
|
|
void saveSuccessfull();
|
|
|
|
void beginOp();
|
|
|
|
void endOp();
|
2011-07-19 15:50:42 +02:00
|
|
|
private slots:
|
|
|
|
void processClick();
|
|
|
|
void transaction_finished(UAVObject* obj, bool result);
|
|
|
|
void saving_finished(int,bool);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPushButton *bupdate;
|
|
|
|
QPushButton *bsave;
|
|
|
|
quint32 current_objectID;
|
2011-08-23 12:25:28 +02:00
|
|
|
UAVDataObject * current_object;
|
2011-07-19 15:50:42 +02:00
|
|
|
bool up_result;
|
|
|
|
bool sv_result;
|
|
|
|
QEventLoop loop;
|
2011-08-23 12:25:28 +02:00
|
|
|
QList<UAVDataObject *> objects;
|
2011-07-19 15:50:42 +02:00
|
|
|
protected:
|
2011-07-26 00:18:41 +02:00
|
|
|
public slots:
|
|
|
|
void enableControls(bool value);
|
2011-07-19 15:50:42 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SMARTSAVEBUTTON_H
|