From 93f6ca70a859b8b0f4a7ae296e0150ed2c63ad53 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 10 May 2020 11:53:13 +0200 Subject: [PATCH] FileTypes: ensure there is enough space to display app info Fixes #15793 --- src/preferences/filetypes/ApplicationTypeWindow.cpp | 6 ++---- src/preferences/filetypes/ApplicationTypesWindow.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/preferences/filetypes/ApplicationTypeWindow.cpp b/src/preferences/filetypes/ApplicationTypeWindow.cpp index 0dcae2d0a3..4250f54cbd 100644 --- a/src/preferences/filetypes/ApplicationTypeWindow.cpp +++ b/src/preferences/filetypes/ApplicationTypeWindow.cpp @@ -493,14 +493,12 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, BLayoutBuilder::Grid<>(versionBox, padding / 2, padding / 2) .SetInsets(padding, padding * 2, padding, padding) - .Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0) - .Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0) + .AddTextControl(fMajorVersionControl, 0, 0) .Add(fMiddleVersionControl, 2, 0, 2) .Add(fMinorVersionControl, 4, 0, 2) .Add(varietyField, 6, 0, 3) .Add(fInternalVersionControl, 9, 0, 2) - .Add(fShortDescriptionControl->CreateLabelLayoutItem(), 0, 1) - .Add(fShortDescriptionControl->CreateTextViewLayoutItem(), 1, 1, 10) + .AddTextControl(fShortDescriptionControl, 0, 1) .Add(longLabel, 0, 2) .Add(scrollView, 1, 2, 10, 3) .SetRowWeight(3, 3); diff --git a/src/preferences/filetypes/ApplicationTypesWindow.cpp b/src/preferences/filetypes/ApplicationTypesWindow.cpp index 4f69fa85bd..3781cc5dc6 100644 --- a/src/preferences/filetypes/ApplicationTypesWindow.cpp +++ b/src/preferences/filetypes/ApplicationTypesWindow.cpp @@ -170,10 +170,6 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings) fTypeListView = new MimeTypeListView("listview", "application", true, true); fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected)); fTypeListView->SetInvocationMessage(new BMessage(kMsgTypeInvoked)); - // TODO: this isn't the perfect solution, but otherwise the window contents - // will jump chaotically - fTypeListView->SetExplicitMinSize(BSize(200, B_SIZE_UNSET)); - fTypeListView->SetExplicitMaxSize(BSize(250, B_SIZE_UNSET)); BScrollView* scrollView = new BScrollView("scrollview", fTypeListView, B_FRAME_EVENTS | B_WILL_DRAW, false, true); @@ -193,6 +189,8 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings) fSignatureView = new StringView(B_TRANSLATE("Signature:"), NULL); fSignatureView->TextView()->SetExplicitAlignment(labelAlignment); fSignatureView->LabelView()->SetExplicitAlignment(labelAlignment); + fSignatureView->TextView()->SetExplicitMinSize(BSize( + fSignatureView->TextView()->StringWidth("M") * 42, B_SIZE_UNSET)); fPathView = new StringView(B_TRANSLATE("Path:"), NULL); fPathView->TextView()->SetExplicitAlignment(labelAlignment); fPathView->LabelView()->SetExplicitAlignment(labelAlignment);