hrev46887 adds 6 changesets to branch 'master' old head: 9046835de9260baab79fa1422096bf0f1a9509ca new head: 39d7cced9f749efa7275786c2f9c4c11ff187196 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=39d7cce+%5E9046835 ---------------------------------------------------------------------------- 5da0005: 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. bb322d3: BMenuField: Draw everything on resize * The label might be truncated, in which case the entire width needs to be redrawn when the menu field shrinks or grows. * Invalidating the border in the parent looked a bit weird. Simplified. 1e35b8f: PackageInstaller: Handle aborting the file panel * Select the first item and reset the path. 51f3488: PackageInstaller: More robust way to select destination... ... after file panel is cancelled. 1835c16: PackageInstaller: Disable debug output of scripts 39d7cce: PackageInstaller: Ignore uninstall-error before install [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- 4 files changed, 52 insertions(+), 27 deletions(-) src/apps/packageinstaller/PackageInstall.cpp | 2 +- src/apps/packageinstaller/PackageItem.cpp | 2 +- src/apps/packageinstaller/PackageView.cpp | 53 ++++++++++++++++++++---- src/kits/interface/BMCPrivate.cpp | 22 +++------- ############################################################################ Commit: 5da00053491bf01fe04f33fd302b064e3d87f958 URL: http://cgit.haiku-os.org/haiku/commit/?id=5da0005 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 21:32:27 2014 UTC 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. ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index 76e9aaa..039be82 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -477,10 +477,15 @@ PackageView::_InitView() "install type description", fontHeight * 3); fInstallTypeDescriptionView->MakeEditable(false); fInstallTypeDescriptionView->MakeSelectable(false); + fInstallTypeDescriptionView->SetInsets(8, 0, 0, 0); + // Left inset needs to match BMenuField text offset fInstallTypeDescriptionView->SetText( B_TRANSLATE("No installation type selected")); fInstallTypeDescriptionView->SetViewColor( 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( "install type description scroll view", fInstallTypeDescriptionView, @@ -494,17 +499,27 @@ PackageView::_InitView() fInstall = new BButton("install_button", B_TRANSLATE("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 BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(descriptionScrollView) .AddGrid() - .AddMenuField(fDestField, 0, 0, B_ALIGN_RIGHT) - .AddMenuField(installType, 0, 1, B_ALIGN_RIGHT) - .Add(installTypeScrollView, 0, 2, 2) - .End() - .AddGroup(B_HORIZONTAL) - .AddGlue() - .Add(fInstall) + .Add(typeLabelItem, 0, 0) + .Add(typeMenuItem, 1, 0) + .AddGlue(2, 0) + .Add(installTypeScrollView, 1, 1, 2) + .Add(destFieldLabelItem, 0, 2) + .Add(destFieldMenuItem, 1, 2) + .Add(fInstall, 2, 2) .End() .SetInsets(B_USE_DEFAULT_SPACING) ; @@ -556,7 +571,11 @@ PackageView::_InstallTypeChanged(int32 index) if (profile == NULL) return B_ERROR; - fInstallTypeDescriptionView->SetText(profile->description.String()); + BString typeDescription = profile->description; + if (typeDescription.IsEmpty()) + typeDescription = profile->name; + + fInstallTypeDescriptionView->SetText(typeDescription.String()); BPath path; BVolume volume; ############################################################################ Commit: bb322d35003f8cb1b51fa772c83f8461d1295771 URL: http://cgit.haiku-os.org/haiku/commit/?id=bb322d3 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 21:50:07 2014 UTC BMenuField: Draw everything on resize * The label might be truncated, in which case the entire width needs to be redrawn when the menu field shrinks or grows. * Invalidating the border in the parent looked a bit weird. Simplified. ---------------------------------------------------------------------------- diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 68cf9af..632ac74 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -134,6 +134,8 @@ _BMCMenuBar_::AttachedToWindow() SetLowColor(Parent()->LowColor()); else SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR)); + + fPreviousWidth = Bounds().Width(); } @@ -174,8 +176,7 @@ _BMCMenuBar_::Draw(BRect updateRect) void _BMCMenuBar_::FrameResized(float width, float height) { - // we need to take care of resizing and cleaning up - // the parent menu field + // we need to take care of cleaning up the parent menu field float diff = width - fPreviousWidth; fPreviousWidth = width; @@ -185,24 +186,13 @@ _BMCMenuBar_::FrameResized(float width, float height) // clean up the dirty right border of // the menu field when enlarging dirty.right = Frame().right + kVMargin; - dirty.left = dirty.left - diff - kVMargin * 2; + dirty.left = dirty.right - diff - kVMargin * 2; fMenuField->Invalidate(dirty); - - // clean up the arrow part - dirty = Bounds(); - dirty.left = dirty.right - diff - kPopUpIndicatorWidth; - Invalidate(dirty); } else if (diff < 0) { // clean up the dirty right line of // the menu field when shrinking dirty.left = Frame().right - kVMargin; - dirty.right = dirty.left - diff + kVMargin * 2; fMenuField->Invalidate(dirty); - - // clean up the arrow part - dirty = Bounds(); - dirty.left = dirty.right - kPopUpIndicatorWidth; - Invalidate(dirty); } } @@ -299,7 +289,7 @@ _BMCMenuBar_::MaxSize() void _BMCMenuBar_::_Init() { - SetFlags(Flags() | B_FRAME_EVENTS); + SetFlags(Flags() | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE); SetBorder(B_BORDER_CONTENTS); float left, top, right, bottom; @@ -326,6 +316,4 @@ _BMCMenuBar_::_Init() SetItemMargins(left, top, right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom); - - fPreviousWidth = Bounds().Width(); } ############################################################################ Commit: 1e35b8fc96f5c5e5d8398555a05115a8744af6d9 URL: http://cgit.haiku-os.org/haiku/commit/?id=1e35b8f Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 21:57:24 2014 UTC PackageInstaller: Handle aborting the file panel * Select the first item and reset the path. ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index 039be82..2669018 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -279,6 +279,17 @@ PackageView::MessageReceived(BMessage* message) } break; } + case B_CANCEL: + { + // File panel aborted, select first item + BMenuItem* item = fDestination->ItemAt(0); + if (item != NULL && item->Message() != NULL) { + item->SetMarked(true); + Window()->PostMessage(item->Message(), this); + } + break; + } + case B_SIMPLE_DATA: if (message->WasDropped()) { uint32 type; ############################################################################ Commit: 51f34888d923ddb28af4ce6dc6f117629a3bbc24 URL: http://cgit.haiku-os.org/haiku/commit/?id=51f3488 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 22:01:51 2014 UTC PackageInstaller: More robust way to select destination... ... after file panel is cancelled. ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageView.cpp b/src/apps/packageinstaller/PackageView.cpp index 2669018..3e28a6e 100644 --- a/src/apps/packageinstaller/PackageView.cpp +++ b/src/apps/packageinstaller/PackageView.cpp @@ -281,11 +281,18 @@ PackageView::MessageReceived(BMessage* message) } case B_CANCEL: { - // File panel aborted, select first item - BMenuItem* item = fDestination->ItemAt(0); - if (item != NULL && item->Message() != NULL) { - item->SetMarked(true); - Window()->PostMessage(item->Message(), this); + // File panel aborted, select first suitable item + for (int32 i = 0; i < fDestination->CountItems(); i++) { + BMenuItem* item = fDestination->ItemAt(i); + BMessage* message = item->Message(); + if (message == NULL) + continue; + BString path; + if (message->FindString("path", &path) == B_OK) { + fCurrentPath.SetTo(path.String()); + item->SetMarked(true); + break; + } } break; } ############################################################################ Commit: 1835c16d8e90b319794a55b441d77b321a2a7643 URL: http://cgit.haiku-os.org/haiku/commit/?id=1835c16 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 22:05:52 2014 UTC PackageInstaller: Disable debug output of scripts ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageItem.cpp b/src/apps/packageinstaller/PackageItem.cpp index f09d303..9fa3640 100644 --- a/src/apps/packageinstaller/PackageItem.cpp +++ b/src/apps/packageinstaller/PackageItem.cpp @@ -610,7 +610,7 @@ PackageScript::DoInstall(const char* path, ItemState* state) // that's more fragile... but a common source for // the rewriting of BeOS paths is needed. - printf("%s\n", script.String()); +// printf("%s\n", script.String()); BPath workingDirectory; if (path != NULL) ############################################################################ Revision: hrev46887 Commit: 39d7cced9f749efa7275786c2f9c4c11ff187196 URL: http://cgit.haiku-os.org/haiku/commit/?id=39d7cce Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Feb 18 22:06:15 2014 UTC PackageInstaller: Ignore uninstall-error before install ---------------------------------------------------------------------------- diff --git a/src/apps/packageinstaller/PackageInstall.cpp b/src/apps/packageinstaller/PackageInstall.cpp index 8028598..10fb1b7 100644 --- a/src/apps/packageinstaller/PackageInstall.cpp +++ b/src/apps/packageinstaller/PackageInstall.cpp @@ -156,7 +156,7 @@ PackageInstall::_Install() if (err != B_OK) { fprintf(stderr, "Error uninstalling previously installed " "package: %s\n", strerror(err)); - return P_MSG_I_ERROR; + // Ignore error } err = packageInfo.SetTo(info->GetName(), info->GetVersion(), true);