Use system AboutWindow instead of custom

This commit is contained in:
Jaidyn Ann 2021-12-14 10:28:11 -06:00
parent 06df963434
commit 4ad75cd807
4 changed files with 7 additions and 108 deletions

View File

@ -75,7 +75,6 @@ SRCS = \
application/views/UserItem.cpp \
application/views/UserListView.cpp \
application/views/UserPopUp.cpp \
application/windows/AboutWindow.cpp \
application/windows/AccountsWindow.cpp \
application/windows/ConversationInfoWindow.cpp \
application/windows/MainWindow.cpp \

View File

@ -14,6 +14,7 @@
#include <stdio.h>
#include <AboutWindow.h>
#include <Alert.h>
#include <Catalog.h>
#include <Path.h>
@ -21,7 +22,6 @@
#include <librunview/Emoticor.h>
#include "AboutWindow.h"
#include "ChatOMatic.h"
#include "AppMessages.h"
#include "FilePanel.h"
@ -109,28 +109,21 @@ TheApp::AboutRequested()
"2009-2010 Andrea Anzani",
"2010-2015 Dario Casalinuovo",
"2009-2010 Pier Luigi Fiorini",
"2021 Jaidyn Levesque",
NULL
};
const char* authors[] = {
"Andrea Anzani",
"Dario Casalinuovo",
"Pier Luigi Fiorini",
"Jaidyn Levesque",
NULL
};
BString extraInfo(B_TRANSLATE("%app% is released under the MIT License.\n"
"Add-on and library licenses may vary.\n"
"Built: %buildDate%"));
extraInfo.ReplaceAll("%buildDate", BUILD_DATE);
extraInfo.ReplaceAll("%buildDate%", BUILD_DATE);
extraInfo.ReplaceAll("%app%", B_TRANSLATE_SYSTEM_NAME(APP_NAME));
AboutWindow* about = new AboutWindow(B_TRANSLATE_SYSTEM_NAME(APP_NAME),
holders, authors, extraInfo.String());
BAboutWindow* about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME(APP_NAME),
APP_SIGNATURE);
about->AddDescription(B_TRANSLATE("A multi-protocol chat program."));
about->AddCopyright(2021, "Jaidyn Levesque", holders);
about->AddExtraInfo(extraInfo);
about->Show();
delete about;
}

View File

@ -1,69 +0,0 @@
/*
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
* 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>
#include <Catalog.h>
#include <Font.h>
#include <String.h>
#include <TextView.h>
#include "AboutWindow.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "About window"
AboutWindow::AboutWindow(const char* appName, const char** holders,
const char** authors, const char* extraInfo)
{
fAppName = new BString(appName);
// Build the text to display
int32 i;
BString text(appName);
text << "\n\n";
for (i = 0; holders[i]; i++)
text << B_TRANSLATE("Copyright " B_UTF8_COPYRIGHT " ") << holders[i]
<< "\n";
text << B_TRANSLATE("\nWritten by:\n");
for (int32 i = 0; authors[i]; i++) {
text << " " << authors[i] << "\n";
}
// 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()
{
BAlert* alert = new BAlert(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
fText->String(), B_TRANSLATE("Close"));
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();
}

View File

@ -1,24 +0,0 @@
/*
* Copyright 2010-2011, Pier Luigi Fiorini. All rights reserved.
* Copyright 2007-2009, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ABOUT_WINDOW_H
#define _ABOUT_WINDOW_H
#include <String.h>
class AboutWindow {
public:
AboutWindow(const char* appName, const char** holders,
const char** authors, const char* extraInfo = NULL);
virtual ~AboutWindow();
void Show();
private:
BString* fAppName;
BString* fText;
};
#endif // _ABOUT_WINDOW_H