1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

Update this with help of FredrikA

This commit is contained in:
Fredrik Larsson 2014-11-24 08:56:01 +11:00
parent ea5c0db322
commit eaebe3eb30

@ -211,17 +211,20 @@ void AirframeInitialTuningPage::loadValidFiles()
void AirframeInitialTuningPage::setupTemplateList() void AirframeInitialTuningPage::setupTemplateList()
{ {
QListWidgetItem *item = new QListWidgetItem(("Current Tuning"), ui->templateList); QListWidgetItem *item;
item->setData(Qt::UserRole + 1, QVariant::fromValue((QJsonObject *)NULL));
foreach(QString templ, m_templates.keys()) { foreach(QString templ, m_templates.keys()) {
QJsonObject *json = m_templates[templ]; QJsonObject *json = m_templates[templ];
item = new QListWidgetItem(json->value("name").toString(), ui->templateList); item = new QListWidgetItem(json->value("name").toString(), ui->templateList);
item->setData(Qt::UserRole + 1, QVariant::fromValue(json)); item->setData(Qt::UserRole + 1, QVariant::fromValue(json));
} }
ui->templateList->sortItems(); ui->templateList->sortItems(Qt::AscendingOrder);
item = new QListWidgetItem(tr("Current Tuning"));
item->setData(Qt::UserRole + 1, QVariant::fromValue((QJsonObject *)NULL));
ui->templateList->insertItem(0, item);
ui->templateList->setCurrentRow(0); ui->templateList->setCurrentRow(0);
//TODO Add generics to top under item Current tuning
} }
QString AirframeInitialTuningPage::getTemplateKey(QJsonObject *templ) QString AirframeInitialTuningPage::getTemplateKey(QJsonObject *templ)