dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
smartsavebutton.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 #ifndef SMARTSAVEBUTTON_H
29 #define SMARTSAVEBUTTON_H
30 
34 #include "uavobjects/uavobject.h"
35 #include <QPushButton>
36 #include <QList>
37 #include <QEventLoop>
39 #include <QObject>
40 #include <QDebug>
41 class smartSaveButton : public QObject
42 {
43  enum buttonTypeEnum { save_button, apply_button };
44 
45 public:
46  Q_OBJECT
47 public:
49  void addButtons(QPushButton *save, QPushButton *apply);
51  void addObject(UAVDataObject *);
52  void addObject(UAVDataObject *, bool);
53  void clearObjects();
54  void removeObject(UAVDataObject *obj);
55  void removeAllObjects();
56  void addApplyButton(QPushButton *apply);
57  void addSaveButton(QPushButton *save);
58  void resetIcons();
60 signals:
61  void preProcessOperations();
62  void saveSuccessfull();
63  void beginOp();
64  void endOp();
65 public slots:
66  void apply();
67  void save();
68 private slots:
69  void processClick();
70  void processOperation(QPushButton *button, bool save);
71  void transaction_finished(UAVObject *obj, bool result);
72  void saving_finished(int, bool);
73 
74 private:
75  quint32 current_objectID;
76  UAVDataObject *current_object;
77  bool upload_result;
78  bool save_result;
79  QEventLoop loop;
80  QList<UAVDataObject *> objects;
81  QMap<QPushButton *, buttonTypeEnum> buttonList;
82  QMap<UAVDataObject *, bool> mandatoryList;
83 
84 protected:
85 public slots:
86  void enableControls(bool value);
87 };
88 
89 #endif // SMARTSAVEBUTTON_H
void addApplyButton(QPushButton *apply)
smartSaveButton::addApplyButton Called only by the ConfigTaskWidget when adding the smart save button...
void removeAllObjects()
smartSaveButton::removeAllObjects Remove all tracked objects at once.
void addSaveButton(QPushButton *save)
smartSaveButton::addSaveButton Called only by the ConfigTaskWidget when adding the smart save buttons...
void addButtons(QPushButton *save, QPushButton *apply)
smartSaveButton::addButtons Called only by the ConfigTaskWidget when adding the smart save buttons...
void removeObject(UAVDataObject *obj)
smartSaveButton::removeObject The smartSaveButton contains a list of objects it will work with...
void enableControls(bool value)
void addObject(UAVDataObject *)
smartSaveButton::addObject The smartSaveButton contains a list of objects it will work with...
void preProcessOperations()
void setNotMandatory(UAVDataObject *)
void setObjects(QList< UAVDataObject * >)
smartSaveButton::setObjects Sets all monitored objects in one operation
void saveSuccessfull()