1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

GCS: Remove support in [UAVGadgetManager] for Settings/DefaultSettings.

Wasn't really used since it wasn't properly finished (no support in UI).
The idea of having ways to support defaults is good, but can probably be
done better in a different way. (I like the idea of a embedded second
ini file, which serves as 'default'. But many ways are possible).

AS usual, write support removed, read support still there for now.


git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1688 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
cranphin 2010-09-19 12:35:48 +00:00 committed by cranphin
parent 33494ffc7c
commit e59a58aa0e

View File

@ -493,18 +493,19 @@ void UAVGadgetManager::saveSettings(QSettings *qs)
QString defaultUAVGadgetManagerKey = "DefaultSettings"; QString defaultUAVGadgetManagerKey = "DefaultSettings";
QString uavGadgetManagerKey = "Settings"; QString uavGadgetManagerKey = "Settings";
// The idea is to have a default setting that is only written once // The default group can be done in a better way,
// TODO: Currently the default thing doesn't seem to be used, // remove them for now. Since we no longer have two
// and is slightly randomly set the first time you close the app (after creating the specific mode?) // possible groups, we can remove the non default one too.
if (!qs->childGroups().contains(defaultUAVGadgetManagerKey)) { // TODO: Remove this code, and support for reading default group.
qs->beginGroup(defaultUAVGadgetManagerKey); if (qs->childGroups().contains(defaultUAVGadgetManagerKey)) {
saveState(qs); qs->remove(defaultUAVGadgetManagerKey);
qs->endGroup();
} else {
qs->beginGroup(uavGadgetManagerKey);
saveState(qs);
qs->endGroup();
} }
if (qs->childGroups().contains(uavGadgetManagerKey)) {
qs->remove(uavGadgetManagerKey);
}
// Do actual saving
saveState(qs);
qs->endGroup(); qs->endGroup();
qs->endGroup(); qs->endGroup();
@ -519,19 +520,24 @@ void UAVGadgetManager::readSettings(QSettings *qs)
QString uavGadgetManagerKey = "Settings"; QString uavGadgetManagerKey = "Settings";
if (qs->childGroups().contains(uavGadgetManagerKey)) { if (qs->childGroups().contains(uavGadgetManagerKey)) {
// TODO: Remove.
qs->beginGroup(uavGadgetManagerKey); qs->beginGroup(uavGadgetManagerKey);
restoreState(qs); restoreState(qs);
qs->endGroup(); qs->endGroup();
} else if (qs->childGroups().contains(defaultUAVGadgetManagerKey)) { } else if (qs->childGroups().contains(defaultUAVGadgetManagerKey)) {
// TODO: Remove.
qs->beginGroup(defaultUAVGadgetManagerKey); qs->beginGroup(defaultUAVGadgetManagerKey);
restoreState(qs); restoreState(qs);
qs->endGroup(); qs->endGroup();
} else if (qs->contains(uavGadgetManagerKey)) { } else if (qs->contains(uavGadgetManagerKey)) {
// TODO: Remove.
restoreState(QByteArray::fromBase64(qs->value(uavGadgetManagerKey).toByteArray())); restoreState(QByteArray::fromBase64(qs->value(uavGadgetManagerKey).toByteArray()));
} else if (qs->contains(defaultUAVGadgetManagerKey)) { } else if (qs->contains(defaultUAVGadgetManagerKey)) {
// TODO: Remove.
restoreState(QByteArray::fromBase64(qs->value(defaultUAVGadgetManagerKey).toByteArray())); restoreState(QByteArray::fromBase64(qs->value(defaultUAVGadgetManagerKey).toByteArray()));
} else { } else {
return; // TODO: Make this the only way of loading.
restoreState(qs);
} }
showToolbars(m_showToolbars); showToolbars(m_showToolbars);