diff --git a/src/apps/debugger/settings/generic/Settings.cpp b/src/apps/debugger/settings/generic/Settings.cpp index 686b729d40..dfc176d3a7 100644 --- a/src/apps/debugger/settings/generic/Settings.cpp +++ b/src/apps/debugger/settings/generic/Settings.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -81,6 +82,24 @@ Settings::SetValue(Setting* setting, const BVariant& value) } +bool +Settings::RestoreValues(const BMessage& message) +{ + AutoLocker locker(fLock); + + for (int32 i = 0; i < fDescription->CountSettings(); i++) { + Setting* setting = fDescription->SettingAt(i); + BVariant value; + if (value.SetFromMessage(message, setting->ID()) == B_OK) { + if (!SetValue(setting, value)) + return false; + } + } + + return true; +} + + SettingsOption* Settings::OptionValue(OptionsSetting* setting) const { diff --git a/src/apps/debugger/settings/generic/Settings.h b/src/apps/debugger/settings/generic/Settings.h index 5862fa3a02..b921702c1e 100644 --- a/src/apps/debugger/settings/generic/Settings.h +++ b/src/apps/debugger/settings/generic/Settings.h @@ -1,4 +1,5 @@ /* + * Copyright 2013, Rene Gollent, rene@gollent.com. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -40,6 +41,8 @@ public: bool SetValue(Setting* setting, const BVariant& value); + bool RestoreValues(const BMessage& message); + bool BoolValue(BoolSetting* setting) const { return Value(setting).ToBool(); } SettingsOption* OptionValue(OptionsSetting* setting) const;