PackageInstaller: Implement John's suggestions

* Rename "Install" button to "Begin" so it matches most packages instructions
   at least for the English locale.
 * Restore right-alignment of the menu field labels.
 * Also move the "Begin" button onto its own line to allow more of the target
   folder to be readable on the menu field.
This commit is contained in:
Stephan Aßmus
2014-02-19 22:23:56 +01:00
parent b6bd9f7b46
commit e75f469d34
2 changed files with 22 additions and 16 deletions
+21 -15
View File
@@ -119,7 +119,7 @@ PackageView::AttachedToWindow()
title.ReplaceAll("%name%", name); title.ReplaceAll("%name%", name);
} }
parent->SetTitle(title.String()); parent->SetTitle(title.String());
fInstall->SetTarget(this); fBeginButton->SetTarget(this);
fOpenPanel->SetTarget(BMessenger(this)); fOpenPanel->SetTarget(BMessenger(this));
fInstallTypes->SetTargetForItems(this); fInstallTypes->SetTargetForItems(this);
@@ -162,7 +162,7 @@ PackageView::MessageReceived(BMessage* message)
switch (message->what) { switch (message->what) {
case P_MSG_INSTALL: case P_MSG_INSTALL:
{ {
fInstall->SetEnabled(false); fBeginButton->SetEnabled(false);
fInstallTypes->SetEnabled(false); fInstallTypes->SetEnabled(false);
fDestination->SetEnabled(false); fDestination->SetEnabled(false);
fStatusWindow->Show(); fStatusWindow->Show();
@@ -201,7 +201,7 @@ PackageView::MessageReceived(BMessage* message)
notify->Go(); notify->Go();
fStatusWindow->Hide(); fStatusWindow->Hide();
fInstall->SetEnabled(true); fBeginButton->SetEnabled(true);
fInstallTypes->SetEnabled(true); fInstallTypes->SetEnabled(true);
fDestination->SetEnabled(true); fDestination->SetEnabled(true);
fInstallProcess.Stop(); fInstallProcess.Stop();
@@ -221,7 +221,7 @@ PackageView::MessageReceived(BMessage* message)
notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE);
notify->Go(); notify->Go();
fStatusWindow->Hide(); fStatusWindow->Hide();
fInstall->SetEnabled(true); fBeginButton->SetEnabled(true);
fInstallTypes->SetEnabled(true); fInstallTypes->SetEnabled(true);
fDestination->SetEnabled(true); fDestination->SetEnabled(true);
fInstallProcess.Stop(); fInstallProcess.Stop();
@@ -243,7 +243,7 @@ PackageView::MessageReceived(BMessage* message)
notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE); notify->SetFlags(notify->Flags() | B_CLOSE_ON_ESCAPE);
notify->Go(); notify->Go();
fStatusWindow->Hide(); fStatusWindow->Hide();
fInstall->SetEnabled(true); fBeginButton->SetEnabled(true);
fInstallTypes->SetEnabled(true); fInstallTypes->SetEnabled(true);
fDestination->SetEnabled(true); fDestination->SetEnabled(true);
fInstallProcess.Stop(); fInstallProcess.Stop();
@@ -257,7 +257,7 @@ PackageView::MessageReceived(BMessage* message)
// We actually use this message only when a post installation script // We actually use this message only when a post installation script
// is running and we want to kill it while it's still running // is running and we want to kill it while it's still running
fStatusWindow->Hide(); fStatusWindow->Hide();
fInstall->SetEnabled(true); fBeginButton->SetEnabled(true);
fInstallTypes->SetEnabled(true); fInstallTypes->SetEnabled(true);
fDestination->SetEnabled(true); fDestination->SetEnabled(true);
fInstallProcess.Stop(); fInstallProcess.Stop();
@@ -524,35 +524,41 @@ PackageView::_InitView()
fDestField = new BMenuField("install_to", B_TRANSLATE("Install to:"), fDestField = new BMenuField("install_to", B_TRANSLATE("Install to:"),
fDestination); fDestination);
fInstall = new BButton("install_button", B_TRANSLATE("Install"), fBeginButton = new BButton("begin_button", B_TRANSLATE("Begin"),
new BMessage(P_MSG_INSTALL)); new BMessage(P_MSG_INSTALL));
BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem();
BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem();
BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem(); BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem();
BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem(); BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem();
BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem();
BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem();
float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5; float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5;
destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET)); destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET)); typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
BAlignment labelAlignment(B_ALIGN_RIGHT, B_ALIGN_VERTICAL_UNSET);
typeLabelItem->SetExplicitAlignment(labelAlignment);
destFieldLabelItem->SetExplicitAlignment(labelAlignment);
// Build the layout // Build the layout
BLayoutBuilder::Group<>(this, B_VERTICAL) BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(descriptionScrollView) .Add(descriptionScrollView)
.AddGrid() .AddGrid(B_USE_SMALL_SPACING, B_USE_DEFAULT_SPACING)
.Add(typeLabelItem, 0, 0) .Add(typeLabelItem, 0, 0)
.Add(typeMenuItem, 1, 0) .Add(typeMenuItem, 1, 0)
.AddGlue(2, 0) .Add(installTypeScrollView, 1, 1)
.Add(installTypeScrollView, 1, 1, 2)
.Add(destFieldLabelItem, 0, 2) .Add(destFieldLabelItem, 0, 2)
.Add(destFieldMenuItem, 1, 2) .Add(destFieldMenuItem, 1, 2)
.Add(fInstall, 2, 2) .End()
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(fBeginButton)
.End() .End()
.SetInsets(B_USE_DEFAULT_SPACING) .SetInsets(B_USE_DEFAULT_SPACING)
; ;
fInstall->MakeDefault(true); fBeginButton->MakeDefault(true);
} }
+1 -1
View File
@@ -71,7 +71,7 @@ private:
BTextView* fInstallTypeDescriptionView; BTextView* fInstallTypeDescriptionView;
BPopUpMenu* fDestination; BPopUpMenu* fDestination;
BMenuField* fDestField; BMenuField* fDestField;
BButton* fInstall; BButton* fBeginButton;
BFilePanel* fOpenPanel; BFilePanel* fOpenPanel;
BPath fCurrentPath; BPath fCurrentPath;