git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34724 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-12-20 16:10:17 +00:00
parent 613cdfa696
commit 3212667705
+20 -19
View File
@@ -7,6 +7,7 @@
* René Gollent * René Gollent
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <sys/utsname.h> #include <sys/utsname.h>
@@ -56,9 +57,9 @@
#define SCROLL_CREDITS_VIEW 'mviv' #define SCROLL_CREDITS_VIEW 'mviv'
static const char *UptimeToString(char string[], size_t size); static const char* UptimeToString(char string[], size_t size);
static const char *MemUsageToString(char string[], size_t size, static const char* MemUsageToString(char string[], size_t size,
system_info *info); system_info* info);
static const rgb_color kDarkGrey = { 100, 100, 100, 255 }; static const rgb_color kDarkGrey = { 100, 100, 100, 255 };
static const rgb_color kHaikuGreen = { 42, 131, 36, 255 }; static const rgb_color kHaikuGreen = { 42, 131, 36, 255 };
@@ -508,12 +509,12 @@ AboutView::Pulse()
void void
AboutView::MessageReceived(BMessage *msg) AboutView::MessageReceived(BMessage* msg)
{ {
switch (msg->what) { switch (msg->what) {
case SCROLL_CREDITS_VIEW: case SCROLL_CREDITS_VIEW:
{ {
BScrollBar *scrollBar = fCreditsView->ScrollBar(B_VERTICAL); BScrollBar* scrollBar = fCreditsView->ScrollBar(B_VERTICAL);
if (scrollBar == NULL) if (scrollBar == NULL)
break; break;
float max, min; float max, min;
@@ -532,16 +533,16 @@ AboutView::MessageReceived(BMessage *msg)
void void
AboutView::AddCopyrightEntry(const char *name, const char *text, AboutView::AddCopyrightEntry(const char* name, const char* text,
const char *url) const char* url)
{ {
AddCopyrightEntry(name, text, StringVector(), url); AddCopyrightEntry(name, text, StringVector(), url);
} }
void void
AboutView::AddCopyrightEntry(const char *name, const char *text, AboutView::AddCopyrightEntry(const char* name, const char* text,
const StringVector& licenses, const char *url) const StringVector& licenses, const char* url)
{ {
BFont font(be_bold_font); BFont font(be_bold_font);
//font.SetSize(be_bold_font->Size()); //font.SetSize(be_bold_font->Size());
@@ -609,16 +610,16 @@ AboutView::PickRandomHaiku()
return; return;
if (fortunes.GetStat(&st) < B_OK) if (fortunes.GetStat(&st) < B_OK)
return; return;
char *buff = (char *)malloc((size_t)st.st_size + 1); char* buff = (char*)malloc((size_t)st.st_size + 1);
if (!buff) if (!buff)
return; return;
buff[(size_t)st.st_size] = '\0'; buff[(size_t)st.st_size] = '\0';
BList haikuList; BList haikuList;
if (fortunes.Read(buff, (size_t)st.st_size) == (ssize_t)st.st_size) { if (fortunes.Read(buff, (size_t)st.st_size) == (ssize_t)st.st_size) {
char *p = buff; char* p = buff;
while (p && *p) { while (p && *p) {
char *e = strchr(p, '%'); char* e = strchr(p, '%');
BString *s = new BString(p, e ? (e - p) : -1); BString* s = new BString(p, e ? (e - p) : -1);
haikuList.AddItem(s); haikuList.AddItem(s);
p = e; p = e;
if (p && (*p == '%')) if (p && (*p == '%'))
@@ -630,7 +631,7 @@ AboutView::PickRandomHaiku()
free(buff); free(buff);
if (haikuList.CountItems() < 1) if (haikuList.CountItems() < 1)
return; return;
BString *s = (BString *)haikuList.ItemAt(rand() % haikuList.CountItems()); BString* s = (BString*)haikuList.ItemAt(rand() % haikuList.CountItems());
BFont font(be_bold_font); BFont font(be_bold_font);
font.SetSize(be_bold_font->Size()); font.SetSize(be_bold_font->Size());
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE); font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
@@ -639,7 +640,7 @@ AboutView::PickRandomHaiku()
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kDarkGrey); fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert(s->String()); fCreditsView->Insert(s->String());
fCreditsView->Insert("\n"); fCreditsView->Insert("\n");
while ((s = (BString *)haikuList.RemoveItem((int32)0))) { while ((s = (BString*)haikuList.RemoveItem((int32)0))) {
delete s; delete s;
} }
} }
@@ -1423,8 +1424,8 @@ AboutView::_AddPackageCredit(const PackageCredit& package)
// #pragma mark - // #pragma mark -
static const char * static const char*
MemUsageToString(char string[], size_t size, system_info *info) MemUsageToString(char string[], size_t size, system_info* info)
{ {
snprintf(string, size, "%d MB total, %d MB used (%d%%)", snprintf(string, size, "%d MB total, %d MB used (%d%%)",
int(info->max_pages / 256.0f + 0.5f), int(info->max_pages / 256.0f + 0.5f),
@@ -1435,7 +1436,7 @@ MemUsageToString(char string[], size_t size, system_info *info)
} }
static const char * static const char*
UptimeToString(char string[], size_t size) UptimeToString(char string[], size_t size)
{ {
int64 days, hours, minutes, seconds, remainder; int64 days, hours, minutes, seconds, remainder;
@@ -1452,7 +1453,7 @@ UptimeToString(char string[], size_t size)
seconds = remainder / 1000000; seconds = remainder / 1000000;
char *str = string; char* str = string;
if (days) { if (days) {
str += snprintf(str, size, "%lld day%s",days, days > 1 ? "s" : ""); str += snprintf(str, size, "%lld day%s",days, days > 1 ? "s" : "");
} }