dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavconfiginfo.h
Go to the documentation of this file.
1 
12 /*
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.
17  *
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.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 #ifndef UAVCONFIGINFO_H
27 #define UAVCONFIGINFO_H
28 
29 #include <QObject>
30 #include <QString>
31 #include <QSettings>
33 #include "core_global.h"
34 
35 namespace Core {
36 
37 class IUAVGadgetConfiguration;
38 
39 class CORE_EXPORT UAVConfigVersion
40 {
41 public:
42  UAVConfigVersion(QString versionString = "0.0.0");
43  UAVConfigVersion(int major, int minor, int patch);
44 
45  int majorNr;
46  int minorNr;
47  int patchNr;
48 
49  QString toString() const;
50  bool operator==(const UAVConfigVersion &other);
51 };
52 
53 class CORE_EXPORT UAVConfigInfo : public QObject
54 {
55  Q_OBJECT
56 public:
57  explicit UAVConfigInfo(QObject *parent = nullptr);
58  explicit UAVConfigInfo(QSettings *qs, QObject *parent = nullptr);
59  explicit UAVConfigInfo(IUAVGadgetConfiguration *config, QObject *parent = nullptr);
60  UAVConfigInfo(UAVConfigVersion version, QString nameOfConfigurable, QObject *parent = nullptr);
61 
67  NotCompatible
68  };
69  void setNameOfConfigurable(const QString nameOfConfigurable)
70  {
71  m_nameOfConfigurable = nameOfConfigurable;
72  }
73 
74  void save(QSettings *qs);
75  void read(QSettings *qs);
76 
77  void setVersion(int major, int minor, int patch)
78  {
79  m_version = UAVConfigVersion(major, minor, patch);
80  }
81  void setVersion(const QString version) { m_version = UAVConfigVersion(version); }
82  void setVersion(const UAVConfigVersion version) { m_version = version; }
83  UAVConfigVersion version() { return m_version; }
84  bool locked() { return m_locked; }
85  void setLocked(bool locked) { m_locked = locked; }
86 
87  int checkCompatibilityWith(UAVConfigVersion programVersion);
88  bool askToAbort(int compat, QString message);
89  void notify(QString message);
90  bool standardVersionHandlingOK(UAVConfigVersion programVersion);
91  bool standardVersionHandlingOK(QString programVersion)
92  {
93  return standardVersionHandlingOK(UAVConfigVersion(programVersion));
94  }
95 
96 signals:
97 
98 public slots:
99 
100 private:
101  UAVConfigVersion m_version;
102  bool m_locked;
103  QString m_nameOfConfigurable;
104 };
105 
106 } // namespace Core
107 
108 #endif // UAVCONFIGINFO_H
void setVersion(const QString version)
Definition: uavconfiginfo.h:81
bool operator==(Point const &lhs, Point const &rhs)
Definition: point.cpp:49
bool standardVersionHandlingOK(QString programVersion)
Definition: uavconfiginfo.h:91
void setVersion(int major, int minor, int patch)
Definition: uavconfiginfo.h:77
UAVConfigVersion version()
Definition: uavconfiginfo.h:83
The Config Info is a helper-class to handle version changes in GCS configuration files.
Definition: uavconfiginfo.h:53
void setVersion(const UAVConfigVersion version)
Definition: uavconfiginfo.h:82
void setNameOfConfigurable(const QString nameOfConfigurable)
Definition: uavconfiginfo.h:69
void setLocked(bool locked)
Definition: uavconfiginfo.h:85
save(matfile $(SAVEOBJECTSCODE))