Ticket #6926: activitymonitor.patch
File activitymonitor.patch, 11.1 KB (added by , 13 years ago) |
---|
-
src/apps/activitymonitor/ActivityMonitor.cpp
14 14 15 15 #include "ActivityWindow.h" 16 16 17 #include <Catalog.h> 18 #include <Language.h> 19 #include <Locale.h> 20 #include <LocaleRoster.h> 17 21 18 22 const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor"; 19 23 … … 61 65 /*static*/ void 62 66 ActivityMonitor::ShowAbout() 63 67 { 64 BAlert *alert = new BAlert("about", "ActivityMonitor\n"68 BAlert *alert = new BAlert("about", B_TRANSLATE("ActivityMonitor\n" 65 69 "\twritten by Axel Dörfler\n" 66 "\tCopyright 2008, Haiku Inc.\n" , "OK");70 "\tCopyright 2008, Haiku Inc.\n"), B_TRANSLATE("OK")); 67 71 BTextView *view = alert->TextView(); 68 72 BFont font; 69 73 -
src/apps/activitymonitor/ActivityWindow.cpp
25 25 #include "DataSource.h" 26 26 #include "SettingsWindow.h" 27 27 28 #include <Catalog.h> 29 #include <Language.h> 30 #include <Locale.h> 31 #include <LocaleRoster.h> 28 32 29 33 static const uint32 kMsgAddView = 'advw'; 30 34 static const uint32 kMsgShowSettings = 'shst'; 31 35 32 36 33 37 ActivityWindow::ActivityWindow() 34 : BWindow(BRect(100, 100, 500, 350), "ActivityMonitor", B_TITLED_WINDOW,35 B_ ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE)38 : BWindow(BRect(100, 100, 500, 350), B_TRANSLATE("ActivityMonitor"), 39 B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE) 36 40 { 37 41 BMessage settings; 38 42 _LoadSettings(settings); … … 113 117 // add menu 114 118 115 119 // "File" menu 116 BMenu* menu = new BMenu( "File");120 BMenu* menu = new BMenu(B_TRANSLATE("File")); 117 121 BMenuItem* item; 118 122 119 menu->AddItem(new BMenuItem("Add graph", new BMessage(kMsgAddView))); 123 menu->AddItem(new BMenuItem(B_TRANSLATE("Add graph"), 124 new BMessage(kMsgAddView))); 120 125 menu->AddSeparatorItem(); 121 126 122 menu->AddItem(item = new BMenuItem("About ActivityMonitor" B_UTF8_ELLIPSIS, 127 menu->AddItem(item = new BMenuItem( 128 B_TRANSLATE("About ActivityMonitor" B_UTF8_ELLIPSIS), 123 129 new BMessage(B_ABOUT_REQUESTED))); 124 130 menu->AddSeparatorItem(); 125 131 126 menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); 132 menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), 133 new BMessage(B_QUIT_REQUESTED), 'Q')); 127 134 menu->SetTargetForItems(this); 128 135 item->SetTarget(be_app); 129 136 menuBar->AddItem(menu); 130 137 131 138 // "Settings" menu 132 menu = new BMenu( "Settings");133 menu->AddItem(new BMenuItem( "Settings" B_UTF8_ELLIPSIS,139 menu = new BMenu(B_TRANSLATE("Settings")); 140 menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), 134 141 new BMessage(kMsgShowSettings))); 135 142 menu->SetTargetForItems(this); 136 143 menuBar->AddItem(menu); -
src/apps/activitymonitor/ActivityView.cpp
33 33 #include "SystemInfo.h" 34 34 #include "SystemInfoHandler.h" 35 35 36 #include <Catalog.h> 37 #include <Language.h> 38 #include <Locale.h> 39 #include <LocaleRoster.h> 36 40 37 41 template<typename ObjectType> 38 42 class ListAddDeleter { … … 991 995 BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); 992 996 menu->SetFont(be_plain_font); 993 997 994 BMenu* additionalMenu = new BMenu( "Additional items");998 BMenu* additionalMenu = new BMenu(B_TRANSLATE("Additional items")); 995 999 additionalMenu->SetFont(be_plain_font); 996 1000 997 1001 SystemInfo info; … … 1018 1022 1019 1023 menu->AddItem(new BMenuItem(additionalMenu)); 1020 1024 menu->AddSeparatorItem(); 1021 menu->AddItem(new BMenuItem(fShowLegend ? "Hide legend" : "Show legend", 1025 menu->AddItem(new BMenuItem(fShowLegend ? B_TRANSLATE("Hide legend") 1026 : B_TRANSLATE("Show legend"), 1022 1027 new BMessage(kMsgToggleLegend))); 1023 1028 1024 1029 menu->SetTargetForItems(this); … … 1029 1034 menu->AddSeparatorItem(); 1030 1035 BMessage* message = new BMessage(kMsgRemoveView); 1031 1036 message->AddPointer("view", this); 1032 menu->AddItem(item = new BMenuItem("Remove graph", message)); 1037 menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove graph"), 1038 message)); 1033 1039 item->SetTarget(window); 1034 1040 } 1035 1041 -
src/apps/activitymonitor/SettingsWindow.cpp
14 14 #include <Slider.h> 15 15 #include <String.h> 16 16 17 #include <Catalog.h> 18 #include <Language.h> 19 #include <Locale.h> 20 #include <LocaleRoster.h> 17 21 18 22 static const uint32 kMsgUpdateTimeInterval = 'upti'; 19 23 … … 70 74 71 75 bigtime_t interval = kUpdateIntervals[level]; 72 76 if ((interval % 1000) == 0) 73 snprintf(fText, sizeof(fText), "%lld sec.", interval / 1000);77 snprintf(fText, sizeof(fText), B_TRANSLATE("%lld sec."), interval / 1000); 74 78 else 75 snprintf(fText, sizeof(fText), "%lld ms", interval);79 snprintf(fText, sizeof(fText), B_TRANSLATE("%lld ms"), interval); 76 80 77 81 return fText; 78 82 } … … 85 89 86 90 87 91 SettingsWindow::SettingsWindow(ActivityWindow* target) 88 : BWindow(_RelativeTo(target), "Settings", B_FLOATING_WINDOW,92 : BWindow(_RelativeTo(target), B_TRANSLATE("Settings"), B_FLOATING_WINDOW, 89 93 B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), 90 94 fTarget(target) 91 95 { 92 96 SetLayout(new BGroupLayout(B_VERTICAL)); 93 97 94 fIntervalSlider = new IntervalSlider( "Update time interval:",98 fIntervalSlider = new IntervalSlider(B_TRANSLATE("Update time interval:"), 95 99 new BMessage(kMsgUpdateTimeInterval), kNumUpdateIntervals); 96 100 fIntervalSlider->SetInterval(target->RefreshInterval()); 97 101 -
src/apps/activitymonitor/DataSource.cpp
14 14 15 15 #include "SystemInfo.h" 16 16 17 #include <Catalog.h> 18 #include <Language.h> 19 #include <Locale.h> 20 #include <LocaleRoster.h> 17 21 18 22 const DataSource* kSources[] = { 19 23 new UsedMemoryDataSource(), … … 286 290 MemoryDataSource::Print(BString& text, int64 value) const 287 291 { 288 292 char buffer[32]; 289 snprintf(buffer, sizeof(buffer), "%.1f MB", value / 1048576.0); 293 snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f MB"), 294 value / 1048576.0); 290 295 291 296 text = buffer; 292 297 } … … 295 300 const char* 296 301 MemoryDataSource::Unit() const 297 302 { 298 return "MB";303 return B_TRANSLATE("MB"); 299 304 } 300 305 301 306 … … 329 334 const char* 330 335 UsedMemoryDataSource::Label() const 331 336 { 332 return "Used memory";337 return B_TRANSLATE("Used memory"); 333 338 } 334 339 335 340 336 341 const char* 337 342 UsedMemoryDataSource::ShortLabel() const 338 343 { 339 return "Memory";344 return B_TRANSLATE("Memory"); 340 345 } 341 346 342 347 … … 378 383 const char* 379 384 CachedMemoryDataSource::Label() const 380 385 { 381 return "Cached memory";386 return B_TRANSLATE("Cached memory"); 382 387 } 383 388 384 389 385 390 const char* 386 391 CachedMemoryDataSource::ShortLabel() const 387 392 { 388 return "Cache";393 return B_TRANSLATE("Cache"); 389 394 } 390 395 391 396 … … 430 435 const char* 431 436 SwapSpaceDataSource::Label() const 432 437 { 433 return "Swap space";438 return B_TRANSLATE("Swap space"); 434 439 } 435 440 436 441 437 442 const char* 438 443 SwapSpaceDataSource::ShortLabel() const 439 444 { 440 return "Swap";445 return B_TRANSLATE("Swap"); 441 446 } 442 447 443 448 … … 485 490 const char* 486 491 BlockCacheDataSource::Label() const 487 492 { 488 return "Block cache memory";493 return B_TRANSLATE("Block cache memory"); 489 494 } 490 495 491 496 492 497 const char* 493 498 BlockCacheDataSource::ShortLabel() const 494 499 { 495 return "Block cache";500 return B_TRANSLATE("Block cache"); 496 501 } 497 502 498 503 … … 532 537 const char* 533 538 SemaphoresDataSource::Label() const 534 539 { 535 return "Semaphores";540 return B_TRANSLATE("Semaphores"); 536 541 } 537 542 538 543 539 544 const char* 540 545 SemaphoresDataSource::ShortLabel() const 541 546 { 542 return "Sems";547 return B_TRANSLATE("Sems"); 543 548 } 544 549 545 550 … … 586 591 const char* 587 592 PortsDataSource::Label() const 588 593 { 589 return "Ports";594 return B_TRANSLATE("Ports"); 590 595 } 591 596 592 597 … … 633 638 const char* 634 639 ThreadsDataSource::Label() const 635 640 { 636 return "Threads";641 return B_TRANSLATE("Threads"); 637 642 } 638 643 639 644 … … 680 685 const char* 681 686 TeamsDataSource::Label() const 682 687 { 683 return "Teams";688 return B_TRANSLATE("Teams"); 684 689 } 685 690 686 691 … … 727 732 const char* 728 733 RunningAppsDataSource::Label() const 729 734 { 730 return "Running applications";735 return B_TRANSLATE("Running applications"); 731 736 } 732 737 733 738 734 739 const char* 735 740 RunningAppsDataSource::ShortLabel() const 736 741 { 737 return "Apps";742 return B_TRANSLATE("Apps"); 738 743 } 739 744 740 745 … … 839 844 const char* 840 845 CPUUsageDataSource::Name() const 841 846 { 842 return "CPU usage";847 return B_TRANSLATE("CPU usage"); 843 848 } 844 849 845 850 … … 868 873 CPUUsageDataSource::_SetCPU(int32 cpu) 869 874 { 870 875 fCPU = cpu; 871 fLabel = "CPU";876 fLabel = B_TRANSLATE("CPU"); 872 877 if (SystemInfo().CPUCount() > 1) 873 878 fLabel << " " << cpu + 1; 874 879 875 880 fShortLabel = fLabel; 876 fLabel << " usage";881 fLabel << B_TRANSLATE(" usage"); 877 882 878 883 const rgb_color kColors[B_MAX_CPU_COUNT] = { 879 884 // TODO: find some better defaults... … … 967 972 const char* 968 973 CPUCombinedUsageDataSource::Label() const 969 974 { 970 return "CPU usage";975 return B_TRANSLATE("CPU usage"); 971 976 } 972 977 973 978 974 979 const char* 975 980 CPUCombinedUsageDataSource::ShortLabel() const 976 981 { 977 return "CPU";982 return B_TRANSLATE("CPU"); 978 983 } 979 984 980 985 981 986 const char* 982 987 CPUCombinedUsageDataSource::Name() const 983 988 { 984 return "CPU usage (combined)";989 return B_TRANSLATE("CPU usage (combined)"); 985 990 } 986 991 987 992 … … 1041 1046 PageFaultsDataSource::Print(BString& text, int64 value) const 1042 1047 { 1043 1048 char buffer[32]; 1044 snprintf(buffer, sizeof(buffer), "%.1f faults/s", value / 1024.0);1049 snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f faults/s"), value / 1024.0); 1045 1050 1046 1051 text = buffer; 1047 1052 } … … 1065 1070 const char* 1066 1071 PageFaultsDataSource::Label() const 1067 1072 { 1068 return "Page faults";1073 return B_TRANSLATE("Page faults"); 1069 1074 } 1070 1075 1071 1076 1072 1077 const char* 1073 1078 PageFaultsDataSource::ShortLabel() const 1074 1079 { 1075 return "P-faults";1080 return B_TRANSLATE("P-faults"); 1076 1081 } 1077 1082 1078 1083 1079 1084 const char* 1080 1085 PageFaultsDataSource::Name() const 1081 1086 { 1082 return "Page faults";1087 return B_TRANSLATE("Page faults"); 1083 1088 } 1084 1089 1085 1090 … … 1142 1147 NetworkUsageDataSource::Print(BString& text, int64 value) const 1143 1148 { 1144 1149 char buffer[32]; 1145 snprintf(buffer, sizeof(buffer), "%.1f KB/s", value / 1024.0);1150 snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f KB/s"), value / 1024.0); 1146 1151 1147 1152 text = buffer; 1148 1153 } … … 1166 1171 const char* 1167 1172 NetworkUsageDataSource::Label() const 1168 1173 { 1169 return fIn ? "Receiving" : "Sending";1174 return fIn ? B_TRANSLATE("Receiving") : B_TRANSLATE("Sending"); 1170 1175 } 1171 1176 1172 1177 … … 1180 1185 const char* 1181 1186 NetworkUsageDataSource::Name() const 1182 1187 { 1183 return fIn ? "Network receive" : "Network send";1188 return fIn ? B_TRANSLATE("Network receive") : B_TRANSLATE("Network send"); 1184 1189 } 1185 1190 1186 1191 … … 1250 1255 const char* 1251 1256 ClipboardSizeDataSource::Label() const 1252 1257 { 1253 return fText ? "Text clipboard size" : "Raw clipboard size"; 1258 return fText ? B_TRANSLATE("Text clipboard size") 1259 : B_TRANSLATE("Raw clipboard size"); 1254 1260 } 1255 1261 1256 1262 1257 1263 const char* 1258 1264 ClipboardSizeDataSource::Unit() const 1259 1265 { 1260 return "bytes"/*"KB"*/;1266 return B_TRANSLATE("bytes")/*"KB"*/; 1261 1267 } 1262 1268 1263 1269 … … 1304 1310 const char* 1305 1311 MediaNodesDataSource::Label() const 1306 1312 { 1307 return "Media nodes";1313 return B_TRANSLATE("Media nodes"); 1308 1314 } 1309 1315 1310 1316