2010-09-12 17:51:14 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file uavconfiginfo.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup CorePlugin Core Plugin
|
|
|
|
* @{
|
|
|
|
* @brief The Core GCS plugin
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* 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 UAVCONFIGINFO_H
|
|
|
|
#define UAVCONFIGINFO_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QSettings>
|
2010-09-26 19:34:23 +02:00
|
|
|
#include "iuavgadgetconfiguration.h"
|
|
|
|
#include "core_global.h"
|
2010-09-12 17:51:14 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
namespace Core {
|
2010-09-26 19:34:23 +02:00
|
|
|
class IUAVGadgetConfiguration;
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
class CORE_EXPORT UAVConfigVersion {
|
2010-09-12 17:51:14 +02:00
|
|
|
public:
|
|
|
|
UAVConfigVersion(QString versionString = "0.0.0");
|
|
|
|
UAVConfigVersion(int major, int minor, int patch);
|
|
|
|
|
|
|
|
int majorNr;
|
|
|
|
int minorNr;
|
|
|
|
int patchNr;
|
|
|
|
|
|
|
|
QString toString() const;
|
|
|
|
bool operator==(const UAVConfigVersion &other);
|
|
|
|
};
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
class CORE_EXPORT UAVConfigInfo : public QObject {
|
2010-09-12 17:51:14 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
|
2010-09-26 19:34:23 +02:00
|
|
|
explicit UAVConfigInfo(QObject *parent = 0);
|
|
|
|
explicit UAVConfigInfo(QSettings *qs, QObject *parent = 0);
|
2013-05-19 16:37:30 +02:00
|
|
|
explicit UAVConfigInfo(IUAVGadgetConfiguration *config, QObject *parent = 0);
|
2010-09-12 17:51:14 +02:00
|
|
|
UAVConfigInfo(UAVConfigVersion version, QString nameOfConfigurable, QObject *parent = 0);
|
|
|
|
|
|
|
|
enum Compatibility { FullyCompatible, MinorLossOfConfiguration, MissingConfiguration, MajorLossOfConfiguration, NotCompatible };
|
2013-05-19 16:37:30 +02:00
|
|
|
void setNameOfConfigurable(const QString nameOfConfigurable)
|
|
|
|
{
|
|
|
|
m_nameOfConfigurable = nameOfConfigurable;
|
|
|
|
}
|
2010-09-12 17:51:14 +02:00
|
|
|
|
|
|
|
void save(QSettings *qs);
|
2010-09-26 19:34:23 +02:00
|
|
|
void read(QSettings *qs);
|
2010-09-12 17:51:14 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setVersion(int major, int minor, int patch)
|
|
|
|
{
|
|
|
|
m_version = UAVConfigVersion(major, minor, patch);
|
|
|
|
}
|
|
|
|
void setVersion(const QString version)
|
|
|
|
{
|
|
|
|
m_version = UAVConfigVersion(version);
|
|
|
|
}
|
|
|
|
void setVersion(const UAVConfigVersion version)
|
|
|
|
{
|
|
|
|
m_version = version;
|
|
|
|
}
|
|
|
|
UAVConfigVersion version()
|
|
|
|
{
|
|
|
|
return m_version;
|
|
|
|
}
|
|
|
|
bool locked()
|
|
|
|
{
|
|
|
|
return m_locked;
|
|
|
|
}
|
|
|
|
void setLocked(bool locked)
|
|
|
|
{
|
|
|
|
m_locked = locked;
|
|
|
|
}
|
2010-09-26 19:34:23 +02:00
|
|
|
|
2010-09-12 17:51:14 +02:00
|
|
|
int checkCompatibilityWith(UAVConfigVersion programVersion);
|
|
|
|
bool askToAbort(int compat, QString message);
|
2010-09-26 19:34:23 +02:00
|
|
|
void notify(QString message);
|
|
|
|
bool standardVersionHandlingOK(UAVConfigVersion programVersion);
|
2013-05-19 16:37:30 +02:00
|
|
|
bool standardVersionHandlingOK(QString programVersion)
|
|
|
|
{
|
|
|
|
return standardVersionHandlingOK(UAVConfigVersion(programVersion));
|
|
|
|
}
|
2010-09-12 17:51:14 +02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
private:
|
|
|
|
UAVConfigVersion m_version;
|
2010-09-26 19:34:23 +02:00
|
|
|
bool m_locked;
|
2010-09-12 17:51:14 +02:00
|
|
|
QString m_nameOfConfigurable;
|
|
|
|
};
|
|
|
|
} // namespace Core
|
|
|
|
|
|
|
|
#endif // UAVCONFIGINFO_H
|