Add hooks to UserInterface to allow for saving/restoring of UI settings.

Make use of them as appopriate.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43121 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-11-02 19:04:24 +00:00
parent 3fa483ccda
commit bbc851098d
7 changed files with 102 additions and 10 deletions
+25 -4
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2010, Rene Gollent, [email protected].
* Copyright 2010-2011, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -40,6 +40,7 @@
#include "TeamMemoryBlock.h"
#include "TeamMemoryBlockManager.h"
#include "TeamSettings.h"
#include "TeamUISettings.h"
#include "Tracing.h"
#include "ValueNode.h"
#include "ValueNodeContainer.h"
@@ -1370,13 +1371,12 @@ TeamDebugger::_LoadSettings()
locker.Unlock();
// load the settings
TeamSettings settings;
if (fSettingsManager->LoadTeamSettings(teamName, settings) != B_OK)
if (fSettingsManager->LoadTeamSettings(teamName, fTeamSettings) != B_OK)
return;
// create the saved breakpoints
for (int32 i = 0; const BreakpointSetting* breakpointSetting
= settings.BreakpointAt(i); i++) {
= fTeamSettings.BreakpointAt(i); i++) {
if (breakpointSetting->GetFunctionID() == NULL)
continue;
@@ -1404,6 +1404,11 @@ TeamDebugger::_LoadSettings()
fBreakpointManager->InstallUserBreakpoint(breakpoint,
breakpointSetting->IsEnabled());
}
const TeamUISettings* uiSettings = fTeamSettings.UISettingFor(
fUserInterface->ID());
if (uiSettings != NULL)
fUserInterface->LoadSettings(uiSettings);
}
@@ -1415,6 +1420,22 @@ TeamDebugger::_SaveSettings()
TeamSettings settings;
if (settings.SetTo(fTeam) != B_OK)
return;
TeamUISettings* uiSettings = NULL;
if (fUserInterface->SaveSettings(uiSettings) != B_OK)
return;
if (uiSettings != NULL)
settings.AddUISettings(uiSettings);
// preserve the UI settings from our cached copy.
for (int32 i = 0; i < fTeamSettings.CountUISettings(); i++) {
const TeamUISettings* oldUISettings = fTeamSettings.UISettingAt(i);
if (strcmp(oldUISettings->ID(), fUserInterface->ID()) != 0) {
TeamUISettings* clonedSettings = oldUISettings->Clone();
if (clonedSettings != NULL)
settings.AddUISettings(clonedSettings);
}
}
locker.Unlock();
// save the settings