WIP: Create the about dialog once, hide and show, Quit() when object is destroyed.
This commit is contained in:
parent
0046f44436
commit
5b0cd98792
|
@ -24,6 +24,8 @@ class BAboutWindow : public BWindow {
|
|||
const char* signature);
|
||||
virtual ~BAboutWindow();
|
||||
|
||||
virtual bool QuitRequested();
|
||||
|
||||
void AddDescription(const char* description);
|
||||
void AddCopyright(int32 firstCopyrightYear,
|
||||
const char* copyrightHolder,
|
||||
|
@ -40,6 +42,7 @@ class BAboutWindow : public BWindow {
|
|||
|
||||
private:
|
||||
AboutView* fAboutView;
|
||||
BHandler* fCaller;
|
||||
};
|
||||
|
||||
#endif // B_ABOUT_WINDOW_H
|
||||
|
|
|
@ -8,17 +8,19 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <AboutWindow.h>
|
||||
#include <Application.h>
|
||||
|
||||
#include "ActivityWindow.h"
|
||||
|
||||
|
||||
const char* kAppName = B_TRANSLATE_SYSTEM_NAME("ActivityMonitor");
|
||||
const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor";
|
||||
|
||||
|
||||
ActivityMonitor::ActivityMonitor()
|
||||
: BApplication(kSignature)
|
||||
{
|
||||
fWindow = new ActivityWindow();
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +32,6 @@ ActivityMonitor::~ActivityMonitor()
|
|||
void
|
||||
ActivityMonitor::ReadyToRun()
|
||||
{
|
||||
fWindow = new ActivityWindow();
|
||||
fWindow->Show();
|
||||
}
|
||||
|
||||
|
@ -52,20 +53,6 @@ ActivityMonitor::MessageReceived(BMessage* message)
|
|||
void
|
||||
ActivityMonitor::AboutRequested()
|
||||
{
|
||||
ShowAbout();
|
||||
}
|
||||
|
||||
|
||||
/*static*/ void
|
||||
ActivityMonitor::ShowAbout()
|
||||
{
|
||||
const char* kAuthors[] = {
|
||||
"Axel Dörfler",
|
||||
NULL
|
||||
};
|
||||
|
||||
BAboutWindow aboutWindow(B_TRANSLATE_SYSTEM_NAME("ActivityMonitor"), 2008, kAuthors);
|
||||
aboutWindow.Show();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#include <Application.h>
|
||||
#include <Catalog.h>
|
||||
|
||||
class BMessage;
|
||||
|
||||
class ActivityWindow;
|
||||
class BMessage;
|
||||
|
||||
#undef B_TRANSLATION_CONTEXT
|
||||
#define B_TRANSLATION_CONTEXT "ActivityWindow"
|
||||
|
@ -28,8 +29,6 @@ public:
|
|||
|
||||
virtual void AboutRequested();
|
||||
|
||||
static void ShowAbout();
|
||||
|
||||
private:
|
||||
ActivityWindow* fWindow;
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <vector>
|
||||
|
||||
#ifdef __HAIKU__
|
||||
# include <AboutWindow.h>
|
||||
# include <AbstractLayoutItem.h>
|
||||
# include <ControlLook.h>
|
||||
#endif
|
||||
|
@ -175,6 +176,7 @@ const uint32 kMsgToggleDataSource = 'tgds';
|
|||
const uint32 kMsgToggleLegend = 'tglg';
|
||||
const uint32 kMsgUpdateResolution = 'ures';
|
||||
|
||||
extern const char* kAppName;
|
||||
extern const char* kSignature;
|
||||
|
||||
|
||||
|
@ -598,6 +600,8 @@ ActivityView::~ActivityView()
|
|||
{
|
||||
delete fOffscreen;
|
||||
delete fSystemInfoHandler;
|
||||
|
||||
fAboutWindow->Quit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -614,6 +618,9 @@ ActivityView::_Init(const BMessage* settings)
|
|||
#endif
|
||||
SetViewColor(B_TRANSPARENT_COLOR);
|
||||
|
||||
fAboutWindow = new BAboutWindow(kAppName, kSignature);
|
||||
fAboutWindow->AddCopyright(2008, "Haiku, Inc.");
|
||||
|
||||
fLastRefresh = 0;
|
||||
fDrawResolution = 1;
|
||||
fZooming = false;
|
||||
|
@ -1104,7 +1111,7 @@ ActivityView::MessageReceived(BMessage* message)
|
|||
|
||||
switch (message->what) {
|
||||
case B_ABOUT_REQUESTED:
|
||||
ActivityMonitor::ShowAbout();
|
||||
fAboutWindow->Show();
|
||||
break;
|
||||
|
||||
case kMsgUpdateResolution:
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "CircularBuffer.h"
|
||||
#include "DataSource.h"
|
||||
|
||||
|
||||
class BAboutWindow;
|
||||
class BBitmap;
|
||||
class BMessageRunner;
|
||||
class Scale;
|
||||
|
@ -23,7 +25,6 @@ class SystemInfoHandler;
|
|||
class ViewHistory;
|
||||
struct data_item;
|
||||
|
||||
|
||||
class DataHistory {
|
||||
public:
|
||||
DataHistory(bigtime_t memorize, bigtime_t interval);
|
||||
|
@ -145,6 +146,8 @@ private:
|
|||
int32 fOriginalResolution;
|
||||
SystemInfoHandler* fSystemInfoHandler;
|
||||
std::map<scale_type, ::Scale*> fScales;
|
||||
|
||||
BAboutWindow* fAboutWindow;
|
||||
};
|
||||
|
||||
#endif // ACTIVITY_VIEW_H
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <FindDirectory.h>
|
||||
#include <Path.h>
|
||||
|
||||
#include "CalcView.h"
|
||||
#include "CalcWindow.h"
|
||||
|
||||
|
||||
|
@ -29,9 +30,9 @@
|
|||
#define B_TRANSLATION_CONTEXT "CalcApplication"
|
||||
|
||||
|
||||
static const char* kSettingsFileName = "DeskCalc_settings";
|
||||
const char* kAppName = B_TRANSLATE_SYSTEM_NAME("DeskCalc");
|
||||
const char* kAppSig = "application/x-vnd.Haiku-DeskCalc";
|
||||
static const char* kSettingsFileName = "DeskCalc_settings";
|
||||
const char* kAppName = B_TRANSLATE_SYSTEM_NAME("DeskCalc");
|
||||
const char* kSignature = "application/x-vnd.Haiku-DeskCalc";
|
||||
|
||||
static const float kDefaultWindowWidth = 220.0;
|
||||
static const float kDefaultWindowHeight = 140.0;
|
||||
|
@ -39,7 +40,7 @@ static const float kDefaultWindowHeight = 140.0;
|
|||
|
||||
CalcApplication::CalcApplication()
|
||||
:
|
||||
BApplication(kAppSig),
|
||||
BApplication(kSignature),
|
||||
fCalcWindow(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -67,8 +68,7 @@ CalcApplication::ReadyToRun()
|
|||
void
|
||||
CalcApplication::AboutRequested()
|
||||
{
|
||||
// TODO: implement me!
|
||||
return BApplication::AboutRequested();
|
||||
fCalcWindow->View()->MessageReceived(new BMessage(B_ABOUT_REQUESTED));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
|
||||
extern const char* kAppName;
|
||||
extern const char* kAppSig;
|
||||
extern const char* kSignature;
|
||||
|
||||
class BFile;
|
||||
class CalcWindow;
|
||||
|
|
|
@ -138,24 +138,10 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings)
|
|||
fAudioFeedbackItem(NULL),
|
||||
fOptions(new CalcOptions())
|
||||
{
|
||||
// create expression text view
|
||||
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
|
||||
AddChild(fExpressionTextView);
|
||||
|
||||
// read data from archive
|
||||
_LoadSettings(settings);
|
||||
|
||||
// tell the app server not to erase our b/g
|
||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||
|
||||
// parse calculator description
|
||||
_ParseCalcDesc(fKeypadDescription);
|
||||
|
||||
// colorize based on base color.
|
||||
_Colorize();
|
||||
|
||||
// Fetch the calc icon for compact view
|
||||
_FetchAppIcon(fCalcIcon);
|
||||
_Init(settings);
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,15 +174,7 @@ CalcView::CalcView(BMessage* archive)
|
|||
// Do not restore the follow mode, in shelfs, we never follow.
|
||||
SetResizingMode(B_FOLLOW_NONE);
|
||||
|
||||
// create expression text view
|
||||
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
|
||||
AddChild(fExpressionTextView);
|
||||
|
||||
// read data from archive
|
||||
_LoadSettings(archive);
|
||||
|
||||
// Fetch the calc icon for compact view
|
||||
_FetchAppIcon(fCalcIcon);
|
||||
_Init(archive);
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,6 +183,8 @@ CalcView::~CalcView()
|
|||
delete fKeypad;
|
||||
delete fOptions;
|
||||
free(fKeypadDescription);
|
||||
|
||||
fAboutWindow->Quit();
|
||||
}
|
||||
|
||||
|
||||
|
@ -288,7 +268,7 @@ CalcView::MessageReceived(BMessage* message)
|
|||
|
||||
// (replicant) about box requested
|
||||
case B_ABOUT_REQUESTED:
|
||||
AboutRequested();
|
||||
fAboutWindow->Show();
|
||||
break;
|
||||
|
||||
case MSG_UNFLASH_KEY:
|
||||
|
@ -296,6 +276,7 @@ CalcView::MessageReceived(BMessage* message)
|
|||
int32 key;
|
||||
if (message->FindInt32("key", &key) == B_OK)
|
||||
_FlashKey(key, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -709,20 +690,6 @@ CalcView::FrameResized(float width, float height)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
CalcView::AboutRequested()
|
||||
{
|
||||
const char* extraCopyrights[] = {
|
||||
"1997, 1998 R3 Software Ltd.",
|
||||
NULL
|
||||
};
|
||||
|
||||
BAboutWindow* about = new BAboutWindow(kAppName, kAppSig);
|
||||
about->AddCopyright(2006, "Haiku, Inc.", extraCopyrights);
|
||||
about->Show();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CalcView::Archive(BMessage* archive, bool deep) const
|
||||
{
|
||||
|
@ -735,7 +702,7 @@ CalcView::Archive(BMessage* archive, bool deep) const
|
|||
|
||||
// save app signature for replicant add-on loading
|
||||
if (ret == B_OK)
|
||||
ret = archive->AddString("add_on", kAppSig);
|
||||
ret = archive->AddString("add_on", kSignature);
|
||||
|
||||
// save all the options
|
||||
if (ret == B_OK)
|
||||
|
@ -816,73 +783,6 @@ CalcView::Paste(BMessage* message)
|
|||
}
|
||||
|
||||
|
||||
status_t
|
||||
CalcView::_LoadSettings(BMessage* archive)
|
||||
{
|
||||
if (!archive)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// record calculator description
|
||||
const char* calcDesc;
|
||||
if (archive->FindString("calcDesc", &calcDesc) < B_OK)
|
||||
calcDesc = kKeypadDescriptionBasic;
|
||||
|
||||
// save calculator description for reference
|
||||
free(fKeypadDescription);
|
||||
fKeypadDescription = strdup(calcDesc);
|
||||
|
||||
// read grid dimensions
|
||||
if (archive->FindInt16("cols", &fColumns) < B_OK)
|
||||
fColumns = 5;
|
||||
if (archive->FindInt16("rows", &fRows) < B_OK)
|
||||
fRows = 4;
|
||||
|
||||
// read color scheme
|
||||
const rgb_color* color;
|
||||
ssize_t size;
|
||||
if (archive->FindData("rgbBaseColor", B_RGB_COLOR_TYPE,
|
||||
(const void**)&color, &size) < B_OK
|
||||
|| size != sizeof(rgb_color)) {
|
||||
fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
puts("Missing rgbBaseColor from CalcView archive!\n");
|
||||
} else {
|
||||
fBaseColor = *color;
|
||||
}
|
||||
|
||||
if (archive->FindData("rgbDisplay", B_RGB_COLOR_TYPE,
|
||||
(const void**)&color, &size) < B_OK
|
||||
|| size != sizeof(rgb_color)) {
|
||||
fExpressionBGColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
puts("Missing rgbBaseColor from CalcView archive!\n");
|
||||
} else {
|
||||
fExpressionBGColor = *color;
|
||||
}
|
||||
|
||||
// load options
|
||||
fOptions->LoadSettings(archive);
|
||||
|
||||
// load display text
|
||||
const char* display;
|
||||
if (archive->FindString("displayText", &display) < B_OK) {
|
||||
puts("Missing expression text from CalcView archive.\n");
|
||||
} else {
|
||||
// init expression text
|
||||
fExpressionTextView->SetText(display);
|
||||
}
|
||||
|
||||
// load expression history
|
||||
fExpressionTextView->LoadSettings(archive);
|
||||
|
||||
// parse calculator description
|
||||
_ParseCalcDesc(fKeypadDescription);
|
||||
|
||||
// colorize based on base color.
|
||||
_Colorize();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CalcView::SaveSettings(BMessage* archive) const
|
||||
{
|
||||
|
@ -1068,6 +968,99 @@ CalcView::SetKeypadMode(uint8 mode)
|
|||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
CalcView::_Init(BMessage* settings)
|
||||
{
|
||||
// create the about window
|
||||
const char* extraCopyrights[] = {
|
||||
"1997, 1998 R3 Software Ltd.",
|
||||
NULL
|
||||
};
|
||||
|
||||
fAboutWindow = new BAboutWindow(kAppName, kSignature);
|
||||
fAboutWindow->AddCopyright(2006, "Haiku, Inc.",
|
||||
extraCopyrights);
|
||||
|
||||
// create expression text view
|
||||
fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this);
|
||||
AddChild(fExpressionTextView);
|
||||
|
||||
// read data from archive
|
||||
_LoadSettings(settings);
|
||||
|
||||
// fetch the calc icon for compact view
|
||||
_FetchAppIcon(fCalcIcon);
|
||||
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
CalcView::_LoadSettings(BMessage* archive)
|
||||
{
|
||||
if (!archive)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// record calculator description
|
||||
const char* calcDesc;
|
||||
if (archive->FindString("calcDesc", &calcDesc) < B_OK)
|
||||
calcDesc = kKeypadDescriptionBasic;
|
||||
|
||||
// save calculator description for reference
|
||||
free(fKeypadDescription);
|
||||
fKeypadDescription = strdup(calcDesc);
|
||||
|
||||
// read grid dimensions
|
||||
if (archive->FindInt16("cols", &fColumns) < B_OK)
|
||||
fColumns = 5;
|
||||
if (archive->FindInt16("rows", &fRows) < B_OK)
|
||||
fRows = 4;
|
||||
|
||||
// read color scheme
|
||||
const rgb_color* color;
|
||||
ssize_t size;
|
||||
if (archive->FindData("rgbBaseColor", B_RGB_COLOR_TYPE,
|
||||
(const void**)&color, &size) < B_OK
|
||||
|| size != sizeof(rgb_color)) {
|
||||
fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
puts("Missing rgbBaseColor from CalcView archive!\n");
|
||||
} else {
|
||||
fBaseColor = *color;
|
||||
}
|
||||
|
||||
if (archive->FindData("rgbDisplay", B_RGB_COLOR_TYPE,
|
||||
(const void**)&color, &size) < B_OK
|
||||
|| size != sizeof(rgb_color)) {
|
||||
fExpressionBGColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
puts("Missing rgbBaseColor from CalcView archive!\n");
|
||||
} else {
|
||||
fExpressionBGColor = *color;
|
||||
}
|
||||
|
||||
// load options
|
||||
fOptions->LoadSettings(archive);
|
||||
|
||||
// load display text
|
||||
const char* display;
|
||||
if (archive->FindString("displayText", &display) < B_OK) {
|
||||
puts("Missing expression text from CalcView archive.\n");
|
||||
} else {
|
||||
// init expression text
|
||||
fExpressionTextView->SetText(display);
|
||||
}
|
||||
|
||||
// load expression history
|
||||
fExpressionTextView->LoadSettings(archive);
|
||||
|
||||
// parse calculator description
|
||||
_ParseCalcDesc(fKeypadDescription);
|
||||
|
||||
// colorize based on base color.
|
||||
_Colorize();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CalcView::_ParseCalcDesc(const char* keypadDescription)
|
||||
{
|
||||
|
@ -1372,7 +1365,7 @@ void
|
|||
CalcView::_FetchAppIcon(BBitmap* into)
|
||||
{
|
||||
entry_ref appRef;
|
||||
status_t status = be_roster->FindApp(kAppSig, &appRef);
|
||||
status_t status = be_roster->FindApp(kSignature, &appRef);
|
||||
if (status == B_OK) {
|
||||
BFile file(&appRef, B_READ_ONLY);
|
||||
BAppFileInfo appInfo(&file);
|
||||
|
|
|
@ -34,6 +34,7 @@ static const float kMaximumHeightBasic = 400.0f;
|
|||
class BAboutWindow;
|
||||
class BString;
|
||||
class BMenuItem;
|
||||
class BMessage;
|
||||
class BPopUpMenu;
|
||||
class CalcOptions;
|
||||
class CalcOptionsWindow;
|
||||
|
@ -64,9 +65,6 @@ class CalcView : public BView {
|
|||
virtual void ResizeTo(float width, float height);
|
||||
virtual void FrameResized(float width, float height);
|
||||
|
||||
// Present about box for view (replicant).
|
||||
virtual void AboutRequested();
|
||||
|
||||
// Archive this view.
|
||||
virtual status_t Archive(BMessage* archive, bool deep) const;
|
||||
|
||||
|
@ -102,6 +100,8 @@ class CalcView : public BView {
|
|||
void SetKeypadMode(uint8 mode);
|
||||
|
||||
private:
|
||||
void _Init(BMessage* settings);
|
||||
status_t _LoadSettings(BMessage* archive);
|
||||
void _ParseCalcDesc(const char* keypadDescription);
|
||||
|
||||
void _PressKey(int key);
|
||||
|
@ -121,8 +121,6 @@ class CalcView : public BView {
|
|||
|
||||
void _FetchAppIcon(BBitmap* into);
|
||||
|
||||
status_t _LoadSettings(BMessage* archive);
|
||||
|
||||
// grid dimensions
|
||||
int16 fColumns;
|
||||
int16 fRows;
|
||||
|
@ -165,6 +163,9 @@ class CalcView : public BView {
|
|||
|
||||
// calculator options.
|
||||
CalcOptions* fOptions;
|
||||
|
||||
// about window for replicant
|
||||
BAboutWindow* fAboutWindow;
|
||||
};
|
||||
|
||||
#endif // _CALC_VIEW_H
|
||||
|
|
|
@ -31,6 +31,8 @@ class CalcWindow : public BWindow {
|
|||
void SetFrame(BRect frame,
|
||||
bool forceCenter = false);
|
||||
|
||||
CalcView* View() const { return fCalcView; };
|
||||
|
||||
private:
|
||||
CalcView* fCalcView;
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <SystemCatalog.h>
|
||||
#include <TextView.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
|
||||
static const float kStripeWidth = 30.0;
|
||||
|
@ -80,8 +81,12 @@ StripeView::StripeView(BBitmap* icon)
|
|||
BView("StripeView", B_WILL_DRAW),
|
||||
fIcon(icon)
|
||||
{
|
||||
SetExplicitMinSize(BSize(160.0, B_SIZE_UNSET));
|
||||
SetExplicitPreferredSize(BSize(160.0, B_SIZE_UNLIMITED));
|
||||
float width = 48.0f;
|
||||
if (icon != NULL)
|
||||
width += icon->Bounds().Width() - 16.0f;
|
||||
|
||||
SetExplicitMinSize(BSize(width, B_SIZE_UNSET));
|
||||
SetExplicitPreferredSize(BSize(width, B_SIZE_UNLIMITED));
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
}
|
||||
|
||||
|
@ -233,7 +238,7 @@ AboutView::AppIcon(const char* signature)
|
|||
|
||||
BAboutWindow::BAboutWindow(const char* appName, int32 firstCopyrightYear,
|
||||
const char** authors, const char* extraInfo)
|
||||
: BWindow(BRect(0.0, 0.0, 300.0, 140.0), appName, B_TITLED_WINDOW,
|
||||
: BWindow(BRect(0.0, 0.0, 200.0, 140.0), appName, B_TITLED_WINDOW,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
|
@ -261,6 +266,19 @@ BAboutWindow::~BAboutWindow()
|
|||
}
|
||||
|
||||
|
||||
bool
|
||||
BAboutWindow::QuitRequested()
|
||||
{
|
||||
while (!IsHidden())
|
||||
Hide();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
BAboutWindow::AddDescription(const char* description)
|
||||
{
|
||||
|
@ -270,8 +288,11 @@ BAboutWindow::AddDescription(const char* description)
|
|||
const char* appDesc = B_TRANSLATE_MARK(description);
|
||||
appDesc = gSystemCatalog.GetString(appDesc, "AboutWindow");
|
||||
|
||||
BString desc(appDesc);
|
||||
desc << "\n\n";
|
||||
BString desc("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
desc << "\n\n";
|
||||
|
||||
desc << appDesc;
|
||||
|
||||
fAboutView->InfoView()->Insert(desc.String());
|
||||
}
|
||||
|
@ -281,10 +302,7 @@ void
|
|||
BAboutWindow::AddCopyright(int32 firstCopyrightYear,
|
||||
const char* copyrightHolder, const char** extraCopyrights)
|
||||
{
|
||||
BString copyright(B_UTF8_COPYRIGHT " %years%");
|
||||
if (copyrightHolder != NULL)
|
||||
copyright << " " << copyrightHolder;
|
||||
|
||||
BString copyright(B_UTF8_COPYRIGHT " %years% %holder%");
|
||||
const char* firstCopyright = B_TRANSLATE_MARK(copyright.String());
|
||||
firstCopyright = gSystemCatalog.GetString(copyright, "AboutWindow");
|
||||
|
||||
|
@ -298,23 +316,29 @@ BAboutWindow::AddCopyright(int32 firstCopyrightYear,
|
|||
if (copyrightYears != currentYear)
|
||||
copyrightYears << "-" << currentYear;
|
||||
|
||||
BString text(firstCopyright);
|
||||
BString text("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
text << "\n\n";
|
||||
|
||||
// Replace the copyright year with the current year
|
||||
text << firstCopyright;
|
||||
|
||||
// Fill out the copyright year placeholder
|
||||
text.ReplaceAll("%years%", copyrightYears.String());
|
||||
|
||||
// Fill in the copyright holder placeholder
|
||||
text.ReplaceAll("%holder%", copyrightHolder);
|
||||
|
||||
// Add extra copyright strings
|
||||
if (extraCopyrights != NULL) {
|
||||
// Add optional extra copyright information
|
||||
for (int32 i = 0; extraCopyrights[i]; i++)
|
||||
text << "\n" << B_UTF8_COPYRIGHT << " " << extraCopyrights[i];
|
||||
}
|
||||
text << "\n";
|
||||
|
||||
const char* allRightsReserved = B_TRANSLATE_MARK("All Rights Reserved.");
|
||||
allRightsReserved = gSystemCatalog.GetString(allRightsReserved,
|
||||
"AboutWindow");
|
||||
text << " " << allRightsReserved << "\n\n";
|
||||
text << "\n " << allRightsReserved;
|
||||
|
||||
fAboutView->InfoView()->Insert(text.String());
|
||||
}
|
||||
|
@ -329,11 +353,14 @@ BAboutWindow::AddAuthors(const char** authors)
|
|||
const char* writtenBy = B_TRANSLATE_MARK("Written by:");
|
||||
writtenBy = gSystemCatalog.GetString(writtenBy, "AboutWindow");
|
||||
|
||||
BString text(writtenBy);
|
||||
BString text("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
text << "\n\n";
|
||||
|
||||
text << writtenBy;
|
||||
text << "\n";
|
||||
for (int32 i = 0; authors[i]; i++)
|
||||
text << " " << authors[i] << "\n";
|
||||
text << "\n";
|
||||
|
||||
fAboutView->InfoView()->Insert(text.String());
|
||||
}
|
||||
|
@ -348,11 +375,13 @@ BAboutWindow::AddSpecialThanks(const char** thanks)
|
|||
const char* specialThanks = B_TRANSLATE_MARK("Special Thanks:");
|
||||
specialThanks = gSystemCatalog.GetString(specialThanks, "AboutWindow");
|
||||
|
||||
BString text(specialThanks);
|
||||
text << "\n";
|
||||
BString text("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
text << "\n\n";
|
||||
|
||||
text << specialThanks << "\n";
|
||||
for (int32 i = 0; thanks[i]; i++)
|
||||
text << " " << thanks[i] << "\n";
|
||||
text << "\n";
|
||||
|
||||
fAboutView->InfoView()->Insert(text.String());
|
||||
}
|
||||
|
@ -366,11 +395,14 @@ BAboutWindow::AddVersionHistory(const char** history)
|
|||
|
||||
const char* versionHistory = B_TRANSLATE_MARK("Version history:");
|
||||
versionHistory = gSystemCatalog.GetString(versionHistory, "AboutWindow");
|
||||
BString text(versionHistory);
|
||||
text << "\n";
|
||||
|
||||
BString text("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
text << "\n\n";
|
||||
|
||||
text << versionHistory << "\n";
|
||||
for (int32 i = 0; history[i]; i++)
|
||||
text << " " << history[i] << "\n";
|
||||
text << "\n";
|
||||
|
||||
fAboutView->InfoView()->Insert(text.String());
|
||||
}
|
||||
|
@ -385,8 +417,11 @@ BAboutWindow::AddExtraInfo(const char* extraInfo)
|
|||
const char* appExtraInfo = B_TRANSLATE_MARK(extraInfo);
|
||||
appExtraInfo = gSystemCatalog.GetString(extraInfo, "AboutWindow");
|
||||
|
||||
BString extra(appExtraInfo);
|
||||
extra << "\n";
|
||||
BString extra("");
|
||||
if (fAboutView->InfoView()->TextLength() > 0)
|
||||
extra << "\n\n";
|
||||
|
||||
extra << appExtraInfo;
|
||||
|
||||
fAboutView->InfoView()->Insert(extra.String());
|
||||
}
|
||||
|
@ -409,7 +444,8 @@ BAboutWindow::AboutPosition(float width, float height)
|
|||
result.x = screenFrame.left + (screenFrame.Width() / 2.0) - (width / 2.0);
|
||||
|
||||
// This is probably sooo wrong, but it looks right on 1024 x 768
|
||||
result.y = screenFrame.top + (screenFrame.Height() / 4.0) - ceil(height / 3.0);
|
||||
result.y = screenFrame.top + (screenFrame.Height() / 4.0)
|
||||
- ceil(height / 3.0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue