1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-26 15: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();
foreach(QJsonObject * templ, m_templates.values()) {
delete templ;
}
m_templates.clear();
QDir templateDir(QString("%1/%2/").arg(Utils::PathUtils().InsertDataPath("%%DATAPATH%%cloudconfig")).arg(m_dir));
QDir templateDir(templateBasePath);
qDebug() << "Loading templates from base path:" << templateBasePath;
QStringList names;
names << "*.optmpl";
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()
{
QListWidgetItem *item;

View File

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