Move the info button's general informative text to the main view, and set as intro screen. Remove About window. Fix memory leak of config views. Replace the info BAlert's tab characters with a single space for more consistent spacing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41249 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9b4ad591d8
commit
eb88c867c1
@ -44,27 +44,6 @@ DataTranslationsApplication::~DataTranslationsApplication()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DataTranslationsApplication::AboutRequested()
|
||||
{
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("About"),
|
||||
B_TRANSLATE("DataTranslations\n\twritten by Oliver Siebenmarck and"
|
||||
" others\n\tCopyright 2002-2010, Haiku Inc. All rights reserved.\n"),
|
||||
B_TRANSLATE("OK"));
|
||||
|
||||
BTextView* view = alert->TextView();
|
||||
view->SetStylable(true);
|
||||
|
||||
BFont font;
|
||||
view->GetFont(&font);
|
||||
font.SetSize(18);
|
||||
font.SetFace(B_BOLD_FACE);
|
||||
view->SetFontAndColor(0, 16, &font);
|
||||
|
||||
alert->Go();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DataTranslationsApplication::_InstallError(const char* name, status_t status)
|
||||
{
|
||||
|
@ -22,7 +22,6 @@ public:
|
||||
virtual ~DataTranslationsApplication();
|
||||
|
||||
virtual void RefsReceived(BMessage* message);
|
||||
virtual void AboutRequested();
|
||||
|
||||
private:
|
||||
void _InstallError(const char* name, status_t status);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Entry.h>
|
||||
#include <GroupView.h>
|
||||
#include <IconView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
@ -138,10 +139,11 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
|
||||
|
||||
BTranslatorRoster* roster = BTranslatorRoster::Default();
|
||||
|
||||
// fConfigView is NULL the first time this function
|
||||
// is called, prevent a segment fault
|
||||
if (fConfigView)
|
||||
if (fConfigView) {
|
||||
fRightBox->RemoveChild(fConfigView);
|
||||
delete fConfigView;
|
||||
fConfigView = NULL;
|
||||
}
|
||||
|
||||
BMessage emptyMsg;
|
||||
BRect rect(0, 0, 200, 233);
|
||||
@ -159,6 +161,33 @@ DataTranslationsWindow::_ShowConfigView(int32 id)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DataTranslationsWindow::_ShowInfoView()
|
||||
{
|
||||
if (fConfigView) {
|
||||
fRightBox->RemoveChild(fConfigView);
|
||||
delete fConfigView;
|
||||
fConfigView = NULL;
|
||||
}
|
||||
|
||||
BTextView* view = new BTextView("info text");
|
||||
view->MakeEditable(false);
|
||||
view->MakeSelectable(false);
|
||||
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
view->SetText(B_TRANSLATE(
|
||||
"Use this control panel to set default values for translators, "
|
||||
"to be used when no other settings are specified by an application."));
|
||||
|
||||
BGroupView* group = new BGroupView(B_VERTICAL);
|
||||
group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
group->AddChild(view);
|
||||
float spacing = be_control_look->DefaultItemSpacing();
|
||||
group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
|
||||
fRightBox->AddChild(group);
|
||||
fConfigView = group;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DataTranslationsWindow::_SetupViews()
|
||||
{
|
||||
@ -186,6 +215,7 @@ DataTranslationsWindow::_SetupViews()
|
||||
// Add the translator info button
|
||||
fButton = new BButton("info", B_TRANSLATE("Info" B_UTF8_ELLIPSIS),
|
||||
new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
|
||||
fButton->SetEnabled(false);
|
||||
|
||||
// Populate the translators list view
|
||||
_PopulateListView();
|
||||
@ -202,7 +232,7 @@ DataTranslationsWindow::_SetupViews()
|
||||
.Add(fButton, 2, 1);
|
||||
|
||||
fTranslatorListView->MakeFocus();
|
||||
fTranslatorListView->Select(0);
|
||||
_ShowInfoView();
|
||||
}
|
||||
|
||||
|
||||
@ -228,10 +258,11 @@ DataTranslationsWindow::_ShowInfoAlert(int32 id)
|
||||
BString message;
|
||||
// Convert the version number into a readable format
|
||||
snprintf(message.LockBuffer(2048), 2048,
|
||||
B_TRANSLATE("Name:\t%s \nVersion:\t%ld.%ld.%ld\nInfo:\t%s\n\nPath:\n%s\n"),
|
||||
name, B_TRANSLATION_MAJOR_VERSION(version),
|
||||
B_TRANSLATION_MINOR_VERSION(version),
|
||||
B_TRANSLATION_REVISION_VERSION(version), info, path.Path());
|
||||
B_TRANSLATE("Name: %s \nVersion: %ld.%ld.%ld\n\n"
|
||||
"Info:\n%s\n\nPath:\n%s\n"),
|
||||
name, B_TRANSLATION_MAJOR_VERSION(version),
|
||||
B_TRANSLATION_MINOR_VERSION(version),
|
||||
B_TRANSLATION_REVISION_VERSION(version), info, path.Path());
|
||||
message.UnlockBuffer();
|
||||
|
||||
BAlert* alert = new BAlert(B_TRANSLATE("Info"), message.String(),
|
||||
@ -262,17 +293,8 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
|
||||
case kMsgTranslatorInfo:
|
||||
{
|
||||
int32 selected = fTranslatorListView->CurrentSelection(0);
|
||||
if (selected < 0) {
|
||||
// If no translator is selected, show a message explaining
|
||||
// what the config panel is for
|
||||
(new BAlert(B_TRANSLATE("Panel Info"),
|
||||
B_TRANSLATE("Translation Settings\n\n"
|
||||
"Use this control panel to set values that various\n"
|
||||
"translators use when no other settings are specified\n"
|
||||
"in the application."),
|
||||
B_TRANSLATE("OK")))->Go();
|
||||
if (selected < 0)
|
||||
break;
|
||||
}
|
||||
|
||||
TranslatorItem* item = fTranslatorListView->TranslatorAt(selected);
|
||||
if (item != NULL)
|
||||
@ -291,6 +313,7 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
|
||||
fIconView->DrawIcon(false);
|
||||
fButton->SetEnabled(false);
|
||||
fRightBox->RemoveChild(fConfigView);
|
||||
_ShowInfoView();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -351,4 +374,3 @@ DataTranslationsWindow::MessageReceived(BMessage* message)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
void _ShowInfoView();
|
||||
status_t _GetTranslatorInfo(int32 id, const char*& name,
|
||||
const char*& info, int32& version, BPath& path);
|
||||
void _ShowInfoAlert(int32 id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user