Unified
Split
Showing
with
65 additions
and 8 deletions.
- +30 −0 src/SizeColumn.cpp
- +17 −0 src/SizeColumn.h
- +2 −2 src/TeamItem.cpp
- +1 −0 src/TeamItem.h
- +3 −1 src/TeamListView.cpp
- +1 −1 src/ThreadItem.cpp
- +10 −3 src/miscSlayer.cpp
- +1 −1 src/miscSlayer.h
| @@ -0,0 +1,30 @@ | ||
| #include "SizeColumn.h" | ||
|
|
||
| SizeColumn::SizeColumn(const char* title, float width, | ||
| float minWidth, float maxWidth, | ||
| alignment align): | ||
| BSizeColumn(title, width, minWidth, maxWidth, align) | ||
| { | ||
| } | ||
|
|
||
| void | ||
| SizeColumn::DrawField(BField* field, BRect rect, BView* parent) | ||
| { | ||
| off_t size = ((BSizeField*)field)->Size(); | ||
|
|
||
| if (size <= 0) | ||
| DrawString("-", parent, rect); | ||
| else | ||
| BSizeColumn::DrawField(field, rect, parent); | ||
| } | ||
|
|
||
|
|
||
| int | ||
| SizeColumn::CompareFields(BField* field1, BField* field2) | ||
| { | ||
| off_t diff = ((BSizeField*)field1)->Size() - ((BSizeField*)field2)->Size(); | ||
| if (diff > 0) return 1; | ||
| else | ||
| if (diff < 0) return -1; | ||
| return 0; | ||
| } |
| @@ -0,0 +1,17 @@ | ||
| #ifndef _SIZECOLUMN_H_ | ||
| #define _SIZECOLUMN_H_ | ||
|
|
||
| #include <ColumnTypes.h> | ||
|
|
||
|
|
||
| class SizeColumn : public BSizeColumn | ||
| { | ||
| public: | ||
| SizeColumn(const char* title, float width, | ||
| float minWidth, float maxWidth, | ||
| alignment align = B_ALIGN_LEFT); | ||
| virtual void DrawField(BField* field, BRect rect, BView* parent); | ||
| virtual int CompareFields(BField* field1, BField* field2); | ||
| }; | ||
|
|
||
| #endif |
| @@ -39,7 +39,7 @@ TeamItem::TeamItem(team_info *info) : BRow() | ||
| else | ||
| memory_usage = 0; | ||
|
|
||
| get_app_info(team, &team_icon, &name); | ||
| get_app_info(team, &team_icon, &name, &fullName); | ||
| if (name == NULL) { | ||
| // if couldn't get app name from BRoster, use args | ||
| strcpy(args, info->args); | ||
| @@ -58,7 +58,7 @@ TeamItem::TeamItem(team_info *info) : BRow() | ||
| SetField(new BStringField("-"), i++); | ||
| SetField(new BSizeField(memory_usage < 0 ? 0 : memory_usage), i++); | ||
| SetField(new BIntegerField(0), i++); | ||
|
|
||
| SetField(new BStringField(fullName), i++); | ||
| changed = 0; | ||
| } | ||
|
|
||
| @@ -35,6 +35,7 @@ class TeamItem : public BRow { | ||
| team_id team; | ||
| char args[64]; | ||
| char *name; | ||
| char *fullName; | ||
| int32 area_count; | ||
| size_t memory_usage; | ||
| bigtime_t CPU_diff; | ||
| @@ -31,7 +31,7 @@ TeamListView::TeamListView(const char *name) | ||
| : BColumnListView("fileListView", B_FRAME_EVENTS|B_NAVIGABLE) | ||
| { | ||
| // add Columns... | ||
|
|
||
| BColumn* column; | ||
| int32 i = 0; | ||
| AddColumn(new BBitmapColumn(B_TRANSLATE("Icon"), 16, 16, 16, B_ALIGN_CENTER), i++); | ||
| AddColumn(new BStringColumn(B_TRANSLATE("Name"), 180, 10, 600, 0), i++); | ||
| @@ -40,6 +40,8 @@ TeamListView::TeamListView(const char *name) | ||
| AddColumn(new BStringColumn(B_TRANSLATE("State"), 70, 10, 600, 0), i++); | ||
| AddColumn(new SizeColumn(B_TRANSLATE("Memory"), 80, 10, 600), i++); | ||
| AddColumn(new GraphColumn(B_TRANSLATE("CPU"), 80.0, 10, 100.0), i++); | ||
| AddColumn(column = new BStringColumn(B_TRANSLATE("Full name"), 180, 10, 600, 0), i++); | ||
| column->SetVisible(false); | ||
|
|
||
| SetInvocationMessage(new BMessage(TEAM_INV)); | ||
|
|
||
| @@ -79,7 +79,7 @@ ThreadItem::ThreadItem(thread_info *info) : BRow() | ||
| SetField(new BStringField(strp), i++); | ||
| SetField(new BSizeField(0), i++); | ||
| SetField(new BIntegerField(0), i++); | ||
|
|
||
| SetField(new BStringField(name), i++); | ||
| changed = 0; | ||
| } | ||
|
|
||
| @@ -22,11 +22,12 @@ | ||
| #include <AppMisc.h> | ||
|
|
||
|
|
||
| void get_app_info(team_id team, BBitmap **a_icon, char **name) | ||
| void get_app_info(team_id team, BBitmap **a_icon, char **name, char **fullName) | ||
| { | ||
| // code from the debugger | ||
| app_info appInfo; | ||
| *name = NULL; | ||
| *fullName = NULL; | ||
| status_t status = be_roster->GetRunningAppInfo(team, | ||
| &appInfo); | ||
| if (status != B_OK) { | ||
| @@ -59,7 +60,13 @@ void get_app_info(team_id team, BBitmap **a_icon, char **name) | ||
| if (status != B_OK) { | ||
| delete icon; | ||
| icon = NULL; | ||
| } else *name = strdup(appInfo.ref.name); | ||
|
|
||
| } else { | ||
| *name = strdup(appInfo.ref.name); | ||
| BPath appFullName(&appInfo.ref); | ||
| if (appFullName.InitCheck() == B_OK) | ||
| { | ||
| *fullName = strdup(appFullName.Path()); | ||
| } | ||
| } | ||
| *a_icon = icon; | ||
| } | ||
| @@ -26,6 +26,6 @@ | ||
| #include <StorageKit.h> | ||
| #include <InterfaceKit.h> | ||
|
|
||
| void get_app_info(team_id, BBitmap **icon, char **name); | ||
| void get_app_info(team_id, BBitmap **icon, char **name, char **fullName); | ||
|
|
||
| #endif | ||