108 #include <QMainWindow>
109 #include <QMessageBox>
111 #define VERSION_DEFAULT "0.0.0"
113 #define TEXT_MINOR_LOSS_OF_CONFIGURATION \
114 tr(" Some of the configured features might not be supported \
115 by your version of the plugin. You might want to upgrade the plugin.")
117 #define TEXT_MISSING_CONFIGURATION \
118 tr(" Some configuration is missing in the imported config and will be replaced \
119 by default settings.")
121 #define TEXT_MAJOR_LOSS_OF_CONFIGURATION \
122 tr(" Major features can't be imported \
123 by your version of the plugin. You should upgrade the plugin to import these settings.")
125 #define TEXT_NOT_COMPATIBLE \
126 tr(" The imported settings are not compatible with this plugin and won't be imported!")
128 using namespace Core;
132 , m_version(VERSION_DEFAULT)
134 , m_nameOfConfigurable(
"")
140 , m_version(VERSION_DEFAULT)
149 , m_nameOfConfigurable(nameOfConfigurable)
156 m_locked = config->
locked();
157 m_nameOfConfigurable = config->
classId() +
"-" + config->
name();
162 qs->beginGroup(
"configInfo");
163 qs->setValue(
"version", m_version.
toString());
164 qs->setValue(
"locked", m_locked);
170 qs->beginGroup(
"configInfo");
171 m_version =
UAVConfigVersion(qs->value(
"version", VERSION_DEFAULT).toString());
172 m_locked = qs->value(
"locked",
false).toBool();
179 msgBox.setInformativeText(tr(
"Do you want to continue the import?"));
180 msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
190 msgBox.setText(tr(
"INFO: ") + message + TEXT_MINOR_LOSS_OF_CONFIGURATION);
191 msgBox.setDefaultButton(QMessageBox::Ok);
192 result = msgBox.exec();
196 msgBox.setText(tr(
"WARNING: ") + message + TEXT_MISSING_CONFIGURATION);
197 msgBox.setDefaultButton(QMessageBox::Ok);
198 result = msgBox.exec();
202 msgBox.setText(tr(
"ERROR: ") + message + TEXT_MAJOR_LOSS_OF_CONFIGURATION);
203 msgBox.setDefaultButton(QMessageBox::Cancel);
204 result = msgBox.exec();
208 msgBox.setText(
"ERROR: " + message + TEXT_NOT_COMPATIBLE);
209 msgBox.setInformativeText(tr(
""));
210 msgBox.setStandardButtons(QMessageBox::Ok);
215 msgBox.setText(
"INTERNAL ERROR: " + message + tr(
"Unknown compatibility level: ")
216 + QString::number(compat));
218 if (result == QMessageBox::Ok)
227 msgBox.setText(message);
263 end = versionString.indexOf(
".", begin);
264 majorNr = versionString.mid(begin, end - begin).toInt();
267 end = versionString.indexOf(
".", begin);
268 minorNr = versionString.mid(begin, end - begin).toInt();
271 patchNr = versionString.mid(begin).toInt();
int checkCompatibilityWith(UAVConfigVersion programVersion)
UAVConfigInfo(QObject *parent=nullptr)
bool askToAbort(int compat, QString message)
end(INSTANTIATIONCODE) fid
static ICore * instance()
bool operator==(const UAVConfigVersion &other)
bool standardVersionHandlingOK(UAVConfigVersion programVersion)
Default version handling.
void notify(QString message)
UAVConfigVersion(QString versionString="0.0.0")