mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-803 more cleanups
This commit is contained in:
parent
a9d2679e39
commit
3e9c819850
@ -45,8 +45,6 @@ UAVGadgetDecorator::UAVGadgetDecorator(IUAVGadget *gadget, QList<IUAVGadgetConfi
|
|||||||
foreach (IUAVGadgetConfiguration *config, *m_configurations)
|
foreach (IUAVGadgetConfiguration *config, *m_configurations)
|
||||||
m_toolbar->addItem(config->name());
|
m_toolbar->addItem(config->name());
|
||||||
connect(m_toolbar, SIGNAL(activated(int)), this, SLOT(loadConfiguration(int)));
|
connect(m_toolbar, SIGNAL(activated(int)), this, SLOT(loadConfiguration(int)));
|
||||||
// if (m_configurations->count() > 0)
|
|
||||||
// loadConfiguration(0);
|
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +239,9 @@ void UAVGadgetInstanceManager::createOptionsPages()
|
|||||||
m_pm->removeObject(m_optionsPages.takeLast());
|
m_pm->removeObject(m_optionsPages.takeLast());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (IUAVGadgetConfiguration *config, m_configurations)
|
QMutableListIterator<IUAVGadgetConfiguration*> ite(m_configurations);
|
||||||
{
|
while (ite.hasNext()) {
|
||||||
|
IUAVGadgetConfiguration *config = ite.next();
|
||||||
IUAVGadgetFactory *f = factory(config->classId());
|
IUAVGadgetFactory *f = factory(config->classId());
|
||||||
IOptionsPage *p = f->createOptionsPage(config);
|
IOptionsPage *p = f->createOptionsPage(config);
|
||||||
if (p) {
|
if (p) {
|
||||||
@ -249,6 +250,14 @@ void UAVGadgetInstanceManager::createOptionsPages()
|
|||||||
m_optionsPages.append(page);
|
m_optionsPages.append(page);
|
||||||
m_pm->addObject(page);
|
m_pm->addObject(page);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
qWarning()
|
||||||
|
<< "UAVGadgetInstanceManager::createOptionsPages - failed to create options page for configuration "
|
||||||
|
+ config->classId() + ":" + config->name() + ", configuration will be removed.";
|
||||||
|
// The m_optionsPages list and m_configurations list must be in synch otherwise nasty issues happen later
|
||||||
|
// so if we fail to create an options page we must remove the associated configuration
|
||||||
|
ite.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +230,9 @@ void UAVGadgetView::updateToolBar()
|
|||||||
|
|
||||||
void UAVGadgetView::listSelectionActivated(int index)
|
void UAVGadgetView::listSelectionActivated(int index)
|
||||||
{
|
{
|
||||||
|
if (index < 0 || index >= m_uavGadgetList->count())
|
||||||
|
index = m_defaultIndex;
|
||||||
|
|
||||||
QString classId = m_uavGadgetList->itemData(index).toString();
|
QString classId = m_uavGadgetList->itemData(index).toString();
|
||||||
if (m_uavGadget && (m_uavGadget->classId() == classId))
|
if (m_uavGadget && (m_uavGadget->classId() == classId))
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user