bootman: add the drive's icon in the drive list
* Also check status of GetIcon() * Delete fDrive, fIcon in destructor Fixes #7088 Signed-off-by: Jessica Hamilton <[email protected]>
This commit is contained in:
committed by
Jessica Hamilton
parent
c8990b0907
commit
73309d564f
@@ -15,6 +15,7 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <TextView.h>
|
#include <TextView.h>
|
||||||
|
#include <Bitmap.h>
|
||||||
|
|
||||||
#include <StringForSize.h>
|
#include <StringForSize.h>
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BootDrive* fDrive;
|
BootDrive* fDrive;
|
||||||
|
BBitmap* fIcon;
|
||||||
BString fName;
|
BString fName;
|
||||||
BPath fPath;
|
BPath fPath;
|
||||||
BString fSize;
|
BString fSize;
|
||||||
@@ -73,6 +75,11 @@ DriveItem::DriveItem(const BDiskDevice& device, const BootMenuList& menus)
|
|||||||
else
|
else
|
||||||
fName = B_TRANSLATE_COMMENT("Hard Drive", "Default disk name");
|
fName = B_TRANSLATE_COMMENT("Hard Drive", "Default disk name");
|
||||||
|
|
||||||
|
fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1),
|
||||||
|
B_RGBA32);
|
||||||
|
if (device.GetIcon(fIcon, B_LARGE_ICON) != B_OK)
|
||||||
|
memset(fIcon->Bits(), 0, fIcon->BitsLength());
|
||||||
|
|
||||||
fDrive = new BootDrive(fPath.Path());
|
fDrive = new BootDrive(fPath.Path());
|
||||||
|
|
||||||
fIsInstalled = fDrive->InstalledMenu(menus) != NULL;
|
fIsInstalled = fDrive->InstalledMenu(menus) != NULL;
|
||||||
@@ -85,6 +92,8 @@ DriveItem::DriveItem(const BDiskDevice& device, const BootMenuList& menus)
|
|||||||
|
|
||||||
DriveItem::~DriveItem()
|
DriveItem::~DriveItem()
|
||||||
{
|
{
|
||||||
|
delete fDrive;
|
||||||
|
delete fIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -113,7 +122,7 @@ void
|
|||||||
DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||||
{
|
{
|
||||||
owner->PushState();
|
owner->PushState();
|
||||||
|
owner->SetDrawingMode(B_OP_ALPHA);
|
||||||
if (IsSelected() || complete) {
|
if (IsSelected() || complete) {
|
||||||
if (IsSelected()) {
|
if (IsSelected()) {
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_2_TINT));
|
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_2_TINT));
|
||||||
@@ -131,8 +140,12 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
|||||||
else
|
else
|
||||||
owner->SetHighColor(black);
|
owner->SetHighColor(black);
|
||||||
|
|
||||||
|
// icon
|
||||||
|
owner->MovePenTo(frame.left + 4, frame.top + 1);
|
||||||
|
owner->DrawBitmap(fIcon);
|
||||||
|
|
||||||
// device
|
// device
|
||||||
owner->MovePenTo(frame.left + 4, frame.top + fSecondBaselineOffset);
|
owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fSecondBaselineOffset);
|
||||||
owner->DrawString(fPath.Path());
|
owner->DrawString(fPath.Path());
|
||||||
|
|
||||||
// size
|
// size
|
||||||
@@ -145,7 +158,7 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
|||||||
boldFont.SetFace(B_BOLD_FACE);
|
boldFont.SetFace(B_BOLD_FACE);
|
||||||
owner->SetFont(&boldFont);
|
owner->SetFont(&boldFont);
|
||||||
|
|
||||||
owner->MovePenTo(frame.left + 4, frame.top + fBaselineOffset);
|
owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fBaselineOffset);
|
||||||
owner->DrawString(fName.String());
|
owner->DrawString(fName.String());
|
||||||
|
|
||||||
if (fCanBeInstalled != B_OK) {
|
if (fCanBeInstalled != B_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user