diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index d5029bacc4..c8c2158686 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -140,8 +140,10 @@ Application Debugger : # settings BreakpointSetting.cpp - TeamSettings.cpp SettingsManager.cpp + TeamSettings.cpp + TeamUISettings.cpp + GUITeamUISettings.cpp # settings/generic Setting.cpp diff --git a/src/apps/debugger/settings/GUITeamUISettings.cpp b/src/apps/debugger/settings/GUITeamUISettings.cpp new file mode 100644 index 0000000000..0bdfe1778e --- /dev/null +++ b/src/apps/debugger/settings/GUITeamUISettings.cpp @@ -0,0 +1,67 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#include "GUITeamUISettings.h" + +#include + + +GUITeamUISettings::GUITeamUISettings(const char* settingsID) + : + fID(settingsID) +{ +} + + +GUITeamUISettings::GUITeamUISettings(const GUITeamUISettings& other) +{ + fID = other.fID; +} + + +GUITeamUISettings::~GUITeamUISettings() +{ +} + + +const char* +GUITeamUISettings::ID() const +{ + return fID.String(); +} + + +status_t +GUITeamUISettings::SetTo(const BMessage& archive) +{ + status_t error = archive.FindString("ID", &fID); + + return error; +} + + +status_t +GUITeamUISettings::WriteTo(BMessage& archive) const +{ + status_t error = archive.AddString("ID", fID); + + return error; +} + + +TeamUISettings* +GUITeamUISettings::Clone() const +{ + GUITeamUISettings* settings = new GUITeamUISettings(fID.String()); + + return settings; +} + + +GUITeamUISettings& +GUITeamUISettings::operator=(const GUITeamUISettings& other) +{ + fID = other.fID; + return *this; +} diff --git a/src/apps/debugger/settings/GUITeamUISettings.h b/src/apps/debugger/settings/GUITeamUISettings.h new file mode 100644 index 0000000000..ab3e0dcd0d --- /dev/null +++ b/src/apps/debugger/settings/GUITeamUISettings.h @@ -0,0 +1,40 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef GUI_TEAM_UI_SETTINGS_H +#define GUI_TEAM_UI_SETTINGS_H + + +#include + +#include + +#include "TeamUISettings.h" + +class BMessage; + + +class GUITeamUISettings : public TeamUISettings { +public: + GUITeamUISettings(const char* settingsID); + GUITeamUISettings(const GUITeamUISettings& + other); + // throws std::bad_alloc + ~GUITeamUISettings(); + + virtual const char* ID() const; + virtual status_t SetTo(const BMessage& archive); + virtual status_t WriteTo(BMessage& archive) const; + virtual TeamUISettings* Clone() const; + + GUITeamUISettings& operator=(const GUITeamUISettings& other); + // throws std::bad_alloc + +private: + + BString fID; +}; + + +#endif // GUI_TEAM_UI_SETTINGS_H diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index 723cd12f71..d94448328a 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -15,6 +15,7 @@ #include "ArchivingUtils.h" #include "BreakpointSetting.h" #include "Team.h" +#include "TeamUISettings.h" #include "UserBreakpoint.h" @@ -98,6 +99,12 @@ TeamSettings::SetTo(const BMessage& archive) return error; } } + + // add UI settings + for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive) + == B_OK; i++) { + + } return B_OK; } @@ -140,6 +147,20 @@ TeamSettings::BreakpointAt(int32 index) const } +int32 +TeamSettings::CountUISettings() const +{ + return fUISettings.CountItems(); +} + + +const TeamUISettings* +TeamSettings::UISettingAt(int32 index) const +{ + return fUISettings.ItemAt(index); +} + + TeamSettings& TeamSettings::operator=(const TeamSettings& other) { @@ -160,6 +181,16 @@ TeamSettings::operator=(const TeamSettings& other) } } + for (int32 i = 0; TeamUISettings* uiSetting + = other.fUISettings.ItemAt(i); i++) { + TeamUISettings* clonedSetting + = uiSetting->Clone(); + if (!fUISettings.AddItem(clonedSetting)) { + delete clonedSetting; + throw std::bad_alloc(); + } + } + return *this; } @@ -171,7 +202,12 @@ TeamSettings::_Unset() i++) { delete breakpoint; } + + for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); i++) + delete uiSetting; + fBreakpoints.MakeEmpty(); + fUISettings.MakeEmpty(); fTeamName.Truncate(0); } diff --git a/src/apps/debugger/settings/TeamSettings.h b/src/apps/debugger/settings/TeamSettings.h index 3b66c5e2da..202924d11e 100644 --- a/src/apps/debugger/settings/TeamSettings.h +++ b/src/apps/debugger/settings/TeamSettings.h @@ -14,6 +14,7 @@ class BMessage; class Team; class BreakpointSetting; +class TeamUISettings; class TeamSettings { @@ -31,18 +32,23 @@ public: int32 CountBreakpoints() const; const BreakpointSetting* BreakpointAt(int32 index) const; + + int32 CountUISettings() const; + const TeamUISettings* UISettingAt(int32 index) const; TeamSettings& operator=(const TeamSettings& other); // throws std::bad_alloc private: typedef BObjectList BreakpointList; + typedef BObjectList UISettingsList; private: void _Unset(); private: BreakpointList fBreakpoints; + UISettingsList fUISettings; BString fTeamName; }; diff --git a/src/apps/debugger/settings/TeamUISettings.cpp b/src/apps/debugger/settings/TeamUISettings.cpp new file mode 100644 index 0000000000..bbffadb05e --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettings.cpp @@ -0,0 +1,15 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#include "TeamUISettings.h" + + +TeamUISettings::TeamUISettings() +{ +} + + +TeamUISettings::~TeamUISettings() +{ +} diff --git a/src/apps/debugger/settings/TeamUISettings.h b/src/apps/debugger/settings/TeamUISettings.h new file mode 100644 index 0000000000..fc15d03962 --- /dev/null +++ b/src/apps/debugger/settings/TeamUISettings.h @@ -0,0 +1,30 @@ +/* + * Copyright 2011, Rene Gollent, rene@gollent.com. + * Distributed under the terms of the MIT License. + */ +#ifndef TEAM_UI_SETTINGS_H +#define TEAM_UI_SETTINGS_H + + +#include + + +class BMessage; + + +class TeamUISettings { +public: + TeamUISettings(); + ~TeamUISettings(); + + virtual const char* ID() const = 0; + virtual status_t SetTo(const BMessage& archive) = 0; + virtual status_t WriteTo(BMessage& archive) const = 0; + + virtual TeamUISettings* Clone() const = 0; + // throws std::bad_alloc + +}; + + +#endif // TEAM_UI_SETTINGS_H