1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1763 Added import functionality to the template dialog.

Added new tab and gui with template selector widget to the export
template dialog.
Renamed dialog menu to export/import vehicle wizard settings.
Added code to upload and save template data to board.
This commit is contained in:
m_thread 2015-03-18 00:32:42 +01:00
parent 2b0d357df3
commit 8eedfcec49
7 changed files with 659 additions and 491 deletions

View File

@ -47,7 +47,8 @@ AirframeInitialTuningPage::~AirframeInitialTuningPage()
void AirframeInitialTuningPage::initializePage()
{
const char* path;
const char *path;
switch (getWizard()->getVehicleType()) {
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
path = VehicleTemplateExportDialog::EXPORT_FIXEDWING_NAME;

View File

@ -59,7 +59,7 @@ bool SetupWizardPlugin::initialize(const QStringList & args, QString *errMsg)
QList<int>() <<
Core::Constants::C_GLOBAL_ID);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+V"));
cmd->action()->setText(tr("Vehicle Setup Wizard"));
cmd->action()->setText(tr("Vehicle Setup Wizard..."));
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(showSetupWizard()));
Core::ModeManager::instance()->addAction(cmd, 1);
@ -71,7 +71,7 @@ bool SetupWizardPlugin::initialize(const QStringList & args, QString *errMsg)
"SetupWizardPlugin.ExportJSon",
QList<int>() <<
Core::Constants::C_GLOBAL_ID);
cmd->action()->setText(tr("Export Wizard Vehicle Template"));
cmd->action()->setText(tr("Export/Import Wizard Vehicle Template..."));
connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportSettings()));
Core::ModeManager::instance()->addAction(cmd, 1);

View File

