From d4d5bf6c50e67ebc57430df8dc1fec2b2b682c8b Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 13 Nov 2012 01:37:30 -0500 Subject: [PATCH] Update PowerStatus about window --- src/apps/powerstatus/Jamfile | 2 +- src/apps/powerstatus/PowerStatusView.cpp | 39 +++++++++++++----------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/apps/powerstatus/Jamfile b/src/apps/powerstatus/Jamfile index 6ce508e3ab..59d8d7a82d 100644 --- a/src/apps/powerstatus/Jamfile +++ b/src/apps/powerstatus/Jamfile @@ -13,7 +13,7 @@ Application PowerStatus : PowerStatusWindow.cpp PowerStatusView.cpp PowerStatus.cpp - : be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) + : be libshared.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS) : PowerStatus.rdef ; DoCatalogs PowerStatus : diff --git a/src/apps/powerstatus/PowerStatusView.cpp b/src/apps/powerstatus/PowerStatusView.cpp index 726747a775..be86d1aebf 100644 --- a/src/apps/powerstatus/PowerStatusView.cpp +++ b/src/apps/powerstatus/PowerStatusView.cpp @@ -96,6 +96,8 @@ PowerStatusView::_Init() { SetViewColor(B_TRANSPARENT_COLOR); + fAboutWindow = NULL; + fShowLabel = true; fShowTime = false; fShowStatusIcon = true; @@ -503,14 +505,16 @@ PowerStatusReplicant::PowerStatusReplicant(BMessage* archive) PowerStatusReplicant::~PowerStatusReplicant() { - if (fMessengerExist) { + if (fMessengerExist) delete fExtWindowMessenger; - } fDriverInterface->StopWatching(this); fDriverInterface->Disconnect(); fDriverInterface->ReleaseReference(); + if (fAboutWindow != NULL) + fAboutWindow->Quit(); + _SaveSettings(); } @@ -621,22 +625,23 @@ PowerStatusReplicant::MouseDown(BPoint point) void PowerStatusReplicant::_AboutRequested() { - BAlert* alert = new BAlert(B_TRANSLATE("About"), - B_TRANSLATE("PowerStatus\n" - "written by Axel Dörfler, Clemens Zeidler\n" - "Copyright 2006, Haiku, Inc.\n"), B_TRANSLATE("OK")); - BTextView *view = alert->TextView(); - BFont font; + if (fAboutWindow == NULL) { + const char* authors[] = { + "Axel Dörfler", + "Alexander von Gluck", + "Clemens Zeidler", + NULL + }; - view->SetStylable(true); - - view->GetFont(&font); - font.SetSize(18); - font.SetFace(B_BOLD_FACE); - view->SetFontAndColor(0, strlen(B_TRANSLATE("PowerStatus")), &font); - - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - alert->Go(); + fAboutWindow = new BAboutWindow( + B_TRANSLATE_SYSTEM_NAME("PowerStatus"), kSignature); + fAboutWindow->AddCopyright(2006, "Haiku, Inc."); + fAboutWindow->AddAuthors(authors); + fAboutWindow->Show(); + } else if (fAboutWindow->IsHidden()) + fAboutWindow->Show(); + else + fAboutWindow->Activate(); }