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