mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
OP-803 minor cleanups
This commit is contained in:
parent
1e3aeaf988
commit
a9d2679e39
@ -115,17 +115,18 @@ void UAVGadgetDecorator::updateToolbar()
|
||||
void UAVGadgetDecorator::saveState(QSettings* qSettings)
|
||||
{
|
||||
if (m_activeConfiguration) {
|
||||
qSettings->setValue("activeConfiguration",m_activeConfiguration->name());
|
||||
qSettings->setValue("activeConfiguration", m_activeConfiguration->name());
|
||||
}
|
||||
}
|
||||
|
||||
void UAVGadgetDecorator::restoreState(QSettings* qSetting)
|
||||
void UAVGadgetDecorator::restoreState(QSettings* qSettings)
|
||||
{
|
||||
QString configName = qSetting->value("activeConfiguration").toString();
|
||||
QString configName = qSettings->value("activeConfiguration").toString();
|
||||
foreach (IUAVGadgetConfiguration *config, *m_configurations) {
|
||||
if (config->name() == configName) {
|
||||
m_activeConfiguration = config;
|
||||
loadConfiguration(config);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -230,14 +230,14 @@ void UAVGadgetView::updateToolBar()
|
||||
|
||||
void UAVGadgetView::listSelectionActivated(int index)
|
||||
{
|
||||
if (index < 0) // this could happen when called from SplitterOrView::restoreState()
|
||||
index = m_defaultIndex;
|
||||
QString classId = m_uavGadgetList->itemData(index).toString();
|
||||
if (m_uavGadget && (m_uavGadget->classId() == classId))
|
||||
return;
|
||||
|
||||
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||
IUAVGadget *gadgetToRemove = m_uavGadget;
|
||||
IUAVGadget *gadget = im->createGadget(classId, this);
|
||||
|
||||
IUAVGadget *gadgetToRemove = m_uavGadget;
|
||||
setGadget(gadget);
|
||||
m_uavGadgetManager->setCurrentGadget(gadget);
|
||||
im->removeGadget(gadgetToRemove);
|
||||
@ -265,15 +265,12 @@ void UAVGadgetView::saveState(QSettings* qSettings)
|
||||
void UAVGadgetView::restoreState(QSettings* qSettings)
|
||||
{
|
||||
QString classId = qSettings->value("classId").toString();
|
||||
|
||||
int index = indexOfClassId(classId);
|
||||
if (index < 0) {
|
||||
index = m_defaultIndex;
|
||||
}
|
||||
|
||||
classId = m_uavGadgetList->itemData(index).toString();
|
||||
|
||||
|
||||
IUAVGadget *newGadget;
|
||||
UAVGadgetInstanceManager *im = ICore::instance()->uavGadgetInstanceManager();
|
||||
if(qSettings->childGroups().contains("gadget")) {
|
||||
|
@ -67,15 +67,15 @@ public:
|
||||
UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uavGadget = 0, QWidget *parent = 0);
|
||||
virtual ~UAVGadgetView();
|
||||
|
||||
void removeGadget();
|
||||
IUAVGadget *gadget() const;
|
||||
void setGadget(IUAVGadget *uavGadget);
|
||||
bool hasGadget(IUAVGadget *uavGadget) const;
|
||||
void removeGadget();
|
||||
|
||||
void showToolbar(bool show);
|
||||
|
||||
void saveState(QSettings* qSettings);
|
||||
void restoreState(QSettings* qSettings);
|
||||
void saveState(QSettings *qSettings);
|
||||
void restoreState(QSettings *qSettings);
|
||||
|
||||
public slots:
|
||||
void closeView();
|
||||
|
Loading…
Reference in New Issue
Block a user