PackageInstaller: Improved main window layout
* Moved "Install to:" besides the "Install" button again. * Don't right-align menu field labels. * Give the install type description some default text when no description is given. Give it a smaller font, align with the type menu.
This commit is contained in:
@@ -477,10 +477,15 @@ PackageView::_InitView()
|
|||||||
"install type description", fontHeight * 3);
|
"install type description", fontHeight * 3);
|
||||||
fInstallTypeDescriptionView->MakeEditable(false);
|
fInstallTypeDescriptionView->MakeEditable(false);
|
||||||
fInstallTypeDescriptionView->MakeSelectable(false);
|
fInstallTypeDescriptionView->MakeSelectable(false);
|
||||||
|
fInstallTypeDescriptionView->SetInsets(8, 0, 0, 0);
|
||||||
|
// Left inset needs to match BMenuField text offset
|
||||||
fInstallTypeDescriptionView->SetText(
|
fInstallTypeDescriptionView->SetText(
|
||||||
B_TRANSLATE("No installation type selected"));
|
B_TRANSLATE("No installation type selected"));
|
||||||
fInstallTypeDescriptionView->SetViewColor(
|
fInstallTypeDescriptionView->SetViewColor(
|
||||||
ui_color(B_PANEL_BACKGROUND_COLOR));
|
ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
BFont font(be_plain_font);
|
||||||
|
font.SetSize(ceilf(font.Size() * 0.85));
|
||||||
|
fInstallTypeDescriptionView->SetFontAndColor(&font);
|
||||||
|
|
||||||
BScrollView* installTypeScrollView = new BScrollView(
|
BScrollView* installTypeScrollView = new BScrollView(
|
||||||
"install type description scroll view", fInstallTypeDescriptionView,
|
"install type description scroll view", fInstallTypeDescriptionView,
|
||||||
@@ -494,17 +499,27 @@ PackageView::_InitView()
|
|||||||
fInstall = new BButton("install_button", B_TRANSLATE("Install"),
|
fInstall = new BButton("install_button", B_TRANSLATE("Install"),
|
||||||
new BMessage(P_MSG_INSTALL));
|
new BMessage(P_MSG_INSTALL));
|
||||||
|
|
||||||
|
BLayoutItem* destFieldLabelItem = fDestField->CreateLabelLayoutItem();
|
||||||
|
BLayoutItem* destFieldMenuItem = fDestField->CreateMenuBarLayoutItem();
|
||||||
|
|
||||||
|
BLayoutItem* typeLabelItem = installType->CreateLabelLayoutItem();
|
||||||
|
BLayoutItem* typeMenuItem = installType->CreateMenuBarLayoutItem();
|
||||||
|
|
||||||
|
float forcedMinWidth = be_plain_font->StringWidth("XXX") * 5;
|
||||||
|
destFieldMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
|
||||||
|
typeMenuItem->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
|
||||||
|
|
||||||
// Build the layout
|
// Build the layout
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||||
.Add(descriptionScrollView)
|
.Add(descriptionScrollView)
|
||||||
.AddGrid()
|
.AddGrid()
|
||||||
.AddMenuField(fDestField, 0, 0, B_ALIGN_RIGHT)
|
.Add(typeLabelItem, 0, 0)
|
||||||
.AddMenuField(installType, 0, 1, B_ALIGN_RIGHT)
|
.Add(typeMenuItem, 1, 0)
|
||||||
.Add(installTypeScrollView, 0, 2, 2)
|
.AddGlue(2, 0)
|
||||||
.End()
|
.Add(installTypeScrollView, 1, 1, 2)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.Add(destFieldLabelItem, 0, 2)
|
||||||
.AddGlue()
|
.Add(destFieldMenuItem, 1, 2)
|
||||||
.Add(fInstall)
|
.Add(fInstall, 2, 2)
|
||||||
.End()
|
.End()
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
;
|
;
|
||||||
@@ -556,7 +571,11 @@ PackageView::_InstallTypeChanged(int32 index)
|
|||||||
if (profile == NULL)
|
if (profile == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fInstallTypeDescriptionView->SetText(profile->description.String());
|
BString typeDescription = profile->description;
|
||||||
|
if (typeDescription.IsEmpty())
|
||||||
|
typeDescription = profile->name;
|
||||||
|
|
||||||
|
fInstallTypeDescriptionView->SetText(typeDescription.String());
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
BVolume volume;
|
BVolume volume;
|
||||||
|
|||||||
Reference in New Issue
Block a user