Introduced DataSource::InternalName(), which must be implemented by all
derived classes. This is now used for storing and restoring DataSources in/from the ActivityView archive. Fixes replicant restoration after switching the preferred system language. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41027 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e6c49e10f9
commit
d1901581f4
@ -643,9 +643,8 @@ ActivityView::_Init(const BMessage* settings)
|
||||
fHistoryBackgroundColor = *color;
|
||||
|
||||
const char* name;
|
||||
for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++) {
|
||||
for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++)
|
||||
AddDataSource(DataSource::FindSource(name), settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -700,7 +699,7 @@ ActivityView::SaveState(BMessage& state) const
|
||||
DataSource* source = fSources.ItemAt(i);
|
||||
|
||||
if (!source->PerCPU() || source->CPU() == 0)
|
||||
status = state.AddString("source", source->Name());
|
||||
status = state.AddString("source", source->InternalName());
|
||||
if (status != B_OK)
|
||||
return status;
|
||||
|
||||
|
@ -149,14 +149,14 @@ DataSource::Print(BString& text, int64 value) const
|
||||
|
||||
|
||||
const char*
|
||||
DataSource::Name() const
|
||||
DataSource::ShortLabel() const
|
||||
{
|
||||
return Label();
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
DataSource::ShortLabel() const
|
||||
DataSource::Name() const
|
||||
{
|
||||
return Label();
|
||||
}
|
||||
@ -243,11 +243,11 @@ DataSource::SourceAt(int32 index)
|
||||
|
||||
|
||||
/*static*/ const DataSource*
|
||||
DataSource::FindSource(const char* name)
|
||||
DataSource::FindSource(const char* internalName)
|
||||
{
|
||||
for (uint32 i = 0; i < kSourcesCount; i++) {
|
||||
const DataSource* source = kSources[i];
|
||||
if (!strcmp(source->Name(), name))
|
||||
if (!strcmp(source->InternalName(), internalName))
|
||||
return source;
|
||||
}
|
||||
|
||||
@ -330,6 +330,13 @@ UsedMemoryDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
UsedMemoryDataSource::InternalName() const
|
||||
{
|
||||
return "Used memory";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
UsedMemoryDataSource::Label() const
|
||||
{
|
||||
@ -379,6 +386,13 @@ CachedMemoryDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CachedMemoryDataSource::InternalName() const
|
||||
{
|
||||
return "Cached memory";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CachedMemoryDataSource::Label() const
|
||||
{
|
||||
@ -431,6 +445,13 @@ SwapSpaceDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
SwapSpaceDataSource::InternalName() const
|
||||
{
|
||||
return "Swap space";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
SwapSpaceDataSource::Label() const
|
||||
{
|
||||
@ -486,6 +507,13 @@ BlockCacheDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
BlockCacheDataSource::InternalName() const
|
||||
{
|
||||
return "Block cache memory";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
BlockCacheDataSource::Label() const
|
||||
{
|
||||
@ -533,6 +561,13 @@ SemaphoresDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
SemaphoresDataSource::InternalName() const
|
||||
{
|
||||
return "Semaphores";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
SemaphoresDataSource::Label() const
|
||||
{
|
||||
@ -587,6 +622,13 @@ PortsDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PortsDataSource::InternalName() const
|
||||
{
|
||||
return "Ports";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PortsDataSource::Label() const
|
||||
{
|
||||
@ -634,6 +676,13 @@ ThreadsDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
ThreadsDataSource::InternalName() const
|
||||
{
|
||||
return "Threads";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
ThreadsDataSource::Label() const
|
||||
{
|
||||
@ -681,6 +730,13 @@ TeamsDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
TeamsDataSource::InternalName() const
|
||||
{
|
||||
return "Teams";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
TeamsDataSource::Label() const
|
||||
{
|
||||
@ -728,6 +784,13 @@ RunningAppsDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
RunningAppsDataSource::InternalName() const
|
||||
{
|
||||
return "Running applications";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
RunningAppsDataSource::Label() const
|
||||
{
|
||||
@ -840,6 +903,13 @@ CPUUsageDataSource::ShortLabel() const
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CPUUsageDataSource::InternalName() const
|
||||
{
|
||||
return "CPU usage";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CPUUsageDataSource::Name() const
|
||||
{
|
||||
@ -982,6 +1052,13 @@ CPUCombinedUsageDataSource::ShortLabel() const
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CPUCombinedUsageDataSource::InternalName() const
|
||||
{
|
||||
return "CPU usage (combined)";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
CPUCombinedUsageDataSource::Name() const
|
||||
{
|
||||
@ -1081,6 +1158,13 @@ PageFaultsDataSource::ShortLabel() const
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PageFaultsDataSource::InternalName() const
|
||||
{
|
||||
return "Page faults";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
PageFaultsDataSource::Name() const
|
||||
{
|
||||
@ -1183,6 +1267,13 @@ NetworkUsageDataSource::ShortLabel() const
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
NetworkUsageDataSource::InternalName() const
|
||||
{
|
||||
return fIn ? "Network receive" : "Network send";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
NetworkUsageDataSource::Name() const
|
||||
{
|
||||
@ -1253,11 +1344,18 @@ ClipboardSizeDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
ClipboardSizeDataSource::InternalName() const
|
||||
{
|
||||
return fText ? "Text clipboard size" : "Raw clipboard size";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
ClipboardSizeDataSource::Label() const
|
||||
{
|
||||
return fText ?
|
||||
B_TRANSLATE("Text clipboard size") : B_TRANSLATE("Raw clipboard size");
|
||||
return fText ? B_TRANSLATE("Text clipboard size")
|
||||
: B_TRANSLATE("Raw clipboard size");
|
||||
}
|
||||
|
||||
|
||||
@ -1308,6 +1406,13 @@ MediaNodesDataSource::NextValue(SystemInfo& info)
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
MediaNodesDataSource::InternalName() const
|
||||
{
|
||||
return "Media nodes";
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
MediaNodesDataSource::Label() const
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual void Print(BString& text, int64 value) const;
|
||||
|
||||
virtual const char* InternalName() const = 0;
|
||||
virtual const char* Name() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
@ -52,7 +53,7 @@ public:
|
||||
|
||||
static int32 CountSources();
|
||||
static const DataSource* SourceAt(int32 index);
|
||||
static const DataSource* FindSource(const char* name);
|
||||
static const DataSource* FindSource(const char* internalName);
|
||||
static int32 IndexOf(const DataSource* source);
|
||||
|
||||
protected:
|
||||
@ -81,6 +82,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
virtual bool Primary() const;
|
||||
@ -95,6 +97,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
virtual bool Primary() const;
|
||||
@ -109,6 +112,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
virtual bool Primary() const;
|
||||
@ -123,6 +127,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
};
|
||||
@ -136,6 +141,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
@ -150,6 +156,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
};
|
||||
@ -163,6 +170,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
};
|
||||
@ -176,6 +184,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
};
|
||||
@ -189,6 +198,7 @@ public:
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
@ -207,6 +217,7 @@ public:
|
||||
virtual void Print(BString& text, int64 value) const;
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Name() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
@ -238,6 +249,7 @@ public:
|
||||
virtual void Print(BString& text, int64 value) const;
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Name() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
@ -263,6 +275,7 @@ public:
|
||||
virtual void Print(BString& text, int64 value) const;
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Name() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
@ -287,6 +300,7 @@ public:
|
||||
virtual void Print(BString& text, int64 value) const;
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Name() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* ShortLabel() const;
|
||||
@ -312,6 +326,7 @@ public:
|
||||
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual const char* Label() const;
|
||||
virtual const char* Unit() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
@ -328,6 +343,7 @@ public:
|
||||
|
||||
virtual DataSource* Copy() const;
|
||||
|
||||
virtual const char* InternalName() const;
|
||||
virtual int64 NextValue(SystemInfo& info);
|
||||
virtual const char* Label() const;
|
||||
virtual bool AdaptiveScale() const;
|
||||
|
Loading…
Reference in New Issue
Block a user