notification_server: Use automatic percent formatting
This uses automatic percent formatting for the BStatusBar progress text, instead of appending the sign manually. Change-Id: I435220dd774822b60e376972a0f379a0e2b7359e Reviewed-on: https://review.haiku-os.org/c/haiku/+/7375 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
3e8df064cd
commit
fce034d2ce
@ -25,6 +25,7 @@
|
||||
#include <MessageRunner.h>
|
||||
#include <Messenger.h>
|
||||
#include <Notification.h>
|
||||
#include <NumberFormat.h>
|
||||
#include <Path.h>
|
||||
#include <PropertyInfo.h>
|
||||
#include <Roster.h>
|
||||
@ -95,10 +96,14 @@ NotificationView::NotificationView(BNotification* notification, bigtime_t timeou
|
||||
progress->SetMaxValue(1.0f);
|
||||
progress->Update(fNotification->Progress());
|
||||
|
||||
BString label = "";
|
||||
label << (int)(fNotification->Progress() * 100) << " %";
|
||||
progress->SetTrailingText(label);
|
||||
BNumberFormat numberFormat;
|
||||
BString label;
|
||||
double progressPercent = fNotification->Progress();
|
||||
|
||||
if (numberFormat.FormatPercent(label, progressPercent) != B_OK)
|
||||
label.SetToFormat("%d%%", (int)(progressPercent * 100));
|
||||
|
||||
progress->SetTrailingText(label.String());
|
||||
layout->AddView(progress);
|
||||
}
|
||||
// fall through.
|
||||
|
Loading…
x
Reference in New Issue
Block a user