Chat-O-Matic/application/windows/AboutWindow.cpp

70 lines
1.5 KiB
C++
Raw Normal View History

2010-05-12 13:57:19 -05:00
/*
2011-12-03 16:38:03 -06:00
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
2010-05-12 13:57:19 -05:00
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Pier Luigi Fiorini, pierluigi.fiorini@gmail.com
* Ryan Leavengood, leavengood@gmail.com
*/
#include <Alert.h>
2021-07-19 09:54:27 -05:00
#include <Catalog.h>
2010-05-12 13:57:19 -05:00
#include <Font.h>
#include <String.h>
#include <TextView.h>
#include "AboutWindow.h"
2010-05-12 13:57:19 -05:00
2021-07-19 09:54:27 -05:00
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "About window"
2010-05-12 13:57:19 -05:00
AboutWindow::AboutWindow(const char* appName, const char** holders,
2010-05-19 17:28:26 -05:00
const char** authors, const char* extraInfo)
2010-05-12 13:57:19 -05:00
{
fAppName = new BString(appName);
// Build the text to display
int32 i;
BString text(appName);
text << "\n\n";
for (i = 0; holders[i]; i++)
2021-07-19 09:54:27 -05:00
text << B_TRANSLATE("Copyright " B_UTF8_COPYRIGHT " ") << holders[i]
<< "\n";
text << B_TRANSLATE("\nWritten by:\n");
for (int32 i = 0; authors[i]; i++) {
2010-05-12 13:57:19 -05:00
text << " " << authors[i] << "\n";
2021-07-19 09:54:27 -05:00
}
2010-05-12 13:57:19 -05:00
// The extra information is optional
if (extraInfo != NULL)
text << "\n" << extraInfo << "\n";
fText = new BString(text);
}
AboutWindow::~AboutWindow()
{
delete fText;
delete fAppName;
}
void
AboutWindow::Show()
{
2021-07-19 09:54:27 -05:00
BAlert* alert = new BAlert(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
fText->String(), B_TRANSLATE("Close"));
2010-05-12 13:57:19 -05:00
BTextView* view = alert->TextView();
BFont font;
view->SetStylable(true);
view->GetFont(&font);
font.SetFace(B_BOLD_FACE);
font.SetSize(font.Size() * 1.7f);
view->SetFontAndColor(0, fAppName->Length(), &font);
alert->Go();
}