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
|