[haiku-commits] Re: haiku: hrev47869 - src/apps/bootmanager

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 18 Sep 2014 10:36:43 +0200

Am 18.09.2014 05:53, schrieb jessica.l.hamilton@xxxxxxxxx:
hrev47869 adds 1 changeset to branch 'master'
old head: c8990b0907d8dcf5f282e8c23a58d7466dbc25cc
new head: 73309d564f6e50159c2051eded8e466946e494eb
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=73309d5+%5Ec8990b0

----------------------------------------------------------------------------

73309d5: 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 <jessica.l.hamilton@xxxxxxxxx>

                                     [ Julien Lepiller <julien@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47869
Commit:      73309d564f6e50159c2051eded8e466946e494eb
URL:         http://cgit.haiku-os.org/haiku/commit/?id=73309d5
Author:      Julien Lepiller <julien@xxxxxxxxxxx>
Date:        Thu Sep 18 03:44:22 2014 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Thu Sep 18 03:50:18 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/7088

----------------------------------------------------------------------------

1 file changed, 16 insertions(+), 3 deletions(-)
src/apps/bootmanager/DrivesPage.cpp | 19 ++++++++++++++++---

----------------------------------------------------------------------------

diff --git a/src/apps/bootmanager/DrivesPage.cpp 
b/src/apps/bootmanager/DrivesPage.cpp
index d96dc33..8c1c204 100644
--- a/src/apps/bootmanager/DrivesPage.cpp
+++ b/src/apps/bootmanager/DrivesPage.cpp
@@ -15,6 +15,7 @@
  #include <Path.h>
  #include <ScrollView.h>
  #include <TextView.h>
+#include <Bitmap.h>

Those should be ordered alphabetically.

+       fIcon = new BBitmap(BRect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1),
+               B_RGBA32);

The bitmap might be invalid if the allocation failed.

+       if (device.GetIcon(fIcon, B_LARGE_ICON) != B_OK)
+               memset(fIcon->Bits(), 0, fIcon->BitsLength());

Why present a black box in this case? I would find it much nicer to do it this way:

if (!fIcon.IsValid()
        || device.GetIcon(fIcon, B_LARGE_ICON) != B_OK) {
        delete fIcon;
        fIcon = NULL;
}

+       // icon
+       owner->MovePenTo(frame.left + 4, frame.top + 1);
+       owner->DrawBitmap(fIcon);

Of course, that one would have to be protected with if (fIcon != NULL) then.

+
        // device
-       owner->MovePenTo(frame.left + 4, frame.top + fSecondBaselineOffset);
+       owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + 
fSecondBaselineOffset);
        owner->DrawString(fPath.Path());

        // size
@@ -145,7 +158,7 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool 
complete)
        boldFont.SetFace(B_BOLD_FACE);
        owner->SetFont(&boldFont);

-       owner->MovePenTo(frame.left + 4, frame.top + fBaselineOffset);
+       owner->MovePenTo(frame.left + 8 + fIcon->Bounds().Width(), frame.top + 
fBaselineOffset);

Same here

Bye,
   Axel.

Other related posts: