Debugger: Add persistent settings classes for signal dispositions.
- Add class TeamSignalSettings for storing signal disposition settings, and add instance to TeamSettings. - Adjust TeamDebugger to load signal settings.
This commit is contained in:
@@ -208,6 +208,7 @@ Application Debugger :
|
|||||||
SettingsManager.cpp
|
SettingsManager.cpp
|
||||||
TeamFileManagerSettings.cpp
|
TeamFileManagerSettings.cpp
|
||||||
TeamSettings.cpp
|
TeamSettings.cpp
|
||||||
|
TeamSignalSettings.cpp
|
||||||
TeamUiSettings.cpp
|
TeamUiSettings.cpp
|
||||||
TeamUiSettingsFactory.cpp
|
TeamUiSettingsFactory.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
#include "TeamMemoryBlock.h"
|
#include "TeamMemoryBlock.h"
|
||||||
#include "TeamMemoryBlockManager.h"
|
#include "TeamMemoryBlockManager.h"
|
||||||
#include "TeamSettings.h"
|
#include "TeamSettings.h"
|
||||||
|
#include "TeamSignalSettings.h"
|
||||||
#include "TeamUiSettings.h"
|
#include "TeamUiSettings.h"
|
||||||
#include "Tracing.h"
|
#include "Tracing.h"
|
||||||
#include "ValueNode.h"
|
#include "ValueNode.h"
|
||||||
@@ -2315,6 +2316,22 @@ TeamDebugger::_LoadSettings()
|
|||||||
fUserInterface->ID());
|
fUserInterface->ID());
|
||||||
if (uiSettings != NULL)
|
if (uiSettings != NULL)
|
||||||
fUserInterface->LoadSettings(uiSettings);
|
fUserInterface->LoadSettings(uiSettings);
|
||||||
|
|
||||||
|
const TeamSignalSettings* signalSettings = fTeamSettings.SignalSettings();
|
||||||
|
if (signalSettings != NULL) {
|
||||||
|
fTeam->SetDefaultSignalDisposition(
|
||||||
|
signalSettings->DefaultSignalDisposition());
|
||||||
|
|
||||||
|
int32 signal;
|
||||||
|
int32 disposition;
|
||||||
|
for (int32 i = 0; i < signalSettings->CountCustomSignalDispositions();
|
||||||
|
i++) {
|
||||||
|
if (signalSettings->GetCustomSignalDispositionAt(i, signal,
|
||||||
|
disposition) == B_OK) {
|
||||||
|
fTeam->SetCustomSignalDisposition(signal, disposition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2013, Rene Gollent, [email protected].
|
* Copyright 2013-2015, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "BreakpointSetting.h"
|
#include "BreakpointSetting.h"
|
||||||
#include "Team.h"
|
#include "Team.h"
|
||||||
#include "TeamFileManagerSettings.h"
|
#include "TeamFileManagerSettings.h"
|
||||||
|
#include "TeamSignalSettings.h"
|
||||||
#include "TeamUiSettings.h"
|
#include "TeamUiSettings.h"
|
||||||
#include "TeamUiSettingsFactory.h"
|
#include "TeamUiSettingsFactory.h"
|
||||||
#include "UserBreakpoint.h"
|
#include "UserBreakpoint.h"
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
TeamSettings::TeamSettings()
|
TeamSettings::TeamSettings()
|
||||||
{
|
{
|
||||||
fFileManagerSettings = new TeamFileManagerSettings();
|
fFileManagerSettings = new TeamFileManagerSettings();
|
||||||
|
fSignalSettings = new TeamSignalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,6 +76,22 @@ TeamSettings::SetTo(Team* team)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add signal configuration
|
||||||
|
|
||||||
|
fSignalSettings->SetDefaultSignalDisposition(
|
||||||
|
team->DefaultSignalDisposition());
|
||||||
|
|
||||||
|
const SignalDispositionMappings& mappings
|
||||||
|
= team->GetSignalDispositionMappings();
|
||||||
|
|
||||||
|
for (SignalDispositionMappings::const_iterator it = mappings.begin();
|
||||||
|
it != mappings.end(); ++it) {
|
||||||
|
status_t error = fSignalSettings->AddCustomSignalDisposition(
|
||||||
|
it->first, it->second);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +142,12 @@ TeamSettings::SetTo(const BMessage& archive)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (archive.FindMessage("signalsettings", &childArchive) == B_OK) {
|
||||||
|
error = fSignalSettings->SetTo(childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +190,14 @@ TeamSettings::WriteTo(BMessage& archive) const
|
|||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
error = fSignalSettings->WriteTo(childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
error = archive.AddMessage("signalsettings", &childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +285,8 @@ TeamSettings::operator=(const TeamSettings& other)
|
|||||||
|
|
||||||
*fFileManagerSettings = *other.fFileManagerSettings;
|
*fFileManagerSettings = *other.fFileManagerSettings;
|
||||||
|
|
||||||
|
*fSignalSettings = *other.fSignalSettings;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +311,26 @@ TeamSettings::SetFileManagerSettings(TeamFileManagerSettings* settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamSignalSettings*
|
||||||
|
TeamSettings::SignalSettings() const
|
||||||
|
{
|
||||||
|
return fSignalSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSettings::SetSignalSettings(TeamSignalSettings* settings)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
*fSignalSettings = *settings;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TeamSettings::_Unset()
|
TeamSettings::_Unset()
|
||||||
{
|
{
|
||||||
@@ -290,6 +344,7 @@ TeamSettings::_Unset()
|
|||||||
|
|
||||||
fBreakpoints.MakeEmpty();
|
fBreakpoints.MakeEmpty();
|
||||||
fUiSettings.MakeEmpty();
|
fUiSettings.MakeEmpty();
|
||||||
|
fSignalSettings->Unset();
|
||||||
|
|
||||||
fTeamName.Truncate(0);
|
fTeamName.Truncate(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
* Copyright 2013-2015, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef TEAM_SETTINGS_H
|
#ifndef TEAM_SETTINGS_H
|
||||||
@@ -13,10 +13,11 @@
|
|||||||
|
|
||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class Team;
|
|
||||||
class BreakpointSetting;
|
class BreakpointSetting;
|
||||||
class TeamUiSettings;
|
class Team;
|
||||||
class TeamFileManagerSettings;
|
class TeamFileManagerSettings;
|
||||||
|
class TeamSignalSettings;
|
||||||
|
class TeamUiSettings;
|
||||||
|
|
||||||
|
|
||||||
class TeamSettings {
|
class TeamSettings {
|
||||||
@@ -48,6 +49,10 @@ public:
|
|||||||
status_t SetFileManagerSettings(
|
status_t SetFileManagerSettings(
|
||||||
TeamFileManagerSettings* settings);
|
TeamFileManagerSettings* settings);
|
||||||
|
|
||||||
|
TeamSignalSettings* SignalSettings() const;
|
||||||
|
status_t SetSignalSettings(
|
||||||
|
TeamSignalSettings* settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<BreakpointSetting> BreakpointList;
|
typedef BObjectList<BreakpointSetting> BreakpointList;
|
||||||
typedef BObjectList<TeamUiSettings> UiSettingsList;
|
typedef BObjectList<TeamUiSettings> UiSettingsList;
|
||||||
@@ -60,6 +65,7 @@ private:
|
|||||||
UiSettingsList fUiSettings;
|
UiSettingsList fUiSettings;
|
||||||
TeamFileManagerSettings*
|
TeamFileManagerSettings*
|
||||||
fFileManagerSettings;
|
fFileManagerSettings;
|
||||||
|
TeamSignalSettings* fSignalSettings;
|
||||||
BString fTeamName;
|
BString fTeamName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#include "TeamSignalSettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const char* skDefaultSignalFieldName = "signal:default_disposition";
|
||||||
|
static const char* skSignalNumberFieldName = "signal:number";
|
||||||
|
static const char* skSignalDispositionFieldName = "signal:disposition";
|
||||||
|
static const char* skSignalSettingName = "signal:setting";
|
||||||
|
|
||||||
|
|
||||||
|
TeamSignalSettings::TeamSignalSettings()
|
||||||
|
:
|
||||||
|
fValues()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamSignalSettings::~TeamSignalSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamSignalSettings&
|
||||||
|
TeamSignalSettings::operator=(const TeamSignalSettings& other)
|
||||||
|
{
|
||||||
|
fValues = other.fValues;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
TeamSignalSettings::ID() const
|
||||||
|
{
|
||||||
|
return "Signals";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSignalSettings::SetTo(const BMessage& archive)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
fValues = archive;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSignalSettings::WriteTo(BMessage& archive) const
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
archive = fValues;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TeamSignalSettings::Unset()
|
||||||
|
{
|
||||||
|
fValues.MakeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TeamSignalSettings::SetDefaultSignalDisposition(int32 disposition)
|
||||||
|
{
|
||||||
|
fValues.SetInt32(skDefaultSignalFieldName, disposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
TeamSignalSettings::DefaultSignalDisposition() const
|
||||||
|
{
|
||||||
|
return fValues.GetInt32(skDefaultSignalFieldName,
|
||||||
|
SIGNAL_DISPOSITION_IGNORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
TeamSignalSettings::CountCustomSignalDispositions() const
|
||||||
|
{
|
||||||
|
type_code type;
|
||||||
|
int32 count = 0;
|
||||||
|
|
||||||
|
if (fValues.GetInfo(skSignalSettingName, &type, &count) == B_OK)
|
||||||
|
return count;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSignalSettings::AddCustomSignalDisposition(int32 signal, int32 disposition)
|
||||||
|
{
|
||||||
|
BMessage setting;
|
||||||
|
if (setting.AddInt32(skSignalNumberFieldName, signal) != B_OK
|
||||||
|
|| setting.AddInt32(skSignalDispositionFieldName, disposition) != B_OK
|
||||||
|
|| fValues.AddMessage(skSignalSettingName, &setting) != B_OK) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSignalSettings::RemoveCustomSignalDispositionAt(int32 index)
|
||||||
|
{
|
||||||
|
return fValues.RemoveData(skSignalSettingName, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSignalSettings::GetCustomSignalDispositionAt(int32 index, int32& signal,
|
||||||
|
int32& disposition) const
|
||||||
|
{
|
||||||
|
BMessage setting;
|
||||||
|
status_t error = fValues.FindMessage(skSignalSettingName, index, &setting);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
error = setting.FindInt32(skSignalNumberFieldName, &signal);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
return setting.FindInt32(skSignalDispositionFieldName, &disposition);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamSignalSettings*
|
||||||
|
TeamSignalSettings::Clone() const
|
||||||
|
{
|
||||||
|
TeamSignalSettings* settings = new(std::nothrow)
|
||||||
|
TeamSignalSettings();
|
||||||
|
|
||||||
|
if (settings == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (settings->SetTo(fValues) != B_OK) {
|
||||||
|
delete settings;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TEAM_SIGNAL_SETTINGS_H
|
||||||
|
#define TEAM_SIGNAL_SETTINGS_H
|
||||||
|
|
||||||
|
#include <Message.h>
|
||||||
|
|
||||||
|
#include "SignalDispositionTypes.h"
|
||||||
|
|
||||||
|
|
||||||
|
class TeamSignalSettings {
|
||||||
|
public:
|
||||||
|
TeamSignalSettings();
|
||||||
|
virtual ~TeamSignalSettings();
|
||||||
|
|
||||||
|
TeamSignalSettings&
|
||||||
|
operator=(
|
||||||
|
const TeamSignalSettings& other);
|
||||||
|
// throws std::bad_alloc;
|
||||||
|
|
||||||
|
const char* ID() const;
|
||||||
|
status_t SetTo(const BMessage& archive);
|
||||||
|
status_t WriteTo(BMessage& archive) const;
|
||||||
|
void Unset();
|
||||||
|
|
||||||
|
void SetDefaultSignalDisposition(int32 disposition);
|
||||||
|
int32 DefaultSignalDisposition() const;
|
||||||
|
|
||||||
|
int32 CountCustomSignalDispositions() const;
|
||||||
|
status_t AddCustomSignalDisposition(int32 signal,
|
||||||
|
int32 disposition);
|
||||||
|
status_t RemoveCustomSignalDispositionAt(int32 index);
|
||||||
|
status_t GetCustomSignalDispositionAt(int32 index,
|
||||||
|
int32& signal, int32& disposition) const;
|
||||||
|
|
||||||
|
virtual TeamSignalSettings*
|
||||||
|
Clone() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessage fValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // TEAM_SIGNAL_SETTINGS_H
|
||||||
Reference in New Issue
Block a user