Screen prefs: Layout tweaks based on feedback

- Put workspaces settings in their own box below the screen box.
- Put brightness slider inside the screen box (currently it works per
  screen, not per workspace).
- Move screen name to the title of the screen box.

Remove Set background... button, but keep its label for MonitorView
tool tip to let you know that clicking on it opens Backgrounds. There
wasn't enough room for this button with the brightness slider.

When brightness slider is hidden the window is shorter (unless you
have a lot of options on the right.)

Change-Id: I8b39d9e074e7e6abca2c37545f21c456289de381
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1984
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
John Scipione
2020-01-11 02:25:24 +00:00
committed by waddlesplash
parent 476d0ad38e
commit ef046e3b14
2 changed files with 51 additions and 50 deletions
+50 -47
View File
@@ -212,29 +212,51 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
// box on the left with workspace count and monitor view
BBox* screenBox = new BBox("screen box");
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, B_USE_SMALL_SPACING);
layout->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
screenBox->SetLayout(layout);
fScreenBox = new BBox("screen box");
BGroupView* groupView = new BGroupView(B_VERTICAL, B_USE_SMALL_SPACING);
fScreenBox->AddChild(groupView);
fScreenBox->SetLabel("placeholder");
// Needed for layouting, will be replaced with screen name/size
groupView->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
fMonitorInfo = new BStringView("monitor info", "");
fMonitorInfo->SetAlignment(B_ALIGN_CENTER);
screenBox->AddChild(fMonitorInfo);
fDeviceInfo = new BStringView("monitor info", "");
fDeviceInfo = new BStringView("device info", "");
fDeviceInfo->SetAlignment(B_ALIGN_CENTER);
screenBox->AddChild(fDeviceInfo);
groupView->AddChild(fDeviceInfo);
float scaling = std::max(1.0f, be_plain_font->Size() / 12.0f);
fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0 * scaling,
80.0 * scaling), "monitor", screen.Frame().IntegerWidth() + 1,
screen.Frame().IntegerHeight() + 1);
screenBox->AddChild(fMonitorView);
fMonitorView->SetToolTip(B_TRANSLATE("Set background" B_UTF8_ELLIPSIS));
groupView->AddChild(fMonitorView);
BStringView* workspaces = new BStringView("workspaces",
B_TRANSLATE("Workspaces"));
workspaces->SetAlignment(B_ALIGN_CENTER);
// brightness slider
fBrightnessSlider = new BSlider("brightness", B_TRANSLATE("Brightness:"),
NULL, 0, 255, B_HORIZONTAL);
groupView->AddChild(fBrightnessSlider);
if (screen.GetBrightness(&fOriginalBrightness) == B_OK) {
fBrightnessSlider->SetModificationMessage(
new BMessage(SLIDER_BRIGHTNESS_MSG));
fBrightnessSlider->SetValue(fOriginalBrightness * 255);
} else {
// The driver does not support changing the brightness,
// so hide the slider
fBrightnessSlider->Hide();
fOriginalBrightness = -1;
}
// box on the left below the screen box with workspaces
BBox* workspacesBox = new BBox("workspaces box");
workspacesBox->SetLabel(B_TRANSLATE("Workspaces"));
BGroupLayout* workspacesLayout = new BGroupLayout(B_VERTICAL);
workspacesLayout->SetInsets(B_USE_DEFAULT_SPACING,
be_control_look->DefaultItemSpacing() * 2, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING);
workspacesBox->SetLayout(workspacesLayout);
fColumnsControl = new BSpinner("columns", B_TRANSLATE("Columns:"),
new BMessage(kMsgWorkspaceColumnsChanged));
@@ -252,9 +274,8 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
fColumnsControl->SetValue(columns);
fRowsControl->SetValue(rows);
screenBox->AddChild(BLayoutBuilder::Group<>()
workspacesBox->AddChild(BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
.Add(workspaces)
.AddGroup(B_HORIZONTAL, 0)
.AddGlue()
.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
@@ -270,11 +291,12 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
.End()
.View());
fBackgroundsButton = new BButton("BackgroundsButton",
B_TRANSLATE("Set background" B_UTF8_ELLIPSIS),
new BMessage(BUTTON_LAUNCH_BACKGROUNDS_MSG));
fBackgroundsButton->SetFontSize(be_plain_font->Size() * 0.9);
screenBox->AddChild(fBackgroundsButton);
// put workspaces slider in a vertical group with a half space above so
// if hidden you won't see the extra space.
BView* workspacesView = BLayoutBuilder::Group<>(B_VERTICAL, 0)
.AddStrut(B_USE_HALF_ITEM_SPACING)
.Add(workspacesBox)
.View();
// box on the right with screen resolution, etc.
@@ -510,22 +532,6 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
.Add(fTVStandardField->CreateMenuBarLayoutItem(), 1, 6)
.End();
fBrightnessSlider = new BSlider("brightness", B_TRANSLATE("Brightness:"),
NULL, 0, 255, B_HORIZONTAL);
status_t result = screen.GetBrightness(&fOriginalBrightness);
if (result == B_OK) {
fBrightnessSlider->SetModificationMessage(
new BMessage(SLIDER_BRIGHTNESS_MSG));
fBrightnessSlider->SetValue(fOriginalBrightness * 255);
} else {
// The driver does not support changing the brightness,
// so hide the slider
fBrightnessSlider->Hide();
fOriginalBrightness = -1;
}
// TODO: we don't support getting the screen's preferred settings
/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
new BMessage(BUTTON_DEFAULTS_MSG));*/
@@ -546,12 +552,13 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL)
.AddGroup(B_VERTICAL, 0, 1)
.AddStrut(floorf(controlsBox->TopBorderOffset()) - 1)
.Add(screenBox)
.AddStrut(floorf(controlsBox->TopBorderOffset()
- fScreenBox->TopBorderOffset()))
.Add(fScreenBox)
.Add(workspacesView)
.End()
.AddGroup(B_VERTICAL, 0, 1)
.Add(controlsBox, 2)
.Add(fBrightnessSlider)
.End()
.End()
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
@@ -1283,13 +1290,9 @@ ScreenWindow::_UpdateMonitor()
snprintf(text, sizeof(text), "%s%s%s %g\"", info.vendor,
info.name[0] ? " " : "", info.name, diagonalInches);
fMonitorInfo->SetText(text);
if (fMonitorInfo->IsHidden(fMonitorInfo))
fMonitorInfo->Show();
fScreenBox->SetLabel(text);
} else {
if (!fMonitorInfo->IsHidden(fMonitorInfo))
fMonitorInfo->Hide();
fScreenBox->SetLabel(B_TRANSLATE("Display info"));
}
// Add info about the graphics device
+1 -3
View File
@@ -68,7 +68,7 @@ private:
bool fIsVesa;
bool fBootWorkspaceApplied;
BStringView* fMonitorInfo;
BBox* fScreenBox;
BStringView* fDeviceInfo;
MonitorView* fMonitorView;
BMenuItem* fAllWorkspacesItem;
@@ -102,8 +102,6 @@ private:
BButton* fApplyButton;
BButton* fRevertButton;
BButton* fBackgroundsButton;
ScreenMode fScreenMode;
ScreenMode fUndoScreenMode;
// screen modes for all workspaces