WIP: Add abstract base class TeamUISettings and corresponding subclass GUITeamUISettings.
Once complete, these will be used to store/restore settings for the debugger's various UI components. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43060 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -140,8 +140,10 @@ Application Debugger :
|
|||||||
|
|
||||||
# settings
|
# settings
|
||||||
BreakpointSetting.cpp
|
BreakpointSetting.cpp
|
||||||
TeamSettings.cpp
|
|
||||||
SettingsManager.cpp
|
SettingsManager.cpp
|
||||||
|
TeamSettings.cpp
|
||||||
|
TeamUISettings.cpp
|
||||||
|
GUITeamUISettings.cpp
|
||||||
|
|
||||||
# settings/generic
|
# settings/generic
|
||||||
Setting.cpp
|
Setting.cpp
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#include "GUITeamUISettings.h"
|
||||||
|
|
||||||
|
#include <Message.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef GUI_TEAM_UI_SETTINGS_H
|
||||||
|
#define GUI_TEAM_UI_SETTINGS_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <ObjectList.h>
|
||||||
|
|
||||||
|
#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
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "ArchivingUtils.h"
|
#include "ArchivingUtils.h"
|
||||||
#include "BreakpointSetting.h"
|
#include "BreakpointSetting.h"
|
||||||
#include "Team.h"
|
#include "Team.h"
|
||||||
|
#include "TeamUISettings.h"
|
||||||
#include "UserBreakpoint.h"
|
#include "UserBreakpoint.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -98,6 +99,12 @@ TeamSettings::SetTo(const BMessage& archive)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add UI settings
|
||||||
|
for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive)
|
||||||
|
== B_OK; i++) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
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&
|
||||||
TeamSettings::operator=(const TeamSettings& other)
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +202,12 @@ TeamSettings::_Unset()
|
|||||||
i++) {
|
i++) {
|
||||||
delete breakpoint;
|
delete breakpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int32 i = 0; TeamUISettings* uiSetting = fUISettings.ItemAt(i); i++)
|
||||||
|
delete uiSetting;
|
||||||
|
|
||||||
fBreakpoints.MakeEmpty();
|
fBreakpoints.MakeEmpty();
|
||||||
|
fUISettings.MakeEmpty();
|
||||||
|
|
||||||
fTeamName.Truncate(0);
|
fTeamName.Truncate(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
class BMessage;
|
class BMessage;
|
||||||
class Team;
|
class Team;
|
||||||
class BreakpointSetting;
|
class BreakpointSetting;
|
||||||
|
class TeamUISettings;
|
||||||
|
|
||||||
|
|
||||||
class TeamSettings {
|
class TeamSettings {
|
||||||
@@ -31,18 +32,23 @@ public:
|
|||||||
|
|
||||||
int32 CountBreakpoints() const;
|
int32 CountBreakpoints() const;
|
||||||
const BreakpointSetting* BreakpointAt(int32 index) const;
|
const BreakpointSetting* BreakpointAt(int32 index) const;
|
||||||
|
|
||||||
|
int32 CountUISettings() const;
|
||||||
|
const TeamUISettings* UISettingAt(int32 index) const;
|
||||||
|
|
||||||
TeamSettings& operator=(const TeamSettings& other);
|
TeamSettings& operator=(const TeamSettings& other);
|
||||||
// throws std::bad_alloc
|
// throws std::bad_alloc
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<BreakpointSetting> BreakpointList;
|
typedef BObjectList<BreakpointSetting> BreakpointList;
|
||||||
|
typedef BObjectList<TeamUISettings> UISettingsList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Unset();
|
void _Unset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BreakpointList fBreakpoints;
|
BreakpointList fBreakpoints;
|
||||||
|
UISettingsList fUISettings;
|
||||||
BString fTeamName;
|
BString fTeamName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#include "TeamUISettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
TeamUISettings::TeamUISettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamUISettings::~TeamUISettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011, Rene Gollent, [email protected].
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TEAM_UI_SETTINGS_H
|
||||||
|
#define TEAM_UI_SETTINGS_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user