1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-16 Uncrustified.

This commit is contained in:
m_thread 2015-07-16 16:53:29 +02:00
parent fd3eaa2fef
commit 4918f61054
2 changed files with 12 additions and 8 deletions

View File

@ -104,7 +104,7 @@ void VehicleTemplateSelectorWidget::deleteSelectedTemplate()
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QFile fileToDelete(selectedTemplatePath());
if (fileToDelete.remove()) {
QJsonObject* templObj = selectedTemplate();
QJsonObject *templObj = selectedTemplate();
if (templObj) {
VehicleTemplate *templ = m_templates[templObj->value("uuid").toString()];
m_templates.remove(templObj->value("uuid").toString());
@ -120,6 +120,7 @@ void VehicleTemplateSelectorWidget::addTemplate()
{
QString path = QFileDialog::getOpenFileName(this, tr("Add settings"), QDir::homePath(),
tr("Vehicle Template Files (*.vtmpl *.optmpl)"));
if (path != NULL) {
QFile file(path);
@ -132,7 +133,7 @@ void VehicleTemplateSelectorWidget::addTemplate()
if (airframeIsCompatible(json["type"].toInt(), json["subtype"].toInt())) {
QFileInfo fInfo(file);
QString destinationFilePath = QString("%1/%2").arg(Utils::InsertStoragePath("%%STOREPATH%%vehicletemplates"))
.arg(getTemplatePath());
.arg(getTemplatePath());
QDir dir;
if (dir.mkpath(destinationFilePath) && file.copy(QString("%1/%2").arg(destinationFilePath).arg(fInfo.fileName()))) {
updateTemplates();

View File

@ -39,24 +39,27 @@ class VehicleTemplateSelectorWidget;
class VehicleTemplate {
public:
VehicleTemplate(QJsonObject *templateObject, bool editable, QString templatePath) :
m_templateObject(templateObject), m_editable(editable), m_templatePath(templatePath) {
}
m_templateObject(templateObject), m_editable(editable), m_templatePath(templatePath) {}
~VehicleTemplate() {
~VehicleTemplate()
{
if (m_templateObject) {
delete m_templateObject;
}
}
QJsonObject *templateObject() {
QJsonObject *templateObject()
{
return m_templateObject;
}
bool editable() {
bool editable()
{
return m_editable;
}
QString templatePath() {
QString templatePath()
{
return m_templatePath;
}