beos: Simplify about box

Just print some version infos, the buttons are there for credits
and licence.
This commit is contained in:
François Revol 2014-01-01 19:35:21 +01:00
parent f713cdd90b
commit a7ef9dc4ab

View File

@ -22,6 +22,9 @@
#include <string.h> #include <string.h>
extern "C" { extern "C" {
#include "utils/log.h" #include "utils/log.h"
#include "utils/testament.h"
#include "utils/useragent.h"
#include "curl/curlver.h"
} }
#include "beos/about.h" #include "beos/about.h"
#include "beos/scaffolding.h" #include "beos/scaffolding.h"
@ -30,83 +33,23 @@ extern "C" {
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Invoker.h> #include <Invoker.h>
#include <ScrollView.h>
#include <String.h> #include <String.h>
#include <TextView.h>
static const char *authors[] = {
"John-Mark Bell", "James Bursa", "Michael Drake",
"Rob Kendrick", "Adrian Lees", "Vincent Sanders",
"Daniel Silverstone", "Richard Wilson",
"\nContributors:", "Kevin Bagust", "Stefaan Claes",
"Matthew Hambley", "Rob Jackson", "Jeffrey Lee", "Phil Mellor",
"Philip Pemberton", "Darren Salt", "Andrew Timmins",
"John Tytgat", "Chris Williams",
"\nGoogle Summer of Code Contributors:", "Adam Blokus",
"Sean Fox", "Michael Lester", "Andrew Sidwell", NULL
};
static const char *translators[] = { "Sebastian Barthel", "Bruno D'Arcangeli",
"Gerard van Katwijk", "Jérôme Mathevet", "Simon Voortman.", NULL
};
static const char *artists[] = {
"Michael Drake", "\nContributors:", "Andrew Duffell",
"John Duffell", "Richard Hallas", "Phil Mellor", NULL
};
static const char *documenters[] = {
"John-Mark Bell", "James Bursa", "Michael Drake",
"Richard Wilson", "\nContributors:", "James Shaw", NULL
};
static const char *name = "NetSurf";
static const char *description =
"Small as a mouse, fast as a cheetah, and available for free.\n"
"NetSurf is a web browser for RISC OS and UNIX-like platforms.";
static const char *url = "http://www.netsurf-browser.org/";
static const char *url_label = "NetSurf Website";
static const char *copyright =
"Copyright © 2003 - 2008 The NetSurf Developers";
static void add_section(BTextView *textview, const char *header,
const char *text)
{
BFont titleFont;
titleFont.SetSize(titleFont.Size() + 10);
BFont textFont;
text_run_array titleRuns = { 1, { 0, titleFont, { 0, 0, 0, 255 } } };
text_run_array textRuns = { 1, { 0, textFont, { 0, 0, 0, 255 } } };
BString h(header);
BString t(text);
h << "\n";
t << "\n\n";
if (header)
textview->Insert(h.String(), &titleRuns);
if (text)
textview->Insert(t.String(), &textRuns);
}
static void add_section(BTextView *textview, const char *header,
const char **texts)
{
BString t;
while (*texts) {
t << *texts;
t << ", ";
texts++;
}
add_section(textview, header, t.String());
}
/** /**
* Creates the about alert * Creates the about alert
*/ */
void nsbeos_about(struct gui_window *gui) void nsbeos_about(struct gui_window *gui)
{ {
BAlert *alert; BString text;
alert = new BAlert("about", "", "Credits", "Licence", "Ok"); text << "Netsurf : " << user_agent_string() << "\n";
//XXX: i18n-ize text << "Version : " << netsurf_version << "\n";
BTextView *tv = alert->TextView(); text << "Build ID : " << WT_REVID << "\n";
text << "Date : " << WT_COMPILEDATE << "\n";
text << "cURL : " << LIBCURL_VERSION << "\n";
BAlert *alert = new BAlert("about", text.String(), "Credits", "Licence", "Ok");
BHandler *target = be_app; BHandler *target = be_app;
BMessage *message = new BMessage(ABOUT_BUTTON); BMessage *message = new BMessage(ABOUT_BUTTON);
BInvoker *invoker = NULL; BInvoker *invoker = NULL;
@ -128,20 +71,7 @@ void nsbeos_about(struct gui_window *gui)
} }
invoker = new BInvoker(message, target); invoker = new BInvoker(message, target);
// make space for controls //TODO: i18n-ize
alert->ResizeBy(200, 640);
alert->MoveTo(alert->AlertPosition(alert->Frame().Width() + 1,
alert->Frame().Height() + 1));
tv->SetStylable(true);
tv->ResizeBy(200, 640);
add_section(tv, name, description);
add_section(tv, NULL, copyright);
add_section(tv, "authors", authors);
add_section(tv, "translators", translators);
add_section(tv, "artists", artists);
add_section(tv, "documenters", documenters);
add_section(tv, url_label, url);
alert->Go(invoker); alert->Go(invoker);
} }