Ticket #7169: diskusage-refactoring.patch
File diskusage-refactoring.patch, 20.1 KB (added by , 14 years ago) |
---|
-
src/apps/diskusage/VolumeView.cpp
8 8 */ 9 9 10 10 11 #include <Catalog.h> 11 12 #include <Box.h> 12 13 #include <Button.h> 13 14 #include <StringView.h> … … 23 24 24 25 #include "VolumeView.h" 25 26 27 #undef B_TRANSLATE_CONTEXT 28 #define B_TRANSLATE_CONTEXT "Volume View" 29 26 30 const float kMinWinSize = 275.0; 27 31 28 32 VolumeView::VolumeView(const char* name, BVolume* volume) … … 58 62 VolumeView::SetPath(BPath path) 59 63 { 60 64 fPieView->SetPath(path); 61 fStatusView->SetBtnLabel( kStrRescan);65 fStatusView->SetBtnLabel(B_TRANSLATE("Rescan")); 62 66 } 63 67 64 68 … … 69 73 switch(msg->what) { 70 74 case kBtnRescan: 71 75 fPieView->MessageReceived(msg); 72 fStatusView->SetBtnLabel( kStrRescan);76 fStatusView->SetBtnLabel(B_TRANSLATE("Rescan")); 73 77 break; 74 78 75 79 default: -
src/apps/diskusage/PieView.cpp
16 16 17 17 #include <AppFileInfo.h> 18 18 #include <Bitmap.h> 19 #include <Catalog.h> 19 20 #include <Entry.h> 20 21 #include <File.h> 21 22 #include <MenuItem.h> … … 34 35 #include "MainWindow.h" 35 36 #include "Scanner.h" 36 37 38 #undef B_TRANSLATE_CONTEXT 39 #define B_TRANSLATE_CONTEXT "Pie View" 37 40 38 41 static const int32 kIdxGetInfo = 0; 39 42 static const int32 kIdxOpen = 1; … … 96 99 AppMenuItem::GetContentSize(float* _width, float* _height) 97 100 { 98 101 if (_width) 99 *_width = fIcon->Bounds().Width() + be_plain_font->StringWidth(Label()); 102 *_width = fIcon->Bounds().Width() + 103 be_plain_font->StringWidth(Label()); 100 104 101 105 if (_height) { 102 106 struct font_height fh; … … 134 138 fOutdated(false) 135 139 { 136 140 fMouseOverMenu = new BPopUpMenu(kEmptyStr, false, false); 137 fMouseOverMenu->AddItem(new BMenuItem(kMenuGetInfo, NULL), kIdxGetInfo); 138 fMouseOverMenu->AddItem(new BMenuItem(kMenuOpen, NULL), kIdxOpen); 141 fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Get Info"), NULL), 142 kIdxGetInfo); 143 fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Open"), NULL), 144 kIdxOpen); 139 145 140 146 fFileUnavailableMenu = new BPopUpMenu(kEmptyStr, false, false); 141 BMenuItem* item = new BMenuItem( kStrUnavail, NULL);147 BMenuItem* item = new BMenuItem(B_TRANSLATE("file unavailable"), NULL); 142 148 item->SetEnabled(false); 143 149 fFileUnavailableMenu->AddItem(item); 144 150 … … 424 430 parent = parent->parent; 425 431 colorIdx++; 426 432 } 427 _DrawDirectory(pieRect, currentDir, 0.0, 0.0, colorIdx % kBasePieColorCount,428 0);433 _DrawDirectory(pieRect, currentDir, 0.0, 0.0, 434 colorIdx % kBasePieColorCount, 0); 429 435 430 436 if (fOutdated) { 431 437 432 438 BRect b = Bounds(); 433 439 434 float strWidth = StringWidth( kOutdatedStr);440 float strWidth = StringWidth(B_TRANSLATE("Outdated view")); 435 441 float bx = (b.Width() - strWidth - kSmallHMargin); 436 442 437 443 struct font_height fh; … … 439 445 440 446 float by = (b.Height() - ceil(fh.descent) - kSmallVMargin); 441 447 SetHighColor(0x00, 0x00, 0x00); 442 DrawString( kOutdatedStr, BPoint(bx, by));448 DrawString(B_TRANSLATE("Outdated view"), BPoint(bx, by)); 443 449 } 444 450 } 445 451 … … 711 717 712 718 delete type; 713 719 714 BMenu* openWith = new BMenu( kMenuOpenWith);720 BMenu* openWith = new BMenu(B_TRANSLATE("Open With")); 715 721 716 722 if (appList.size() == 0) { 717 BMenuItem* item = new BMenuItem(kMenuNoApps, NULL); 723 BMenuItem* item = new BMenuItem(B_TRANSLATE("no supporting apps"), 724 NULL); 718 725 item->SetEnabled(false); 719 726 openWith->AddItem(item); 720 727 } else { … … 749 756 // Add a "Rescan" option for folders. 750 757 BMenuItem* rescan = NULL; 751 758 if (info->children.size() > 0) { 752 rescan = new BMenuItem( kStrRescan, NULL);759 rescan = new BMenuItem(B_TRANSLATE("Rescan"), NULL); 753 760 fMouseOverMenu->AddItem(rescan, kIdxRescan); 754 761 } 755 762 -
src/apps/diskusage/MainWindow.cpp
10 10 #include "MainWindow.h" 11 11 12 12 #include <Application.h> 13 #include <Catalog.h> 13 14 #include <Node.h> 14 15 #include <Roster.h> 15 16 #include <Screen.h> … … 19 20 #include "Common.h" 20 21 #include "ControlsView.h" 21 22 23 #undef B_TRANSLATE_CONTEXT 24 #define B_TRANSLATE_CONTEXT "MainWindow" 22 25 23 26 MainWindow::MainWindow(BRect pieRect) 24 27 : 25 BWindow(pieRect, "DiskUsage", B_TITLED_WINDOW,28 BWindow(pieRect, B_TRANSLATE("DiskUsage"), B_TITLED_WINDOW, 26 29 B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE 27 30 | B_AUTO_UPDATE_SIZE_LIMITS) 28 31 { -
src/apps/diskusage/DiskUsage.rdef
3 3 resource app_version { 4 4 major = 1, 5 5 middle = 0, 6 minor = 0,6 minor = 2, 7 7 8 8 variety = B_APPV_FINAL, 9 9 internal = 0, 10 10 11 short_info = "1.0. 1",12 long_info = "1.0. 1 ©1999 Mike Steed, ©2008-2009Haiku"11 short_info = "1.0.2", 12 long_info = "1.0.2 ©1999 Mike Steed, ©2008-2011 Haiku" 13 13 }; 14 14 15 15 resource app_flags B_MULTIPLE_LAUNCH; … … 47 47 $"18001501178600040A01010B1815FF01178400040A08010C000A09010D000A0A" 48 48 $"010E00" 49 49 }; 50 51 resource(101, "RGB_WIN") rgb_color { 0xDE, 0xDB, 0xDE, 0xFF };52 resource(102, "RGB_PIE_OL") rgb_color { 0x80, 0x80, 0x80, 0xFF };53 resource(103, "RGB_PIE_BG") rgb_color { 0xFF, 0xFF, 0xFF, 0xFF };54 resource(104, "RGB_PIE_MT") rgb_color { 0xA0, 0xA0, 0xA0, 0xFF };55 resource(105, "RGB_PIE_1") rgb_color { 0x00, 0x60, 0x60, 0xFF };56 resource(106, "RGB_PIE_2") rgb_color { 0x00, 0x00, 0x68, 0xFF };57 resource(107, "RGB_PIE_3") rgb_color { 0x60, 0x00, 0x60, 0xFF };58 resource(108, "RGB_PIE_4") rgb_color { 0x68, 0x00, 0x00, 0xFF };59 60 resource(101, "N_PIE_COLORS") (uint8)4;61 62 resource(103, "STR_N_FILES") "%d files";63 resource(102, "STR_1_FILE") "%d file";64 resource(101, "STR_VM_LABEL") "Volume:";65 resource(120, "STR_SCAN") "Scan";66 resource(104, "STR_RESCAN") "Rescan";67 resource(105, "STR_SCN_X") "Scanning ";68 resource(106, "STR_UNAVAIL") "file unavailable";69 resource(107, "STR_VM_DFLT") "(Select)";70 resource(108, "STR_VPROMPT") "Select a volume to scan";71 resource(109, "STR_M_INFO") "Get Info";72 resource(110, "STR_M_OPEN") "Open";73 resource(111, "STR_M_OPENW") "Open With";74 resource(112, "STR_M_NAPPS") "no supporting apps";75 resource(113, "STR_SIZE") "Size";76 resource(114, "STR_INFILES") " in %d files";77 resource(115, "STR_MADE") "Created";78 resource(116, "STR_MOD") "Modified";79 resource(117, "STR_TIMEFMT") "%a, %d %b %Y, %r";80 resource(118, "STR_KIND") "Kind";81 resource(119, "STR_PATH") "Path";82 resource(121, "STR_OUTDATED") "Outdated view"; -
src/apps/diskusage/StatusView.cpp
14 14 #include <math.h> 15 15 #include <stdio.h> 16 16 17 #include <Catalog.h> 17 18 #include <Box.h> 18 19 #include <Button.h> 19 20 #include <Node.h> … … 25 26 #include "Common.h" 26 27 #include "Scanner.h" 27 28 29 #undef B_TRANSLATE_CONTEXT 30 #define B_TRANSLATE_CONTEXT "Status View" 28 31 29 32 StatusView::StatusView() 30 33 : … … 35 38 SetLowColor(kPieBGColor); 36 39 37 40 fSizeView = new BStringView(NULL, kEmptyStr); 38 fSizeView->SetExplicitMinSize(BSize(StringWidth( "9999.99 GB"),41 fSizeView->SetExplicitMinSize(BSize(StringWidth(B_TRANSLATE("9999.99 GB")), 39 42 B_SIZE_UNSET)); 40 fSizeView->SetExplicitMaxSize(BSize(StringWidth( "9999.99 GB"),43 fSizeView->SetExplicitMaxSize(BSize(StringWidth(B_TRANSLATE("9999.99 GB")), 41 44 B_SIZE_UNSET)); 42 45 43 46 char testLabel[256]; 44 sprintf(testLabel, kManyFiles, 999999);47 sprintf(testLabel, B_TRANSLATE("%d files"), 999999); 45 48 46 49 fCountView = new BStringView(NULL, kEmptyStr); 47 50 fCountView->SetExplicitMinSize(BSize(StringWidth(testLabel), B_SIZE_UNSET)); … … 50 53 fPathView = new BStringView(NULL, kEmptyStr); 51 54 fPathView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 52 55 53 fRefreshBtn = new BButton(NULL, kStrScan, new BMessage(kBtnRescan));56 fRefreshBtn = new BButton(NULL, B_TRANSLATE("Scan"), new BMessage(kBtnRescan)); 54 57 55 58 fRefreshBtn->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNLIMITED)); 56 59 … … 119 122 if (!info->pseudo) { 120 123 BNode node(&info->ref); 121 124 if (node.InitCheck() != B_OK) { 122 fPathView->SetText( kStrUnavail);125 fPathView->SetText(B_TRANSLATE("file unavailable")); 123 126 fSizeView->SetText(kEmptyStr); 124 127 fCountView->SetText(kEmptyStr); 125 128 return; … … 139 142 140 143 if (info->count > 0) { 141 144 char label[256]; 142 sprintf(label, (info->count == 1) ? kOneFile : kManyFiles, info->count); 145 sprintf(label, (info->count == 1) ? B_TRANSLATE("%d file") : 146 B_TRANSLATE("%d files"), info->count); 143 147 fCountView->SetText(label); 144 148 } else { 145 149 fCountView->SetText(kEmptyStr); -
src/apps/diskusage/InfoWindow.cpp
16 16 #include <utility> 17 17 #include <vector> 18 18 19 #include <Catalog.h> 19 20 #include <StringView.h> 20 21 #include <Bitmap.h> 21 22 #include <NodeInfo.h> … … 27 28 using std::vector; 28 29 using std::pair; 29 30 31 #undef B_TRANSLATE_CONTEXT 32 #define B_TRANSLATE_CONTEXT "Info Window" 30 33 31 34 LeftView::LeftView(BRect frame, BBitmap* icon) 32 35 : … … 67 70 68 71 char name[B_PATH_NAME_LENGTH]; 69 72 strcpy(name, f->ref.name); 70 strcat(name, " info");73 strcat(name, B_TRANSLATE(" info")); 71 74 SetTitle(name); 72 75 73 76 InfoList info; … … 78 81 if (f->count > 0) { 79 82 // This is a directory. 80 83 char str[64]; 81 sprintf(str, kInfoInFiles, f->count);84 sprintf(str, B_TRANSLATE(" in %d files"), f->count); 82 85 strcat(name, str); 83 86 } 84 info.push_back(Item( kInfoSize, name));87 info.push_back(Item(B_TRANSLATE_MARK("Size"), name)); 85 88 86 89 // Created & modified dates 87 90 BEntry entry(&f->ref); 88 91 time_t t; 89 92 entry.GetCreationTime(&t); 90 strftime(name, 64, kInfoTimeFmt, localtime(&t));91 info.push_back(Item( kInfoCreated, name));93 strftime(name, 64, B_TRANSLATE("%a, %d %b %Y, %r"), localtime(&t)); 94 info.push_back(Item(B_TRANSLATE("Created"), name)); 92 95 entry.GetModificationTime(&t); 93 strftime(name, 64, kInfoTimeFmt, localtime(&t));94 info.push_back(Item( kInfoModified, name));96 strftime(name, 64, B_TRANSLATE("%a, %d %b %Y, %r"), localtime(&t)); 97 info.push_back(Item(B_TRANSLATE("Modified"), name)); 95 98 96 99 // Kind 97 100 BMimeType* type = f->Type(); 98 101 type->GetShortDescription(name); 99 info.push_back(Item( kInfoKind, name));102 info.push_back(Item(B_TRANSLATE("Kind"), name)); 100 103 delete type; 101 104 102 105 // Path 103 106 string path; 104 107 f->GetPath(path); 105 info.push_back(Item( kInfoPath, path));108 info.push_back(Item(B_TRANSLATE("Path"), path)); 106 109 107 110 // Icon 108 111 BBitmap *icon = new BBitmap(BRect(0.0, 0.0, 31.0, 31.0), B_RGBA32); … … 122 125 float rightWidth = 0.0; 123 126 InfoList::iterator i = info.begin(); 124 127 while (i != info.end()) { 125 float w = smallFont.StringWidth((*i).first.c_str()) + 2.0 * kSmallHMargin; 128 float w = smallFont.StringWidth((*i).first.c_str()) + 129 2.0 * kSmallHMargin; 126 130 leftWidth = max_c(leftWidth, w); 127 131 w = smallFont.StringWidth((*i).second.c_str()) + 2.0 * kSmallHMargin; 128 132 rightWidth = max_c(rightWidth, w); 129 133 i++; 130 134 } 131 135 132 float winHeight = 32.0 + 4.0 * kSmallVMargin + 5.0 * (fontHeight + kSmallVMargin); 136 float winHeight = 32.0 + 4.0 * kSmallVMargin + 5.0 * (fontHeight 137 + kSmallVMargin); 133 138 float winWidth = leftWidth + rightWidth; 134 139 ResizeTo(winWidth, winHeight); 135 140 136 LeftView *leftView = new LeftView(BRect(0.0, 0.0, leftWidth, winHeight), icon); 141 LeftView *leftView = new LeftView(BRect(0.0, 0.0, leftWidth, winHeight), 142 icon); 137 143 BView *rightView = new BView( 138 144 BRect(leftWidth + 1.0, 0.0, winWidth, winHeight), NULL, 139 145 B_FOLLOW_NONE, B_WILL_DRAW); … … 142 148 AddChild(rightView); 143 149 144 150 BStringView *sv = new BStringView( 145 BRect(kSmallHMargin, kSmallVMargin, rightView->Bounds().Width(), kSmallVMargin + 30.0),146 NULL, f->ref.name, B_FOLLOW_ALL);151 BRect(kSmallHMargin, kSmallVMargin, rightView->Bounds().Width(), 152 kSmallVMargin + 30.0), NULL, f->ref.name, B_FOLLOW_ALL); 147 153 148 154 BFont largeFont(be_plain_font); 149 155 largeFont.SetSize(ceilf(largeFont.Size() * 1.1)); … … 154 160 i = info.begin(); 155 161 while (i != info.end()) { 156 162 sv = new BStringView( 157 BRect(kSmallHMargin, y, leftView->Bounds().Width(), y + fontHeight),158 NULL, (*i).first.c_str());163 BRect(kSmallHMargin, y, leftView->Bounds().Width(), 164 y + fontHeight), NULL, (*i).first.c_str()); 159 165 sv->SetFont(&smallFont); 160 166 sv->SetAlignment(B_ALIGN_RIGHT); 161 167 sv->SetHighColor(kBasePieColor[1]); // arbitrary 162 168 leftView->AddChild(sv); 163 169 164 170 sv = new BStringView( 165 BRect(kSmallHMargin, y, rightView->Bounds().Width(), y + fontHeight),166 NULL, (*i).second.c_str());171 BRect(kSmallHMargin, y, rightView->Bounds().Width(), 172 y + fontHeight), NULL, (*i).second.c_str()); 167 173 sv->SetFont(&smallFont); 168 174 rightView->AddChild(sv); 169 175 -
src/apps/diskusage/Jamfile
15 15 Snapshot.cpp 16 16 StatusView.cpp 17 17 VolumeView.cpp 18 : be $( TARGET_LIBSTDC++)18 : be $(HAIKU_LOCALE_LIBS) $(TARGET_LIBSTDC++) 19 19 : DiskUsage.rdef 20 20 ; 21 21 22 DoCatalogs DiskUsage : 23 x-vnd.Haiku-DiskUsage 24 : 25 MainWindow.cpp 26 Common.cpp 27 InfoWindow.cpp 28 PieView.cpp 29 Scanner.cpp 30 StatusView.cpp 31 VolumeView.cpp 32 ; 33 -
src/apps/diskusage/Common.cpp
17 17 #include <stdlib.h> 18 18 19 19 #include <Application.h> 20 #include <Catalog.h> 20 21 #include <FindDirectory.h> 21 22 #include <Roster.h> 22 23 #include <Path.h> 23 24 24 25 26 #undef B_TRANSLATE_CONTEXT 27 #define B_TRANSLATE_CONTEXT "Common" 28 25 29 const char* kAppSignature = "application/x-vnd.Haiku-DiskUsage"; 26 30 const char* kHelpFileName = "userguide/en/applications/diskusage.html"; 27 31 const char* kPieRectAttrName = "mainrect"; … … 70 74 71 75 BResources* r = new BResources(&file); 72 76 73 #define LoadString(n) (char*)r->LoadResource(B_STRING_TYPE, n, &ignore)74 #define LoadColor(n) *(rgb_color*)r->LoadResource(B_RGB_COLOR_TYPE, n, &ignore)75 #define LoadUint8(n) *(uint8*)r->LoadResource(B_UINT8_TYPE, n, &ignore)76 77 size_t ignore;78 kVolMenuLabel = LoadString("STR_VM_LABEL");79 kOneFile = LoadString("STR_1_FILE");80 kManyFiles = LoadString("STR_N_FILES");81 kStrScan = LoadString("STR_SCAN");82 kStrRescan = LoadString("STR_RESCAN");83 kStrScanningX = LoadString("STR_SCN_X");84 kStrUnavail = LoadString("STR_UNAVAIL");85 kVolMenuDefault = LoadString("STR_VM_DFLT");86 kVolPrompt = LoadString("STR_VPROMPT");87 kMenuGetInfo = LoadString("STR_M_INFO");88 kMenuOpen = LoadString("STR_M_OPEN");89 kMenuOpenWith = LoadString("STR_M_OPENW");90 kMenuNoApps = LoadString("STR_M_NAPPS");91 kInfoSize = LoadString("STR_SIZE");92 kInfoInFiles = LoadString("STR_INFILES");93 kInfoCreated = LoadString("STR_MADE");94 kInfoModified = LoadString("STR_MOD");95 kInfoTimeFmt = LoadString("STR_TIMEFMT");96 kInfoKind = LoadString("STR_KIND");97 kInfoPath = LoadString("STR_PATH");98 kOutdatedStr = LoadString("STR_OUTDATED");99 100 77 kWindowColor = ui_color(B_PANEL_BACKGROUND_COLOR); 101 kOutlineColor = LoadColor("RGB_PIE_OL");102 kPieBGColor = LoadColor("RGB_PIE_BG");103 kEmptySpcColor = LoadColor("RGB_PIE_MT");78 kOutlineColor = RGB_PIE_OL; 79 kPieBGColor = RGB_PIE_BG; 80 kEmptySpcColor = RGB_PIE_MT; 104 81 105 kBasePieColorCount = LoadUint8("N_PIE_COLORS");82 kBasePieColorCount = N_PIE_COLORS; 106 83 kBasePieColor = new rgb_color[kBasePieColorCount]; 107 84 for (int i = 0; i < kBasePieColorCount; i++) { 108 char colorName[16] = "RGB_PIE_n"; 109 colorName[8] = '1' + i; 110 kBasePieColor[i] = LoadColor(colorName); 85 switch (i) { 86 case 0: 87 kBasePieColor[i] = RGB_PIE_1; 88 break; 89 case 1: 90 kBasePieColor[i] = RGB_PIE_2; 91 break; 92 case 2: 93 kBasePieColor[i] = RGB_PIE_3; 94 break; 95 case 3: 96 kBasePieColor[i] = RGB_PIE_4; 97 break; 98 default: 99 break; 100 } 111 101 } 112 102 113 103 // Get a reference to the help file. … … 133 123 float divisor; 134 124 const char* format; 135 125 } scale[] = { 136 { 0x100000, 1024.0, "%.2f KiB" }, 137 { 0x40000000, 1048576.0, "%.2f MiB" }, 138 { 0x10000000000ull, 1073741824.0, "%.2f GiB" }, 139 { 0x4000000000000ull, 1.09951162778e+12, "%.2f TiB" } 126 { 0x100000, 1024.0, 127 B_TRANSLATE("%.2f KiB") }, 128 { 0x40000000, 1048576.0, 129 B_TRANSLATE("%.2f MiB") }, 130 { 0x10000000000ull, 1073741824.0, 131 B_TRANSLATE("%.2f GiB") }, 132 { 0x4000000000000ull, 1.09951162778e+12, 133 B_TRANSLATE("%.2f TiB") } 140 134 }; 141 135 142 136 if (byteCount < 1024) { 143 sprintf(name, "%lld bytes", byteCount);137 sprintf(name, B_TRANSLATE("%lld bytes"), byteCount); 144 138 } else { 145 139 int i = 0; 146 140 while (byteCount >= scale[i].limit) -
src/apps/diskusage/Scanner.cpp
13 13 #include <stdlib.h> 14 14 #include <string.h> 15 15 16 #include <Catalog.h> 16 17 #include <Directory.h> 17 18 #include <PathMonitor.h> 18 19 19 20 #include "Common.h" 20 21 22 #undef B_TRANSLATE_CONTEXT 23 #define B_TRANSLATE_CONTEXT "Scanner" 24 21 25 using std::vector; 22 26 23 27 … … 63 67 case kScanRefresh: 64 68 { 65 69 FileInfo* startInfo; 66 if (message->FindPointer(kNameFilePtr, (void **)&startInfo) == B_OK) 70 if (message->FindPointer(kNameFilePtr, (void **)&startInfo) 71 == B_OK) 67 72 _RunScan(startInfo); 68 73 break; 69 74 } … … 200 205 void 201 206 Scanner::_RunScan(FileInfo* startInfo) 202 207 { 208 BString sScan(B_TRANSLATE("Scanning")); 209 sScan << " "; 210 const char* kStrScanningX = sScan.String(); 211 203 212 if (startInfo == NULL || startInfo == fSnapshot->rootDir) { 204 213 delete fSnapshot; 205 214 fSnapshot = new VolumeSnapshot(fVolume); … … 215 224 216 225 FileInfo* freeSpace = new FileInfo; 217 226 freeSpace->pseudo = true; 218 string s = "Free on "+ fSnapshot->name;227 string s = B_TRANSLATE("Free on ") + fSnapshot->name; 219 228 freeSpace->ref.set_name(s.c_str()); 220 229 freeSpace->size = fSnapshot->freeBytes; 221 230 fSnapshot->freeSpace = freeSpace; … … 227 236 fSnapshot->freeBytes = fVolume->FreeBytes(); 228 237 fTask = kStrScanningX + string(startInfo->ref.name); 229 238 fVolumeBytesInUse = fSnapshot->capacity - fSnapshot->freeBytes; 230 fVolumeBytesScanned = fVolumeBytesInUse - startInfo->size; // 239 fVolumeBytesScanned = fVolumeBytesInUse - startInfo->size; //best guess 231 240 fProgress = 100.0 * fVolumeBytesScanned / fVolumeBytesInUse; 232 241 fLastReport = -100.0; 233 242 -
src/apps/diskusage/Common.h
9 9 #ifndef COMMON_H 10 10 #define COMMON_H 11 11 12 13 12 #include <Entry.h> 14 13 #include <GraphicsDefs.h> 15 14 #include <Resources.h> 16 15 #include <Roster.h> 17 16 18 17 18 const rgb_color RGB_WIN = { 0xDE, 0xDB, 0xDE, 0xFF }; 19 const rgb_color RGB_PIE_OL = { 0x80, 0x80, 0x80, 0xFF }; 20 const rgb_color RGB_PIE_BG = { 0xFF, 0xFF, 0xFF, 0xFF }; 21 const rgb_color RGB_PIE_MT = { 0xA0, 0xA0, 0xA0, 0xFF }; 22 const rgb_color RGB_PIE_1 = { 0x00, 0x60, 0x60, 0xFF }; 23 const rgb_color RGB_PIE_2 = { 0x00, 0x00, 0x68, 0xFF }; 24 const rgb_color RGB_PIE_3 = { 0x60, 0x00, 0x60, 0xFF }; 25 const rgb_color RGB_PIE_4 = { 0x68, 0x00, 0x00, 0xFF }; 26 27 #define N_PIE_COLORS ((uint8)4) 28 19 29 #ifdef ASSIGN_RESOURCES 20 30 # define EXTERN 21 31 # define EQ(x) … … 26 36 27 37 #define EXTERN_CONST extern const 28 38 29 30 39 // Resources 31 EXTERN char* kStrScan;32 EXTERN char* kStrRescan;33 EXTERN char* kOutdatedStr;34 EXTERN char* kStrScanningX;35 EXTERN char* kStrUnavail;36 EXTERN char* kVolMenuLabel;37 EXTERN char* kVolMenuDefault;38 EXTERN char* kVolPrompt;39 EXTERN char* kOneFile;40 EXTERN char* kManyFiles;41 EXTERN char* kMenuGetInfo;42 EXTERN char* kMenuOpen;43 EXTERN char* kMenuOpenWith;44 EXTERN char* kMenuNoApps;45 EXTERN char* kInfoSize;46 EXTERN char* kInfoInFiles;47 EXTERN char* kInfoCreated;48 EXTERN char* kInfoModified;49 EXTERN char* kInfoTimeFmt;50 EXTERN char* kInfoKind;51 EXTERN char* kInfoPath;52 53 40 EXTERN rgb_color kWindowColor; 54 41 EXTERN rgb_color kOutlineColor; 55 42 EXTERN rgb_color kPieBGColor; … … 104 91 void size_to_string(off_t byteCount, char* name); 105 92 106 93 94 107 95 #endif // COMMON_H