SoftwareUpdater: Move "More details" into settings window

This unclutters the main window by moving the "Settings…" button to
the left and the "Show more details" checkbox into the settings
window.

Added standard shortcut ALT+, to open the settings window.

Addresses #20066.

Change-Id: I9b954b763fc84a83c9f31b3c7175ebd34969a261
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11251
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: nephele nephele <[email protected]>
This commit is contained in:
Humdinger
2026-07-15 05:42:17 +00:00
committed by humdinger humdinger
parent b4bc72fdc1
commit 05fd080554
2 changed files with 19 additions and 33 deletions
@@ -82,10 +82,6 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
fScrollView = new BScrollView("scrollview", fListView, B_WILL_DRAW, fScrollView = new BScrollView("scrollview", fListView, B_WILL_DRAW,
false, true); false, true);
fDetailsCheckbox = new BCheckBox("detailscheckbox",
B_TRANSLATE("Show more details"),
new BMessage(kMsgMoreDetailsToggle));
BFont font; BFont font;
fHeaderView->GetFont(&font); fHeaderView->GetFont(&font);
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
@@ -106,9 +102,8 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
.End() .End()
.AddStrut(B_USE_SMALL_SPACING) .AddStrut(B_USE_SMALL_SPACING)
.AddGroup(new BGroupView(B_HORIZONTAL)) .AddGroup(new BGroupView(B_HORIZONTAL))
.Add(fDetailsCheckbox)
.AddGlue()
.Add(fSettingsButton) .Add(fSettingsButton)
.AddGlue()
.Add(fCancelButton) .Add(fCancelButton)
.Add(fUpdateButton) .Add(fUpdateButton)
.Add(fRebootButton) .Add(fRebootButton)
@@ -123,12 +118,13 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
fCancelButtonLayoutItem = layout_item_for(fCancelButton); fCancelButtonLayoutItem = layout_item_for(fCancelButton);
fUpdateButtonLayoutItem = layout_item_for(fUpdateButton); fUpdateButtonLayoutItem = layout_item_for(fUpdateButton);
fRebootButtonLayoutItem = layout_item_for(fRebootButton); fRebootButtonLayoutItem = layout_item_for(fRebootButton);
fDetailsCheckboxLayoutItem = layout_item_for(fDetailsCheckbox);
_SetState(STATE_DISPLAY_STATUS); _SetState(STATE_DISPLAY_STATUS);
CenterOnScreen(); CenterOnScreen();
SetFlags(Flags() ^ B_AUTO_UPDATE_SIZE_LIMITS); SetFlags(Flags() ^ B_AUTO_UPDATE_SIZE_LIMITS);
AddShortcut(',', B_COMMAND_KEY, new BMessage(kMsgSettings));
// Prevent resizing for now // Prevent resizing for now
fDefaultRect = Bounds(); fDefaultRect = Bounds();
SetSizeLimits(fDefaultRect.Width(), fDefaultRect.Width(), SetSizeLimits(fDefaultRect.Width(), fDefaultRect.Width(),
@@ -141,6 +137,7 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
fSettingsReadStatus = _ReadSettings(fInitialSettings); fSettingsReadStatus = _ReadSettings(fInitialSettings);
} }
fAutoCleanUpAdminDirectory = fInitialSettings.GetBool(kKeyAutoCleanUpAdminDirectory, true); fAutoCleanUpAdminDirectory = fInitialSettings.GetBool(kKeyAutoCleanUpAdminDirectory, true);
fShowMoreDetails = fInitialSettings.GetBool(kKeyShowDetails, true);
if (fSettingsReadStatus == B_OK) { if (fSettingsReadStatus == B_OK) {
// Move to saved setting position // Move to saved setting position
@@ -390,7 +387,8 @@ SoftwareUpdaterWindow::MessageReceived(BMessage* message)
} }
case kMsgMoreDetailsToggle: case kMsgMoreDetailsToggle:
fListView->SetMoreDetails(fDetailsCheckbox->Value() != 0); fShowMoreDetails = (message->GetInt32("be:value", 0) != 0);
fListView->SetMoreDetails(fShowMoreDetails);
PostMessage(kMsgSetZoomLimits); PostMessage(kMsgSetZoomLimits);
_WriteSettings(); _WriteSettings();
break; break;
@@ -407,8 +405,7 @@ SoftwareUpdaterWindow::MessageReceived(BMessage* message)
float controlHeight; float controlHeight;
if (fUpdateButtonLayoutItem->IsVisible()) if (fUpdateButtonLayoutItem->IsVisible())
fUpdateButton->GetPreferredSize(NULL, &controlHeight); fUpdateButton->GetPreferredSize(NULL, &controlHeight);
else
fDetailsCheckbox->GetPreferredSize(NULL, &controlHeight);
// Calculate height and width values // Calculate height and width values
float zoomHeight = fZoomHeightBaseline + zoomPoint.y float zoomHeight = fZoomHeightBaseline + zoomPoint.y
+ controlHeight; + controlHeight;
@@ -613,7 +610,6 @@ SoftwareUpdaterWindow::_SetState(uint32 state)
fProgressLayoutItem->SetVisible(false); fProgressLayoutItem->SetVisible(false);
fPackagesLayoutItem->SetVisible(false); fPackagesLayoutItem->SetVisible(false);
fSettingsButtonLayoutItem->SetVisible(false); fSettingsButtonLayoutItem->SetVisible(false);
fDetailsCheckboxLayoutItem->SetVisible(false);
fCancelButtonLayoutItem->SetVisible(false); fCancelButtonLayoutItem->SetVisible(false);
fRebootButtonLayoutItem->SetVisible(false); fRebootButtonLayoutItem->SetVisible(false);
} }
@@ -631,31 +627,18 @@ SoftwareUpdaterWindow::_SetState(uint32 state)
if (fCurrentState == STATE_GET_CONFIRMATION) { if (fCurrentState == STATE_GET_CONFIRMATION) {
fPackagesLayoutItem->SetVisible(true); fPackagesLayoutItem->SetVisible(true);
fSettingsButtonLayoutItem->SetVisible(true); fSettingsButtonLayoutItem->SetVisible(true);
fDetailsCheckboxLayoutItem->SetVisible(true); if (fSettingsReadStatus == B_OK)
if (fSettingsReadStatus == B_OK) { fListView->SetMoreDetails(fShowMoreDetails);
bool showMoreDetails;
status_t result = fInitialSettings.FindBool(kKeyShowDetails,
&showMoreDetails);
if (result == B_OK) {
fDetailsCheckbox->SetValue(showMoreDetails ? 1 : 0);
fListView->SetMoreDetails(showMoreDetails);
}
}
} else if (fCurrentState == STATE_FINAL_MESSAGE) { } else if (fCurrentState == STATE_FINAL_MESSAGE) {
fPackagesLayoutItem->SetVisible(false); fPackagesLayoutItem->SetVisible(false);
fSettingsButtonLayoutItem->SetVisible(false); fSettingsButtonLayoutItem->SetVisible(false);
fDetailsCheckboxLayoutItem->SetVisible(false);
} }
// Progress bar and string view // Progress bar and string view
// Hide detail text while showing status bar if (fCurrentState == STATE_DISPLAY_PROGRESS)
if (fCurrentState == STATE_DISPLAY_PROGRESS) {
fDetailsLayoutItem->SetVisible(false);
fProgressLayoutItem->SetVisible(true); fProgressLayoutItem->SetVisible(true);
} else { else
fProgressLayoutItem->SetVisible(false); fProgressLayoutItem->SetVisible(false);
fDetailsLayoutItem->SetVisible(true);
}
// Resizing and zooming // Resizing and zooming
if (fCurrentState == STATE_GET_CONFIRMATION) { if (fCurrentState == STATE_GET_CONFIRMATION) {
@@ -727,14 +710,18 @@ SoftwareUpdaterWindow::_ShowSettingsDialog()
B_TRANSLATE("Settings"), B_FLOATING_WINDOW, B_TRANSLATE("Settings"), B_FLOATING_WINDOW,
B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_CLOSE_ON_ESCAPE); B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_CLOSE_ON_ESCAPE);
BCheckBox* showDetails = new BCheckBox(B_TRANSLATE("Show more details"),
new BMessage(kMsgMoreDetailsToggle));
showDetails->SetValue(fShowMoreDetails);
showDetails->SetTarget(this);
BCheckBox* autoCleanUp = new BCheckBox(B_TRANSLATE( BCheckBox* autoCleanUp = new BCheckBox(B_TRANSLATE(
"Automatically clean up old install states")); "Automatically clean up old install states"), new BMessage(kSettingMsgAutoCleanUp));
autoCleanUp->SetValue(fAutoCleanUpAdminDirectory); autoCleanUp->SetValue(fAutoCleanUpAdminDirectory);
autoCleanUp->SetMessage(new BMessage(kSettingMsgAutoCleanUp));
autoCleanUp->SetTarget(this); autoCleanUp->SetTarget(this);
BLayoutBuilder::Group<>(window, B_VERTICAL, B_USE_ITEM_SPACING) BLayoutBuilder::Group<>(window, B_VERTICAL, B_USE_ITEM_SPACING)
.SetInsets(B_USE_ITEM_INSETS) .SetInsets(B_USE_ITEM_INSETS)
.Add(showDetails)
.Add(autoCleanUp) .Add(autoCleanUp)
.End(); .End();
@@ -751,7 +738,7 @@ SoftwareUpdaterWindow::_WriteSettings()
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
if (status == B_OK) { if (status == B_OK) {
BMessage settings; BMessage settings;
settings.AddBool(kKeyShowDetails, fDetailsCheckbox->Value() != 0); settings.AddBool(kKeyShowDetails, fShowMoreDetails);
settings.AddRect(kKeyWindowFrame, Frame()); settings.AddRect(kKeyWindowFrame, Frame());
settings.AddBool(kKeyAutoCleanUpAdminDirectory, fAutoCleanUpAdminDirectory); settings.AddBool(kKeyAutoCleanUpAdminDirectory, fAutoCleanUpAdminDirectory);
status = settings.Flatten(&file); status = settings.Flatten(&file);
@@ -189,7 +189,6 @@ private:
BStatusBar* fStatusBar; BStatusBar* fStatusBar;
PackageListView* fListView; PackageListView* fListView;
BScrollView* fScrollView; BScrollView* fScrollView;
BCheckBox* fDetailsCheckbox;
BLayoutItem* fDetailsLayoutItem; BLayoutItem* fDetailsLayoutItem;
BLayoutItem* fPackagesLayoutItem; BLayoutItem* fPackagesLayoutItem;
BLayoutItem* fProgressLayoutItem; BLayoutItem* fProgressLayoutItem;
@@ -197,7 +196,6 @@ private:
BLayoutItem* fCancelButtonLayoutItem; BLayoutItem* fCancelButtonLayoutItem;
BLayoutItem* fUpdateButtonLayoutItem; BLayoutItem* fUpdateButtonLayoutItem;
BLayoutItem* fRebootButtonLayoutItem; BLayoutItem* fRebootButtonLayoutItem;
BLayoutItem* fDetailsCheckboxLayoutItem;
uint32 fCurrentState; uint32 fCurrentState;
sem_id fWaitingSem; sem_id fWaitingSem;
@@ -209,6 +207,7 @@ private:
int32 fWarningAlertCount; int32 fWarningAlertCount;
BInvoker fWarningAlertDismissed; BInvoker fWarningAlertDismissed;
bool fAutoCleanUpAdminDirectory; bool fAutoCleanUpAdminDirectory;
bool fShowMoreDetails;
BPath fSettingsPath; BPath fSettingsPath;
status_t fSettingsReadStatus; status_t fSettingsReadStatus;
BMessage fInitialSettings; BMessage fInitialSettings;