Fixed a bug that always report one processor even on SMP machine.
Colorized with Haiku theme the credits text, tell me what you think... Enhanced the uptime text construction. Added some resizable support, but I failed to see why the textview don't adjust, so it's still disable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13354 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -51,6 +51,7 @@ class AboutView : public BView {
|
|||||||
~AboutView(void);
|
~AboutView(void);
|
||||||
void AttachedToWindow(void);
|
void AttachedToWindow(void);
|
||||||
void Pulse(void);
|
void Pulse(void);
|
||||||
|
void FrameResized(float width, float height);
|
||||||
void Draw(BRect update);
|
void Draw(BRect update);
|
||||||
void MessageReceived(BMessage *msg);
|
void MessageReceived(BMessage *msg);
|
||||||
void MouseDown(BPoint pt);
|
void MouseDown(BPoint pt);
|
||||||
@@ -127,7 +128,7 @@ AboutView::AboutView(const BRect &r)
|
|||||||
if (fLogo)
|
if (fLogo)
|
||||||
r.OffsetBy(0, fLogo->Bounds().Height());
|
r.OffsetBy(0, fLogo->Bounds().Height());
|
||||||
|
|
||||||
fInfoView = new BView(r, "infoview", B_FOLLOW_NONE, B_WILL_DRAW);
|
fInfoView = new BView(r, "infoview", B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW);
|
||||||
fInfoView->SetViewColor(235, 235, 235);
|
fInfoView->SetViewColor(235, 235, 235);
|
||||||
AddChild(fInfoView);
|
AddChild(fInfoView);
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ AboutView::AboutView(const BRect &r)
|
|||||||
else
|
else
|
||||||
strcpy(string, "Processor:");
|
strcpy(string, "Processor:");
|
||||||
|
|
||||||
stringView = new BStringView(r, "cpulabel", "Processor:");
|
stringView = new BStringView(r, "cpulabel", string);
|
||||||
stringView->SetFont(be_bold_font);
|
stringView->SetFont(be_bold_font);
|
||||||
fInfoView->AddChild(stringView);
|
fInfoView->AddChild(stringView);
|
||||||
|
|
||||||
@@ -186,7 +187,7 @@ AboutView::AboutView(const BRect &r)
|
|||||||
r.bottom = r.top + textHeight;
|
r.bottom = r.top + textHeight;
|
||||||
|
|
||||||
if (systemInfo.cpu_clock_speed < 1000000000)
|
if (systemInfo.cpu_clock_speed < 1000000000)
|
||||||
sprintf(string,"%.2f Mhz", systemInfo.cpu_clock_speed / 1000000.0f);
|
sprintf(string,"%d Mhz", int(systemInfo.cpu_clock_speed / 1000000.0f));
|
||||||
else
|
else
|
||||||
sprintf(string,"%.2f Ghz", systemInfo.cpu_clock_speed / 1000000000.0f);
|
sprintf(string,"%.2f Ghz", systemInfo.cpu_clock_speed / 1000000000.0f);
|
||||||
|
|
||||||
@@ -245,30 +246,38 @@ AboutView::AboutView(const BRect &r)
|
|||||||
r.right -= B_V_SCROLL_BAR_WIDTH;
|
r.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
|
|
||||||
fCreditsView = new BTextView(r, "credits",
|
fCreditsView = new BTextView(r, "credits",
|
||||||
r.OffsetToCopy(0, 0).InsetByCopy(5, 5), B_FOLLOW_NONE);
|
r.OffsetToCopy(0, 0).InsetByCopy(5, 5), B_FOLLOW_ALL);
|
||||||
BScrollView *creditsScroller = new BScrollView("creditsScroller",
|
fCreditsView->SetFlags(fCreditsView->Flags() | B_FRAME_EVENTS );
|
||||||
fCreditsView, 0, 0, false, true, B_PLAIN_BORDER);
|
|
||||||
AddChild(creditsScroller);
|
|
||||||
|
|
||||||
fCreditsView->SetStylable(true);
|
fCreditsView->SetStylable(true);
|
||||||
fCreditsView->MakeEditable(false);
|
fCreditsView->MakeEditable(false);
|
||||||
|
fCreditsView->SetWordWrap(true);
|
||||||
|
|
||||||
|
BScrollView *creditsScroller = new BScrollView("creditsScroller",
|
||||||
|
fCreditsView, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, false, true, B_PLAIN_BORDER);
|
||||||
|
AddChild(creditsScroller);
|
||||||
|
|
||||||
|
|
||||||
|
rgb_color darkgrey = { 100, 100, 100, 255 };
|
||||||
|
rgb_color haiku_green = { 42, 131, 36, 255 };
|
||||||
|
rgb_color haiku_orange = { 255, 69, 0, 255 };
|
||||||
|
rgb_color haiku_yellow = { 255, 176, 0, 255 };
|
||||||
|
|
||||||
BFont font(be_bold_font);
|
BFont font(be_bold_font);
|
||||||
font.SetSize(font.Size() + 2);
|
font.SetSize(font.Size() + 4);
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_green);
|
||||||
fCreditsView->Insert("Haiku\n");
|
fCreditsView->Insert("Haiku\n");
|
||||||
|
|
||||||
font.SetSize(be_bold_font->Size() + 1);
|
font.SetSize(be_bold_font->Size());
|
||||||
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
|
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert("Copyright " B_UTF8_COPYRIGHT "2001-2005 Haiku, Inc.\n\n");
|
fCreditsView->Insert("Copyright " B_UTF8_COPYRIGHT "2001-2005 Haiku, Inc.\n\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_orange);
|
||||||
fCreditsView->Insert("Team Leads:\n");
|
fCreditsView->Insert("Team Leads:\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Bruno G. Albuquerque\n"
|
"Bruno G. Albuquerque\n"
|
||||||
"DarkWyrm\n"
|
"DarkWyrm\n"
|
||||||
@@ -282,10 +291,10 @@ AboutView::AboutView(const BRect &r)
|
|||||||
"Michael Wilber\n"
|
"Michael Wilber\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_orange);
|
||||||
fCreditsView->Insert("Developers:\n");
|
fCreditsView->Insert("Developers:\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Stephan Aßmus\n"
|
"Stephan Aßmus\n"
|
||||||
"Andrew Bachmann\n"
|
"Andrew Bachmann\n"
|
||||||
@@ -298,21 +307,21 @@ AboutView::AboutView(const BRect &r)
|
|||||||
"Niels Reedijk\n"
|
"Niels Reedijk\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_orange);
|
||||||
fCreditsView->Insert("Contributors:\n");
|
fCreditsView->Insert("Contributors:\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Bruce Cameron\n"
|
"Bruce Cameron\n"
|
||||||
"Tyler Dauwalder\n"
|
"Tyler Dauwalder\n"
|
||||||
"Oliver Ruiz Dorantes\n"
|
"Oliver Ruiz Dorantes\n"
|
||||||
"Cian Duffy\n"
|
"Cian Duffy\n"
|
||||||
"Marc Flerackers\n"
|
"Marc Flerackers\n"
|
||||||
"Daniel Furrer\n"
|
"Daniel Furrer\n"
|
||||||
"Erik Jaesler\n"
|
"Erik Jaesler\n"
|
||||||
"Marcin Konicki\n"
|
"Marcin Konicki\n"
|
||||||
"Elad Lahav\n"
|
"Elad Lahav\n"
|
||||||
"Santiago Lema\n"
|
"Santiago Lema\n"
|
||||||
"Oscar Lesta\n"
|
"Oscar Lesta\n"
|
||||||
"Jerome Leveque\n"
|
"Jerome Leveque\n"
|
||||||
"Michael Lotz\n"
|
"Michael Lotz\n"
|
||||||
@@ -328,7 +337,7 @@ AboutView::AboutView(const BRect &r)
|
|||||||
"Pahtz\n"
|
"Pahtz\n"
|
||||||
"Michael Phipps\n"
|
"Michael Phipps\n"
|
||||||
"Jeremy Rand\n"
|
"Jeremy Rand\n"
|
||||||
"David Reid"
|
"David Reid\n"
|
||||||
"Daniel Reinhold\n"
|
"Daniel Reinhold\n"
|
||||||
"François Revol\n"
|
"François Revol\n"
|
||||||
"Thomas Roell\n"
|
"Thomas Roell\n"
|
||||||
@@ -341,75 +350,67 @@ AboutView::AboutView(const BRect &r)
|
|||||||
"Nathan Whitehorn\n"
|
"Nathan Whitehorn\n"
|
||||||
"Ulrich Wimboeck\n"
|
"Ulrich Wimboeck\n"
|
||||||
"Gabe Yoder\n"
|
"Gabe Yoder\n"
|
||||||
//"(and probably some more we forgot to mention (sorry!)...)\n"
|
"\n" B_UTF8_ELLIPSIS " and probably some more we forgot to mention (sorry!)"
|
||||||
"\n");
|
"\n\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_orange);
|
||||||
fCreditsView->Insert("Special Thanks To:\n");
|
fCreditsView->Insert("Special Thanks To:\n");
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert("Michael Phipps (project founder)\n\n");
|
fCreditsView->Insert("Michael Phipps (project founder)\n\n");
|
||||||
|
|
||||||
font.SetSize(be_bold_font->Size() + 2);
|
font.SetSize(be_bold_font->Size() + 4);
|
||||||
font.SetFace(B_BOLD_FACE);
|
font.SetFace(B_BOLD_FACE);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_green);
|
||||||
fCreditsView->Insert("\nCopyrights\n\n");
|
fCreditsView->Insert("\nCopyrights\n\n");
|
||||||
|
|
||||||
font.SetSize(be_bold_font->Size()+1);
|
font.SetSize(be_bold_font->Size());
|
||||||
font.SetFace(B_ITALIC_FACE);
|
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
|
||||||
|
|
||||||
fCreditsView->SetFontAndColor(&font);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->Insert("AntiGrain Geometry\n");
|
fCreditsView->Insert("AntiGrain Geometry\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert("Copyright (C) 2002-2005 Maxim Shemanarev (McSeem)\n\n");
|
fCreditsView->Insert("Copyright (C) 2002-2005 Maxim Shemanarev (McSeem)\n\n");
|
||||||
|
|
||||||
font.SetFace(B_ITALIC_FACE);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
|
||||||
fCreditsView->Insert("PDFLib\n");
|
fCreditsView->Insert("PDFLib\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Copyright (c) 1997-2005 PDFlib GmbH and Thomas Merz. "
|
"Copyright (c) 1997-2005 PDFlib GmbH and Thomas Merz. "
|
||||||
"All rights reserved.\n"
|
"All rights reserved.\n"
|
||||||
"PDFlib and the PDFlib logo are registered trademarks of PDFlib GmbH.\n\n");
|
"PDFlib and the PDFlib logo are registered trademarks of PDFlib GmbH.\n\n");
|
||||||
|
|
||||||
font.SetFace(B_ITALIC_FACE);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
|
||||||
fCreditsView->Insert("FreeType2\n");
|
fCreditsView->Insert("FreeType2\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert("Portions of this software are copyright (C) 1996-2002 The FreeType"
|
fCreditsView->Insert("Portions of this software are copyright (C) 1996-2002 The FreeType"
|
||||||
" Project (www.freetype.org). All rights reserved.\n\n");
|
" Project (www.freetype.org). All rights reserved.\n\n");
|
||||||
|
|
||||||
// Mesa3D (http://www.mesa3d.org) copyrights
|
// Mesa3D (http://www.mesa3d.org) copyrights
|
||||||
font.SetFace(B_ITALIC_FACE);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
|
||||||
fCreditsView->Insert("Mesa\n");
|
fCreditsView->Insert("Mesa\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Copyright (c) 1999-2005 Brian Paul. "
|
"Copyright (c) 1999-2005 Brian Paul. "
|
||||||
"All rights reserved.\n\n");
|
"Mesa3D project (www.mesa3d.org). All rights reserved.\n\n");
|
||||||
|
|
||||||
// SGI's GLU implementation copyrights
|
// SGI's GLU implementation copyrights
|
||||||
font.SetFace(B_ITALIC_FACE);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
|
||||||
fCreditsView->Insert("GLU\n");
|
fCreditsView->Insert("GLU\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Copyright (c) 1991-2000 Silicon Graphics, Inc."
|
"Copyright (c) 1991-2000 Silicon Graphics, Inc. "
|
||||||
"All rights reserved.\n\n");
|
"SGI's Software FreeB license. All rights reserved.\n\n");
|
||||||
|
|
||||||
/*
|
|
||||||
// TODO: Add these (somehow)
|
|
||||||
Mark Kilgard & Be Inc. & Jam Hamby (GLUT)
|
|
||||||
|
|
||||||
// GLUT implementation copyrights
|
// GLUT implementation copyrights
|
||||||
font.SetFace(B_ITALIC_FACE);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &haiku_yellow);
|
||||||
fCreditsView->SetFontAndColor(&font);
|
|
||||||
fCreditsView->Insert("GLUT\n");
|
fCreditsView->Insert("GLUT\n");
|
||||||
fCreditsView->SetFontAndColor(be_plain_font);
|
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &darkgrey);
|
||||||
fCreditsView->Insert(
|
fCreditsView->Insert(
|
||||||
"Copyright (c) 1991-2000 Silicon Graphics, Inc."
|
"Copyright (c) 1994-1997 Mark Kilgard. "
|
||||||
"All rights reserved.\n"
|
"All rights reserved.\n"
|
||||||
*/
|
"Copyright (c) 1997 Be Inc.\n"
|
||||||
|
"Copyright (c) 1999 Jake Hamby. \n\n");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -435,6 +436,15 @@ AboutView::MouseDown(BPoint pt)
|
|||||||
printf("Easter Egg\n");
|
printf("Easter Egg\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AboutView::FrameResized(float width, float height)
|
||||||
|
{
|
||||||
|
BRect r = fCreditsView->Bounds();
|
||||||
|
r.OffsetTo(B_ORIGIN);
|
||||||
|
r.InsetBy(3, 3);
|
||||||
|
fCreditsView->SetTextRect(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AboutView::Draw(BRect update)
|
AboutView::Draw(BRect update)
|
||||||
@@ -475,39 +485,35 @@ UptimeToString(char string[], size_t size)
|
|||||||
int64 days, hours, minutes, seconds, remainder;
|
int64 days, hours, minutes, seconds, remainder;
|
||||||
int64 systime = system_time();
|
int64 systime = system_time();
|
||||||
|
|
||||||
if (systime > 86400000000LL) {
|
days = systime / 86400000000LL;
|
||||||
days = systime / 86400000000LL;
|
remainder = systime % 86400000000LL;
|
||||||
remainder = systime % 86400000000LL;
|
|
||||||
|
|
||||||
hours = remainder / 3600000000LL;
|
hours = remainder / 3600000000LL;
|
||||||
remainder = remainder % 3600000000LL;
|
remainder = remainder % 3600000000LL;
|
||||||
|
|
||||||
minutes = remainder / 60000000;
|
minutes = remainder / 60000000;
|
||||||
remainder = remainder % 60000000;
|
remainder = remainder % 60000000;
|
||||||
|
|
||||||
seconds = remainder / 1000000;
|
seconds = remainder / 1000000;
|
||||||
snprintf(string, size, "%lld days, %lld hours, %lld minutes, %lld seconds",
|
|
||||||
days, hours, minutes, seconds);
|
|
||||||
} else if (systime > 3600000000LL) {
|
|
||||||
hours = systime / 3600000000LL;
|
|
||||||
remainder = systime % 3600000000LL;
|
|
||||||
|
|
||||||
minutes = remainder / 60000000;
|
char *str = string;
|
||||||
remainder = remainder % 60000000;
|
if (days) {
|
||||||
|
str += snprintf(str, size, "%lld day%s",days, days > 1 ? "s" : "");
|
||||||
seconds = remainder / 1000000;
|
|
||||||
snprintf(string, size, "%lld hours, %lld minutes, %lld seconds",
|
|
||||||
hours, minutes, seconds);
|
|
||||||
} else if (systime > 60000000) {
|
|
||||||
minutes = systime / 60000000;
|
|
||||||
remainder = systime % 60000000;
|
|
||||||
|
|
||||||
seconds = remainder / 1000000;
|
|
||||||
snprintf(string, size, "%lld minutes, %lld seconds", minutes, seconds);
|
|
||||||
} else {
|
|
||||||
seconds = systime / 1000000;
|
|
||||||
snprintf(string, size, "%lld seconds", seconds);
|
|
||||||
}
|
}
|
||||||
|
if (hours) {
|
||||||
|
str += snprintf(str, size - strlen(string), "%s%lld hour%s",
|
||||||
|
str != string ? ", " : "",
|
||||||
|
hours, hours > 1 ? "s" : "");
|
||||||
|
}
|
||||||
|
if (minutes) {
|
||||||
|
str += snprintf(str, size - strlen(string), "%s%lld minute%s",
|
||||||
|
str != string ? ", " : "",
|
||||||
|
minutes, minutes > 1 ? "s" : "");
|
||||||
|
}
|
||||||
|
// Always show second(s)...
|
||||||
|
str += snprintf(str, size - strlen(string), "%s%lld second%s",
|
||||||
|
str != string ? ", " : "",
|
||||||
|
seconds, seconds > 1 ? "s" : "");
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user