@ -37,12 +37,15 @@
#include <QUuid>
#include <QDebug>
#include <QMessageBox>
#include <uavobjecthelper.h>
#include <objectpersistence.h>
#include "stabilizationsettings.h"
#include "stabilizationsettingsbank1.h"
#include "stabilizationsettingsbank2.h"
#include "stabilizationsettingsbank3.h"
#include "mixersettings.h"
#include "ekfconfiguration.h"
#include <uavtalk/telemetrymanager.h>
const char *VehicleTemplateExportDialog::EXPORT_BASE_NAME = "../share/openpilotgcs/cloudconfig";
const char *VehicleTemplateExportDialog::EXPORT_FIXEDWING_NAME = "fixedwing";
@ -61,12 +64,24 @@ VehicleTemplateExportDialog::VehicleTemplateExportDialog(QWidget *parent) :
m_uavoManager = pm->getObject<UAVObjectManager>();
ui->Photo->setScene(new QGraphicsScene(this));
ui->Type->setText(setupVehicleType());
ui->selectionWidget->setTemplateInfo(m_dir, m_type, m_subType);
connect(ui->Name, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(ui->Owner, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(ui->ForumNick, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(ui->Size, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(ui->Weight, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
connect(ui->exportBtn, SIGNAL(clicked()), this, SLOT(exportTemplate()));
connect(ui->importBtn, SIGNAL(clicked()), this, SLOT(importTemplate()));
connect(ui->cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->cancelBtn_2, SIGNAL(clicked()), this, SLOT(reject()));
TelemetryManager *telemManager = pm->getObject<TelemetryManager>();
ui->importBtn->setEnabled(telemManager->isConnected());
connect(telemManager, SIGNAL(connected()), this, SLOT(onAutoPilotConnect()));
connect(telemManager, SIGNAL(disconnected()), this, SLOT(onAutoPilotDisconnect()));
}
VehicleTemplateExportDialog::~VehicleTemplateExportDialog()
@ -85,85 +100,102 @@ QString VehicleTemplateExportDialog::setupVehicleType()
case SystemSettings::AIRFRAMETYPE_FIXEDWING:
m_type = VehicleConfigurationSource::VEHICLE_FIXEDWING;
m_subType = VehicleConfigurationSource::FIXED_WING_AILERON;
m_dir = EXPORT_FIXEDWING_NAME;
return tr("Fixed Wing - Aileron");
case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON:
m_type = VehicleConfigurationSource::VEHICLE_FIXEDWING;
m_subType = VehicleConfigurationSource::FIXED_WING_ELEVON;
m_dir = EXPORT_FIXEDWING_NAME;
return tr("Fixed Wing - Elevon");
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL:
m_type = VehicleConfigurationSource::VEHICLE_FIXEDWING;
m_subType = VehicleConfigurationSource::FIXED_WING_VTAIL;
m_dir = EXPORT_FIXEDWING_NAME;
return tr("Fixed Wing - V-Tail");
case SystemSettings::AIRFRAMETYPE_HELICP:
m_type = VehicleConfigurationSource::VEHICLE_HELI;
m_subType = VehicleConfigurationSource::HELI_CCPM;
m_dir = EXPORT_HELI_NAME;
return tr("Helicopter");
case SystemSettings::AIRFRAMETYPE_TRI:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_TRI_Y;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Tricopter");
case SystemSettings::AIRFRAMETYPE_QUADX:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_X;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Quadrocopter X");
case SystemSettings::AIRFRAMETYPE_QUADP:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Quadrocopter +");
case SystemSettings::AIRFRAMETYPE_OCTOV:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_OCTO_V;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Octocopter V");
case SystemSettings::AIRFRAMETYPE_OCTOCOAXX:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_X;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Octocopter X8X");
case SystemSettings::AIRFRAMETYPE_OCTOCOAXP:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_PLUS;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Octocopter X8+");
case SystemSettings::AIRFRAMETYPE_OCTO:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_OCTO;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Octocopter +");
case SystemSettings::AIRFRAMETYPE_OCTOX:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_OCTO_X;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Octocopter X");
case SystemSettings::AIRFRAMETYPE_HEXAX:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_X;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Hexacopter X");
case SystemSettings::AIRFRAMETYPE_HEXAH:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_H;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Hexacopter H");
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Hexacopter Y6");
case SystemSettings::AIRFRAMETYPE_HEXA:
m_type = VehicleConfigurationSource::VEHICLE_MULTI;
m_subType = VehicleConfigurationSource::MULTI_ROTOR_HEXA;
m_dir = EXPORT_MULTI_NAME;
return tr("Multirotor - Hexacopter +");
default:
m_type = VehicleConfigurationSource::VEHICLE_UNKNOWN;
m_dir = "";
return tr("Unsupported");
}
}
@ -178,7 +210,7 @@ QString VehicleTemplateExportDialog::fixFilenameString(QString input, int trunca
.left(truncate);
}
void VehicleTemplateExportDialog::accept()
void VehicleTemplateExportDialog::exportTemplate()
{
QJsonObject exportObject;
@ -257,6 +289,34 @@ void VehicleTemplateExportDialog::accept()
}
}
void VehicleTemplateExportDialog::importTemplate()
{
QJsonObject *tmpl = ui->selectionWidget->selectedTemplate();
if (tmpl != NULL) {
QList<UAVObject *> updatedObjects;
m_uavoManager->fromJson(*tmpl, &updatedObjects);
UAVObjectUpdaterHelper helper;
foreach(UAVObject * object, updatedObjects) {
UAVDataObject *dataObj = dynamic_cast<UAVDataObject *>(object);
if (dataObj != NULL && dataObj->isKnown()) {
helper.doObjectAndWait(dataObj);
ObjectPersistence *objper = ObjectPersistence::GetInstance(m_uavoManager);
ObjectPersistence::DataFields data;
data.Operation = ObjectPersistence::OPERATION_SAVE;
data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT;
data.ObjectID = dataObj->getObjID();
data.InstanceID = dataObj->getInstID();
objper->setData(data);
helper.doObjectAndWait(objper);
}
}
}
}
void VehicleTemplateExportDialog::importImage()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Import Image"), "", tr("Images (*.png *.jpg)"));
@ -269,6 +329,16 @@ void VehicleTemplateExportDialog::importImage()
}
}
void VehicleTemplateExportDialog::onAutoPilotConnect()
{
ui->importBtn->setEnabled(true);
}
void VehicleTemplateExportDialog::onAutoPilotDisconnect()
{
ui->importBtn->setEnabled(false);
}
QString VehicleTemplateExportDialog::getTypeDirectory()
{
switch (m_type) {
@ -291,7 +361,7 @@ QString VehicleTemplateExportDialog::getTypeDirectory()
void VehicleTemplateExportDialog::updateStatus()
{
ui->acceptBtn->setEnabled(ui->Name->text().length() > 3 && ui->Owner->text().length() > 2 &&
ui->exportBtn->setEnabled(ui->Name->text().length() > 3 && ui->Owner->text().length() > 2 &&
ui->ForumNick->text().length() > 2 && ui->Size->text().length() > 0 &&
ui->Weight->text().length() > 0);
}

View File

@ -51,11 +51,14 @@ public:
~VehicleTemplateExportDialog();
public slots:
void accept();
void exportTemplate();
void importTemplate();
void updateStatus();
private slots:
void importImage();
void onAutoPilotConnect();
void onAutoPilotDisconnect();
private:
static const int IMAGE_SCALE_WIDTH = 500;
@ -64,6 +67,7 @@ private:
UAVObjectManager *m_uavoManager;
VehicleConfigurationSource::VEHICLE_TYPE m_type;
VehicleConfigurationSource::VEHICLE_SUB_TYPE m_subType;
const char *m_dir;
QPixmap m_image;
QString fixFilenameString(QString input, int truncate = 100);

View File

@ -35,6 +35,570 @@
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Export template</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="6" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Weight:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="Propeller">
<property name="placeholderText">
<string>Size and angle</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Battery:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="Size">
<property name="placeholderText">
<string>Size of the vehicle in mm</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Motor:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Servo:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="Servo">
<property name="placeholderText">
<string>Brand and name</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="Owner">
<property name="placeholderText">
<string>Your name</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Propeller:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Forum name:</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="5">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
<widget class="QLineEdit" name="Name">
<property name="placeholderText">
<string>The name of the vehicle, brand etc</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Owner:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="Motor">
<property name="placeholderText">
<string>Brand, size and Kv</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="10" column="3" colspan="2">
<widget class="QLineEdit" name="Battery">
<property name="placeholderText">
<string>How many cells etc?</string>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="Type">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>ESC:</string>
</property>
</widget>
</item>
<item row="11" column="3" colspan="2">
<widget class="QComboBox" name="Controllers">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>CC</string>
</property>
</item>
<item>
<property name="text">
<string>CC3D</string>
</property>
</item>
<item>
<property name="text">
<string>Atom</string>
</property>
</item>
<item>
<property name="text">
<string>Revolution</string>
</property>
</item>
<item>
<property name="text">
<string>Nano</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2">
<widget class="QLineEdit" name="ForumNick">
<property name="placeholderText">
<string>Forum nickname</string>
</property>
</widget>
</item>
<item row="8" column="3" colspan="2">
<widget class="QLineEdit" name="Esc">
<property name="placeholderText">
<string>Brand and name</string>
</property>
</widget>
</item>
<item row="6" column="3" colspan="2">
<widget class="QLineEdit" name="Weight">
<property name="placeholderText">
<string>Weight in grams</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_6">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Comment:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="Comment">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="placeholderText">
<string>Put comments here that don't fit in the categories above</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Photo:</string>
</property>
</widget>
</item>
<item>
<widget class="QGraphicsView" name="Photo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(254, 254, 254, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="backgroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="interactive">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_7">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Photo will be scaled to 500x500px</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ImportButton">
<property name="text">
<string>Select Image...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<zorder>frame_4</zorder>
<zorder>frame_3</zorder>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_5">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelBtn">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exportBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Import template</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="VehicleTemplateSelectorWidget" name="selectionWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_8">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelBtn_2">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="importBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Import</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
@ -56,490 +620,19 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="6" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Weight:</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="Propeller">
<property name="placeholderText">
<string>Size and angle</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Battery:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="Size">
<property name="placeholderText">
<string>Size of the vehicle in mm</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Motor:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Servo:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="Servo">
<property name="placeholderText">
<string>Brand and name</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="Owner">
<property name="placeholderText">
<string>Your name</string>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Propeller:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Forum name:</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="5">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
<widget class="QLineEdit" name="Name">
<property name="placeholderText">
<string>The name of the vehicle, brand etc</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Owner:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="Motor">
<property name="placeholderText">
<string>Brand, size and Kv</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
<item row="10" column="3" colspan="2">
<widget class="QLineEdit" name="Battery">
<property name="placeholderText">
<string>How many cells etc?</string>
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="Type">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>ESC:</string>
</property>
</widget>
</item>
<item row="11" column="3" colspan="2">
<widget class="QComboBox" name="Controllers">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>CC</string>
</property>
</item>
<item>
<property name="text">
<string>CC3D</string>
</property>
</item>
<item>
<property name="text">
<string>Atom</string>
</property>
</item>
<item>
<property name="text">
<string>Revolution</string>
</property>
</item>
<item>
<property name="text">
<string>Nano</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2">
<widget class="QLineEdit" name="ForumNick">
<property name="placeholderText">
<string>Forum nickname</string>
</property>
</widget>
</item>
<item row="8" column="3" colspan="2">
<widget class="QLineEdit" name="Esc">
<property name="placeholderText">
<string>Brand and name</string>
</property>
</widget>
</item>
<item row="6" column="3" colspan="2">
<widget class="QLineEdit" name="Weight">
<property name="placeholderText">
<string>Weight in grams</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_6">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Comment:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="Comment">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="placeholderText">
<string>Put comments here that don't fit in the categories above</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Photo:</string>
</property>
</widget>
</item>
<item>
<widget class="QGraphicsView" name="Photo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(254, 254, 254, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="backgroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="interactive">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_7">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Photo will be scaled to 500x500px</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ImportButton">
<property name="text">
<string>Select Image...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<zorder>frame_4</zorder>
<zorder>frame_3</zorder>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_5">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelBtn">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="acceptBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>VehicleTemplateSelectorWidget</class>
<extends>QWidget</extends>
<header>vehicletemplateselectorwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>Type</tabstop>
<tabstop>Name</tabstop>
@ -555,7 +648,7 @@
<tabstop>Controllers</tabstop>
<tabstop>Comment</tabstop>
<tabstop>ImportButton</tabstop>
<tabstop>acceptBtn</tabstop>
<tabstop>exportBtn</tabstop>
<tabstop>cancelBtn</tabstop>
<tabstop>Photo</tabstop>
</tabstops>
@ -578,7 +671,7 @@
</hints>
</connection>
<connection>
<sender>acceptBtn</sender>
<sender>exportBtn</sender>
<signal>clicked()</signal>
<receiver>VehicleTemplateExportDialog</receiver>
<slot>accept()</slot>

View File

@ -54,9 +54,10 @@ VehicleTemplateSelectorWidget::~VehicleTemplateSelectorWidget()
delete ui;
}
void VehicleTemplateSelectorWidget::setTemplateInfo(QString path, int vehicleType, int vehicleSubType) {
void VehicleTemplateSelectorWidget::setTemplateInfo(QString path, int vehicleType, int vehicleSubType)
{
m_templateFolder = path;
m_vehicleType = vehicleType;
m_vehicleType = vehicleType;
m_vehicleSubType = vehicleSubType;
updateTemplates();
}

View File

@ -36,8 +36,7 @@ namespace Ui {
class VehicleTemplateSelectorWidget;
}
class VehicleTemplateSelectorWidget : public QWidget
{
class VehicleTemplateSelectorWidget : public QWidget {
Q_OBJECT
public: