| 1362 | static const CMuleColour crNextPending(255, 255, 100); |
| 1363 | |
| 1364 | void CGenericClientListCtrl::DrawSourceStatusBar( |
| 1365 | const CClientRef& source, wxDC* dc, const wxRect& rect, bool bFlat) const |
| 1366 | { |
| 1367 | static CBarShader s_StatusBar(16); |
| 1368 | |
| 1369 | CPartFile* reqfile = source.GetRequestFile(); |
| 1370 | |
| 1371 | s_StatusBar.SetHeight(rect.height); |
| 1372 | s_StatusBar.SetWidth(rect.width); |
| 1373 | s_StatusBar.Set3dDepth( thePrefs::Get3DDepth() ); |
| 1374 | const BitVector& partStatus = source.GetPartStatus(); |
| 1375 | |
| 1376 | if (reqfile && reqfile->GetPartCount() == partStatus.size()) { |
| 1377 | s_StatusBar.SetFileSize(reqfile->GetFileSize()); |
| 1378 | uint16 lastDownloadingPart = source.GetDownloadState() == DS_DOWNLOADING |
| 1379 | ? source.GetLastDownloadingPart() : 0xffff; |
| 1380 | uint16 nextRequestedPart = source.GetNextRequestedPart(); |
| 1381 | |
| 1382 | for ( uint32 i = 0; i < partStatus.size(); i++ ) { |
| 1383 | uint64 uStart = PARTSIZE * i; |
| 1384 | uint64 uEnd = uStart + reqfile->GetPartSize(static_cast<uint16>(i)) - 1; |
| 1385 | |
| 1386 | CMuleColour colour; |
| 1387 | if (!partStatus.get(i)) { |
| 1388 | // client does not have this part |
| 1389 | // light grey |
| 1390 | colour = bFlat ? crFlatNeither : crNeither; |
| 1391 | } else if ( reqfile->IsComplete(static_cast<uint16>(i))) { |
| 1392 | // completed part |
| 1393 | // green |
| 1394 | colour = bFlat ? crFlatBoth : crBoth; |
| 1395 | } else if (lastDownloadingPart == static_cast<uint16>(i)) { |
| 1396 | // downloading part |
| 1397 | // yellow |
| 1398 | colour = crPending; |
| 1399 | } else if (nextRequestedPart == static_cast<uint16>(i)) { |
| 1400 | // requested part |
| 1401 | // light yellow |
| 1402 | colour = crNextPending; |
| 1403 | } else { |
| 1404 | // client has this part, we need it |
| 1405 | // black |
| 1406 | colour = bFlat ? crFlatClientOnly : crClientOnly; |
| 1407 | } |
| 1408 | |
| 1409 | if ( source.GetRequestFile()->IsStopped() ) { |
| 1410 | colour.Blend(50); |
| 1411 | } |
| 1412 | |
| 1413 | s_StatusBar.FillRange(uStart, uEnd, colour); |
| 1414 | } |
| 1415 | } else { |
| 1416 | s_StatusBar.SetFileSize(1); |
| 1417 | s_StatusBar.FillRange(0, 1, bFlat ? crFlatNeither : crNeither); |
| 1418 | } |
| 1419 | |
| 1420 | s_StatusBar.Draw(dc, rect.x, rect.y, bFlat); |
| 1421 | } |
nothing calls this directly
no test coverage detected