ActivityMonitor: fix non-i18n-friendly string

Fixes #16008
This commit is contained in:
Adrien Destugues
2020-05-11 17:27:49 +02:00
parent 9cfe144326
commit a22fff485c
2 changed files with 9 additions and 7 deletions
+1 -2
View File
@@ -1448,8 +1448,7 @@ ActivityView::Draw(BRect updateRect)
BString label = source->Label();
float possibleLabelWidth = frame.right - colorBox.right - 12 - width;
// TODO: TruncateString() is broken... remove + 5 when fixed!
if (ceilf(StringWidth(label.String()) + 5) > possibleLabelWidth)
if (ceilf(StringWidth(label.String())) > possibleLabelWidth)
label = source->ShortLabel();
TruncateString(&label, B_TRUNCATE_MIDDLE, possibleLabelWidth);
+8 -5
View File
@@ -937,12 +937,15 @@ void
CPUUsageDataSource::_SetCPU(int32 cpu)
{
fCPU = cpu;
fLabel = B_TRANSLATE("CPU");
if (SystemInfo().CPUCount() > 1)
fLabel << " " << cpu + 1;
fShortLabel = fLabel;
fLabel << " " << B_TRANSLATE("usage");
if (SystemInfo().CPUCount() > 1) {
fLabel.SetToFormat(B_TRANSLATE("CPU %d usage"), cpu + 1);
fShortLabel.SetToFormat(B_TRANSLATE("CPU %d"), cpu + 1);
} else {
fLabel = B_TRANSLATE("CPU usage");
fShortLabel = B_TRANSLATE("CPU");
}
const rgb_color kColors[] = {
// TODO: find some better defaults...