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

OP-1755 Added additional location for cloudconfigs.

This commit is contained in:
m_thread 2015-02-28 00:14:51 +01:00
parent 3ee481fd2a
commit a8b6e1f959
2 changed files with 16 additions and 9 deletions

View File

@ -169,15 +169,10 @@ bool AirframeInitialTuningPage::airframeIsCompatible(int vehicleType, int vehicl
} }
} }
void AirframeInitialTuningPage::loadValidFiles() void AirframeInitialTuningPage::loadFilesInDir(QString templateBasePath)
{ {
ui->templateList->clear(); QDir templateDir(templateBasePath);
foreach(QJsonObject * templ, m_templates.values()) { qDebug() << "Loading templates from base path:" << templateBasePath;
delete templ;
}
m_templates.clear();
QDir templateDir(QString("%1/%2/").arg(Utils::PathUtils().InsertDataPath("%%DATAPATH%%cloudconfig")).arg(m_dir));
QStringList names; QStringList names;
names << "*.optmpl"; names << "*.optmpl";
templateDir.setNameFilters(names); templateDir.setNameFilters(names);
@ -207,6 +202,18 @@ void AirframeInitialTuningPage::loadValidFiles()
} }
} }
void AirframeInitialTuningPage::loadValidFiles()
{
ui->templateList->clear();
foreach(QJsonObject * templ, m_templates.values()) {
delete templ;
}
m_templates.clear();
loadFilesInDir(QString("%1/%2/").arg(Utils::PathUtils().InsertDataPath("%%DATAPATH%%cloudconfig")).arg(m_dir));
loadFilesInDir(QString("%1/%2/").arg(Utils::PathUtils().InsertStoragePath("%%STOREPATH%%cloudconfig")).arg(m_dir));
}
void AirframeInitialTuningPage::setupTemplateList() void AirframeInitialTuningPage::setupTemplateList()
{ {
QListWidgetItem *item; QListWidgetItem *item;

View File

@ -44,7 +44,6 @@ public:
void initializePage(); void initializePage();
bool validatePage(); bool validatePage();
bool isComplete() const; bool isComplete() const;
public slots: public slots:
void templateSelectionChanged(); void templateSelectionChanged();
@ -59,6 +58,7 @@ private:
QGraphicsPixmapItem *m_photoItem; QGraphicsPixmapItem *m_photoItem;
void loadValidFiles(); void loadValidFiles();
void loadFilesInDir(QString templateBasePath);
void setupTemplateList(); void setupTemplateList();
QString getTemplateKey(QJsonObject *templ); QString getTemplateKey(QJsonObject *templ);
void updatePhoto(QJsonObject *templ); void updatePhoto(QJsonObject *templ);