From e2b356bf228fb0b589677e59776fa8066971d720 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Wed, 23 Apr 2014 00:16:06 +0200
Subject: [PATCH] =?UTF-8?q?add=20the=20drive=E2=80=99s=20icon=20in=20front?=
=?UTF-8?q?=20of=20its=20name=20in=20drive=20list?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apps/bootmanager/DrivesPage.cpp | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/apps/bootmanager/DrivesPage.cpp b/src/apps/bootmanager/DrivesPage.cpp
index d96dc33..e98ce2d 100644
a
|
b
|
|
15 | 15 | #include <Path.h> |
16 | 16 | #include <ScrollView.h> |
17 | 17 | #include <TextView.h> |
| 18 | #include <Bitmap.h> |
18 | 19 | |
19 | 20 | #include <StringForSize.h> |
20 | 21 | |
… |
… |
protected:
|
49 | 50 | |
50 | 51 | private: |
51 | 52 | BootDrive* fDrive; |
| 53 | BBitmap* fIcon; |
52 | 54 | BString fName; |
53 | 55 | BPath fPath; |
54 | 56 | BString fSize; |
… |
… |
DriveItem::DriveItem(const BDiskDevice& device, const BootMenuList& menus)
|
73 | 75 | else |
74 | 76 | fName = B_TRANSLATE_COMMENT("Hard Drive", "Default disk name"); |
75 | 77 | |
| 78 | fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1), |
| 79 | B_RGBA32); |
| 80 | device.GetIcon(fIcon, B_LARGE_ICON); |
| 81 | |
76 | 82 | fDrive = new BootDrive(fPath.Path()); |
77 | 83 | |
78 | 84 | fIsInstalled = fDrive->InstalledMenu(menus) != NULL; |
… |
… |
void
|
113 | 119 | DriveItem::DrawItem(BView* owner, BRect frame, bool complete) |
114 | 120 | { |
115 | 121 | owner->PushState(); |
116 | | |
| 122 | owner->SetDrawingMode(B_OP_ALPHA); |
117 | 123 | if (IsSelected() || complete) { |
118 | 124 | if (IsSelected()) { |
119 | 125 | owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_2_TINT)); |
… |
… |
DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
130 | 136 | owner->SetHighColor(tint_color(black, B_LIGHTEN_2_TINT)); |
131 | 137 | else |
132 | 138 | owner->SetHighColor(black); |
| 139 | |
| 140 | // icon |
| 141 | owner->MovePenTo(frame.left + 4, frame.top + 1); |
| 142 | owner->DrawBitmap(fIcon); |
133 | 143 | |
134 | 144 | // device |
135 | | owner->MovePenTo(frame.left + 4, frame.top + fSecondBaselineOffset); |
| 145 | owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fSecondBaselineOffset); |
136 | 146 | owner->DrawString(fPath.Path()); |
137 | 147 | |
138 | 148 | // size |
… |
… |
DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
|
145 | 155 | boldFont.SetFace(B_BOLD_FACE); |
146 | 156 | owner->SetFont(&boldFont); |
147 | 157 | |
148 | | owner->MovePenTo(frame.left + 4, frame.top + fBaselineOffset); |
| 158 | owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + fBaselineOffset); |
149 | 159 | owner->DrawString(fName.String()); |
150 | 160 | |
151 | 161 | if (fCanBeInstalled != B_OK) { |