Files
haiku-beta6/src/apps/aboutsystem/AboutSystem.cpp
T

1398 lines
34 KiB
C++
Raw Normal View History

2005-06-23 18:53:20 +00:00
/*
* Copyright (c) 2005-2009, Haiku, Inc.
2005-06-23 18:53:20 +00:00
* Distributed under the terms of the MIT license.
*
* Authors:
* DarkWyrm <[email protected]>
* René Gollent
2005-06-23 18:53:20 +00:00
*/
2005-06-24 01:48:44 +00:00
#include <ctype.h>
#include <stdio.h>
#include <sys/utsname.h>
#include <time.h>
2008-10-30 19:41:43 +00:00
#include <unistd.h>
2005-06-24 01:48:44 +00:00
#include <map>
#include <string>
2005-06-23 18:53:20 +00:00
#include <AppFileInfo.h>
#include <Application.h>
#include <Bitmap.h>
#include <File.h>
2005-07-09 20:50:44 +00:00
#include <FindDirectory.h>
2005-06-23 18:53:20 +00:00
#include <Font.h>
#include <fs_attr.h>
#include <LayoutBuilder.h>
2005-06-23 18:53:20 +00:00
#include <MessageRunner.h>
#include <Messenger.h>
#include <OS.h>
2005-07-09 20:50:44 +00:00
#include <Path.h>
#include <Resources.h>
2005-06-23 18:53:20 +00:00
#include <Screen.h>
#include <ScrollView.h>
#include <String.h>
#include <StringView.h>
2005-06-23 18:53:20 +00:00
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
2005-06-23 18:53:20 +00:00
#include <View.h>
#include <Volume.h>
#include <VolumeRoster.h>
2005-06-23 18:53:20 +00:00
#include <Window.h>
#include <AppMisc.h>
#include <AutoDeleter.h>
2005-06-24 01:48:44 +00:00
#include <cpu_type.h>
#include "HyperTextActions.h"
#include "HyperTextView.h"
#include "Utilities.h"
2005-06-23 18:53:20 +00:00
2005-06-24 01:48:44 +00:00
2008-10-30 19:41:43 +00:00
#ifndef LINE_MAX
#define LINE_MAX 2048
#endif
2005-07-01 13:35:38 +00:00
#define SCROLL_CREDITS_VIEW 'mviv'
2005-06-23 18:53:20 +00:00
2005-06-24 01:48:44 +00:00
static const char *UptimeToString(char string[], size_t size);
2008-04-15 14:22:03 +00:00
static const char *MemUsageToString(char string[], size_t size,
system_info *info);
2005-06-23 18:53:20 +00:00
static const rgb_color kDarkGrey = { 100, 100, 100, 255 };
static const rgb_color kHaikuGreen = { 42, 131, 36, 255 };
static const rgb_color kHaikuOrange = { 255, 69, 0, 255 };
static const rgb_color kHaikuYellow = { 255, 176, 0, 255 };
static const rgb_color kLinkBlue = { 80, 80, 200, 255 };
2005-06-24 01:48:44 +00:00
class AboutApp : public BApplication {
public:
AboutApp();
2005-06-23 18:53:20 +00:00
};
2005-06-24 01:48:44 +00:00
class AboutWindow : public BWindow {
public:
AboutWindow();
virtual bool QuitRequested();
2005-06-23 18:53:20 +00:00
};
class LogoView : public BView {
public:
LogoView();
virtual ~LogoView();
virtual BSize MinSize();
virtual BSize MaxSize();
virtual void Draw(BRect updateRect);
private:
BBitmap* fLogo;
};
class CropView : public BView {
public:
CropView(BView* target, int32 left, int32 top,
int32 right, int32 bottom);
virtual ~CropView();
2005-06-24 01:48:44 +00:00
virtual BSize MinSize();
virtual BSize MaxSize();
virtual void DoLayout();
private:
BView* fTarget;
int32 fCropLeft;
int32 fCropTop;
int32 fCropRight;
int32 fCropBottom;
};
class AboutView : public BView {
public:
AboutView();
~AboutView();
virtual void AttachedToWindow();
virtual void Pulse();
virtual void MessageReceived(BMessage* msg);
virtual void MouseDown(BPoint point);
void AddCopyrightEntry(const char* name,
const char* text,
const StringVector& licenses,
const char* url);
void AddCopyrightEntry(const char* name,
const char* text, const char* url = NULL);
void PickRandomHaiku();
private:
typedef std::map<std::string, PackageCredit*> PackageCreditMap;
private:
BView* _CreateLabel(const char* name, const char* label);
BView* _CreateCreditsView();
status_t _GetLicensePath(const char* license,
BPath& path);
void _AddCopyrightsFromAttribute();
void _AddPackageCredit(const PackageCredit& package);
void _AddPackageCreditEntries();
BStringView* fMemView;
BTextView* fUptimeView;
BView* fInfoView;
HyperTextView* fCreditsView;
BBitmap* fLogo;
bigtime_t fLastActionTime;
BMessageRunner* fScrollRunner;
PackageCreditMap fPackageCredits;
2005-06-23 18:53:20 +00:00
};
2005-06-24 01:48:44 +00:00
// #pragma mark -
2005-06-23 18:53:20 +00:00
AboutApp::AboutApp()
: BApplication("application/x-vnd.Haiku-About")
2005-06-23 18:53:20 +00:00
{
AboutWindow* window = new AboutWindow();
2005-06-24 01:48:44 +00:00
window->Show();
2005-06-23 18:53:20 +00:00
}
2005-06-24 01:48:44 +00:00
// #pragma mark -
AboutWindow::AboutWindow()
: BWindow(BRect(0, 0, 500, 300), "About This System", B_TITLED_WINDOW,
B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE)
2005-06-23 18:53:20 +00:00
{
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(new AboutView());
// Make sure we take the minimal window size into account when centering
BSize size = GetLayout()->MinSize();
ResizeTo(max_c(size.width, Bounds().Width()),
max_c(size.height, Bounds().Height()));
2005-06-24 01:48:44 +00:00
MoveTo((BScreen().Frame().Width() - Bounds().Width()) / 2,
(BScreen().Frame().Height() - Bounds().Height()) / 2 );
2005-06-23 18:53:20 +00:00
}
2005-06-24 01:48:44 +00:00
2005-06-23 18:53:20 +00:00
bool
2005-06-24 01:48:44 +00:00
AboutWindow::QuitRequested()
2005-06-23 18:53:20 +00:00
{
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
// #pragma mark - LogoView
LogoView::LogoView()
: BView("logo", B_WILL_DRAW)
2005-06-23 18:53:20 +00:00
{
fLogo = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "haikulogo.png");
SetViewColor(255, 255, 255);
}
LogoView::~LogoView()
{
delete fLogo;
}
BSize
LogoView::MinSize()
{
if (fLogo == NULL)
return BSize(0, 0);
return BSize(fLogo->Bounds().Width(), fLogo->Bounds().Height());
}
BSize
LogoView::MaxSize()
{
if (fLogo == NULL)
return BSize(0, 0);
return BSize(B_SIZE_UNLIMITED, fLogo->Bounds().Height());
}
void
LogoView::Draw(BRect updateRect)
{
if (fLogo != NULL) {
DrawBitmap(fLogo,
BPoint((Bounds().Width() - fLogo->Bounds().Width()) / 2, 0));
2005-06-23 18:53:20 +00:00
}
}
2005-06-24 01:48:44 +00:00
// #pragma mark - CropView
2005-06-24 01:48:44 +00:00
CropView::CropView(BView* target, int32 left, int32 top, int32 right,
int32 bottom)
: BView("crop view", 0),
fTarget(target),
fCropLeft(left),
fCropTop(top),
fCropRight(right),
fCropBottom(bottom)
{
AddChild(target);
}
2005-06-24 01:48:44 +00:00
CropView::~CropView()
{
}
2005-06-24 01:48:44 +00:00
BSize
CropView::MinSize()
{
if (fTarget == NULL)
return BSize();
2005-06-24 01:48:44 +00:00
BSize size = fTarget->MinSize();
if (size.width != B_SIZE_UNSET)
size.width -= fCropLeft + fCropRight;
if (size.height != B_SIZE_UNSET)
size.height -= fCropTop + fCropBottom;
2005-06-24 01:48:44 +00:00
return size;
}
2005-06-24 01:48:44 +00:00
2005-07-09 20:50:44 +00:00
BSize
CropView::MaxSize()
{
if (fTarget == NULL)
return BSize();
BSize size = fTarget->MaxSize();
if (size.width != B_SIZE_UNSET)
size.width -= fCropLeft + fCropRight;
if (size.height != B_SIZE_UNSET)
size.height -= fCropTop + fCropBottom;
return size;
}
void
CropView::DoLayout()
{
BView::DoLayout();
if (fTarget == NULL)
return;
fTarget->MoveTo(-fCropLeft, -fCropTop);
fTarget->ResizeTo(Bounds().Width() + fCropLeft + fCropRight,
Bounds().Height() + fCropTop + fCropBottom);
}
// #pragma mark - AboutView
AboutView::AboutView()
: BView("aboutview", B_WILL_DRAW | B_PULSE_NEEDED),
fLastActionTime(system_time()),
fScrollRunner(NULL)
{
// Begin Construction of System Information controls
system_info systemInfo;
get_system_info(&systemInfo);
// Create all the various labels for system infomation
// OS Version
2005-06-24 01:48:44 +00:00
char string[1024];
2005-07-09 20:50:44 +00:00
strcpy(string, "Unknown");
2005-06-23 18:53:20 +00:00
// the version is stored in the BEOS:APP_VERSION attribute of libbe.so
2005-07-09 20:50:44 +00:00
BPath path;
if (find_directory(B_BEOS_LIB_DIRECTORY, &path) == B_OK) {
path.Append("libbe.so");
2005-06-24 01:48:44 +00:00
BAppFileInfo appFileInfo;
version_info versionInfo;
2005-07-09 20:50:44 +00:00
BFile file;
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK
&& appFileInfo.SetTo(&file) == B_OK
2008-04-15 14:22:03 +00:00
&& appFileInfo.GetVersionInfo(&versionInfo,
B_APP_VERSION_KIND) == B_OK
2005-07-09 20:50:44 +00:00
&& versionInfo.short_info[0] != '\0')
2005-06-24 01:48:44 +00:00
strcpy(string, versionInfo.short_info);
2005-06-23 18:53:20 +00:00
}
2005-06-24 01:48:44 +00:00
// Add revision from uname() info
utsname unameInfo;
if (uname(&unameInfo) == 0) {
long revision;
if (sscanf(unameInfo.version, "r%ld", &revision) == 1) {
char version[16];
snprintf(version, sizeof(version), "%ld", revision);
strlcat(string, " (Revision ", sizeof(string));
strlcat(string, version, sizeof(string));
strlcat(string, ")", sizeof(string));
}
}
BStringView* versionView = new BStringView("ostext", string);
versionView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
2005-06-24 01:48:44 +00:00
// GCC version
#if __GNUC__ != 2
snprintf(string, sizeof(string), "GCC %d", __GNUC__);
BStringView* gccView = new BStringView("gcctext", string);
gccView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
#endif
2005-06-23 18:53:20 +00:00
// CPU count, type and clock speed
char processorLabel[256];
if (systemInfo.cpu_count > 1) {
snprintf(processorLabel, sizeof(processorLabel), "%ld Processors:",
systemInfo.cpu_count);
} else
strlcpy(processorLabel, "Processor:", sizeof(processorLabel));
2005-07-01 13:35:38 +00:00
2005-06-24 01:48:44 +00:00
BString cpuType;
cpuType << get_cpu_vendor_string(systemInfo.cpu_type)
<< " " << get_cpu_model_string(&systemInfo);
2005-06-24 01:48:44 +00:00
BStringView* cpuView = new BStringView("cputext", cpuType.String());
cpuView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
2005-06-24 01:48:44 +00:00
int32 clockSpeed = get_rounded_cpu_speed();
if (clockSpeed < 1000)
sprintf(string,"%ld MHz", clockSpeed);
2005-06-23 18:53:20 +00:00
else
sprintf(string,"%.2f GHz", clockSpeed / 1000.0f);
2005-06-24 01:48:44 +00:00
BStringView* frequencyView = new BStringView("frequencytext", string);
frequencyView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
2005-06-24 01:48:44 +00:00
2005-06-23 18:53:20 +00:00
// RAM
fMemView = new BStringView("ramtext",
MemUsageToString(string, sizeof(string), &systemInfo));
fMemView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
2005-06-23 18:53:20 +00:00
// Kernel build time/date
snprintf(string, sizeof(string), "%s %s",
systemInfo.kernel_build_date, systemInfo.kernel_build_time);
2005-06-24 01:48:44 +00:00
BStringView* kernelView = new BStringView("kerneltext", string);
kernelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
2005-06-24 01:48:44 +00:00
2005-06-23 18:53:20 +00:00
// Uptime
fUptimeView = new BTextView("uptimetext");
fUptimeView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fUptimeView->MakeEditable(false);
fUptimeView->MakeSelectable(false);
fUptimeView->SetWordWrap(true);
2005-07-09 20:50:44 +00:00
fUptimeView->SetText(UptimeToString(string, sizeof(string)));
const float offset = 5;
SetLayout(new BGroupLayout(B_HORIZONTAL));
BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
.AddGroup(B_VERTICAL)
.Add(new LogoView())
.AddGroup(B_VERTICAL)
.Add(_CreateLabel("oslabel", "Version:"))
.Add(versionView)
#if __GNUC__ != 2
.Add(gccView)
#endif
.AddStrut(offset)
.Add(_CreateLabel("cpulabel", processorLabel))
.Add(cpuView)
.Add(frequencyView)
.AddStrut(offset)
.Add(_CreateLabel("memlabel", "Memory:"))
.Add(fMemView)
.AddStrut(offset)
.Add(_CreateLabel("kernellabel", "Kernel:"))
.Add(kernelView)
.AddStrut(offset)
.Add(_CreateLabel("uptimelabel", "Time Running:"))
.Add(fUptimeView)
.SetInsets(5, 5, 5, 5)
.End()
// TODO: investigate: adding this causes the time to be cut
//.AddGlue()
.End()
.Add(_CreateCreditsView());
float min = fMemView->MinSize().width * 1.1f;
fCreditsView->SetExplicitMinSize(BSize(min, min));
}
AboutView::~AboutView()
{
delete fScrollRunner;
}
void
AboutView::AttachedToWindow()
{
BView::AttachedToWindow();
Window()->SetPulseRate(500000);
SetEventMask(B_POINTER_EVENTS);
}
void
AboutView::MouseDown(BPoint point)
{
BRect r(92, 26, 105, 31);
if (r.Contains(point)) {
printf("Easter Egg\n");
PickRandomHaiku();
}
if (Bounds().Contains(point)) {
fLastActionTime = system_time();
delete fScrollRunner;
fScrollRunner = NULL;
}
}
void
AboutView::Pulse()
{
char string[255];
system_info info;
get_system_info(&info);
fUptimeView->SetText(UptimeToString(string, sizeof(string)));
fMemView->SetText(MemUsageToString(string, sizeof(string), &info));
if (fScrollRunner == NULL && system_time() > fLastActionTime + 10000000) {
BMessage message(SCROLL_CREDITS_VIEW);
//fScrollRunner = new BMessageRunner(this, &message, 25000, -1);
}
}
void
AboutView::MessageReceived(BMessage *msg)
{
switch (msg->what) {
case SCROLL_CREDITS_VIEW:
{
BScrollBar *scrollBar = fCreditsView->ScrollBar(B_VERTICAL);
if (scrollBar == NULL)
break;
float max, min;
scrollBar->GetRange(&min, &max);
if (scrollBar->Value() < max)
fCreditsView->ScrollBy(0, 1);
break;
}
default:
BView::MessageReceived(msg);
break;
}
}
void
AboutView::AddCopyrightEntry(const char *name, const char *text,
const char *url)
{
AddCopyrightEntry(name, text, StringVector(), url);
}
void
AboutView::AddCopyrightEntry(const char *name, const char *text,
const StringVector& licenses, const char *url)
{
BFont font(be_bold_font);
//font.SetSize(be_bold_font->Size());
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuYellow);
fCreditsView->Insert(name);
fCreditsView->Insert("\n");
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert(text);
fCreditsView->Insert("\n");
if (licenses.CountStrings() > 0) {
if (licenses.CountStrings() > 1)
fCreditsView->Insert("Licenses: ");
else
fCreditsView->Insert("License: ");
for (int32 i = 0; i < licenses.CountStrings(); i++) {
const char* license = licenses.StringAt(i);
if (i > 0)
fCreditsView->Insert(", ");
BPath licensePath;
if (_GetLicensePath(license, licensePath) == B_OK) {
fCreditsView->InsertHyperText(license,
new OpenFileAction(licensePath.Path()));
} else
fCreditsView->Insert(license);
}
fCreditsView->Insert("\n");
}
if (url) {
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
fCreditsView->InsertHyperText(url, new URLAction(url));
fCreditsView->Insert("\n");
}
fCreditsView->Insert("\n");
}
void
AboutView::PickRandomHaiku()
{
BFile fortunes(
#ifdef __HAIKU__
"/etc/fortunes/Haiku",
#else
"data/etc/fortunes/Haiku",
#endif
B_READ_ONLY);
struct stat st;
if (fortunes.InitCheck() < B_OK)
return;
if (fortunes.GetStat(&st) < B_OK)
return;
char *buff = (char *)malloc((size_t)st.st_size + 1);
if (!buff)
return;
buff[(size_t)st.st_size] = '\0';
BList haikuList;
if (fortunes.Read(buff, (size_t)st.st_size) == (ssize_t)st.st_size) {
char *p = buff;
while (p && *p) {
char *e = strchr(p, '%');
BString *s = new BString(p, e ? (e - p) : -1);
haikuList.AddItem(s);
p = e;
if (p && (*p == '%'))
p++;
if (p && (*p == '\n'))
p++;
}
}
free(buff);
if (haikuList.CountItems() < 1)
return;
BString *s = (BString *)haikuList.ItemAt(rand() % haikuList.CountItems());
BFont font(be_bold_font);
font.SetSize(be_bold_font->Size());
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
fCreditsView->SelectAll();
fCreditsView->Delete();
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert(s->String());
fCreditsView->Insert("\n");
while ((s = (BString *)haikuList.RemoveItem((int32)0))) {
delete s;
}
}
BView*
AboutView::_CreateLabel(const char* name, const char* label)
{
BStringView* labelView = new BStringView(name, label);
labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
labelView->SetFont(be_bold_font);
return labelView;
}
2005-06-24 01:48:44 +00:00
BView*
AboutView::_CreateCreditsView()
{
// Begin construction of the credits view
fCreditsView = new HyperTextView("credits");
fCreditsView->SetFlags(fCreditsView->Flags() | B_FRAME_EVENTS);
fCreditsView->SetStylable(true);
fCreditsView->MakeEditable(false);
fCreditsView->SetWordWrap(true);
fCreditsView->SetInsets(5, 5, 5, 5);
BScrollView* creditsScroller = new BScrollView("creditsScroller",
fCreditsView, B_WILL_DRAW | B_FRAME_EVENTS, false, true,
2008-04-15 14:22:03 +00:00
B_PLAIN_BORDER);
2005-06-24 01:48:44 +00:00
// Haiku copyright
2005-06-23 18:53:20 +00:00
BFont font(be_bold_font);
font.SetSize(font.Size() + 4);
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert("Haiku\n");
2005-06-24 01:48:44 +00:00
char string[1024];
time_t time = ::time(NULL);
struct tm* tm = localtime(&time);
int32 year = tm->tm_year + 1900;
if (year < 2008)
year = 2008;
snprintf(string, sizeof(string),
COPYRIGHT_STRING "2001-%ld The Haiku project. ", year);
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert(string);
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert("The copyright to the Haiku code is property of "
"Haiku, Inc. or of the respective authors where expressly noted "
"in the source."
"\n\n");
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
fCreditsView->InsertHyperText("http://www.haiku-os.org",
new URLAction("http://www.haiku-os.org"));
fCreditsView->Insert("\n\n");
font.SetSize(be_bold_font->Size());
font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
fCreditsView->Insert("Current Maintainers:\n");
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert(
"Ithamar R. Adema\n"
"Bruno G. Albuquerque\n"
"Stephan Aßmus\n"
"Salvatore Benedetto\n"
"Stefano Ceccherini\n"
"Rudolf Cornelissen\n"
"Alexandre Deckner\n"
"Adrien Destugues\n"
"Oliver Ruiz Dorantes\n"
"Axel Dörfler\n"
"Jérôme Duval\n"
"René Gollent\n"
2009-08-07 20:27:22 +00:00
"Bryce Groff\n"
"Karsten Heimrich\n"
"Philippe Houdoin\n"
"Maurice Kalinowski\n"
"Euan Kirkhope\n"
"Ryan Leavengood\n"
"Michael Lotz\n"
"David McPaul\n"
"Fredrik Modéen\n"
"Marcus Overhagen\n"
"Michael Pfeiffer\n"
"François Revol\n"
2009-08-07 20:27:22 +00:00
"Philippe Saint-Pierre\n"
"Andrej Spielmann\n"
2009-08-07 20:27:22 +00:00
"Jonas Sundström\n"
"Oliver Tappe\n"
"Gerasim Troeglazov\n"
"Ingo Weinhold\n"
2009-08-07 20:27:22 +00:00
"Artur Wyszynski\n"
"Clemens Zeidler\n"
"Siarzhuk Zharski\n"
"\n");
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
fCreditsView->Insert("Past Maintainers:\n");
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert(
"Andrew Bachmann\n"
"Tyler Dauwalder\n"
"Daniel Furrer\n"
"Andre Alves Garzia\n"
"Erik Jaesler\n"
"Marcin Konicki\n"
"Waldemar Kornewald\n"
"Thomas Kurschel\n"
"Frans Van Nispen\n"
"Adi Oanca\n"
"Michael Phipps\n"
"Niels Sascha Reedijk\n"
"David Reid\n"
"Hugo Santos\n"
"Alexander G. M. Smith\n"
"Bryan Varner\n"
"Nathan Whitehorn\n"
"Michael Wilber\n"
"Jonathan Yoder\n"
"Gabe Yoder\n"
2005-06-24 01:48:44 +00:00
"\n");
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
2008-09-07 10:43:43 +00:00
fCreditsView->Insert("Website, Marketing & Documentation:\n");
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert(
"Phil Greenway\n"
"Gavin James\n"
2009-08-07 20:27:22 +00:00
"Matt Madia\n"
"Jorge G. Mare (aka Koki)\n"
"Urias McCullough\n"
"Niels Sascha Reedijk\n"
2009-08-07 20:27:22 +00:00
"Joachim Seemer (Humdinger)\n"
"Jonathan Yoder\n"
2005-06-24 01:48:44 +00:00
"\n");
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert("Contributors:\n");
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert(
"Andrea Anzani\n"
"Andre Braga\n"
2005-06-24 01:48:44 +00:00
"Bruce Cameron\n"
2006-04-03 09:56:03 +00:00
"Greg Crain\n"
"David Dengg\n"
"John Drinkwater\n"
"Cian Duffy\n"
"Vincent Duvert\n"
"Fredrik Ekdahl\n"
2009-05-02 11:04:40 +00:00
"Mark Erben\n"
"Christian Fasshauer\n"
"Andreas Färber\n"
"Marc Flerackers\n"
"Michele Frau (zuMi)\n"
"Matthijs Hollemans\n"
"Mathew Hounsell\n"
"Morgan Howe\n"
"Ma Jie\n"
"Carwyn Jones\n"
"Vasilis Kaoutsis\n"
"James Kim\n"
2008-05-26 21:21:12 +00:00
"Shintaro Kinugawa\n"
"Jan Klötzke\n"
"Kurtis Kopf\n"
"Tomáš Kučera\n"
"Luboš Kulič\n"
2005-06-24 01:48:44 +00:00
"Elad Lahav\n"
"Anthony Lee\n"
"Santiago Lema\n"
"Raynald Lesieur\n"
"Oscar Lesta\n"
2005-06-24 01:48:44 +00:00
"Jerome Leveque\n"
"Christof Lutteroth\n"
2005-06-24 01:48:44 +00:00
"Graham MacDonald\n"
2009-08-07 20:27:22 +00:00
"Brecht Machiels\n"
"Jan Matějek\n"
2005-06-24 01:48:44 +00:00
"Brian Matzon\n"
"Christopher ML Zumwalt May\n"
"Andrew McCall\n"
"Scott McCreary\n"
"Marius Middelthon\n"
"Marco Minutoli\n"
2005-06-24 01:48:44 +00:00
"Misza\n"
"MrSiggler\n"
"Alan Murta\n"
"Raghuram Nagireddy\n"
"Jeroen Oortwijn (idefix)\n"
2005-06-24 01:48:44 +00:00
"Pahtz\n"
"Michael Paine\n"
"Adrian Panasiuk\n"
"Francesco Piccinno\n"
"David Powell\n"
2005-06-24 01:48:44 +00:00
"Jeremy Rand\n"
"Hartmut Reh\n"
2005-06-24 01:48:44 +00:00
"Daniel Reinhold\n"
2009-08-13 22:54:05 +00:00
"Chris Roberts\n"
"Samuel Rodriguez Perez\n"
2005-06-24 02:00:26 +00:00
"Thomas Roell\n"
"Rafael Romo\n"
"Ralf Schülke\n"
"Reznikov Sergei\n"
2005-06-24 01:48:44 +00:00
"Zousar Shaker\n"
"Daniel Switkin\n"
"Atsushi Takamatsu\n"
"James Urquhart\n"
2005-06-24 01:48:44 +00:00
"Jason Vandermark\n"
"Sandor Vroemisse\n"
"Denis Washington\n"
2005-06-24 01:48:44 +00:00
"Ulrich Wimboeck\n"
"Johannes Wischert\n"
2008-05-26 21:21:12 +00:00
"James Woodcock\n"
"Gerald Zajac\n"
"Łukasz Zemczak\n"
2007-09-19 22:39:10 +00:00
"JiSheng Zhang\n"
2008-09-09 22:11:03 +00:00
"Zhao Shuai\n"
2008-04-15 14:22:03 +00:00
"\n" B_UTF8_ELLIPSIS " and probably some more we forgot to mention "
"(sorry!)"
"\n\n");
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert("Special Thanks To:\n");
2005-06-24 01:48:44 +00:00
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert("Travis Geiselbrecht (and his NewOS kernel)\n");
2005-06-24 01:48:44 +00:00
fCreditsView->Insert("Michael Phipps (project founder)\n\n");
2009-08-07 20:27:22 +00:00
fCreditsView->Insert("The Haiku-Ports Team\n");
fCreditsView->Insert("The Haikuware Team and their Bounty Program\n");
fCreditsView->Insert("The BeGeistert Team\n\n");
fCreditsView->Insert("... and the many community members making "
"donations!\n\n");
2005-06-24 01:48:44 +00:00
// copyrights for various projects we use
BPath mitPath;
_GetLicensePath("MIT", mitPath);
font.SetSize(be_bold_font->Size() + 4);
2005-06-23 18:53:20 +00:00
font.SetFace(B_BOLD_FACE);
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
2005-06-23 18:53:20 +00:00
fCreditsView->Insert("\nCopyrights\n\n");
fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
fCreditsView->Insert("[Click a license name to read the respective "
"license.]\n\n");
// Haiku license
fCreditsView->Insert("The code that is unique to Haiku, especially the "
"kernel and all code that applications may link against, is "
"distributed under the terms of the ");
fCreditsView->InsertHyperText("MIT license",
new OpenFileAction(mitPath.Path()));
fCreditsView->Insert(". Some system libraries contain third party code "
"distributed under the LGPL license. You can find the copyrights "
"to third party code below.\n\n");
// GNU copyrights
2008-04-15 14:22:03 +00:00
AddCopyrightEntry("The GNU Project",
"Contains software from the GNU Project, "
"released under the GPL and LGPL licences:\n"
2008-04-15 14:22:03 +00:00
"GNU C Library, "
"GNU coretools, diffutils, findutils, "
2008-05-10 21:52:44 +00:00
"sharutils, gawk, bison, m4, make, "
2008-04-15 14:22:03 +00:00
"gdb, wget, ncurses, termcap, "
"Bourne Again Shell.\n"
COPYRIGHT_STRING "The Free Software Foundation.",
StringVector("GNU LGPL v2.1", "GNU GPL v2", "GNU GPL v3", NULL),
"http://www.gnu.org");
2008-04-15 14:22:03 +00:00
// FreeBSD copyrights
AddCopyrightEntry("The FreeBSD Project",
"Contains software from the FreeBSD Project, "
"released under the BSD licence:\n"
"cal, ftpd, ping, telnet, "
"telnetd, traceroute\n"
COPYRIGHT_STRING "1994-2008 The FreeBSD Project. "
2008-04-15 14:22:03 +00:00
"All rights reserved.",
"http://www.freebsd.org");
// TODO: License!
2008-04-15 14:22:03 +00:00
// NetBSD copyrights
AddCopyrightEntry("The NetBSD Project",
"Contains software developed by the NetBSD, "
"Foundation, Inc. and its contributors:\n"
"ftp, tput\n"
COPYRIGHT_STRING "1996-2008 The NetBSD Foundation, Inc. "
2008-04-15 14:22:03 +00:00
"All rights reserved.",
"http://www.netbsd.org");
// TODO: License!
2008-04-15 14:22:03 +00:00
// FFMpeg copyrights
_AddPackageCredit(PackageCredit("FFMpeg libavcodec")
.SetCopyright(COPYRIGHT_STRING "2000-2007 Fabrice Bellard, et al.")
.SetURL("http://www.ffmpeg.org"));
// TODO: License!
// AGG copyrights
_AddPackageCredit(PackageCredit("AntiGrain Geometry")
.SetCopyright(COPYRIGHT_STRING "2002-2006 Maxim Shemanarev (McSeem).")
.SetURL("http://www.antigrain.com"));
// TODO: License!
2005-06-24 01:48:44 +00:00
// PDFLib copyrights
_AddPackageCredit(PackageCredit("PDFLib")
.SetCopyright(COPYRIGHT_STRING "1997-2006 PDFlib GmbH and Thomas Merz. "
"All rights reserved.\n"
"PDFlib and PDFlib logo are registered trademarks of PDFlib GmbH.")
.SetURL("http://www.pdflib.com"));
// TODO: License!
2005-06-24 01:48:44 +00:00
// FreeType copyrights
_AddPackageCredit(PackageCredit("FreeType2")
.SetCopyright("Portions of this software are copyright "
B_UTF8_COPYRIGHT " 1996-2006 "
"The FreeType Project. All rights reserved.")
.SetURL("http://www.freetype.org"));
// TODO: License!
2005-06-26 22:07:18 +00:00
// Mesa3D (http://www.mesa3d.org) copyrights
_AddPackageCredit(PackageCredit("Mesa")
.SetCopyright(COPYRIGHT_STRING "1999-2006 Brian Paul. "
"Mesa3D project. All rights reserved.")
.SetURL("http://www.mesa3d.org"));
// TODO: License!
2005-06-26 22:07:18 +00:00
// SGI's GLU implementation copyrights
_AddPackageCredit(PackageCredit("GLU")
.SetCopyright(COPYRIGHT_STRING
"1991-2000 Silicon Graphics, Inc. "
"SGI's Software FreeB license. All rights reserved."));
// TODO: License!
2005-06-26 22:07:18 +00:00
// GLUT implementation copyrights
_AddPackageCredit(PackageCredit("GLUT")
.SetCopyrights(COPYRIGHT_STRING "1994-1997 Mark Kilgard. "
"All rights reserved.",
COPYRIGHT_STRING "1997 Be Inc.",
COPYRIGHT_STRING "1999 Jake Hamby.",
NULL));
// TODO: License!
2005-07-12 09:17:44 +00:00
// OpenGroup & DEC (BRegion backend) copyright
_AddPackageCredit(PackageCredit("BRegion backend (XFree86)")
.SetCopyrights(COPYRIGHT_STRING "1987, 1988, 1998 The Open Group.",
COPYRIGHT_STRING "1987, 1988 Digital Equipment "
"Corporation, Maynard, Massachusetts.\n"
"All rights reserved.",
NULL));
// TODO: License!
2005-07-12 09:17:44 +00:00
// Konatu font
_AddPackageCredit(PackageCredit("Konatu font")
.SetCopyright(COPYRIGHT_STRING "2002- MASUDA mitiya.\n"
"MIT license. All rights reserved."));
// TODO: License!
// expat copyrights
_AddPackageCredit(PackageCredit("expat")
.SetCopyrights(COPYRIGHT_STRING
"1998, 1999, 2000 Thai Open Source "
"Software Center Ltd and Clark Cooper.",
COPYRIGHT_STRING "2001, 2002, 2003 Expat maintainers.",
NULL));
// TODO: License!
// zlib copyrights
_AddPackageCredit(PackageCredit("zlib")
.SetCopyright(COPYRIGHT_STRING
"1995-2004 Jean-loup Gailly and Mark Adler."));
// TODO: License!
// zip copyrights
_AddPackageCredit(PackageCredit("Info-ZIP")
.SetCopyright(COPYRIGHT_STRING
"1990-2002 Info-ZIP. All rights reserved."));
// TODO: License!
// bzip2 copyrights
_AddPackageCredit(PackageCredit("bzip2")
.SetCopyright(COPYRIGHT_STRING
"1996-2005 Julian R Seward. All rights reserved."));
// TODO: License!
// VIM copyrights
_AddPackageCredit(PackageCredit("Vi IMproved")
.SetCopyright(COPYRIGHT_STRING "Bram Moolenaar et al."));
// TODO: License!
// lp_solve copyrights
_AddPackageCredit(PackageCredit("lp_solve")
.SetCopyright(COPYRIGHT_STRING
"Michel Berkelaar, Kjell Eikland, Peter Notebaert")
.SetLicense("GNU LGPL v2.1")
.SetURL("http://lpsolve.sourceforge.net/"));
2008-02-16 19:23:17 +00:00
// OpenEXR copyrights
_AddPackageCredit(PackageCredit("OpenEXR")
.SetCopyright(COPYRIGHT_STRING "2002-2005 Industrial Light & Magic, "
"a division of Lucas Digital Ltd. LLC."));
// TODO: License!
2008-02-27 17:27:39 +00:00
// Bullet copyrights
_AddPackageCredit(PackageCredit("Bullet")
.SetCopyright(COPYRIGHT_STRING "2003-2008 Erwin Coumans")
.SetURL("http://www.bulletphysics.com"));
// TODO: License!
2008-02-16 19:23:17 +00:00
2008-04-15 14:22:03 +00:00
// atftp copyrights
_AddPackageCredit(PackageCredit("atftp")
.SetCopyright(COPYRIGHT_STRING
"2000 Jean-Pierre Lefebvre and Remi Lefebvre"));
// TODO: License!
2008-04-15 14:22:03 +00:00
// Netcat copyrights
_AddPackageCredit(PackageCredit("Netcat")
.SetCopyright(COPYRIGHT_STRING "1996 Hobbit"));
// TODO: License!
2008-04-15 14:22:03 +00:00
// acpica copyrights
_AddPackageCredit(PackageCredit("acpica")
.SetCopyright(COPYRIGHT_STRING "1999-2006 Intel Corp."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// unrar copyrights
_AddPackageCredit(PackageCredit("unrar")
.SetCopyright(COPYRIGHT_STRING "2002-2008 Alexander L. Roshal. "
"All rights reserved.")
.SetURL("http://www.rarlab.com"));
// TODO: License!
2008-04-15 14:22:03 +00:00
// libpng copyrights
_AddPackageCredit(PackageCredit("libpng")
.SetCopyright(COPYRIGHT_STRING "2004, 2006-2008 Glenn "
"Randers-Pehrson."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// libprint copyrights
_AddPackageCredit(PackageCredit("libprint")
.SetCopyright(COPYRIGHT_STRING
"1999-2000 Y.Takagi. All rights reserved."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// cortex copyrights
_AddPackageCredit(PackageCredit("Cortex")
.SetCopyright(COPYRIGHT_STRING "1999-2000 Eric Moon."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// FluidSynth copyrights
_AddPackageCredit(PackageCredit("FluidSynth")
.SetCopyright(COPYRIGHT_STRING "2003 Peter Hanappe and others."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// CannaIM copyrights
_AddPackageCredit(PackageCredit("CannaIM")
.SetCopyright(COPYRIGHT_STRING "1999 Masao Kawamura."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// libxml2, libxslt, libexslt copyrights
_AddPackageCredit(PackageCredit("libxml2, libxslt")
.SetCopyright(COPYRIGHT_STRING
"1998-2003 Daniel Veillard. All rights reserved."));
// TODO: License!
2008-04-15 14:22:03 +00:00
_AddPackageCredit(PackageCredit("libexslt")
.SetCopyright(COPYRIGHT_STRING
"2001-2002 Thomas Broyer, Charlie "
"Bozeman and Daniel Veillard. All rights reserved."));
// TODO: License!
2008-04-15 14:22:03 +00:00
// Xiph.org Foundation copyrights
_AddPackageCredit(PackageCredit("Xiph.org Foundation")
.SetCopyrights("libvorbis, libogg, libtheora, libspeex",
COPYRIGHT_STRING "1994-2008 Xiph.Org. "
"All rights reserved.",
NULL)
.SetURL("http://www.xiph.org"));
// TODO: License!
2008-04-15 14:22:03 +00:00
// The Tcpdump Group
_AddPackageCredit(PackageCredit("The Tcpdump Group")
.SetCopyright("tcpdump, libpcap")
.SetURL("http://www.tcpdump.org"));
// TODO: License!
// Matroska
_AddPackageCredit(PackageCredit("libmatroska")
.SetCopyright(COPYRIGHT_STRING "2002-2003 Steve Lhomme. "
"All rights reserved.")
.SetURL("http://www.matroska.org"));
// TODO: License!
// BColorQuantizer (originally CQuantizer code)
_AddPackageCredit(PackageCredit("CQuantizer")
.SetCopyright(COPYRIGHT_STRING "1996-1997 Jeff Prosise. "
"All rights reserved."));
// TODO: License!
// MAPM (Mike's Arbitrary Precision Math Library) used by DeskCalc
_AddPackageCredit(PackageCredit("MAPM")
.SetCopyright(COPYRIGHT_STRING
"1999-2007 Michael C. Ring. All rights reserved.")
.SetURL("http://tc.umn.edu/~ringx004"));
// TODO: License!
// MkDepend 1.7 copyright (Makefile dependency generator)
_AddPackageCredit(PackageCredit("MkDepend")
.SetCopyright(COPYRIGHT_STRING "1995-2001 Lars Düning. "
"All rights reserved."));
// TODO: License!
// libhttpd copyright (used as Poorman backend)
_AddPackageCredit(PackageCredit("libhttpd")
.SetCopyright(COPYRIGHT_STRING
"1995,1998,1999,2000,2001 by "
"Jef Poskanzer. All rights reserved.")
.SetLicense("LibHTTPd")
.SetURL("http://www.acme.com/software/thttpd/"));
#ifdef __INTEL__
// Udis86 copyrights
_AddPackageCredit(PackageCredit("Udis86")
.SetCopyright(COPYRIGHT_STRING "2002, 2003, 2004 Vivek Mohan. "
"All rights reserved.")
.SetURL("http://udis86.sourceforge.net"));
// TODO: License!
#endif
_AddCopyrightsFromAttribute();
_AddPackageCreditEntries();
return new CropView(creditsScroller, 0, 1, 1, 1);
2007-12-28 02:42:53 +00:00
}
status_t
AboutView::_GetLicensePath(const char* license, BPath& path)
{
static const directory_which directoryConstants[] = {
B_USER_DATA_DIRECTORY,
B_COMMON_DATA_DIRECTORY,
B_SYSTEM_DATA_DIRECTORY
};
static const int dirCount = 3;
for (int i = 0; i < dirCount; i++) {
struct stat st;
status_t error = find_directory(directoryConstants[i], &path);
if (error == B_OK && path.Append("licenses") == B_OK
&& path.Append(license) == B_OK
&& lstat(path.Path(), &st) == 0) {
return B_OK;
}
}
path.Unset();
return B_ENTRY_NOT_FOUND;
}
void
AboutView::_AddCopyrightsFromAttribute()
{
2008-10-30 19:41:43 +00:00
#ifdef __HAIKU__
// open the app executable file
char appPath[B_PATH_NAME_LENGTH];
int appFD;
if (BPrivate::get_app_path(appPath) != B_OK
|| (appFD = open(appPath, O_RDONLY)) < 0) {
return;
}
// open the attribute
int attrFD = fs_fopen_attr(appFD, "COPYRIGHTS", B_STRING_TYPE, O_RDONLY);
close(appFD);
if (attrFD < 0)
return;
// attach it to a FILE
FILE* attrFile = fdopen(attrFD, "r");
if (attrFile == NULL) {
close(attrFD);
return;
}
CObjectDeleter<FILE, int> _(attrFile, fclose);
// read and parse the copyrights
BMessage package;
BString fieldName;
BString fieldValue;
char lineBuffer[LINE_MAX];
while (char* line = fgets(lineBuffer, sizeof(lineBuffer), attrFile)) {
// chop off line break
size_t lineLen = strlen(line);
if (lineLen > 0 && line[lineLen - 1] == '\n')
line[--lineLen] = '\0';
// flush previous field, if a new field begins, otherwise append
if (lineLen == 0 || !isspace(line[0])) {
// new field -- flush the previous one
if (fieldName.Length() > 0) {
fieldValue = trim_string(fieldValue.String(),
fieldValue.Length());
package.AddString(fieldName.String(), fieldValue);
fieldName = "";
}
} else if (fieldName.Length() > 0) {
// append to current field
fieldValue += line;
continue;
} else {
// bogus line -- ignore
continue;
}
if (lineLen == 0)
continue;
// parse new field
char* colon = strchr(line, ':');
if (colon == NULL) {
// bogus line -- ignore
continue;
}
fieldName.SetTo(line, colon - line);
fieldName = trim_string(line, colon - line);
if (fieldName.Length() == 0) {
// invalid field name
continue;
}
fieldValue = colon + 1;
if (fieldName == "Package") {
// flush the current package
_AddPackageCredit(PackageCredit(package));
package.MakeEmpty();
}
}
// flush current package
_AddPackageCredit(PackageCredit(package));
2008-10-30 19:41:43 +00:00
#endif
}
void
AboutView::_AddPackageCreditEntries()
{
for (PackageCreditMap::iterator it = fPackageCredits.begin();
it != fPackageCredits.end(); ++it) {
PackageCredit* package = it->second;
BString text(package->CopyrightAt(0));
int32 count = package->CountCopyrights();
for (int32 i = 1; i < count; i++)
text << "\n" << package->CopyrightAt(i);
AddCopyrightEntry(package->PackageName(), text.String(),
package->Licenses(), package->URL());
}
}
void
AboutView::_AddPackageCredit(const PackageCredit& package)
{
if (!package.IsValid())
return;
PackageCreditMap::iterator it = fPackageCredits.find(package.PackageName());
if (it != fPackageCredits.end()) {
// If the new package credit isn't "better" than the old one, ignore it.
PackageCredit* oldPackage = it->second;
if (!package.IsBetterThan(*oldPackage))
return;
// replace the old credit
fPackageCredits.erase(it);
delete oldPackage;
}
fPackageCredits[package.PackageName()] = new PackageCredit(package);
}
2005-06-24 01:48:44 +00:00
// #pragma mark -
static const char *
MemUsageToString(char string[], size_t size, system_info *info)
{
snprintf(string, size, "%d MB total, %d MB used (%d%%)",
int(info->max_pages / 256.0f + 0.5f),
int(info->used_pages / 256.0f + 0.5f),
int(100 * info->used_pages / info->max_pages));
return string;
}
static const char *
UptimeToString(char string[], size_t size)
2005-06-23 18:53:20 +00:00
{
int64 days, hours, minutes, seconds, remainder;
int64 systime = system_time();
2005-06-24 01:48:44 +00:00
days = systime / 86400000000LL;
remainder = systime % 86400000000LL;
hours = remainder / 3600000000LL;
remainder = remainder % 3600000000LL;
minutes = remainder / 60000000;
remainder = remainder % 60000000;
seconds = remainder / 1000000;
char *str = string;
if (days) {
str += snprintf(str, size, "%lld day%s",days, days > 1 ? "s" : "");
}
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" : "");
2005-06-23 18:53:20 +00:00
}
if (seconds || str == string) {
// Haiku would be well-known to boot very fast.
// Let's be ready to handle below minute uptime, zero second included ;-)
str += snprintf(str, size - strlen(string), "%s%lld second%s",
str != string ? ", " : "",
seconds, seconds > 1 ? "s" : "");
}
2005-06-24 01:48:44 +00:00
2005-06-23 18:53:20 +00:00
return string;
}
2005-06-24 01:48:44 +00:00
int
main()
{
AboutApp app;
app.Run();
return 0;
}